From 52de1e7b020ea0eeb7084b67fdcc8b7beb5a6497 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Sun, 5 Jun 2016 12:39:11 +0800 Subject: [PATCH] Trinisphere TODO: Morph and Kicker... Morph can be done but how to implement the increased total cost with kicker? multi kicker? manual kicker??? Count the mana pool if you can pay the cost+kicker if less than 3 increase it??? --- projects/mtg/bin/Res/sets/primitives/mtg.txt | 7 +++++ projects/mtg/include/MTGCardInstance.h | 3 +- projects/mtg/src/GameObserver.cpp | 19 +++++++++++++ projects/mtg/src/MTGCardInstance.cpp | 30 +++++++++++++++----- 4 files changed, 51 insertions(+), 8 deletions(-) diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index 1129e3e3a..1064b35c8 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -105485,6 +105485,13 @@ mana={5} type=Artifact [/card] [card] +name=Trinisphere +auto=this(untapped) lord(*[-land]|hand,library,exile,graveyard) trinisphere forcedalive +text=As long as Trinisphere is untapped, each spell that would cost less than three mana to cast costs three mana to cast. (Additional mana in the cost may be paid with any color of mana or colorless mana. For example, a spell that would cost {1}{B} to cast costs {2}{B} to cast instead.) +mana={3} +type=Artifact +[/card] +[card] name=Trinket Mage auto=may moveTo(myhand) target(artifact[manacost<=1]|mylibrary) text=When Trinket Mage enters the battlefield, you may search your library for an artifact card with converted mana cost 1 or less, reveal that card, and put it into your hand. If you do, shuffle your library. diff --git a/projects/mtg/include/MTGCardInstance.h b/projects/mtg/include/MTGCardInstance.h index 52f61a807..bad9b8322 100644 --- a/projects/mtg/include/MTGCardInstance.h +++ b/projects/mtg/include/MTGCardInstance.h @@ -255,7 +255,8 @@ public: bool isTargetter(); int cardistargetter; int myconvertedcost; - ManaCost * computeNewCost(MTGCardInstance * card,ManaCost * oldCost, ManaCost * refCost,bool onlyTrinisphere = false); + ManaCost * computeNewCost(MTGCardInstance * card,ManaCost * oldCost, ManaCost * refCost,bool noTrinisphere = false); + int countTrini; void eventattacked(); void eventattackedAlone(); diff --git a/projects/mtg/src/GameObserver.cpp b/projects/mtg/src/GameObserver.cpp index e52576bd6..7a75cf6c0 100644 --- a/projects/mtg/src/GameObserver.cpp +++ b/projects/mtg/src/GameObserver.cpp @@ -1137,6 +1137,25 @@ void GameObserver::Affinity() card->getManaCost()->remove(color,1); } }//end3 + //trinisphere... now how to implement kicker recomputation + + if(card->has(Constants::TRINISPHERE)) + { + for(int jj = card->getManaCost()->getConvertedCost(); jj < 3; jj++) + { + card->getManaCost()->add(Constants::MTG_COLOR_ARTIFACT, 1); + card->countTrini++; + } + } + else + { + if(card->countTrini) + { + card->getManaCost()->remove(Constants::MTG_COLOR_ARTIFACT, card->countTrini); + card->countTrini=0; + } + } + SAFE_DELETE(original); }//end } diff --git a/projects/mtg/src/MTGCardInstance.cpp b/projects/mtg/src/MTGCardInstance.cpp index 956f60a35..a60fdd421 100644 --- a/projects/mtg/src/MTGCardInstance.cpp +++ b/projects/mtg/src/MTGCardInstance.cpp @@ -198,6 +198,7 @@ void MTGCardInstance::initMTGCI() storedSourceCard = NULL; myPair = NULL; miracle = false; + countTrini = 0; for (int i = 0; i < ManaCost::MANA_PAID_WITH_SUSPEND +1; i++) alternateCostPaid[i] = 0; @@ -922,12 +923,11 @@ JQuadPtr MTGCardInstance::getIcon() return WResourceManager::Instance()->RetrieveCard(this, CACHE_THUMB); } -ManaCost * MTGCardInstance::computeNewCost(MTGCardInstance * card,ManaCost * newCost, ManaCost * refCost, bool onlyTrinisphere) +ManaCost * MTGCardInstance::computeNewCost(MTGCardInstance * card,ManaCost * newCost, ManaCost * refCost, bool noTrinisphere) { if(!card) return NULL; - if(!onlyTrinisphere) - { + if(card->getIncreasedManaCost()->getConvertedCost()) newCost->add(card->getIncreasedManaCost()); if(card->getReducedManaCost()->getConvertedCost()) @@ -1013,11 +1013,27 @@ ManaCost * MTGCardInstance::computeNewCost(MTGCardInstance * card,ManaCost * new newCost->remove(color,1); }//end3 SAFE_DELETE(original); + + if(!noTrinisphere) + { + //trinisphere... now how to implement kicker recomputation + if(card->has(Constants::TRINISPHERE)) + { + for(int jj = newCost->getConvertedCost(); jj < 3; jj++) + { + newCost->add(Constants::MTG_COLOR_ARTIFACT, 1); + card->countTrini++; + } + } + else + { + if(card->countTrini) + { + newCost->remove(Constants::MTG_COLOR_ARTIFACT, card->countTrini); + card->countTrini=0; + } + } } - /*//trinisphere must be here below// - if(card->has(Constants::TRINISPHERE)) - for(int jj = newCost->getConvertedCost(); jj < 3; jj++) - newCost->add(Constants::MTG_COLOR_ARTIFACT, 1);*/ return newCost; }