From 1439aec22f8baf0e8698923e0ed004ef9594a62b Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 13:28:45 +0000 Subject: [PATCH] - Update AF_Damage to properly care about legal targets. --- src/forge/AbilityFactory_DealDamage.java | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/forge/AbilityFactory_DealDamage.java b/src/forge/AbilityFactory_DealDamage.java index 355d1fc247e..0f693f09fd0 100644 --- a/src/forge/AbilityFactory_DealDamage.java +++ b/src/forge/AbilityFactory_DealDamage.java @@ -131,19 +131,17 @@ import java.util.Random; } private Card chooseTgtC(final int d, final boolean noPrevention) { - - PlayerZone human = AllZone.getZone(Constant.Zone.Battlefield, AllZone.HumanPlayer); - CardList hPlay = new CardList(human.getCards()); + CardList hPlay = AllZoneUtil.getPlayerCardsInPlay(AllZone.HumanPlayer); + hPlay = hPlay.getValidCards(AF.getAbTgt().getValidTgts(), AllZone.ComputerPlayer, AF.getHostCard()); + hPlay = hPlay.filter(new CardListFilter() { public boolean addCard(Card c) { int restDamage = d; if (!noPrevention) restDamage = c.staticDamagePrevention(d,AF.getHostCard(),false); // will include creatures already dealt damage - return c.isCreature() && (c.getKillDamage() <= restDamage) - && CardFactoryUtil.canTarget(AF.getHostCard(), c) - && !c.getKeyword().contains("Indestructible") - && !(c.getSVar("SacMe").length() > 0); + return c.getKillDamage() <= restDamage && CardFactoryUtil.canTarget(AF.getHostCard(), c) + && !c.getKeyword().contains("Indestructible") && !(c.getSVar("SacMe").length() > 0); } }); @@ -152,14 +150,6 @@ import java.util.Random; return best; } - // Combo alert!! Casting burn on your own Stuffy Dolls is a waste - /* - PlayerZone compy = AllZone.getZone(Constant.Zone.Play, AllZone.ComputerPlayer); - CardList cPlay = new CardList(compy.getCards()); - if(cPlay.size() > 0) for(int i = 0; i < cPlay.size(); i++) - if(cPlay.get(i).getName().equals("Stuffy Doll")) return cPlay.get(i); - */ - return null; } @@ -188,7 +178,7 @@ import java.util.Random; // TODO handle proper calculation of X values based on Cost - // todo: this should only happen during Players EOT + // todo: this should only happen during Players EOT or if Stuffy is going to die if(AF.getHostCard().equals("Stuffy Doll")) { return true; }