- Improved AI of AB dealDamage.

This commit is contained in:
jendave
2011-08-06 22:24:08 +00:00
parent e81aefc05d
commit d55be36d52
2 changed files with 10 additions and 12 deletions

View File

@@ -2977,7 +2977,11 @@ public class Card extends MyObservable {
else else
if(source.getKeyword().contains("Deathtouch")) { if(source.getKeyword().contains("Deathtouch")) {
for(int i=1; i <= maxDamage; i++) { for(int i=1; i <= maxDamage; i++) {
if (predictDamage(i, source, isCombat) > 0) if (noPrevention) {
if (staticReplaceDamage(i, source, isCombat) > 0)
return i;
}
else if (predictDamage(i, source, isCombat) > 0)
return i; return i;
} }
} }

View File

@@ -292,8 +292,9 @@ public class AbilityFactory_DealDamage {
private Card chooseTgtC(final int d, final boolean noPrevention, final Player pl, final boolean mandatory) { private Card chooseTgtC(final int d, final boolean noPrevention, final Player pl, final boolean mandatory) {
Target tgt = AF.getAbTgt(); Target tgt = AF.getAbTgt();
final Card source = AF.getHostCard();
CardList hPlay = AllZoneUtil.getPlayerCardsInPlay(pl); CardList hPlay = AllZoneUtil.getPlayerCardsInPlay(pl);
hPlay = hPlay.getValidCards(tgt.getValidTgts(), AllZone.ComputerPlayer, AF.getHostCard()); hPlay = hPlay.getValidCards(tgt.getValidTgts(), AllZone.ComputerPlayer, source);
ArrayList<Object> objects = tgt.getTargets(); ArrayList<Object> objects = tgt.getTargets();
for(Object o : objects){ for(Object o : objects){
@@ -303,19 +304,12 @@ public class AbilityFactory_DealDamage {
hPlay.remove(c); hPlay.remove(c);
} }
} }
hPlay = hPlay.getTargetableCards(AF.getHostCard()); hPlay = hPlay.getTargetableCards(source);
CardList killables = hPlay.filter(new CardListFilter() { CardList killables = hPlay.filter(new CardListFilter() {
public boolean addCard(Card c) { public boolean addCard(Card c) {
int restDamage = d; return (c.getEnoughDamageToKill(d, source, false, noPrevention) <= d )
if (!noPrevention) && !(c.getSVar("SacMe").length() > 0);
restDamage = c.predictDamage(d,AF.getHostCard(),false);
else
restDamage = c.staticReplaceDamage(restDamage, AF.getHostCard(), false);
// will include creatures already dealt damage
return c.getKillDamage() <= restDamage && c.getShield() == 0 &&
!c.getKeyword().contains("Indestructible") && !(c.getSVar("SacMe").length() > 0);
} }
}); });