- Improved SpellPermanent AI.

This commit is contained in:
Sloth
2013-04-28 14:44:28 +00:00
parent ef281231fe
commit 55ef9d5baf

View File

@@ -104,19 +104,6 @@ public class SpellPermanent extends Spell {
} }
card.setSVar("PayX", Integer.toString(xPay)); card.setSVar("PayX", Integer.toString(xPay));
} }
// Wait for Main2 if possible
if (game.getPhaseHandler().is(PhaseType.MAIN1)
&& !ComputerUtil.castPermanentInMain1(ai, this)
&& game.getPhaseHandler().isPlayerTurn(ai)) {
return false;
}
// save cards with flash for surprise blocking
if (card.hasKeyword("Flash")
&& !card.hasETBTrigger()
&& (game.getPhaseHandler().isPlayerTurn(ai)
|| game.getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY))) {
return false;
}
// Prevent the computer from summoning Ball Lightning type creatures after attacking // Prevent the computer from summoning Ball Lightning type creatures after attacking
if (card.hasKeyword("At the beginning of the end step, sacrifice CARDNAME.") if (card.hasKeyword("At the beginning of the end step, sacrifice CARDNAME.")
&& (game.getPhaseHandler().isPlayerTurn(ai.getOpponent()) && (game.getPhaseHandler().isPlayerTurn(ai.getOpponent())
@@ -130,6 +117,23 @@ public class SpellPermanent extends Spell {
return false; return false;
} }
// Wait for Main2 if possible
if (game.getPhaseHandler().is(PhaseType.MAIN1)
&& game.getPhaseHandler().isPlayerTurn(ai)
&& ai.getManaPool().totalMana() <= 0
&& !ComputerUtil.castPermanentInMain1(ai, this)) {
return false;
}
// save cards with flash for surprise blocking
if (card.hasKeyword("Flash")
&& (ai.isUnlimitedHandSize() || ai.getCardsIn(ZoneType.Hand).size() <= ai.getMaxHandSize())
&& ai.getManaPool().totalMana() <= 0
&& (game.getPhaseHandler().isPlayerTurn(ai)
|| game.getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY)
&& !card.hasETBTrigger())) {
return false;
}
return canPlayFromEffectAI(false, true); return canPlayFromEffectAI(false, true);
} // canPlayAI() } // canPlayAI()