(Player ai, SpellAbility sa)
| 41 | * @see forge.ai.SpellAbilityAi#checkApiLogic(forge.game.player.Player, forge.game.spellability.SpellAbility) |
| 42 | */ |
| 43 | @Override |
| 44 | protected AiAbilityDecision checkApiLogic(Player ai, SpellAbility sa) { |
| 45 | if (!targetAI(ai, sa, false)) { |
| 46 | return new AiAbilityDecision(0, AiPlayDecision.TargetingFailed); |
| 47 | } |
| 48 | |
| 49 | if (sa.usesTargeting()) { |
| 50 | final Player player = sa.getTargets().getFirstTargetedPlayer(); |
| 51 | if (player != null && player.isOpponentOf(ai)) { |
| 52 | return new AiAbilityDecision(0, AiPlayDecision.CantPlayAi); |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | if (ComputerUtil.playImmediately(ai, sa)) { |
| 57 | return new AiAbilityDecision(100, AiPlayDecision.WillPlay); |
| 58 | } |
| 59 | |
| 60 | // Don't tap creatures that may be able to block |
| 61 | if (ComputerUtil.waitForBlocking(sa)) { |
| 62 | return new AiAbilityDecision(0, AiPlayDecision.WaitForCombat); |
| 63 | } |
| 64 | |
| 65 | if (!canLoot(ai, sa)) { |
| 66 | return new AiAbilityDecision(0, AiPlayDecision.CantPlayAi); |
| 67 | } |
| 68 | |
| 69 | if (ComputerUtilCost.isSacrificeSelfCost(sa.getPayCosts())) { |
| 70 | // Canopy lands and other cards that sacrifice themselves to draw cards |
| 71 | if (ai.getCardsIn(ZoneType.Hand).isEmpty() |
| 72 | || (sa.getHostCard().isLand() && ai.getLandsInPlay().size() >= 5)) { |
| 73 | // TODO: make this configurable in the AI profile |
| 74 | return new AiAbilityDecision(100, AiPlayDecision.WillPlay); |
| 75 | } |
| 76 | return new AiAbilityDecision(0, AiPlayDecision.CostNotAcceptable); |
| 77 | } |
| 78 | |
| 79 | return new AiAbilityDecision(100, AiPlayDecision.WillPlay); |
| 80 | } |
| 81 | |
| 82 | /* |
| 83 | * (non-Javadoc) |
nothing calls this directly
no test coverage detected