diff --git a/forge-ai/src/main/java/forge/ai/ability/ChangeZoneAi.java b/forge-ai/src/main/java/forge/ai/ability/ChangeZoneAi.java index 30f65abe..7bddd946 100644 --- a/forge-ai/src/main/java/forge/ai/ability/ChangeZoneAi.java +++ b/forge-ai/src/main/java/forge/ai/ability/ChangeZoneAi.java @@ -57,7 +57,21 @@ public class ChangeZoneAi extends SpellAbilityAi { if (ai.getGame().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_DECLARE_ATTACKERS)) { return false; } + } else if (aiLogic.equals("PriorityOptionalCost")) { + boolean highPriority = false; + // if we have more than one of these in hand, might not be worth waiting for optional cost payment on the additional copy + highPriority |= CardLists.filter(ai.getCardsIn(ZoneType.Hand), CardPredicates.nameEquals(sa.getHostCard().getName())).size() > 1; + // if we are in danger in combat, no need to wait to pay the optional cost + highPriority |= ai.getGame().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS) + && ai.getGame().getCombat() != null && ComputerUtilCombat.lifeInDanger(ai, ai.getGame().getCombat()); + + if (!highPriority) { + if (Iterables.isEmpty(sa.getOptionalCosts())) { + return false; + } + } } + return super.checkAiLogic(ai, sa, aiLogic); } diff --git a/forge-gui/res/cardsfolder/c/capsize.txt b/forge-gui/res/cardsfolder/c/capsize.txt index 7477d78d..3eaae763 100644 --- a/forge-gui/res/cardsfolder/c/capsize.txt +++ b/forge-gui/res/cardsfolder/c/capsize.txt @@ -1,7 +1,7 @@ Name:Capsize ManaCost:1 U U Types:Instant -A:SP$ ChangeZone | Cost$ 1 U U | ValidTgts$ Permanent | TgtPrompt$ Select target permanent | Origin$ Battlefield | Destination$ Hand | SpellDescription$ Return target permanent to its owner's hand. +A:SP$ ChangeZone | Cost$ 1 U U | ValidTgts$ Permanent | TgtPrompt$ Select target permanent | Origin$ Battlefield | Destination$ Hand | AILogic$ PriorityOptionalCost | SpellDescription$ Return target permanent to its owner's hand. K:Buyback 3 SVar:Picture:http://www.wizards.com/global/images/magic/general/capsize.jpg Oracle:Buyback {3} (You may pay an additional {3} as you cast this spell. If you do, put this card into your hand as it resolves.)\nReturn target permanent to its owner's hand.