diff --git a/forge-ai/src/main/java/forge/ai/ability/AttachAi.java b/forge-ai/src/main/java/forge/ai/ability/AttachAi.java index 6d5f7f00076..5a152b76edc 100644 --- a/forge-ai/src/main/java/forge/ai/ability/AttachAi.java +++ b/forge-ai/src/main/java/forge/ai/ability/AttachAi.java @@ -734,17 +734,15 @@ public class AttachAi extends SpellAbilityAi { */ private static Card attachAISpecificCardPreference(final SpellAbility sa, final List list, final boolean mandatory, final Card attachSource) { - // I know this isn't much better than Hardcoding, but some cards need it for now final Player ai = sa.getActivatingPlayer(); final String sourceName = ComputerUtilAbility.getAbilitySourceName(sa); Card chosen = null; if ("Guilty Conscience".equals(sourceName)) { chosen = SpecialCardAi.GuiltyConscience.getBestAttachTarget(ai, sa, list); - } else if ("Bonds of Faith".equals(sourceName)) { - chosen = doPumpOrCurseAILogic(ai, sa, list, "Human"); - } else if ("Clutch of Undeath".equals(sourceName)) { - chosen = doPumpOrCurseAILogic(ai, sa, list, "Zombie"); + } else if (sa.hasParam("AIValid")) { + // TODO: Make the AI recognize which cards to pump based on the card's abilities alone + chosen = doPumpOrCurseAILogic(ai, sa, list, sa.getParam("AIValid")); } // If Mandatory (brought directly into play without casting) gotta @@ -1699,7 +1697,7 @@ public class AttachAi extends SpellAbilityAi { if (!c.getController().equals(ai)) { return false; } - return c.getType().hasCreatureType(type); + return c.isValid(type, ai, sa.getHostCard(), sa); } }); List oppNonType = CardLists.filter(list, new Predicate() { @@ -1709,7 +1707,7 @@ public class AttachAi extends SpellAbilityAi { if (c.getController().equals(ai)) { return false; } - return !c.getType().hasCreatureType(type) && !ComputerUtilCard.isUselessCreature(ai, c); + return !c.isValid(type, ai, sa.getHostCard(), sa) && !ComputerUtilCard.isUselessCreature(ai, c); } }); diff --git a/forge-gui/res/cardsfolder/a/armament_of_nyx.txt b/forge-gui/res/cardsfolder/a/armament_of_nyx.txt index 981cebed744..d338fbae455 100644 --- a/forge-gui/res/cardsfolder/a/armament_of_nyx.txt +++ b/forge-gui/res/cardsfolder/a/armament_of_nyx.txt @@ -2,8 +2,7 @@ Name:Armament of Nyx ManaCost:2 W Types:Enchantment Aura K:Enchant creature -A:SP$ Attach | Cost$ 2 W | ValidTgts$ Creature | AILogic$ Curse | AITgts$ Creature.nonEnchantment+OppCtrl +A:SP$ Attach | Cost$ 2 W | ValidTgts$ Creature | AILogic$ SpecificCard | AIValid$ Enchantment S:Mode$ Continuous | Affected$ Creature.EnchantedBy+Enchantment | AddKeyword$ Double Strike | Description$ Enchanted creature has double strike as long as it's an enchantment. Otherwise, prevent all damage that would be dealt by enchanted creature. R:Event$ DamageDone | Prevent$ True | ValidSource$ Creature.EnchantedBy+nonEnchantment | Secondary$ True | Description$ Otherwise, prevent all damage that would be dealt by enchanted creature. -SVar:Picture:http://www.wizards.com/global/images/magic/general/armament_of_nyx.jpg Oracle:Enchant creature\nEnchanted creature has double strike as long as it's an enchantment. Otherwise, prevent all damage that would be dealt by enchanted creature. (A creature with double strike deals both first-strike and regular combat damage.) diff --git a/forge-gui/res/cardsfolder/b/bonds_of_faith.txt b/forge-gui/res/cardsfolder/b/bonds_of_faith.txt index d37db9c775c..5fe2ba512cb 100644 --- a/forge-gui/res/cardsfolder/b/bonds_of_faith.txt +++ b/forge-gui/res/cardsfolder/b/bonds_of_faith.txt @@ -2,8 +2,7 @@ Name:Bonds of Faith ManaCost:1 W Types:Enchantment Aura K:Enchant creature -A:SP$ Attach | Cost$ 1 W | ValidTgts$ Creature | AILogic$ SpecificCard +A:SP$ Attach | Cost$ 1 W | ValidTgts$ Creature | AILogic$ SpecificCard | AIValid$ Human S:Mode$ Continuous | Affected$ Creature.EnchantedBy+Human | AddPower$ 2 | AddToughness$ 2 | Description$ Enchanted creature gets +2/+2 as long as it's a Human. S:Mode$ Continuous | Affected$ Creature.EnchantedBy+nonHuman | AddHiddenKeyword$ CARDNAME can't attack or block. | Description$ Otherwise, it can't attack or block. -SVar:Picture:http://www.wizards.com/global/images/magic/general/bonds_of_faith.jpg Oracle:Enchant creature\nEnchanted creature gets +2/+2 as long as it's a Human. Otherwise, it can't attack or block. diff --git a/forge-gui/res/cardsfolder/c/clutch_of_undeath.txt b/forge-gui/res/cardsfolder/c/clutch_of_undeath.txt index 58aeb70876a..8d688464af9 100644 --- a/forge-gui/res/cardsfolder/c/clutch_of_undeath.txt +++ b/forge-gui/res/cardsfolder/c/clutch_of_undeath.txt @@ -2,9 +2,8 @@ Name:Clutch of Undeath ManaCost:3 B B Types:Enchantment Aura K:Enchant creature -A:SP$ Attach | Cost$ 3 B B | ValidTgts$ Creature | AILogic$ SpecificCard +A:SP$ Attach | Cost$ 3 B B | ValidTgts$ Creature | AILogic$ SpecificCard | AIValid$ Zombie S:Mode$ Continuous | Affected$ Creature.EnchantedBy+Zombie | AddPower$ 3 | AddToughness$ 3 | Description$ Enchanted creature gets +3/+3 as long as it's a Zombie. Otherwise, it gets -3/-3. S:Mode$ Continuous | Affected$ Creature.EnchantedBy+nonZombie | AddPower$ -3 | AddToughness$ -3 DeckNeeds:Type$Zombie -SVar:Picture:http://www.wizards.com/global/images/magic/general/clutch_of_undeath.jpg Oracle:Enchant creature\nEnchanted creature gets +3/+3 as long as it's a Zombie. Otherwise, it gets -3/-3. diff --git a/forge-gui/res/cardsfolder/n/nyx_infusion.txt b/forge-gui/res/cardsfolder/n/nyx_infusion.txt index 9b23360c302..5c54ed1e08e 100644 --- a/forge-gui/res/cardsfolder/n/nyx_infusion.txt +++ b/forge-gui/res/cardsfolder/n/nyx_infusion.txt @@ -2,8 +2,7 @@ Name:Nyx Infusion ManaCost:2 B Types:Enchantment Aura K:Enchant creature -A:SP$ Attach | Cost$ 2 B | ValidTgts$ Creature | AILogic$ Curse | AITgts$ Creature.nonEnchantment+OppCtrl +A:SP$ Attach | Cost$ 2 B | ValidTgts$ Creature | AILogic$ SpecificCard | AIValid$ Enchantment S:Mode$ Continuous | Affected$ Creature.EnchantedBy+Enchantment | AddPower$ 2 | AddToughness$ 2 | Description$ Enchanted creature gets +2/+2 as long as it's an enchantment. Otherwise, it gets -2/-2. S:Mode$ Continuous | Affected$ Creature.EnchantedBy+nonEnchantment | AddPower$ -2 | AddToughness$ -2 -SVar:Picture:http://www.wizards.com/global/images/magic/general/nyx_infusion.jpg Oracle:Enchant creature\nEnchanted creature gets +2/+2 as long as it's an enchantment. Otherwise, it gets -2/-2. diff --git a/forge-gui/res/cardsfolder/p/phyrexian_boon.txt b/forge-gui/res/cardsfolder/p/phyrexian_boon.txt index 5b1c331d595..31d2fafb52e 100644 --- a/forge-gui/res/cardsfolder/p/phyrexian_boon.txt +++ b/forge-gui/res/cardsfolder/p/phyrexian_boon.txt @@ -2,9 +2,7 @@ Name:Phyrexian Boon ManaCost:2 B Types:Enchantment Aura K:Enchant creature -A:SP$ Attach | Cost$ 2 B | ValidTgts$ Creature | AILogic$ Pump +A:SP$ Attach | Cost$ 2 B | ValidTgts$ Creature | AILogic$ SpecificCard | AIValid$ Card.Black S:Mode$ Continuous | Affected$ Creature.EnchantedBy+Black | AddPower$ 2 | AddToughness$ 1 | Description$ Enchanted creature gets +2/+1 as long as it's black. S:Mode$ Continuous | Affected$ Creature.EnchantedBy+nonBlack | AddPower$ -1 | AddToughness$ -2 | Description$ Otherwise, it gets -1/-2. -AI:RemoveDeck:All -SVar:Picture:http://www.wizards.com/global/images/magic/general/phyrexian_boon.jpg Oracle:Enchant creature\nEnchanted creature gets +2/+1 as long as it's black. Otherwise, it gets -1/-2. diff --git a/forge-gui/res/cardsfolder/s/sea_legs.txt b/forge-gui/res/cardsfolder/s/sea_legs.txt index ab1af8d4b84..6b0d665fad5 100644 --- a/forge-gui/res/cardsfolder/s/sea_legs.txt +++ b/forge-gui/res/cardsfolder/s/sea_legs.txt @@ -3,9 +3,8 @@ ManaCost:U Types:Enchantment Aura K:Flash K:Enchant creature -A:SP$ Attach | Cost$ U | ValidTgts$ Creature | AILogic$ SpecificCard +A:SP$ Attach | Cost$ U | ValidTgts$ Creature | AILogic$ SpecificCard | AIValid$ Pirate S:Mode$ Continuous | Affected$ Creature.EnchantedBy+Pirate | AddToughness$ 2 | Description$ Enchanted creature gets +0/+2 as long as it's a Pirate. Otherwise, it gets -2/-0. S:Mode$ Continuous | Affected$ Creature.EnchantedBy+nonPirate | AddPower$ -2 DeckNeeds:Type$Pirate -SVar:Picture:http://www.wizards.com/global/images/magic/general/sea_legs.jpg Oracle:Flash\nEnchant creature\nEnchanted creature gets +0/+2 as long as it's a Pirate. Otherwise, it gets -2/-0. \ No newline at end of file diff --git a/forge-gui/res/cardsfolder/s/serras_boon.txt b/forge-gui/res/cardsfolder/s/serras_boon.txt index 458a084cf09..16d448c7f55 100644 --- a/forge-gui/res/cardsfolder/s/serras_boon.txt +++ b/forge-gui/res/cardsfolder/s/serras_boon.txt @@ -2,9 +2,7 @@ Name:Serra's Boon ManaCost:2 W Types:Enchantment Aura K:Enchant creature -A:SP$ Attach | Cost$ 2 W | ValidTgts$ Creature | AILogic$ Pump +A:SP$ Attach | Cost$ 2 W | ValidTgts$ Creature | AILogic$ SpecificCard | AIValid$ Card.White S:Mode$ Continuous | Affected$ Creature.EnchantedBy+White | AddPower$ 1 | AddToughness$ 2 | Description$ Enchanted creature gets +1/+2 as long as it's white. S:Mode$ Continuous | Affected$ Creature.EnchantedBy+nonWhite | AddPower$ -2 | AddToughness$ -1 | Description$ Otherwise, it gets -2/-1. -AI:RemoveDeck:All -SVar:Picture:http://www.wizards.com/global/images/magic/general/serras_boon.jpg Oracle:Enchant creature\nEnchanted creature gets +1/+2 as long as it's white. Otherwise, it gets -2/-1.