diff --git a/res/cardsfolder/b/blazing_torch.txt b/res/cardsfolder/b/blazing_torch.txt index b852b42f3d1..1bd45c3bd51 100644 --- a/res/cardsfolder/b/blazing_torch.txt +++ b/res/cardsfolder/b/blazing_torch.txt @@ -5,6 +5,7 @@ K:Equip 1 S:Mode$ Continuous | Affected$ Creature.EquippedBy | AddHiddenKeyword$ CantBeBlockedBy Creature.Vampire,Creature.Zombie | Description$ Equipped creature can't be blocked by Vampires or Zombies. S:Mode$ Continuous | Affected$ Creature.EquippedBy | AddAbility$ TorchDamage | Description$ Equipped creature has "T, Sacrifice Blazing Torch: Blazing Torch deals 2 damage to target creature or player." SVar:TorchDamage:AB$ DealDamage | Cost$ T Sac<1/Card.Attached+namedBlazing Torch/equipped Blazing Torch> | ValidTgts$ Creature,Player | TgtPrompt$ Select target creature or player | NumDmg$ 2 | DamageSource$ Sacrificed | SpellDescription$ Blazing Torch deals 2 damage to target creature or player. +SVar:NonStackingAttachEffect:True SVar:Picture:http://www.wizards.com/global/images/magic/general/blazing_torch.jpg Oracle:Equipped creature can't be blocked by Vampires or Zombies.\nEquipped creature has "{T}, Sacrifice Blazing Torch: Blazing Torch deals 2 damage to target creature or player."\nEquip {1} SetInfo:ZEN Uncommon diff --git a/res/cardsfolder/b/blinding_powder.txt b/res/cardsfolder/b/blinding_powder.txt index 399816c0cf0..b78b90f8b98 100644 --- a/res/cardsfolder/b/blinding_powder.txt +++ b/res/cardsfolder/b/blinding_powder.txt @@ -4,6 +4,7 @@ Types:Artifact Equipment S:Mode$ Continuous | Affected$ Creature.EquippedBy | AddAbility$ BlindEnemies | Description$ Equipped creature has "Unattach CARDNAME: Prevent all combat damage that would be dealt to this creature this turn." SVar:BlindEnemies:AB$ Pump | Cost$ Unattach | Defined$ Self | KW$ HIDDEN Prevent all combat damage that would be dealt to CARDNAME. | SpellDescription$ Prevent all combat damage that would be dealt to CARDNAME this turn. K:Equip 2 +SVar:NonStackingAttachEffect:True SVar:Picture:http://www.wizards.com/global/images/magic/general/blinding_powder.jpg Oracle:Equipped creature has "Unattach Blinding Powder: Prevent all combat damage that would be dealt to this creature this turn."\nEquip {2} ({2}: Attach to target creature you control. Equip only as a sorcery.) SetInfo:BOK Uncommon \ No newline at end of file diff --git a/res/cardsfolder/c/coat_of_arms.txt b/res/cardsfolder/c/coat_of_arms.txt index 9114fe42f30..f0fac7604b3 100644 --- a/res/cardsfolder/c/coat_of_arms.txt +++ b/res/cardsfolder/c/coat_of_arms.txt @@ -4,6 +4,7 @@ Types:Artifact S:Mode$ Continuous | Affected$ Creature | AddPower$ AffectedX | AddToughness$ AffectedX | EffectZone$ Battlefield | Description$ Each creature gets +1/+1 for each other creature on the battlefield that shares at least one creature type with it. (For example, if two Goblin Warriors and a Goblin Shaman are on the battlefield, each gets +2/+2.) SVar:AffectedX:Count$Valid Creature.sharesCreatureTypeWith+Other SVar:PlayMain1:TRUE +SVar:RemRandomDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/coat_of_arms.jpg Oracle:Each creature gets +1/+1 for each other creature on the battlefield that shares at least one creature type with it. (For example, if two Goblin Warriors and a Goblin Shaman are on the battlefield, each gets +2/+2.) SetInfo:8ED Rare diff --git a/res/cardsfolder/d/dead_iron_sledge.txt b/res/cardsfolder/d/dead_iron_sledge.txt index 5213e250769..06caae2b5a3 100644 --- a/res/cardsfolder/d/dead_iron_sledge.txt +++ b/res/cardsfolder/d/dead_iron_sledge.txt @@ -7,6 +7,7 @@ T:Mode$ Blocks | ValidCard$ Creature | ValidBlocked$ Creature.AttachedBy | Trigg SVar:TrigDestroy:AB$Destroy | Cost$ 0 | Defined$ TriggeredAttacker | SubAbility$ DBDestroy SVar:DBDestroy:DB$Destroy | Defined$ TriggeredBlocker SVar:RemAIDeck:True +SVar:NonStackingAttachEffect:True SVar:Picture:http://www.wizards.com/global/images/magic/general/dead_iron_sledge.jpg Oracle:Whenever equipped creature blocks or becomes blocked by a creature, destroy both creatures.\nEquip {2} ({2}: Attach to target creature you control. Equip only as a sorcery. This card enters the battlefield unattached and stays on the battlefield if the creature leaves.) SetInfo:MRD Uncommon \ No newline at end of file diff --git a/res/cardsfolder/h/hankyu.txt b/res/cardsfolder/h/hankyu.txt index cfd55ea6978..74cb98579a1 100644 --- a/res/cardsfolder/h/hankyu.txt +++ b/res/cardsfolder/h/hankyu.txt @@ -7,5 +7,6 @@ SVar:HankyuPutCounter:AB$ PutCounter | Cost$ T | CounterType$ AIM | CounterNum$ SVar:HankyuDmg:AB$ DealDamage | Cost$ T SubCounter | ValidTgts$ Creature,Player | TgtPrompt$ Select target creature or player | NumDmg$ HankyuX | References$ HankyuX | SpellDescription$ CARDNAME deals damage to target creature or player equal to the number of aim counters removed this way. SVar:HankyuX:SVar$CostCountersRemoved SVar:RemAIDeck:True +SVar:NonStackingAttachEffect:True SVar:Picture:http://www.wizards.com/global/images/magic/general/hankyu.jpg Oracle:Equipped creature has "{T}: Put an aim counter on Hankyu" and "{T}, Remove all aim counters from Hankyu: This creature deals damage to target creature or player equal to the number of aim counters removed this way."\nEquip {4} ({4}: Attach to target creature you control. Equip only as a sorcery.) diff --git a/res/cardsfolder/h/heavy_arbalest.txt b/res/cardsfolder/h/heavy_arbalest.txt index d301ff9b749..6d102aa6122 100644 --- a/res/cardsfolder/h/heavy_arbalest.txt +++ b/res/cardsfolder/h/heavy_arbalest.txt @@ -5,6 +5,7 @@ K:Equip 4 S:Mode$ Continuous | Affected$ Card.EquippedBy | AddHiddenKeyword$ CARDNAME doesn't untap during your untap step. | Description$ Equipped creature doesn't untap during its controller's untap step. S:Mode$ Continuous | Affected$ Card.EquippedBy | AddAbility$ Damage | Description$ Equipped creature has "Tap: This creature deals 2 damage to target creature or player." SVar:Damage:AB$DealDamage | Cost$ T | ValidTgts$ Creature,Player | TgtPrompt$ Select target creature or player | NumDmg$ 2 | SpellDescription$ CARDNAME deals 2 damage to target creature or player. +SVar:NonStackingAttachEffect:True SVar:Picture:http://www.wizards.com/global/images/magic/general/heavy_arbalest.jpg Oracle:Equipped creature doesn't untap during its controller's untap step.\nEquipped creature has "{T}: This creature deals 2 damage to target creature or player."\nEquip {4} SetInfo:SOM Uncommon \ No newline at end of file diff --git a/res/cardsfolder/l/leonin_bola.txt b/res/cardsfolder/l/leonin_bola.txt index 9666c862248..9ccc14601f7 100644 --- a/res/cardsfolder/l/leonin_bola.txt +++ b/res/cardsfolder/l/leonin_bola.txt @@ -4,6 +4,7 @@ Types:Artifact Equipment S:Mode$ Continuous | Affected$ Creature.EquippedBy | AddAbility$ BolaTap | Description$ Equipped creature has "T, Unattach CARDNAME: Tap target creature." SVar:BolaTap:AB$ Tap | Cost$ T Unattach | ValidTgts$ Creature | SpellDescription$ Tap target creature. K:Equip 1 +SVar:NonStackingAttachEffect:True SVar:Picture:http://www.wizards.com/global/images/magic/general/leonin_bola.jpg Oracle:Equipped creature has "{T}, Unattach Leonin Bola: Tap target creature."\nEquip {1} ({1}: Attach to target creature you control. Equip only as a sorcery. This card enters the battlefield unattached and stays on the battlefield if the creature leaves.) SetInfo:DST Common \ No newline at end of file diff --git a/res/cardsfolder/p/paradise_mantle.txt b/res/cardsfolder/p/paradise_mantle.txt index 8ff434b3489..ace1e89f351 100644 --- a/res/cardsfolder/p/paradise_mantle.txt +++ b/res/cardsfolder/p/paradise_mantle.txt @@ -4,6 +4,7 @@ Types:Artifact Equipment K:Equip 1 S:Mode$ Continuous | Affected$ Card.EquippedBy | AddAbility$ AnyMana | Description$ Equipped creature has "Tap: Add one mana of any color to your mana pool." SVar:AnyMana:AB$Mana | Cost$ T | Produced$ Any | SpellDescription$ Add one mana of any color to your mana pool. +SVar:NonStackingAttachEffect:True SVar:Picture:http://www.wizards.com/global/images/magic/general/paradise_mantle.jpg Oracle:Equipped creature has "{T}: Add one mana of any color to your mana pool."\nEquip {1} ({1}: Attach to target creature you control. Equip only as a sorcery.) SetInfo:5DN Uncommon \ No newline at end of file diff --git a/res/cardsfolder/r/razor_boomerang.txt b/res/cardsfolder/r/razor_boomerang.txt index d33cf629ca7..ae06d1e7182 100644 --- a/res/cardsfolder/r/razor_boomerang.txt +++ b/res/cardsfolder/r/razor_boomerang.txt @@ -5,6 +5,7 @@ S:Mode$ Continuous | Affected$ Creature.EquippedBy | AddAbility$ RazorDamage | A SVar:RazorDamage:AB$ DealDamage | Cost$ T Unattach | NumDmg$ 1 | DamageSource$ OriginalHost | ValidTgts$ Creature,Player | TgtPrompt$ Select target creature or player | RememberCostCards$ True | SubAbility$ BoomerangCatch | SpellDescription$ Razor Boomerang deals 1 damage to target creature or player. Return Razor Boomerang to its owner's hand. SVar:BoomerangCatch:DB$ ChangeZone | Origin$ Battlefield | Destination$ Hand | Defined$ Remembered | ForgetChanged$ True K:Equip 2 +SVar:NonStackingAttachEffect:True SVar:Picture:http://www.wizards.com/global/images/magic/general/razor_boomerang.jpg Oracle:Equipped creature has "{T}, Unattach Razor Boomerang: Razor Boomerang deals 1 damage to target creature or player. Return Razor Boomerang to its owner's hand."\nEquip {2} SetInfo:WWK Uncommon \ No newline at end of file diff --git a/res/cardsfolder/s/shuriken.txt b/res/cardsfolder/s/shuriken.txt index 9ddce129955..6ed0afe9386 100644 --- a/res/cardsfolder/s/shuriken.txt +++ b/res/cardsfolder/s/shuriken.txt @@ -8,6 +8,7 @@ SVar:ShurikenGainCtrl:DB$ GainControl | NewController$ TargetedController | Defi SVar:ShurikenForget:DB$ Pump | ForgetObjects$ Valid Card.IsRemembered+namedShuriken | StackDescription$ None SVar:RemAIDeck:True SVar:RemRandomDeck:True +SVar:NonStackingAttachEffect:True SVar:Picture:http://www.wizards.com/global/images/magic/general/shuriken.jpg Oracle:Equipped creature has "{T}, Unattach Shuriken: Shuriken deals 2 damage to target creature. That creature's controller gains control of Shuriken unless it was unattached from a Ninja."\nEquip {2} ({2}: Attach to target creature you control. Equip only as a sorcery.) SetInfo:BOK Uncommon \ No newline at end of file diff --git a/res/cardsfolder/t/thornbite_staff.txt b/res/cardsfolder/t/thornbite_staff.txt index f2a98c6ce85..c9ef90c3c04 100644 --- a/res/cardsfolder/t/thornbite_staff.txt +++ b/res/cardsfolder/t/thornbite_staff.txt @@ -8,6 +8,7 @@ SVar:Damage:AB$DealDamage | Cost$ 2 T | ValidTgts$ Creature,Player | TgtPrompt$ SVar:TrigChangeZone:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Creature | TriggerZones$ Battlefield | Execute$ ThornbiteTrigUntap | TriggerDescription$ Whenever a creature is put into a graveyard from the battlefield, untap equipped creature. SVar:ThornbiteTrigUntap:AB$Untap | Cost$ 0 SVar:TrigAttach:DB$ Attach | Cost$ 0 | Defined$ TriggeredCard +SVar:NonStackingAttachEffect:True SVar:Picture:http://www.wizards.com/global/images/magic/general/thornbite_staff.jpg Oracle:Equipped creature has “{2}, {T}: This creature deals 1 damage to target creature or player” and “Whenever a creature dies, untap this creature.”\nWhenever a Shaman creature enters the battlefield, you may attach Thornbite Staff to it. \nEquip {4} diff --git a/res/cardsfolder/v/viridian_longbow.txt b/res/cardsfolder/v/viridian_longbow.txt index 10a1d764942..889137bc5d4 100644 --- a/res/cardsfolder/v/viridian_longbow.txt +++ b/res/cardsfolder/v/viridian_longbow.txt @@ -4,6 +4,7 @@ Types:Artifact Equipment K:Equip 3 S:Mode$ Continuous | Affected$ Card.EquippedBy | AddAbility$ Damage | Description$ Equipped creature has "Tap: This creature deals 1 damage to target creature or player." SVar:Damage:AB$DealDamage | Cost$ T | ValidTgts$ Creature,Player | TgtPrompt$ Select target creature or player | NumDmg$ 1 | SpellDescription$ CARDNAME deals 1 damage to target creature or player. +SVar:NonStackingAttachEffect:True SVar:Picture:http://www.wizards.com/global/images/magic/general/viridian_longbow.jpg Oracle:Equipped creature has "{T}: This creature deals 1 damage to target creature or player."\nEquip {3} ({3}: Attach to target creature you control. Equip only as a sorcery. This card enters the battlefield unattached and stays on the battlefield if the creature leaves.) SetInfo:MRD Common \ No newline at end of file diff --git a/res/cardsfolder/w/wolfhunters_quiver.txt b/res/cardsfolder/w/wolfhunters_quiver.txt index d9c9765a499..14001a81fc5 100644 --- a/res/cardsfolder/w/wolfhunters_quiver.txt +++ b/res/cardsfolder/w/wolfhunters_quiver.txt @@ -5,6 +5,7 @@ K:Equip 5 S:Mode$ Continuous | Affected$ Card.EquippedBy | AddAbility$ Damage & DamageWerewolf | Description$ Equipped creature has "Tap: This creature deals 1 damage to target creature or player" and "Tap: This creature deals 3 damage to target Werewolf creature." SVar:Damage:AB$DealDamage | Cost$ T | ValidTgts$ Creature,Player | TgtPrompt$ Select target creature or player | NumDmg$ 1 | SpellDescription$ CARDNAME deals 1 damage to target creature or player. SVar:DamageWerewolf:AB$DealDamage | Cost$ T | ValidTgts$ Creature.Werewolf | TgtPrompt$ Select target Werewolf creature | NumDmg$ 3 | SpellDescription$ CARDNAME deals 3 damage to target Werewolf creature. +SVar:NonStackingAttachEffect:True SVar:Picture:http://www.wizards.com/global/images/magic/general/wolfhunters_quiver.jpg Oracle:Equipped creature has "{T}: This creature deals 1 damage to target creature or player" and "{T}: This creature deals 3 damage to target Werewolf creature."\nEquip {5} SetInfo:DKA Uncommon \ No newline at end of file diff --git a/src/main/java/forge/card/ability/ai/AttachAi.java b/src/main/java/forge/card/ability/ai/AttachAi.java index 97c5296ea9c..bf69547c68b 100644 --- a/src/main/java/forge/card/ability/ai/AttachAi.java +++ b/src/main/java/forge/card/ability/ai/AttachAi.java @@ -32,7 +32,6 @@ import forge.game.phase.PhaseHandler; import forge.game.phase.PhaseType; import forge.game.player.Player; import forge.game.player.PlayerActionConfirmMode; -import forge.game.zone.ZoneType; import forge.util.MyRandom; public class AttachAi extends SpellAbilityAi { @@ -618,6 +617,7 @@ public class AttachAi extends SpellAbilityAi { targets = AbilityUtils.getDefinedObjects(sa.getSourceCard(), sa.getParam("Defined"), sa); } else { AttachAi.attachPreference(sa, tgt, mandatory); + targets = sa.getTargets().getTargets(); } if (!mandatory && card.isEquipment() && !targets.isEmpty()) { @@ -633,6 +633,13 @@ public class AttachAi extends SpellAbilityAi { if (ComputerUtilCard.evaluateCreature(oldTarget) > ComputerUtilCard.evaluateCreature(newTarget)) { return false; } + // don't equip creatures that don't gain anything + if (card.hasSVar("NonStackingAttachEffect")) { + for (Card equipment : newTarget.getEquippedBy()) { + if (equipment.getName().equals(card.getName())) + return false; + } + } } } @@ -739,7 +746,7 @@ public class AttachAi extends SpellAbilityAi { }); } - if ((magnetList != null) && !magnetList.isEmpty()) { + if (magnetList != null && !magnetList.isEmpty()) { // Always choose something from the Magnet List. // Probably want to "weight" the list by amount of Enchantments and // choose the "lightest" @@ -815,6 +822,20 @@ public class AttachAi extends SpellAbilityAi { }); } + //some equipments aren't useful in multiples + if (attachSource.hasSVar("NonStackingAttachEffect")) { + prefList = CardLists.filter(prefList, new Predicate() { + @Override + public boolean apply(final Card c) { + for (Card equipment : c.getEquippedBy()) { + if (equipment.getName().equals(attachSource.getName())) + return false; + } + return true; + } + }); + } + // Don't pump cards that will die. prefList = ComputerUtil.getSafeTargets(ai, sa, prefList); @@ -883,7 +904,7 @@ public class AttachAi extends SpellAbilityAi { // I believe this is the only case where mandatory will be true, so just // check that when starting that work // But we shouldn't attach to things with Protection - if (tgt.getZone().contains(ZoneType.Battlefield) && !mandatory) { + if (!mandatory) { list = CardLists.getTargetableCards(list, sa); } else { list = CardLists.filter(list, Predicates.not(CardPredicates.isProtectedFrom(attachSource)));