diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 5a6275f07..5da79447d 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -3964,8 +3964,9 @@ class AVanishing: public ActivatedAbility public: int timeLeft; int amount; + string counterName; - AVanishing(int _id, MTGCardInstance * card, ManaCost * _cost, int _tap = 0, int restrictions = 0,int amount = 0); + AVanishing(int _id, MTGCardInstance * card, ManaCost * _cost, int _tap = 0, int restrictions = 0,int amount = 0,string counterName = ""); void Update(float dt); int resolve(); const char * getMenuText(); diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index ce99e73fc..f3964973a 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -2782,12 +2782,12 @@ APreventDamageTypesUEOT::~APreventDamageTypesUEOT() SAFE_DELETE(ability); } -//AVanishing creature -AVanishing::AVanishing(int _id, MTGCardInstance * card, ManaCost * _cost, int _tap, int restrictions, int amount) : -ActivatedAbility(_id, card, _cost, restrictions, _tap),amount(amount) +//AVanishing creature also fading +AVanishing::AVanishing(int _id, MTGCardInstance * card, ManaCost * _cost, int _tap, int restrictions, int amount, string counterName) : +ActivatedAbility(_id, card, _cost, restrictions, _tap),amount(amount),counterName(counterName) { for(int i = 0;i< amount;i++) - source->counters->addCounter("time",0,0); + source->counters->addCounter(counterName.c_str(),0,0); } void AVanishing::Update(float dt) @@ -2796,13 +2796,13 @@ void AVanishing::Update(float dt) { if(newPhase == Constants::MTG_PHASE_UPKEEP) { - source->counters->removeCounter("time",0,0); + source->counters->removeCounter(counterName.c_str(),0,0); Counter * targetCounter = NULL; timeLeft = 0; - if (source->counters && source->counters->hasCounter("time", 0, 0)) + if (source->counters && source->counters->hasCounter(counterName.c_str(), 0, 0)) { - targetCounter = source->counters->hasCounter("time", 0, 0); + targetCounter = source->counters->hasCounter(counterName.c_str(), 0, 0); timeLeft = targetCounter->nb; } else @@ -2835,6 +2835,8 @@ int AVanishing::resolve() const char * AVanishing::getMenuText() { +if(counterName.find("fading") != string::npos) +return "Fading"; return "Vanishing"; } diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 8f84e0711..20a8db5ee 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -2439,10 +2439,27 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG { amount = atoi(s.substr(start + 1).c_str()); } - MTGAbility * a = NEW AVanishing(id, card, NULL, doTap, restrictions,amount); + MTGAbility * a = NEW AVanishing(id, card, NULL, doTap, restrictions,amount,"time"); + return a; + } + //Fading + found = s.find("fading:"); + if (found != string::npos) + { + size_t start = s.find(":", found); + size_t end = s.find(" ", start); + int amount; + if (end != string::npos) + { + amount = atoi(s.substr(start + 1, end - start - 1).c_str()); + } + else + { + amount = atoi(s.substr(start + 1).c_str()); + } + MTGAbility * a = NEW AVanishing(id, card, NULL, doTap, restrictions,amount,"fade"); return a; } - if (s.find("altercost(") != string::npos) return getManaReduxAbility(s.substr(s.find("altercost(") + 10), id, spell, card, target);