From 2a21f40853caa28ed9f18fbe171fa0cfd7b7e6c3 Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 03:50:50 +0000 Subject: [PATCH] - Fixed life gain happening whenever a creature with negative attack power would attack a player. --- src/forge/Combat.java | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/forge/Combat.java b/src/forge/Combat.java index 11051c67f45..5777c26b62b 100644 --- a/src/forge/Combat.java +++ b/src/forge/Combat.java @@ -92,16 +92,18 @@ public class Combat //sum unblocked attackers' power for(int i = 0; i < att.size(); i++) { if(! isBlocked(att.get(i)) || (getBlockers(att.get(i)).size() == 0 && att.get(i).getKeyword().contains("Trample")) ){ - int damageDealt = att.get(i).getNetAttack(); - if (CombatUtil.isDoranInPlay()) - damageDealt = att.get(i).getNetDefense(); - - //if the creature has first strike do not do damage in the normal combat phase - //if(att.get(i).hasSecondStrike()) - if(!att.get(i).hasFirstStrike() || (att.get(i).hasFirstStrike() && att.get(i).hasDoubleStrike()) ) - addDefendingDamage(damageDealt, att.get(i)); - } - } + int damageDealt = att.get(i).getNetAttack(); + if (CombatUtil.isDoranInPlay()) + damageDealt = att.get(i).getNetDefense(); + + if (damageDealt > 0) { + //if the creature has first strike do not do damage in the normal combat phase + //if(att.get(i).hasSecondStrike()) + if(!att.get(i).hasFirstStrike() || (att.get(i).hasFirstStrike() && att.get(i).hasDoubleStrike()) ) + addDefendingDamage(damageDealt, att.get(i)); + } + } //! isBlocked... + }//for } public void setDefendingFirstStrikeDamage() { @@ -114,14 +116,15 @@ public class Combat if (CombatUtil.isDoranInPlay()) damageDealt = att.get(i).getNetDefense(); - //if the creature has first strike or double strike do damage in the first strike combat phase - - if(att.get(i).hasFirstStrike() || att.get(i).hasDoubleStrike()){ - addDefendingFirstStrikeDamage(damageDealt, att.get(i)); + if (damageDealt > 0) { + //if the creature has first strike or double strike do damage in the first strike combat phase + if(att.get(i).hasFirstStrike() || att.get(i).hasDoubleStrike()){ + addDefendingFirstStrikeDamage(damageDealt, att.get(i)); + } } } - } - } + } //for + } public void addDefendingDamage(int n, Card source) { if (!defendingDamageMap.containsKey(source))