From 4f915b38c85f00288328bcb716204b9d5751ebf8 Mon Sep 17 00:00:00 2001 From: "anthonycalosa@gmail.com" Date: Fri, 17 May 2013 02:09:48 +0000 Subject: [PATCH] added basic support for "X plus one", "X plus two" & "X plus three". example: [card] name=AEther Burst target=creature|battlefield auto=moveto(ownerhand) text=Return up to X target creatures to their owners' hands, where X is one plus the number of cards named AEther Burst in all graveyards as you cast AEther Burst. mana={1}{U} type=Instant [/card] [card] name=Vitalizing Cascade auto=life:Xplusthree text=You gain X plus 3 life. mana={X}{G}{W} type=Instant [/card] --- projects/mtg/include/AllAbilities.h | 36 +++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 4150c2b8c..8f5d90ea2 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -64,6 +64,9 @@ private: bool halfdown = false; bool twice = false; bool thrice = false; + bool plusone = false; + bool plustwo = false; + bool plusthree = false; if (!target) target = card; int multiplier = 1; if (s[0] == '-') @@ -112,6 +115,24 @@ private: size_t tXXX = s.find("thrice"); s.erase(tXXX,tXXX + 6); } + if(s.find("plusone") != string::npos) + { + plusone = true; + size_t pOne = s.find("plusone"); + s.erase(pOne,pOne + 7); + } + if(s.find("plustwo") != string::npos) + { + plustwo = true; + size_t pTwo = s.find("plustwo"); + s.erase(pTwo,pTwo + 7); + } + if(s.find("plusthree") != string::npos) + { + plusthree = true; + size_t pThree = s.find("plusthree"); + s.erase(pThree,pThree + 9); + } if(s == "prex") { ManaCost * cX = card->controller()->getManaPool()->Diff(card->getManaCost()); @@ -407,6 +428,21 @@ private: intValue = intValue*2; if(thrice) intValue = intValue*3; + if(plusone) + intValue = intValue+1; + if(plustwo) + intValue = intValue+2; + if(plusthree) + intValue = intValue+3; + } + else + { + if(plusone) + intValue = intValue+1; + if(plustwo) + intValue = intValue+2; + if(plusthree) + intValue = intValue+3; } intValue *= multiplier; }