From 754b2d2b2d800bf63f793aff49d9c41f839fd2a3 Mon Sep 17 00:00:00 2001 From: Sloth Date: Sat, 10 Nov 2012 09:31:05 +0000 Subject: [PATCH] - Added the card property "attackingYou". --- res/cardsfolder/b/blessed_reversal.txt | 2 +- res/cardsfolder/g/giant_trap_door_spider.txt | 2 +- res/cardsfolder/h/hunting_kavu.txt | 2 +- res/cardsfolder/i/ice_floe.txt | 2 +- res/cardsfolder/i/inner_flame_acolyte.txt | 4 ++-- res/cardsfolder/q/qasali_ambusher.txt | 2 +- res/cardsfolder/s/snow_fortress.txt | 2 +- res/cardsfolder/s/soul_snare.txt | 2 +- res/cardsfolder/w/watchdog.txt | 24 +++++++++---------- src/main/java/forge/Card.java | 25 ++++++++++++++++++-- 10 files changed, 44 insertions(+), 23 deletions(-) diff --git a/res/cardsfolder/b/blessed_reversal.txt b/res/cardsfolder/b/blessed_reversal.txt index 92df158f2de..6f5a7daaa17 100644 --- a/res/cardsfolder/b/blessed_reversal.txt +++ b/res/cardsfolder/b/blessed_reversal.txt @@ -3,7 +3,7 @@ ManaCost:1 W Types:Instant Text:no text A:SP$ GainLife | Cost$ 1 W | LifeAmount$ X | References$ X | SpellDescription$ You gain 3 life for each creature attacking you. -SVar:X:Count$Valid Creature.attacking+YouDontCtrl/Times.3 +SVar:X:Count$Valid Creature.attackingYou/Times.3 SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/blessed_reversal.jpg SetInfo:8ED|Rare|http://magiccards.info/scans/en/8e/7.jpg diff --git a/res/cardsfolder/g/giant_trap_door_spider.txt b/res/cardsfolder/g/giant_trap_door_spider.txt index c3668c831be..75209d8e1bf 100644 --- a/res/cardsfolder/g/giant_trap_door_spider.txt +++ b/res/cardsfolder/g/giant_trap_door_spider.txt @@ -3,7 +3,7 @@ ManaCost:1 R G Types:Creature Spider Text:no text PT:2/3 -A:AB$ ChangeZone | Cost$ 1 R G T | ValidTgts$ Creature.attacking+YouDontCtrl+withoutFlying | TgtPrompt$ Select target creature without flying that's attacking you | Origin$ Battlefield | Destination$ Exile | SpellDescription$ Exile CARDNAME and target creature without flying that's attacking you. | SubAbility$ ExileME +A:AB$ ChangeZone | Cost$ 1 R G T | ValidTgts$ Creature.attackingYou+withoutFlying | TgtPrompt$ Select target creature without flying that's attacking you | Origin$ Battlefield | Destination$ Exile | SpellDescription$ Exile CARDNAME and target creature without flying that's attacking you. | SubAbility$ ExileME SVar:ExileME:DB$ChangeZone | Origin$ Battlefield | Destination$ Exile | Defined$ Self SVar:RemAIDeck:True SVar:Rarity:Uncommon diff --git a/res/cardsfolder/h/hunting_kavu.txt b/res/cardsfolder/h/hunting_kavu.txt index e4e27f54c78..a3b4584fc19 100644 --- a/res/cardsfolder/h/hunting_kavu.txt +++ b/res/cardsfolder/h/hunting_kavu.txt @@ -3,7 +3,7 @@ ManaCost:1 R G Types:Creature Kavu Text:no text PT:2/3 -A:AB$ ChangeZone | Cost$ 1 R G T | ValidTgts$ Creature.withoutFlying+YouDontCtrl+attacking | TgtPrompt$ Select target creature without flying that's attacking you | Origin$ Battlefield | Destination$ Exile | SubAbility$ ExileSelf | SpellDescription$ Exile CARDNAME and target creature without flying that's attacking you. +A:AB$ ChangeZone | Cost$ 1 R G T | ValidTgts$ Creature.withoutFlying+attackingYou | TgtPrompt$ Select target creature without flying that's attacking you | Origin$ Battlefield | Destination$ Exile | SubAbility$ ExileSelf | SpellDescription$ Exile CARDNAME and target creature without flying that's attacking you. SVar:ExileSelf:DB$ ChangeZone | Defined$ Self | Origin$ Battlefield | Destination$ Exile SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/hunting_kavu.jpg diff --git a/res/cardsfolder/i/ice_floe.txt b/res/cardsfolder/i/ice_floe.txt index af05c84aa76..5caa656828a 100644 --- a/res/cardsfolder/i/ice_floe.txt +++ b/res/cardsfolder/i/ice_floe.txt @@ -3,7 +3,7 @@ ManaCost:no cost Types:Land Text:no text K:You may choose not to untap CARDNAME during your untap step. -A:AB$ Pump | Cost$ T | ValidTgts$ Creature.withoutFlying+attacking+YouDontCtrl | TgtPrompt$ Select target creature without flying that's attacking you | RememberTargets$ True | SubAbility$ DBTap | SpellDescription$ Tap target creature without flying that's attacking you. It doesn't untap during its controller's untap step for as long as CARDNAME remains tapped. +A:AB$ Pump | Cost$ T | ValidTgts$ Creature.withoutFlying+attackingYou | TgtPrompt$ Select target creature without flying that's attacking you | RememberTargets$ True | SubAbility$ DBTap | SpellDescription$ Tap target creature without flying that's attacking you. It doesn't untap during its controller's untap step for as long as CARDNAME remains tapped. SVar:DBTap:DB$Tap | Defined$ Targeted S:Mode$ Continuous | Affected$ Creature.IsRemembered | AddHiddenKeyword$ HIDDEN This card doesn't untap during your next untap step. T:Mode$ Untaps | ValidCard$ Card.Self | TriggerZones$ Battlefield | Execute$ TrigClearRemember | Static$ True diff --git a/res/cardsfolder/i/inner_flame_acolyte.txt b/res/cardsfolder/i/inner_flame_acolyte.txt index 49011927cc5..456bae5e22d 100644 --- a/res/cardsfolder/i/inner_flame_acolyte.txt +++ b/res/cardsfolder/i/inner_flame_acolyte.txt @@ -5,9 +5,9 @@ Text:no text PT:2/2 T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigPump | TriggerDescription$ When CARDNAME enters the battlefield, target creature gets +2/+0 and gains haste until end of turn. K:Evoke:R -SVar:TrigPump:DB$Pump | Cost$ 0 | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumAtt$ +2 | KW$ Haste +SVar:TrigPump:DB$ Pump | Cost$ 0 | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumAtt$ +2 | KW$ Haste T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self+evoked | Execute$ TrigSac | Secondary$ True | TriggerDescription$ When CARDNAME enters the battlefield, if you cast it by it's evoke cost, sacrifice it. -SVar:TrigSac:AB$Sacrifice | Cost$ 0 +SVar:TrigSac:AB$ Sacrifice | Cost$ 0 SVar:PlayMain1:TRUE SVar:Rarity:Common SVar:Picture:http://www.wizards.com/global/images/magic/general/inner_flame_acolyte.jpg diff --git a/res/cardsfolder/q/qasali_ambusher.txt b/res/cardsfolder/q/qasali_ambusher.txt index b9f6d3cdd72..6c0ff077acf 100644 --- a/res/cardsfolder/q/qasali_ambusher.txt +++ b/res/cardsfolder/q/qasali_ambusher.txt @@ -5,7 +5,7 @@ Text:no text PT:2/3 K:Reach S:Mode$ Continuous | Affected$ Card.Self | EffectZone$ All | CheckSVar$ X | CheckSecondSVar2$ Y | CheckThirdSVar$ Z | References$ X,Y,Z | AddHiddenKeyword$ HIDDEN May be played without paying its mana cost and as though it has flash | Description$ If a creature is attacking you and you control a Forest and a Plains, you may cast CARDNAME without paying its mana cost and as though it had flash. -SVar:X:Count$Valid Creature.YouDontCtrl+attacking +SVar:X:Count$Valid Creature.attackingYou SVar:Y:Count$Valid Forest.YouCtrl SVar:Z:Count$Valid Plains.YouCtrl SVar:Rarity:Uncommon diff --git a/res/cardsfolder/s/snow_fortress.txt b/res/cardsfolder/s/snow_fortress.txt index 44e9e1eb4d1..64e36cbacf5 100644 --- a/res/cardsfolder/s/snow_fortress.txt +++ b/res/cardsfolder/s/snow_fortress.txt @@ -6,7 +6,7 @@ PT:0/4 K:Defender A:AB$ Pump | Cost$ 1 | NumAtt$ +1 | SpellDescription$ CARDNAME gets +1/+0 until end of turn. A:AB$ Pump | Cost$ 1 | NumDef$ +1 | SpellDescription$ CARDNAME gets +0/+1 until end of turn. -A:AB$ DealDamage | Cost$ 3 | ValidTgts$ Creature.withoutFlying+attacking+YouDontCtrl | TgtPrompt$ Select target target creature without flying that's attacking you | NumDmg$ 1 | SpellDescription$ CARDNAME deals 1 damage to target creature without flying that's attacking you. +A:AB$ DealDamage | Cost$ 3 | ValidTgts$ Creature.withoutFlying+attackingYou | TgtPrompt$ Select target target creature without flying that's attacking you | NumDmg$ 1 | SpellDescription$ CARDNAME deals 1 damage to target creature without flying that's attacking you. SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/snow_fortress.jpg SetInfo:ICE|Rare|http://magiccards.info/scans/en/ia/312.jpg diff --git a/res/cardsfolder/s/soul_snare.txt b/res/cardsfolder/s/soul_snare.txt index 353a318fb5e..734e93d1820 100644 --- a/res/cardsfolder/s/soul_snare.txt +++ b/res/cardsfolder/s/soul_snare.txt @@ -2,7 +2,7 @@ Name:Soul Snare ManaCost:W Types:Enchantment Text:no text -A:AB$ ChangeZone | Cost$ W Sac<1/CARDNAME> | ValidTgts$ Creature.attacking+YouDontCtrl | TgtPrompt$ Select target creature that's attacking you or a planeswalker you control. | Origin$ Battlefield | Destination$ Exile | SpellDescription$ Exile target creature that's attacking you or a planeswalker you control. +A:AB$ ChangeZone | Cost$ W Sac<1/CARDNAME> | ValidTgts$ Creature.attacking+OppCtrl | TgtPrompt$ Select target creature that's attacking you or a planeswalker you control. | Origin$ Battlefield | Destination$ Exile | SpellDescription$ Exile target creature that's attacking you or a planeswalker you control. SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/soul_snare.jpg SetInfo:COM|Uncommon|http://magiccards.info/scans/en/cmd/32.jpg diff --git a/res/cardsfolder/w/watchdog.txt b/res/cardsfolder/w/watchdog.txt index 08cd9b1d675..06f23d48076 100644 --- a/res/cardsfolder/w/watchdog.txt +++ b/res/cardsfolder/w/watchdog.txt @@ -1,13 +1,13 @@ -Name:Watchdog -ManaCost:3 -Types:Artifact Creature Hound -Text:no text -PT:1/2 -K:CARDNAME blocks each turn if able. -S:Mode$ Continuous | Affected$ Creature.YouDontCtrl+attacking | AddPower$ -1 | CheckSVar$ X | SVarCompare$ EQ1 | Description$ As long as CARDNAME is untapped, all creatures attacking you get -1/-0. -SVar:X:Count$Valid Card.Self+untapped -SVar:Rarity:Uncommon -SVar:Picture:http://www.wizards.com/global/images/magic/general/watchdog.jpg -SetInfo:TMP|Uncommon|http://magiccards.info/scans/en/tp/304.jpg -Oracle:Watchdog blocks each turn if able.\nAs long as Watchdog is untapped, all creatures attacking you get -1/-0. +Name:Watchdog +ManaCost:3 +Types:Artifact Creature Hound +Text:no text +PT:1/2 +K:CARDNAME blocks each turn if able. +S:Mode$ Continuous | Affected$ Creature.attackingYou | AddPower$ -1 | CheckSVar$ X | SVarCompare$ EQ1 | Description$ As long as CARDNAME is untapped, all creatures attacking you get -1/-0. +SVar:X:Count$Valid Card.Self+untapped +SVar:Rarity:Uncommon +SVar:Picture:http://www.wizards.com/global/images/magic/general/watchdog.jpg +SetInfo:TMP|Uncommon|http://magiccards.info/scans/en/tp/304.jpg +Oracle:Watchdog blocks each turn if able.\nAs long as Watchdog is untapped, all creatures attacking you get -1/-0. End \ No newline at end of file diff --git a/src/main/java/forge/Card.java b/src/main/java/forge/Card.java index 7ef5dfd291b..be2462fc2ff 100644 --- a/src/main/java/forge/Card.java +++ b/src/main/java/forge/Card.java @@ -7008,8 +7008,14 @@ public class Card extends GameEntity implements Comparable { return false; } } else if (property.startsWith("attacking")) { - if (!this.isAttacking()) { - return false; + if (property.equals("attacking")) { + if (!this.isAttacking()) { + return false; + } + } else if (property.equals("attackingYou")) { + if (!this.isAttacking(sourceController)) { + return false; + } } } else if (property.startsWith("notattacking")) { if (this.isAttacking()) { @@ -7420,6 +7426,21 @@ public class Card extends GameEntity implements Comparable { return Singletons.getModel().getGame().getCombat().isAttacking(this); } + /** + *

+ * isAttacking. + *

+ * + * @return a boolean. + */ + public final boolean isAttacking(GameEntity ge) { + Combat combat = Singletons.getModel().getGame().getCombat(); + if (!combat.isAttacking(this)) { + return false; + } + return combat.getDefenderByAttacker(this).equals(ge); + } + /** *

* isBlocking.