From a74e543429eb780e905927ba826b266b632e5902 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Fri, 10 Jun 2016 13:25:24 +0800 Subject: [PATCH] Fix leak --- projects/mtg/src/MTGCardInstance.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/projects/mtg/src/MTGCardInstance.cpp b/projects/mtg/src/MTGCardInstance.cpp index e14782181..7888be843 100644 --- a/projects/mtg/src/MTGCardInstance.cpp +++ b/projects/mtg/src/MTGCardInstance.cpp @@ -1535,15 +1535,13 @@ const string& MTGCardInstance::getSample() int MTGCardInstance::stepPower(CombatStep step) { + int damage = has(Constants::COMBATTOUGHNESS) ? toughness : power; switch (step) { case FIRST_STRIKE: case END_FIRST_STRIKE: if (has(Constants::FIRSTSTRIKE) || has(Constants::DOUBLESTRIKE)) - if(has(Constants::COMBATTOUGHNESS)) - return MAX(0, toughness); - else - return MAX(0, power); + return MAX(0, damage); else return 0; case DAMAGE: @@ -1552,10 +1550,7 @@ int MTGCardInstance::stepPower(CombatStep step) if (has(Constants::FIRSTSTRIKE) && !has(Constants::DOUBLESTRIKE)) return 0; else - if(has(Constants::COMBATTOUGHNESS)) - return MAX(0, toughness); - else - return MAX(0, power); + return MAX(0, damage); } }