- AI improvements to the DealDamage AF.

This commit is contained in:
jendave
2011-08-06 11:07:58 +00:00
parent c50e1f2832
commit ec9e6a9ee8
3 changed files with 7 additions and 3 deletions

View File

@@ -174,6 +174,10 @@ import java.util.Random;
}
private boolean shouldTgtP(int d) {
if (AllZone.HumanPlayer.reducePlayerDamageToZero(AF.getHostCard(), false)
|| !AllZone.HumanPlayer.canTarget(AF.getHostCard())) return false;
PlayerZone compHand = AllZone.getZone(Constant.Zone.Hand, AllZone.ComputerPlayer);
CardList hand = new CardList(compHand.getCards());
@@ -227,7 +231,7 @@ import java.util.Random;
}
if (AF.getAbCost().getSubCounter()) {
// +1/+1 counters only if damage from this ability would kill the human, otherwise ok
if(AllZone.HumanPlayer.getLife() - damage > 0 || !AF.getAbCost().getCounterType().equals(Counters.P1P1))
if(AllZone.HumanPlayer.getLife() - damage > 0 && AF.getAbCost().getCounterType().equals(Counters.P1P1))
return false;
}
if (AF.getAbCost().getLifeCost()) {

View File

@@ -268,7 +268,7 @@ public class AbilityFactory_Pump {
if (addsKeywords) {
list = list.filter(new CardListFilter() {
public boolean addCard(Card c) {
return c.hasAnyKeyword(KWs); // don't add duplicate negative keywords
return !c.hasAnyKeyword(KWs); // don't add duplicate negative keywords
}
});
}

View File

@@ -211,7 +211,7 @@ public abstract class Player extends MyObservable{
GameActionUtil.executePlayerDamageEffects(this, source, damageToDo, false);
}
private boolean reducePlayerDamageToZero(final Card source, final boolean isCombat) {
public boolean reducePlayerDamageToZero(final Card source, final boolean isCombat) {
boolean reduce = false;
if(isCombat) {
//for future use