- Little CanPlayAI updates.

This commit is contained in:
Sloth
2012-12-04 20:17:31 +00:00
parent 7eb6a80d0e
commit 994f70ac88
3 changed files with 12 additions and 6 deletions

View File

@@ -102,6 +102,11 @@ public class DrawAi extends SpellAiLogic {
&& !sa.hasParam("ActivationPhases")) {
return false;
}
if (!Singletons.getModel().getGame().getPhaseHandler().getNextTurn().equals(ai)
&& !sa.hasParam("PlayerTurn") && !AbilityFactory.isSorcerySpeed(sa)
&& ai.getCardsIn(ZoneType.Hand).size() < 2) {
return false;
}
// Don't tap creatures that may be able to block
if (ComputerUtil.waitForBlocking(sa)) {

View File

@@ -96,18 +96,19 @@ public class LifeGainAi extends SpellAiLogic {
&& !sa.hasParam("ActivationPhases")) {
return false;
}
// Don't use lifegain before main 2 if possible
if (!lifeCritical && !Singletons.getModel().getGame().getPhaseHandler().getNextTurn().equals(ai)
&& !sa.hasParam("PlayerTurn") && !AbilityFactory.isSorcerySpeed(sa)) {
return false;
}
// Don't tap creatures that may be able to block
if (ComputerUtil.waitForBlocking(sa)) {
return false;
}
// TODO handle proper calculation of X values based on Cost and what
// would be paid
// final int amount = calculateAmount(af.getHostCard(), amountStr, sa);
// prevent run-away activations - first time will always return true
final boolean chance = r.nextFloat() <= Math.pow(.6667, sa.getActivationsThisTurn());
final boolean chance = r.nextFloat() <= Math.pow(.9, sa.getActivationsThisTurn());
final Target tgt = sa.getTarget();
if (tgt != null) {