MCPcopy Create free account
hub / github.com/Card-Forge/forge / checkApiLogic

Method checkApiLogic

forge-ai/src/main/java/forge/ai/ability/ManaAi.java:90–107  ·  view source on GitHub ↗
(Player ai, SpellAbility sa)

Source from the content-addressed store, hash-verified

88 * forge.game.spellability.SpellAbility)
89 */
90 @Override
91 protected AiAbilityDecision checkApiLogic(Player ai, SpellAbility sa) {
92 if (sa.hasParam("AILogic")) {
93 return new AiAbilityDecision(100, AiPlayDecision.WillPlay); // handled elsewhere, does not meet the standard requirements
94 }
95
96 // TODO check if it would be worth it to keep mana open for opponents turn anyway
97 if (ComputerUtil.activateForCost(sa, ai)) {
98 return new AiAbilityDecision(100, AiPlayDecision.WillPlay);
99 }
100
101 if (sa.getPayCosts().hasNoManaCost() && sa.getPayCosts().isReusuableResource()
102 && sa.getSubAbility() == null && (improvesPosition(ai, sa) || ComputerUtil.playImmediately(ai, sa))) {
103 return new AiAbilityDecision(100, AiPlayDecision.WillPlay);
104 }
105
106 return new AiAbilityDecision(0, AiPlayDecision.CantPlayAi);
107 }
108
109 /**
110 * @param aiPlayer

Callers

nothing calls this directly

Calls 8

activateForCostMethod · 0.95
improvesPositionMethod · 0.95
playImmediatelyMethod · 0.95
hasNoManaCostMethod · 0.80
getPayCostsMethod · 0.80
isReusuableResourceMethod · 0.80
hasParamMethod · 0.45
getSubAbilityMethod · 0.45

Tested by

no test coverage detected