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