From 0fb914c0c35a5c0c49e8bce57e0de229a6440479 Mon Sep 17 00:00:00 2001 From: "omegablast2002@yahoo.com" Date: Tue, 22 Mar 2011 03:20:17 +0000 Subject: [PATCH] fixed a reported bug where the foelost restrictions for triggers were not activating correctly, also updated the code by making it more flexiable...you can now do foelost(number) instead. --- projects/mtg/src/ActionStack.cpp | 2 +- projects/mtg/src/MTGAbility.cpp | 16 ++++++---------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/projects/mtg/src/ActionStack.cpp b/projects/mtg/src/ActionStack.cpp index 27bbb2e65..a1aa9235f 100644 --- a/projects/mtg/src/ActionStack.cpp +++ b/projects/mtg/src/ActionStack.cpp @@ -556,7 +556,7 @@ int ActionStack::addDamage(MTGCardInstance * _source, Damageable * _target, int addAction(damage); _source->thatmuch = _damage; _target->thatmuch = _damage; - _target->lifeLostThisTurn += _damage; + //_target->lifeLostThisTurn += _damage; return 1; } diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index ae3b4db72..f2eda4e60 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -335,17 +335,11 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string magicText, int { sourceTap = true; } - found = s.find("foelostthree"); + found = s.find("foelost("); if (found != string::npos) { lifelost = true; - lifeamount = 3; - } - found = s.find("foelosttwo"); - if (found != string::npos) - { - lifelost = true; - lifeamount = 2; + lifeamount = atoi(s.substr(found + 8,')').c_str()); } found = s.find("opponentpoisoned"); if ( found != string::npos) @@ -4388,9 +4382,11 @@ TriggerAtPhase::TriggerAtPhase(int id, MTGCardInstance * source, Targetable * ta int TriggerAtPhase::trigger() { if(source->isPhased) return 0; - if(lifelost && source->controller()->opponent()->lifeLostThisTurn < lifeamount) + if(lifelost) { - return 0; + int lifeloss = source->controller()->opponent()->lifeLostThisTurn; + if(lifeloss < lifeamount) + return 0; } if (sourceUntapped && source->isTapped() == 1) return 0;