From 92a8ccebd8692b3c6cf06beda723eb713dfdf2ce Mon Sep 17 00:00:00 2001 From: "omegablast2002@yahoo.com" Date: Sat, 10 Nov 2012 05:08:23 +0000 Subject: [PATCH] added a new tag to transforms(( keyword ... uynt ...meaning until your(the sources controller) next turn. this should allow players to code cards with the detain ability of rtr correctly, as well as a handful of similar cards in the unsupported text. detain is coded auto={1}{t}:target(creature|opponentBattlefield) transforms((Detained,newability[cantattack],newability[cantblock],newability[noactivatedability])) uynt enjoy --- projects/mtg/include/AllAbilities.h | 8 ++++++-- projects/mtg/src/AllAbilities.cpp | 27 +++++++++++++++++++++------ projects/mtg/src/MTGAbility.cpp | 12 ++++++++---- 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 348444fd8..f71b92d0f 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -3948,10 +3948,13 @@ public: vector newAbilitiesList; bool newAbilityFound; bool aForever; + bool UYNT; + int myCurrentTurn; - ATransformer(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, string stypes, string sabilities,string newpower,bool newpowerfound,string newtoughness,bool newtoughnessfound,vector newAbilitiesList,bool newAbilityFound = false,bool aForever = false); + ATransformer(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, string stypes, string sabilities,string newpower,bool newpowerfound,string newtoughness,bool newtoughnessfound,vector newAbilitiesList,bool newAbilityFound = false,bool aForever = false ,bool UYNT = false); int addToGame(); int reapplyCountersBonus(MTGCardInstance * rtarget= NULL,bool powerapplied=false,bool toughnessapplied=false); + int testDestroy(); int destroy(); const char * getMenuText(); ATransformer * clone() const; @@ -3971,8 +3974,9 @@ public: map > newAbilities; bool newAbilityFound; bool aForever; + bool UYNT; - ATransformerInstant(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, string types = "", string abilities = "",string newpower = "",bool newpowerfound = false,string newtoughness = "",bool newtoughnessfound = false,vectornewAbilitiesList = vector(),bool newAbilityFound = false,bool aForever = false); + ATransformerInstant(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, string types = "", string abilities = "",string newpower = "",bool newpowerfound = false,string newtoughness = "",bool newtoughnessfound = false,vectornewAbilitiesList = vector(),bool newAbilityFound = false,bool aForever = false, bool UYNT = false); int resolve(); const char * getMenuText(); ATransformerInstant * clone() const; diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 842d8f895..5c746f583 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -3566,8 +3566,8 @@ AAlterCost::~AAlterCost() } // ATransformer -ATransformer::ATransformer(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, string stypes, string sabilities,string newpower,bool newpowerfound,string newtoughness,bool newtoughnessfound,vector newAbilitiesList,bool newAbilityFound,bool aForever) : - MTGAbility(observer, id, source, target),newpower(newpower),newpowerfound(newpowerfound),newtoughness(newtoughness),newtoughnessfound(newtoughnessfound),newAbilitiesList(newAbilitiesList),newAbilityFound(newAbilityFound),aForever(aForever) +ATransformer::ATransformer(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, string stypes, string sabilities,string newpower,bool newpowerfound,string newtoughness,bool newtoughnessfound,vector newAbilitiesList,bool newAbilityFound,bool aForever, bool aUntilNext) : + MTGAbility(observer, id, source, target),newpower(newpower),newpowerfound(newpowerfound),newtoughness(newtoughness),newtoughnessfound(newtoughnessfound),newAbilitiesList(newAbilitiesList),newAbilityFound(newAbilityFound),aForever(aForever),UYNT(aUntilNext) { PopulateAbilityIndexVector(abilities, sabilities); @@ -3576,7 +3576,7 @@ ATransformer::ATransformer(GameObserver* observer, int id, MTGCardInstance * sou { colors.push_back(source->chooseacolor); } - + myCurrentTurn = 1000; //this subkeyword adds a color without removing the existing colors. addNewColors = (sabilities.find("newcolors") != string::npos); remove = (stypes.find("removealltypes") != string::npos); @@ -3608,6 +3608,8 @@ ATransformer::ATransformer(GameObserver* observer, int id, MTGCardInstance * sou int ATransformer::addToGame() { + if(UYNT) + myCurrentTurn = game->turn; MTGCardInstance * _target = NULL; Interruptible * action = (Interruptible *) target; if (action && action->type == ACTION_SPELL && action->state == NOT_RESOLVED) @@ -3781,6 +3783,19 @@ for (it = types.begin(); it != types.end(); it++) return rNewToughness; return rNewPower; } + + int ATransformer::testDestroy() + { + if(UYNT) + { + if(myCurrentTurn != 1000 && game->turn > myCurrentTurn && source->controller()->getId() == game->currentPlayer->getId()) + { + return 1; + } + } + return MTGAbility::testDestroy(); + } + int ATransformer::destroy() { if(aForever) @@ -3882,10 +3897,10 @@ ATransformer::~ATransformer() } //ATransformerInstant -ATransformerInstant::ATransformerInstant(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, string types, string abilities,string newpower,bool newpowerfound,string newtoughness,bool newtoughnessfound,vectornewAbilitiesList,bool newAbilityFound,bool aForever) : - InstantAbility(observer, id, source, target),newpower(newpower),newpowerfound(newpowerfound),newtoughness(newtoughness),newtoughnessfound(newtoughnessfound),newAbilitiesList(newAbilitiesList),newAbilityFound(newAbilityFound),aForever(aForever) +ATransformerInstant::ATransformerInstant(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, string types, string abilities,string newpower,bool newpowerfound,string newtoughness,bool newtoughnessfound,vectornewAbilitiesList,bool newAbilityFound,bool aForever,bool aUntilNext) : + InstantAbility(observer, id, source, target),newpower(newpower),newpowerfound(newpowerfound),newtoughness(newtoughness),newtoughnessfound(newtoughnessfound),newAbilitiesList(newAbilitiesList),newAbilityFound(newAbilityFound),aForever(aForever),UYNT(aUntilNext) { - ability = NEW ATransformer(game, id, source, target, types, abilities,newpower,newpowerfound,newtoughness,newtoughnessfound,newAbilitiesList,newAbilityFound,aForever); + ability = NEW ATransformer(game, id, source, target, types, abilities,newpower,newpowerfound,newtoughness,newtoughnessfound,newAbilitiesList,newAbilityFound,aForever,aUntilNext); aType = MTGAbility::STANDARD_BECOMES; } diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index de50d81ad..e744d30fc 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -2036,6 +2036,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG } bool oneShot = false; bool forceForever = false; + bool untilYourNextTurn = false; found = s.find("ueot"); if (found != string::npos) forceUEOT = true; @@ -2045,6 +2046,9 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG found = s.find("forever"); if (found != string::npos) forceForever = true; + found = s.find("uynt"); + if (found != string::npos) + untilYourNextTurn = true; //Prevent Damage const string preventDamageKeywords[] = { "preventallcombatdamage", "preventallnoncombatdamage", "preventalldamage", "fog" }; const int preventDamageTypes[] = {0, 2, 1, 0}; //TODO enum ? @@ -2438,9 +2442,9 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG } } if (oneShot || forceUEOT || forceForever) - return NEW ATransformerInstant(observer, id, card, target, stypes, sabilities,newPower,ptFound,newToughness,ptFound,vector(),false,forceForever); + return NEW ATransformerInstant(observer, id, card, target, stypes, sabilities,newPower,ptFound,newToughness,ptFound,vector(),false,forceForever,untilYourNextTurn); - return NEW ATransformer(observer, id, card, target, stypes, sabilities,newPower,ptFound,newToughness,ptFound,vector(),false,forceForever); + return NEW ATransformer(observer, id, card, target, stypes, sabilities,newPower,ptFound,newToughness,ptFound,vector(),false,forceForever,untilYourNextTurn); } //bloodthirst @@ -2529,9 +2533,9 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG } if (oneShot || forceUEOT || forceForever) - return NEW ATransformerInstant(observer, id, card, target, stypes, sabilities,newpower,newpowerfound,newtoughness,newtoughnessfound,newAbilitiesList,newAbilityFound,forceForever); + return NEW ATransformerInstant(observer, id, card, target, stypes, sabilities,newpower,newpowerfound,newtoughness,newtoughnessfound,newAbilitiesList,newAbilityFound,forceForever,untilYourNextTurn); - return NEW ATransformer(observer, id, card, target, stypes, sabilities,newpower,newpowerfound,newtoughness,newtoughnessfound,newAbilitiesList,newAbilityFound); + return NEW ATransformer(observer, id, card, target, stypes, sabilities,newpower,newpowerfound,newtoughness,newtoughnessfound,newAbilitiesList,newAbilityFound,forceForever,untilYourNextTurn); }