- AI: Improved logic for Capsize.

git-svn-id: http://svn.slightlymagic.net/forge/trunk@35717 269b9781-a132-4a9b-9d4e-f004f1b56b58
This commit is contained in:
Agetian 2017-09-23 05:09:16 +00:00
parent 83a0a1503e
commit 454da1511f
2 changed files with 15 additions and 1 deletions

View File

@ -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);
}

View File

@ -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.