From 8ebc7dc6edc4117902163794f0c2b343e696d50d Mon Sep 17 00:00:00 2001 From: "omegablast2002@yahoo.com" Date: Mon, 12 Sep 2011 17:00:13 +0000 Subject: [PATCH] made cumulativeupcost a little more user friendly, it also now follows the rules more correctly(MTG rules:partial payments can not be made on cumulative cost, it's all or nothing).. it will only need to be clicked once for payment now, instead of once per counter. --- projects/mtg/include/AllAbilities.h | 1 + projects/mtg/src/AllAbilities.cpp | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index d88a38fed..969ac57ce 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -3602,6 +3602,7 @@ public: int once; bool Cumulative; int currentage; + ManaCost * backupMana; AUpkeep(int _id, MTGCardInstance * card, MTGAbility * a, ManaCost * _cost, int restrictions = 0, int _phase = Constants::MTG_PHASE_UPKEEP, int _once = 0,bool Cumulative = false); diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 1f6cfcf07..cd75f35f7 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -3386,6 +3386,7 @@ AUpkeep::AUpkeep(int _id, MTGCardInstance * card, MTGAbility * a, ManaCost * _co { paidThisTurn = 0; aType = MTGAbility::UPCOST; + backupMana = NEW ManaCost(this->getCost()); } int AUpkeep::receiveEvent(WEvent * event) @@ -3424,7 +3425,14 @@ void AUpkeep::Update(float dt) currentage = targetCounter->nb - 1; } if(currentage) - paidThisTurn -= currentage; + { + paidThisTurn = 0; + this->getCost()->copy(backupMana); + for(int age = 0;age < currentage;age++) + { + this->getCost()->add(backupMana); + } + } } if (newPhase == phase + 1 && once) once = 2; @@ -3466,6 +3474,7 @@ AUpkeep * AUpkeep::clone() const AUpkeep::~AUpkeep() { SAFE_DELETE(ability); + SAFE_DELETE(backupMana); } //A Phase based Action