From 763e51e64543b9a5e97917a9670e911f8d044fdd Mon Sep 17 00:00:00 2001 From: Sloth Date: Tue, 21 May 2013 09:51:40 +0000 Subject: [PATCH] - Improved MillAi. --- src/main/java/forge/card/ability/ai/MillAi.java | 10 +++++----- src/main/java/forge/game/ai/ComputerUtil.java | 13 +++++++++++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/main/java/forge/card/ability/ai/MillAi.java b/src/main/java/forge/card/ability/ai/MillAi.java index 88618a19aa6..155c56a2a96 100644 --- a/src/main/java/forge/card/ability/ai/MillAi.java +++ b/src/main/java/forge/card/ability/ai/MillAi.java @@ -48,10 +48,9 @@ public class MillAi extends SpellAbilityAi { return false; } - final Random r = MyRandom.getRandom(); - // Don't use draw abilities before main 2 if possible - if (ai.getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2) && !sa.hasParam("ActivationPhases")) { + if (ai.getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2) && !sa.hasParam("ActivationPhases") + && !ComputerUtil.castSpellInMain1(ai, sa)) { return false; } @@ -67,10 +66,11 @@ public class MillAi extends SpellAbilityAi { } if ((ai.getGame().getPhaseHandler().is(PhaseType.END_OF_TURN) && ai.getGame().getPhaseHandler().getNextTurn().equals(ai))) { - chance = .9; // 90% for end of opponents turn + chance = .95; // 90% for end of opponents turn } - boolean randomReturn = r.nextFloat() <= Math.pow(chance, sa.getActivationsThisTurn() + 1); + final Random r = MyRandom.getRandom(); + boolean randomReturn = r.nextFloat() <= Math.pow(chance, sa.getActivationsThisTurn()); if ((sa.getParam("NumCards").equals("X") || sa.getParam("NumCards").equals("Z")) && source.getSVar("X").startsWith("Count$xPaid")) { // Set PayX here to maximum value. diff --git a/src/main/java/forge/game/ai/ComputerUtil.java b/src/main/java/forge/game/ai/ComputerUtil.java index a253f026a1d..547ba50ad7b 100644 --- a/src/main/java/forge/game/ai/ComputerUtil.java +++ b/src/main/java/forge/game/ai/ComputerUtil.java @@ -1021,8 +1021,17 @@ public class ComputerUtil { final SpellAbility sub = sa.getSubAbility(); // Cipher spells - if (sub != null && ApiType.Encode == sub.getApi() && !ai.getCreaturesInPlay().isEmpty()) { - return true; + if (sub != null) { + final ApiType api = sub.getApi(); + if (ApiType.Encode == api && !ai.getCreaturesInPlay().isEmpty()) { + return true; + } + if (ApiType.PumpAll == api && !ai.getCreaturesInPlay().isEmpty()) { + return true; + } + if (ApiType.Pump == api) { + return true; + } } final List buffed = ai.getCardsIn(ZoneType.Battlefield); for (Card buffedcard : buffed) {