diff --git a/forge-ai/src/main/java/forge/ai/AiAttackController.java b/forge-ai/src/main/java/forge/ai/AiAttackController.java index 2036af728a2..94ef70f394d 100644 --- a/forge-ai/src/main/java/forge/ai/AiAttackController.java +++ b/forge-ai/src/main/java/forge/ai/AiAttackController.java @@ -93,15 +93,14 @@ public class AiAttackController { this.defendingOpponent = choosePreferredDefenderPlayer(ai); this.oppList = getOpponentCreatures(this.defendingOpponent); this.myList = ai.getCreaturesInPlay(); + this.nextTurn = nextTurn; this.attackers = new ArrayList<>(); for (Card c : myList) { - if (nextTurn && CombatUtil.canAttackNextTurn(c, this.defendingOpponent) || - CombatUtil.canAttack(c, this.defendingOpponent)) { + if (canAttackWrapper(c, this.defendingOpponent)) { attackers.add(c); } } - this.blockers = getPossibleBlockers(oppList, this.attackers); - this.nextTurn = nextTurn; + this.blockers = getPossibleBlockers(oppList, this.attackers, this.nextTurn); } // overloaded constructor to evaluate attackers that should attack next turn public AiAttackController(final Player ai, Card attacker) { @@ -109,12 +108,12 @@ public class AiAttackController { this.defendingOpponent = choosePreferredDefenderPlayer(ai); this.oppList = getOpponentCreatures(this.defendingOpponent); this.myList = ai.getCreaturesInPlay(); + this.nextTurn = false; this.attackers = new ArrayList<>(); if (CombatUtil.canAttack(attacker, this.defendingOpponent)) { attackers.add(attacker); } - this.blockers = getPossibleBlockers(oppList, this.attackers); - this.nextTurn = false; + this.blockers = getPossibleBlockers(oppList, this.attackers, this.nextTurn); } // overloaded constructor to evaluate single specified attacker public static List getOpponentCreatures(final Player defender) { @@ -273,28 +272,19 @@ public class AiAttackController { return false; } - public final static List getPossibleBlockers(final List blockers, final List attackers) { + public final static List getPossibleBlockers(final List blockers, final List attackers, final boolean nextTurn) { List possibleBlockers = new ArrayList<>(blockers); possibleBlockers = CardLists.filter(possibleBlockers, new Predicate() { @Override public boolean apply(final Card c) { - return canBlockAnAttacker(c, attackers, false); + return canBlockAnAttacker(c, attackers, nextTurn); } }); return possibleBlockers; } public final static boolean canBlockAnAttacker(final Card c, final List attackers, final boolean nextTurn) { - final List attackerList = new ArrayList<>(attackers); - if (!c.isCreature()) { - return false; - } - for (final Card attacker : attackerList) { - if (CombatUtil.canBlock(attacker, c, nextTurn)) { - return true; - } - } - return false; + return getCardCanBlockAnAttacker(c, attackers, nextTurn) != null; } public final static Card getCardCanBlockAnAttacker(final Card c, final List attackers, final boolean nextTurn) { @@ -383,7 +373,7 @@ public class AiAttackController { int blockersNeeded = opponentsAttackers.size(); // don't hold back creatures that can't block any of the human creatures - final List list = getPossibleBlockers(attackers, opponentsAttackers); + final List list = getPossibleBlockers(attackers, opponentsAttackers, nextTurn); //Calculate the amount of creatures necessary for (int i = 0; i < list.size(); i++) { @@ -1413,11 +1403,11 @@ public class AiAttackController { */ public String toProtectAttacker(SpellAbility sa) { //AiAttackController is created with the selected attacker as the only entry in "attackers" - if (sa.getApi() != ApiType.Protection || oppList.isEmpty() || getPossibleBlockers(oppList, attackers).isEmpty()) { + if (sa.getApi() != ApiType.Protection || oppList.isEmpty() || getPossibleBlockers(oppList, attackers, nextTurn).isEmpty()) { return null; //not protection sa or attacker is already unblockable } final List choices = ProtectEffect.getProtectionList(sa); - String color = ComputerUtilCard.getMostProminentColor(getPossibleBlockers(oppList, attackers)), artifact = null; + String color = ComputerUtilCard.getMostProminentColor(getPossibleBlockers(oppList, attackers, nextTurn)), artifact = null; if (choices.contains("artifacts")) { artifact = "artifacts"; //flag to indicate that protection from artifacts is available } diff --git a/forge-ai/src/main/java/forge/ai/ability/ChooseGenericEffectAi.java b/forge-ai/src/main/java/forge/ai/ability/ChooseGenericEffectAi.java index b458617585e..e81059371c7 100644 --- a/forge-ai/src/main/java/forge/ai/ability/ChooseGenericEffectAi.java +++ b/forge-ai/src/main/java/forge/ai/ability/ChooseGenericEffectAi.java @@ -199,7 +199,6 @@ public class ChooseGenericEffectAi extends SpellAbilityAi { // Todo if hand is empty or mostly empty, skip main phase // Todo if hand has gas, skip draw return Aggregates.random(spells); - } else if ("SinProdder".equals(logic)) { SpellAbility allow = null, deny = null; for (final SpellAbility sp : spells) { diff --git a/forge-gui/res/cardsfolder/a/auriok_siege_sled.txt b/forge-gui/res/cardsfolder/a/auriok_siege_sled.txt index 17735a261ee..5cffe5210f6 100644 --- a/forge-gui/res/cardsfolder/a/auriok_siege_sled.txt +++ b/forge-gui/res/cardsfolder/a/auriok_siege_sled.txt @@ -3,7 +3,7 @@ ManaCost:6 Types:Artifact Creature Juggernaut PT:3/5 A:AB$ MustBlock | Cost$ 1 | ValidTgts$ Creature.Artifact | TgtPrompt$ Select target artifact creature to block this creature | SpellDescription$ Target artifact creature blocks CARDNAME this turn if able. -A:AB$ Effect | Cost$ 1 | ValidTgts$ Creature.Artifact | TgtPrompt$ Select target artifact creature that can't block this creature this turn | IsCurse$ True | RememberObjects$ TargetedCard | ForgetOnMoved$ Battlefield | StaticAbilities$ KWPump | Duration$ UntilHostLeavesPlayOrEOT | StackDescription$ {c:Targeted} can't block CARDNAME this turn. | SpellDescription$ Target artifact creature can't block CARDNAME this turn. +A:AB$ Effect | Cost$ 1 | ValidTgts$ Creature.Artifact | TgtPrompt$ Select target artifact creature that can't block this creature this turn | IsCurse$ True | RememberObjects$ ThisTargetedCard | ForgetOnMoved$ Battlefield | StaticAbilities$ KWPump | Duration$ UntilHostLeavesPlayOrEOT | StackDescription$ {c:Targeted} can't block CARDNAME this turn. | SpellDescription$ Target artifact creature can't block CARDNAME this turn. SVar:KWPump:Mode$ CantBlockBy | ValidAttacker$ Creature.EffectSource | ValidBlocker$ Creature.IsRemembered | Description$ {c:Remembered} can't block EFFECTSOURCE this turn. AI:RemoveDeck:All Oracle:{1}: Target artifact creature blocks Auriok Siege Sled this turn if able.\n{1}: Target artifact creature can't block Auriok Siege Sled this turn. diff --git a/forge-gui/res/cardsfolder/b/burning_tree_bloodscale.txt b/forge-gui/res/cardsfolder/b/burning_tree_bloodscale.txt index e3039228f80..c984cbcccb0 100644 --- a/forge-gui/res/cardsfolder/b/burning_tree_bloodscale.txt +++ b/forge-gui/res/cardsfolder/b/burning_tree_bloodscale.txt @@ -3,7 +3,7 @@ ManaCost:2 R G Types:Creature Viashino Berserker PT:2/2 K:Bloodthirst:1 -A:AB$ Effect | Cost$ 2 R | ValidTgts$ Creature | TgtPrompt$ Select target creature that can't block this creature this turn | IsCurse$ True | RememberObjects$ TargetedCard | ForgetOnMoved$ Battlefield | StaticAbilities$ KWPump | Duration$ UntilHostLeavesPlayOrEOT | StackDescription$ {c:Targeted} can't block CARDNAME this turn. | SpellDescription$ Target creature can't block CARDNAME this turn. +A:AB$ Effect | Cost$ 2 R | ValidTgts$ Creature | TgtPrompt$ Select target creature that can't block this creature this turn | IsCurse$ True | RememberObjects$ ThisTargetedCard | ForgetOnMoved$ Battlefield | StaticAbilities$ KWPump | Duration$ UntilHostLeavesPlayOrEOT | StackDescription$ {c:Targeted} can't block CARDNAME this turn. | SpellDescription$ Target creature can't block CARDNAME this turn. SVar:KWPump:Mode$ CantBlockBy | ValidAttacker$ Creature.EffectSource | ValidBlocker$ Creature.IsRemembered | Description$ {c:Remembered} can't block EFFECTSOURCE this turn. A:AB$ MustBlock | Cost$ 2 G | ValidTgts$ Creature | TgtPrompt$ Select target creature that must block this creature this turn | SpellDescription$ Target creature blocks CARDNAME this turn if able. AI:RemoveDeck:All diff --git a/forge-gui/res/cardsfolder/d/duct_crawler.txt b/forge-gui/res/cardsfolder/d/duct_crawler.txt index f36d80863b7..3c29fc98962 100644 --- a/forge-gui/res/cardsfolder/d/duct_crawler.txt +++ b/forge-gui/res/cardsfolder/d/duct_crawler.txt @@ -2,7 +2,7 @@ Name:Duct Crawler ManaCost:R Types:Creature Insect PT:1/1 -A:AB$ Effect | Cost$ 1 R | ValidTgts$ Creature | TgtPrompt$ Select target creature that can't block this creature this turn | IsCurse$ True | RememberObjects$ TargetedCard | ForgetOnMoved$ Battlefield | StaticAbilities$ KWPump | Duration$ UntilHostLeavesPlayOrEOT | StackDescription$ {c:Targeted} can't block CARDNAME this turn. | SpellDescription$ Target creature can't block CARDNAME this turn. +A:AB$ Effect | Cost$ 1 R | ValidTgts$ Creature | TgtPrompt$ Select target creature that can't block this creature this turn | IsCurse$ True | RememberObjects$ ThisTargetedCard | ForgetOnMoved$ Battlefield | StaticAbilities$ KWPump | Duration$ UntilHostLeavesPlayOrEOT | StackDescription$ {c:Targeted} can't block CARDNAME this turn. | SpellDescription$ Target creature can't block CARDNAME this turn. SVar:KWPump:Mode$ CantBlockBy | ValidAttacker$ Creature.EffectSource | ValidBlocker$ Creature.IsRemembered | Description$ {c:Remembered} can't block EFFECTSOURCE this turn. AI:RemoveDeck:All SVar:Picture:http://www.wizards.com/global/images/magic/general/duct_crawler.jpg diff --git a/forge-gui/res/cardsfolder/f/fearsome_temper.txt b/forge-gui/res/cardsfolder/f/fearsome_temper.txt index 79c30fa0b02..484725a0420 100644 --- a/forge-gui/res/cardsfolder/f/fearsome_temper.txt +++ b/forge-gui/res/cardsfolder/f/fearsome_temper.txt @@ -4,6 +4,6 @@ Types:Enchantment Aura K:Enchant creature A:SP$ Attach | Cost$ 2 R | ValidTgts$ Creature | AILogic$ Pump S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddPower$ 2 | AddToughness$ 2 | AddAbility$ CantBlockFT | Description$ Enchanted creature gets +2/+2 and has "{2}{R}: Target creature can't block this creature this turn." -SVar:CantBlockFT:AB$ Effect | Cost$ 2 R | ValidTgts$ Creature | TgtPrompt$ Select target creature that can't block this creature this turn | IsCurse$ True | RememberObjects$ TargetedCard | ForgetOnMoved$ Battlefield | StaticAbilities$ KWPump | Duration$ UntilHostLeavesPlayOrEOT | StackDescription$ {c:Targeted} can't block CARDNAME this turn. | SpellDescription$ Target creature can't block CARDNAME this turn. +SVar:CantBlockFT:AB$ Effect | Cost$ 2 R | ValidTgts$ Creature | TgtPrompt$ Select target creature that can't block this creature this turn | IsCurse$ True | RememberObjects$ ThisTargetedCard | ForgetOnMoved$ Battlefield | StaticAbilities$ KWPump | Duration$ UntilHostLeavesPlayOrEOT | StackDescription$ {c:Targeted} can't block CARDNAME this turn. | SpellDescription$ Target creature can't block CARDNAME this turn. SVar:KWPump:Mode$ CantBlockBy | ValidAttacker$ Creature.EffectSource | ValidBlocker$ Creature.IsRemembered | Description$ {c:Remembered} can't block EFFECTSOURCE this turn. Oracle:Enchant creature\nEnchanted creature gets +2/+2 and has "{2}{R}: Target creature can't block this creature this turn." diff --git a/forge-gui/res/cardsfolder/k/kozileks_pathfinder.txt b/forge-gui/res/cardsfolder/k/kozileks_pathfinder.txt index f23ab248085..dfb0b17448a 100644 --- a/forge-gui/res/cardsfolder/k/kozileks_pathfinder.txt +++ b/forge-gui/res/cardsfolder/k/kozileks_pathfinder.txt @@ -2,7 +2,7 @@ Name:Kozilek's Pathfinder ManaCost:6 Types:Creature Eldrazi PT:5/5 -A:AB$ Effect | Cost$ C | ValidTgts$ Creature | TgtPrompt$ Select target creature that can't block this creature this turn | IsCurse$ True | RememberObjects$ TargetedCard | ForgetOnMoved$ Battlefield | StaticAbilities$ KWPump | Duration$ UntilHostLeavesPlayOrEOT | StackDescription$ {c:Targeted} can't block CARDNAME this turn. | SpellDescription$ Target creature can't block CARDNAME this turn. +A:AB$ Effect | Cost$ C | ValidTgts$ Creature | TgtPrompt$ Select target creature that can't block this creature this turn | IsCurse$ True | RememberObjects$ ThisTargetedCard | ForgetOnMoved$ Battlefield | StaticAbilities$ KWPump | Duration$ UntilHostLeavesPlayOrEOT | StackDescription$ {c:Targeted} can't block CARDNAME this turn. | SpellDescription$ Target creature can't block CARDNAME this turn. SVar:KWPump:Mode$ CantBlockBy | ValidAttacker$ Creature.EffectSource | ValidBlocker$ Creature.IsRemembered | Description$ {c:Remembered} can't block EFFECTSOURCE this turn. DeckHints:Ability$Mana.Colorless Oracle:{C}: Target creature can't block Kozilek's Pathfinder this turn. ({C} represents colorless mana.) diff --git a/forge-gui/res/cardsfolder/s/screeching_griffin.txt b/forge-gui/res/cardsfolder/s/screeching_griffin.txt index d006bc65f6c..0925941fd54 100644 --- a/forge-gui/res/cardsfolder/s/screeching_griffin.txt +++ b/forge-gui/res/cardsfolder/s/screeching_griffin.txt @@ -3,6 +3,6 @@ ManaCost:3 W Types:Creature Griffin PT:2/2 K:Flying -A:AB$ Effect | Cost$ R | ValidTgts$ Creature | TgtPrompt$ Select target creature that can't block this creature this turn | IsCurse$ True | RememberObjects$ TargetedCard | ForgetOnMoved$ Battlefield | StaticAbilities$ KWPump | Duration$ UntilHostLeavesPlayOrEOT | StackDescription$ {c:Targeted} can't block CARDNAME this turn. | SpellDescription$ Target creature can't block CARDNAME this turn. +A:AB$ Effect | Cost$ R | ValidTgts$ Creature | TgtPrompt$ Select target creature that can't block this creature this turn | IsCurse$ True | RememberObjects$ ThisTargetedCard | ForgetOnMoved$ Battlefield | StaticAbilities$ KWPump | Duration$ UntilHostLeavesPlayOrEOT | StackDescription$ {c:Targeted} can't block CARDNAME this turn. | SpellDescription$ Target creature can't block CARDNAME this turn. SVar:KWPump:Mode$ CantBlockBy | ValidAttacker$ Creature.EffectSource | ValidBlocker$ Creature.IsRemembered | Description$ {c:Remembered} can't block EFFECTSOURCE this turn. Oracle:Flying\n{R}: Target creature can't block Screeching Griffin this turn. diff --git a/forge-gui/res/cardsfolder/s/shrewd_hatchling.txt b/forge-gui/res/cardsfolder/s/shrewd_hatchling.txt index a99f98f722e..01d2275c19e 100644 --- a/forge-gui/res/cardsfolder/s/shrewd_hatchling.txt +++ b/forge-gui/res/cardsfolder/s/shrewd_hatchling.txt @@ -3,7 +3,7 @@ ManaCost:3 UR Types:Creature Elemental PT:6/6 K:etbCounter:M1M1:4 -A:AB$ Effect | Cost$ UR | ValidTgts$ Creature | TgtPrompt$ Select target creature that can't block this creature this turn | IsCurse$ True | RememberObjects$ TargetedCard | ForgetOnMoved$ Battlefield | StaticAbilities$ KWPump | Duration$ UntilHostLeavesPlayOrEOT | StackDescription$ {c:Targeted} can't block CARDNAME this turn. | SpellDescription$ Target creature can't block CARDNAME this turn. +A:AB$ Effect | Cost$ UR | ValidTgts$ Creature | TgtPrompt$ Select target creature that can't block this creature this turn | IsCurse$ True | RememberObjects$ ThisTargetedCard | ForgetOnMoved$ Battlefield | StaticAbilities$ KWPump | Duration$ UntilHostLeavesPlayOrEOT | StackDescription$ {c:Targeted} can't block CARDNAME this turn. | SpellDescription$ Target creature can't block CARDNAME this turn. SVar:KWPump:Mode$ CantBlockBy | ValidAttacker$ Creature.EffectSource | ValidBlocker$ Creature.IsRemembered | Description$ {c:Remembered} can't block EFFECTSOURCE this turn. T:Mode$ SpellCast | ValidCard$ Card.Red | ValidActivatingPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigRemoveCounter | TriggerDescription$ Whenever you cast a red spell, remove a -1/-1 counter from CARDNAME. T:Mode$ SpellCast | ValidCard$ Card.Blue | ValidActivatingPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigRemoveCounter | TriggerDescription$ Whenever you cast a blue spell, remove a -1/-1 counter from CARDNAME. diff --git a/forge-gui/res/cardsfolder/s/spin_engine.txt b/forge-gui/res/cardsfolder/s/spin_engine.txt index fb8d62f20de..1b54380f2bc 100644 --- a/forge-gui/res/cardsfolder/s/spin_engine.txt +++ b/forge-gui/res/cardsfolder/s/spin_engine.txt @@ -2,7 +2,7 @@ Name:Spin Engine ManaCost:3 Types:Artifact Creature Construct PT:3/1 -A:AB$ Effect | Cost$ R | ValidTgts$ Creature | TgtPrompt$ Select target creature that can't block this creature this turn | IsCurse$ True | RememberObjects$ TargetedCard | ForgetOnMoved$ Battlefield | StaticAbilities$ KWPump | Duration$ UntilHostLeavesPlayOrEOT | StackDescription$ {c:Targeted} can't block CARDNAME this turn. | SpellDescription$ Target creature can't block CARDNAME this turn. +A:AB$ Effect | Cost$ R | ValidTgts$ Creature | TgtPrompt$ Select target creature that can't block this creature this turn | IsCurse$ True | RememberObjects$ ThisTargetedCard | ForgetOnMoved$ Battlefield | StaticAbilities$ KWPump | Duration$ UntilHostLeavesPlayOrEOT | StackDescription$ {c:Targeted} can't block CARDNAME this turn. | SpellDescription$ Target creature can't block CARDNAME this turn. SVar:KWPump:Mode$ CantBlockBy | ValidAttacker$ Creature.EffectSource | ValidBlocker$ Creature.IsRemembered | Description$ {c:Remembered} can't block EFFECTSOURCE this turn. DeckNeeds:Color$Red Oracle:{R}: Target creature can't block Spin Engine this turn.