- Make more use of ActivateForSacCost AI function.

This commit is contained in:
Sloth
2013-06-01 12:03:50 +00:00
parent 6542b6085a
commit ace9303c3f
2 changed files with 21 additions and 20 deletions

View File

@@ -108,7 +108,8 @@ public class DrawAi extends SpellAbilityAi {
if ((!game.getPhaseHandler().getNextTurn().equals(ai) if ((!game.getPhaseHandler().getNextTurn().equals(ai)
|| game.getPhaseHandler().getPhase().isBefore(PhaseType.END_OF_TURN)) || game.getPhaseHandler().getPhase().isBefore(PhaseType.END_OF_TURN))
&& !sa.hasParam("PlayerTurn") && !SpellAbilityAi.isSorcerySpeed(sa) && !sa.hasParam("PlayerTurn") && !SpellAbilityAi.isSorcerySpeed(sa)
&& ai.getCardsIn(ZoneType.Hand).size() > 1) { && ai.getCardsIn(ZoneType.Hand).size() > 1
&& !ComputerUtil.ActivateForSacCost(sa, ai)) {
return false; return false;
} }

View File

@@ -52,7 +52,6 @@ public class LifeLoseAi extends SpellAbilityAi {
final Cost abCost = sa.getPayCosts(); final Cost abCost = sa.getPayCosts();
final Card source = sa.getSourceCard(); final Card source = sa.getSourceCard();
boolean priority = false;
final String amountStr = sa.getParam("LifeAmount"); final String amountStr = sa.getParam("LifeAmount");
@@ -99,22 +98,6 @@ public class LifeLoseAi extends SpellAbilityAi {
return false; return false;
} }
if (amount >= opp.getLife()) {
priority = true; // killing the human should be done asap
}
// Don't use loselife before main 2 if possible
if (ai.getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2)
&& !sa.hasParam("ActivationPhases") && !priority
&& !ComputerUtil.castSpellInMain1(ai, sa)) {
return false;
}
// Don't tap creatures that may be able to block
if (ComputerUtil.waitForBlocking(sa) && !priority) {
return false;
}
final Target tgt = sa.getTarget(); final Target tgt = sa.getTarget();
if (sa.getTarget() != null) { if (sa.getTarget() != null) {
@@ -126,9 +109,26 @@ public class LifeLoseAi extends SpellAbilityAi {
} }
} }
if (priority || SpellAbilityAi.isSorcerySpeed(sa) if (amount >= opp.getLife()) {
return true; // killing the human should be done asap
}
// Don't use loselife before main 2 if possible
if (ai.getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2)
&& !sa.hasParam("ActivationPhases")
&& !ComputerUtil.castSpellInMain1(ai, sa)) {
return false;
}
// Don't tap creatures that may be able to block
if (ComputerUtil.waitForBlocking(sa)) {
return false;
}
if (SpellAbilityAi.isSorcerySpeed(sa)
|| sa.hasParam("ActivationPhases") || sa.hasParam("ActivationPhases")
|| SpellAbilityAi.playReusable(ai, sa)) { || SpellAbilityAi.playReusable(ai, sa)
|| ComputerUtil.ActivateForSacCost(sa, ai)) {
return true; return true;
} }