mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
- Improved SpellPermanent AI.
This commit is contained in:
@@ -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())
|
||||||
@@ -129,6 +116,23 @@ public class SpellPermanent extends Spell {
|
|||||||
&& !card.getController().couldCastSorcery(this)) {
|
&& !card.getController().couldCastSorcery(this)) {
|
||||||
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()
|
||||||
|
|||||||
Reference in New Issue
Block a user