From 9d5a9aa23e66db187356eedf80ccd3b4c25a775f Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 22:22:19 +0000 Subject: [PATCH] - Improved the targeting AI of enControl auras. - changeController will no longer reset the TurnInZone variable of a card. --- src/forge/EndOfTurn.java | 2 +- src/forge/GameAction.java | 2 ++ .../card/cardFactory/CardFactory_Auras.java | 31 +++++-------------- 3 files changed, 11 insertions(+), 24 deletions(-) diff --git a/src/forge/EndOfTurn.java b/src/forge/EndOfTurn.java index 0c62316da97..d5612997c25 100644 --- a/src/forge/EndOfTurn.java +++ b/src/forge/EndOfTurn.java @@ -122,7 +122,7 @@ public class EndOfTurn implements java.io.Serializable } if(c.getName().equals("Erg Raiders") && !c.getCreatureAttackedThisTurn() && - !(c.getTurnInZone() == AllZone.Phase.getTurn()) && AllZone.Phase.isPlayerTurn(c.getController())) { + !c.isSick() && AllZone.Phase.isPlayerTurn(c.getController())) { final Card raider = c; final SpellAbility change = new Ability(raider, "0") { @Override diff --git a/src/forge/GameAction.java b/src/forge/GameAction.java index e6c5b095e7c..253a5a2bd09 100644 --- a/src/forge/GameAction.java +++ b/src/forge/GameAction.java @@ -144,9 +144,11 @@ public class GameAction { //so "enters the battlefield" abilities don't trigger for(Card c : list){ + int turnInZone = c.getTurnInZone(); oldBattlefield.remove(c); c.setController(newController); newBattlefield.add(c); + c.setTurnInZone(turnInZone); // The number of turns in the zone should not change if (c.isCreature()) AllZone.Combat.removeFromCombat(c); } diff --git a/src/forge/card/cardFactory/CardFactory_Auras.java b/src/forge/card/cardFactory/CardFactory_Auras.java index d728ad5a62a..fa683c61ce4 100644 --- a/src/forge/card/cardFactory/CardFactory_Auras.java +++ b/src/forge/card/cardFactory/CardFactory_Auras.java @@ -2265,8 +2265,6 @@ class CardFactory_Auras { if(!super.canPlayAI()) return false; CardList tgts = CardFactoryUtil.AI_getHumanCreature(card, true); - CardListUtil.sortAttack(tgts); - CardListUtil.sortFlying(tgts); /* * This is a new addition and is used @@ -2278,13 +2276,6 @@ class CardFactory_Auras { return CardUtil.getConvertedManaCost(c.getManaCost()) <= 2; } }); - if (tgts.isEmpty()) return false; - else { - CardListUtil.sortAttack(tgts); - CardListUtil.sortFlying(tgts); - setTargetCard(tgts.get(0)); - return true; - } } /* @@ -2300,17 +2291,12 @@ class CardFactory_Auras { } if (tgts.isEmpty()) return false; - - if (2 <= tgts.get(0).getNetAttack() - && tgts.get(0).getKeyword().contains("Flying")) { - setTargetCard(tgts.get(0)); - return true; - } - CardListUtil.sortAttack(tgts); - if (4 <= tgts.get(0).getNetAttack()) { - setTargetCard(tgts.get(0)); - return true; + Card target = CardFactoryUtil.AI_getBestCreature(tgts); + + if (CardFactoryUtil.evaluateCreature(target) >= 160) { + setTargetCard(target); + return true; } /* @@ -2318,10 +2304,9 @@ class CardFactory_Auras { * Do we want the AI to hold these auras when * losing game and at a creature disadvatange */ - if (3 <= tgts.get(0).getNetAttack() - && AllZone.HumanPlayer.getLife() > AllZone.ComputerPlayer.getLife()) { - setTargetCard(tgts.get(0)); - return true; + if (CardFactoryUtil.evaluateCreature(target) >= 130 && 5 > AllZone.ComputerPlayer.getLife()) { + setTargetCard(target); + return true; } return false;