diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index 4f595bec7..82dc987c7 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -104963,15 +104963,6 @@ mana={5} type=Artifact [/card] [card] -name=Trinisphere -auto=this(untapped) lord(*[manacost=0]|hand) altercost(colorless, +3) -auto=this(untapped) lord(*[manacost=1]|hand) altercost(colorless, +2) -auto=this(untapped) lord(*[manacost=2]|hand) altercost(colorless, +1) -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. @@ -111696,7 +111687,7 @@ toughness=2 [card] name=Warden of Evos Isle abilities=flying -auto=lord(creature[flying]|myhand) altercost(colorless, -1) +auto=lord(creature[flying]|myhand,mylibrary,mygraveyard,myexile) altercost(colorless, -1) text=Flying. -- Creature spells with flying you cast cost 1 less to cast. mana={2}{U} type=Creature diff --git a/projects/mtg/bin/Res/sets/primitives/unsupported.txt b/projects/mtg/bin/Res/sets/primitives/unsupported.txt index 98c44b964..1432ba3ff 100644 --- a/projects/mtg/bin/Res/sets/primitives/unsupported.txt +++ b/projects/mtg/bin/Res/sets/primitives/unsupported.txt @@ -17156,6 +17156,15 @@ mana={U} type=Instant [/card] [card] +name=Trinisphere +auto=this(untapped) lord(*[manacost=0]|hand) altercost(colorless, +3) +auto=this(untapped) lord(*[manacost=1]|hand) altercost(colorless, +2) +auto=this(untapped) lord(*[manacost=2]|hand) altercost(colorless, +1) +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=Trumpeting Armodon text={1}{G}: Target creature blocks Trumpeting Armodon this turn if able. mana={3}{G} diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 2f6d40e6c..88b6a4d78 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -195,10 +195,11 @@ private: } else if (s == "manacost") { + int convertedvalue = card->currentZone == card->controller()->game->battlefield ? card->getManaCost()->getConvertedCost():card->model->data->getManaCost()->getConvertedCost(); if (target->currentZone == target->controller()->game->stack)//X is 0 except if it's on the stack intValue = target->getManaCost()->getConvertedCost() + target->castX; else - intValue = target->getManaCost()->getConvertedCost(); + intValue = convertedvalue; } else if (s == "azorius")//devotion blue white { @@ -6360,13 +6361,13 @@ class GenericPaidAbility: public ActivatedAbility public: MTGAbility * baseAbility; ManaCost * optionalCost; - + bool asAlternate; string newName; string restrictions; string baseCost; string baseAbilityStr; - GenericPaidAbility(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target,string _newName,string _castRestriction,string _mayCost, string toAdd, ManaCost * cost = NULL); + GenericPaidAbility(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target,string _newName,string _castRestriction,string _mayCost, string toAdd, bool asAlternate = false, ManaCost * cost = NULL); int resolve(); const string getMenuText(); GenericPaidAbility * clone() const; diff --git a/projects/mtg/include/MTGCardInstance.h b/projects/mtg/include/MTGCardInstance.h index 5146b4940..6600e7a1e 100644 --- a/projects/mtg/include/MTGCardInstance.h +++ b/projects/mtg/include/MTGCardInstance.h @@ -253,6 +253,8 @@ public: int cardistargetted; bool isTargetter(); int cardistargetter; + int tmodifier; + int tmodifierb; void eventattacked(); void eventattackedAlone(); diff --git a/projects/mtg/include/MTGDefinitions.h b/projects/mtg/include/MTGDefinitions.h index b321943e7..cc45e19b2 100644 --- a/projects/mtg/include/MTGDefinitions.h +++ b/projects/mtg/include/MTGDefinitions.h @@ -235,7 +235,8 @@ class Constants MYGCREATUREEXILER = 117, OPPGCREATUREEXILER = 118, PAYZERO = 119, - NB_BASIC_ABILITIES = 120, + TRINISPHERE = 120, + NB_BASIC_ABILITIES = 121, RARITY_S = 'S', //Special Rarity diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 7fe81b1c3..ccf0e714d 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -1146,9 +1146,9 @@ AASetCoin::~AASetCoin() //paying for an ability as an effect but as a cost GenericPaidAbility::GenericPaidAbility(GameObserver* observer, int id, MTGCardInstance * source, - Targetable * target, string _newName, string _castRestriction, string mayCost, string _toAdd, ManaCost * cost) : + Targetable * target, string _newName, string _castRestriction, string mayCost, string _toAdd, bool asAlternate, ManaCost * cost) : ActivatedAbility(observer, id, source, cost, 0), - newName(_newName), restrictions(_castRestriction), baseCost(mayCost), baseAbilityStr(_toAdd) + newName(_newName), restrictions(_castRestriction), baseCost(mayCost), baseAbilityStr(_toAdd), asAlternate(asAlternate) { this->GetId(); baseAbility = NULL; @@ -1172,6 +1172,8 @@ int GenericPaidAbility::resolve() AbilityFactory Af(game); vector baseAbilityStrSplit = split(baseAbilityStr,'?'); vector selection; + MTGAbility * nomenuAbility = NULL; + bool nomenu = false; if (baseAbilityStrSplit.size() > 1) { baseAbility = Af.parseMagicLine(baseAbilityStrSplit[0], this->GetId(), NULL, source); @@ -1200,10 +1202,12 @@ int GenericPaidAbility::resolve() } else { + nomenu = true; baseAbility = Af.parseMagicLine(baseAbilityStrSplit[0], this->GetId(), NULL, source); baseAbility->target = target; optionalCost = ManaCost::parseManaCost(baseCost, NULL, source); MTGAbility * set = baseAbility->clone(); + nomenuAbility = baseAbility->clone(); set->oneShot = true; selection.push_back(set); } @@ -1211,10 +1215,37 @@ int GenericPaidAbility::resolve() if (selection.size()) { bool must = baseAbilityStrSplit.size() > 1 ? true : false; - MenuAbility * a1 = NEW MenuAbility(game, this->GetId(), target, source, must, selection, NULL, newName); - a1->optionalCosts.push_back(NEW ManaCost(optionalCost)); - game->mLayers->actionLayer()->currentActionCard = (MTGCardInstance *)target; - a1->resolve(); + //todo get increased - reduced cost if asAlternate cost to cast using castcard + if(asAlternate) + { + must = true; + //cost increase - reduce + trinisphere effect ability todo... + if(((MTGCardInstance *)target)->getIncreasedManaCost()->getConvertedCost()) + optionalCost->add(((MTGCardInstance *)target)->getIncreasedManaCost()); + if(((MTGCardInstance *)target)->getReducedManaCost()->getConvertedCost()) + optionalCost->remove(((MTGCardInstance *)target)->getReducedManaCost()); + //trinisphere effect must be hardcoded...here.. + /*if(((MTGCardInstance *)target)->has(Constants::TRINISPHERE)) + { + if(optionalCost->getConvertedCost() == 2) + optionalCost->add(Constants::MTG_COLOR_ARTIFACT, 1); + else if(optionalCost->getConvertedCost() == 1) + optionalCost->add(Constants::MTG_COLOR_ARTIFACT, 2); + else if(optionalCost->getConvertedCost() < 1) + optionalCost->add(Constants::MTG_COLOR_ARTIFACT, 3); + }*/ + } + if(nomenu && optionalCost->getConvertedCost() < 1) + { + nomenuAbility->resolve(); + } + else + { + MenuAbility * a1 = NEW MenuAbility(game, this->GetId(), target, source, must, selection, NULL, newName); + a1->optionalCosts.push_back(NEW ManaCost(optionalCost)); + game->mLayers->actionLayer()->currentActionCard = (MTGCardInstance *)target; + a1->resolve(); + } } return 1; } diff --git a/projects/mtg/src/CardDescriptor.cpp b/projects/mtg/src/CardDescriptor.cpp index c6ae1e7a7..a3bc1c773 100644 --- a/projects/mtg/src/CardDescriptor.cpp +++ b/projects/mtg/src/CardDescriptor.cpp @@ -125,11 +125,12 @@ MTGCardInstance * CardDescriptor::match_or(MTGCardInstance * card) } // Quantified restrictions are always AND-ed: + int convertedvalue = card->currentZone == card->controller()->game->battlefield ? card->getManaCost()->getConvertedCost():card->model->data->getManaCost()->getConvertedCost(); if (powerComparisonMode && !valueInRange(powerComparisonMode, card->getPower(), power)) return NULL; if (toughnessComparisonMode && !valueInRange(toughnessComparisonMode, card->getToughness(), toughness)) return NULL; - if (manacostComparisonMode && !valueInRange(manacostComparisonMode, card->getManaCost()->getConvertedCost(), convertedManacost)) + if (manacostComparisonMode && !valueInRange(manacostComparisonMode, convertedvalue, convertedManacost)) return NULL; if (nameComparisonMode && compareName != card->name) return NULL; @@ -165,12 +166,12 @@ MTGCardInstance * CardDescriptor::match_and(MTGCardInstance * card) if ((mColorExclusions & card->colors) != 0) match = NULL; } - + int convertedvalue = card->currentZone == card->controller()->game->battlefield ? card->getManaCost()->getConvertedCost():card->model->data->getManaCost()->getConvertedCost(); if (powerComparisonMode && !valueInRange(powerComparisonMode, card->getPower(), power)) match = NULL; if (toughnessComparisonMode && !valueInRange(toughnessComparisonMode, card->getToughness(), toughness)) match = NULL; - if (manacostComparisonMode && !valueInRange(manacostComparisonMode, card->getManaCost()->getConvertedCost(), convertedManacost)) + if (manacostComparisonMode && !valueInRange(manacostComparisonMode, convertedvalue, convertedManacost)) match = NULL; if(nameComparisonMode && compareName != card->name) match = NULL; diff --git a/projects/mtg/src/GameObserver.cpp b/projects/mtg/src/GameObserver.cpp index 933ec20cf..01a1fc1ab 100644 --- a/projects/mtg/src/GameObserver.cpp +++ b/projects/mtg/src/GameObserver.cpp @@ -604,8 +604,8 @@ void GameObserver::gameStateBasedEffects() { for (int c = zone->nb_cards - 1; c >= 0; c--) { - zone->cards[c]->cardistargetted = 0; - zone->cards[c]->cardistargetter = 0; + zone->cards[c]->cardistargetted = 0; + zone->cards[c]->cardistargetter = 0; } } }//check for losers if its GAMEOVER clear the stack to allow gamestateeffects to continue @@ -878,8 +878,90 @@ void GameObserver::gameStateBasedEffects() enchantmentStatus(); ///////////////////////////// // Check affinity on a card// + // plus modify costs // ///////////////////////////// Affinity(); + //trinisphere? + /*for (int td = 0; td < 2; td++) + { + MTGGameZone * dzones[] = { players[td]->game->graveyard, players[td]->game->hand, players[td]->game->library, players[td]->game->exile }; + for (int tk = 0; tk < 4; tk++) + { + MTGGameZone * zone = dzones[tk]; + for (int ct = zone->nb_cards - 1; ct >= 0; ct--) + { + if(zone->cards[ct]->has(Constants::TRINISPHERE)) + { + if(zone->cards[ct]->getManaCost()->getConvertedCost() == 2) + { + zone->cards[ct]->getManaCost()->add(Constants::MTG_COLOR_ARTIFACT, 1); + zone->cards[ct]->tmodifier = 1; + } + else if(zone->cards[ct]->getManaCost()->getConvertedCost() == 1) + { + zone->cards[ct]->getManaCost()->add(Constants::MTG_COLOR_ARTIFACT, 2); + zone->cards[ct]->tmodifier = 2; + } + else if(zone->cards[ct]->getManaCost()->getConvertedCost() < 1) + { + zone->cards[ct]->getManaCost()->add(Constants::MTG_COLOR_ARTIFACT, 3); + zone->cards[ct]->tmodifier = 3; + } + //alternate + if(zone->cards[ct]->getManaCost()->getAlternative() && zone->cards[ct]->getManaCost()->getAlternative()->getConvertedCost() == 2) + { + zone->cards[ct]->getManaCost()->getAlternative()->add(Constants::MTG_COLOR_ARTIFACT, 1); + zone->cards[ct]->tmodifierb = 1; + } + else if(zone->cards[ct]->getManaCost()->getAlternative() && zone->cards[ct]->getManaCost()->getAlternative()->getConvertedCost() == 1) + { + zone->cards[ct]->getManaCost()->getAlternative()->add(Constants::MTG_COLOR_ARTIFACT, 2); + zone->cards[ct]->tmodifierb = 2; + } + else if(zone->cards[ct]->getManaCost()->getAlternative() && zone->cards[ct]->getManaCost()->getAlternative()->getConvertedCost() < 1) + { + zone->cards[ct]->getManaCost()->getAlternative()->add(Constants::MTG_COLOR_ARTIFACT, 3); + zone->cards[ct]->tmodifierb = 3; + } + } + else + { + if(zone->cards[ct]->tmodifier == 1) + { + zone->cards[ct]->getManaCost()->remove(Constants::MTG_COLOR_ARTIFACT, 1); + zone->cards[ct]->tmodifier = 0; + } + else if(zone->cards[ct]->tmodifier == 2) + { + zone->cards[ct]->getManaCost()->remove(Constants::MTG_COLOR_ARTIFACT, 2); + zone->cards[ct]->tmodifier = 0; + } + else if(zone->cards[ct]->tmodifier == 3) + { + zone->cards[ct]->getManaCost()->remove(Constants::MTG_COLOR_ARTIFACT, 3); + zone->cards[ct]->tmodifier = 0; + } + //alternate + if(zone->cards[ct]->tmodifierb == 1) + { + zone->cards[ct]->getManaCost()->getAlternative()->remove(Constants::MTG_COLOR_ARTIFACT, 1); + zone->cards[ct]->tmodifierb = 0; + } + else if(zone->cards[ct]->tmodifierb == 2) + { + zone->cards[ct]->getManaCost()->getAlternative()->remove(Constants::MTG_COLOR_ARTIFACT, 2); + zone->cards[ct]->tmodifierb = 0; + } + else if(zone->cards[ct]->tmodifierb == 3) + { + zone->cards[ct]->getManaCost()->getAlternative()->remove(Constants::MTG_COLOR_ARTIFACT, 3); + zone->cards[ct]->tmodifierb = 0; + } + } + } + } + }*/ + //end trinisphere ///////////////////////////////////// // Check colored statuses on cards // ///////////////////////////////////// @@ -954,46 +1036,140 @@ void GameObserver::enchantmentStatus() void GameObserver::Affinity() { - for (int i = 0; i < 2; i++) + for (int dd = 0; dd < 2; dd++) { - MTGGameZone * zone = players[i]->game->hand; - for (int k = zone->nb_cards - 1; k >= 0; k--) + MTGGameZone * dzones[] = { players[dd]->game->graveyard, players[dd]->game->hand, players[dd]->game->library, players[dd]->game->exile }; + for (int kk = 0; kk < 4; kk++) { - MTGCardInstance * card = zone->cards[k]; - if (!card) - continue; + MTGGameZone * zone = dzones[kk]; + for (int cc = zone->nb_cards - 1; cc >= 0; cc--) + {//start + MTGCardInstance * card = zone->cards[cc]; + if (!card) + continue; - int color = 0; - string type = ""; - //only do any of the following if a card with the stated ability is in your hand. - ManaCost * original = NEW ManaCost(); - original->copy(card->model->data->getManaCost()); - //have to run alter cost before affinity or the 2 cancel each other out. - if(card->getIncreasedManaCost()->getConvertedCost()||card->getReducedManaCost()->getConvertedCost()) - { - if(card->getIncreasedManaCost()->getConvertedCost()) - original->add(card->getIncreasedManaCost()); - if(card->getReducedManaCost()->getConvertedCost()) - original->remove(card->getReducedManaCost()); - card->getManaCost()->copy(original); - if(card->getManaCost()->extraCosts) + int color = 0; + string type = ""; + //only do any of the following if a card with the stated ability is in your hand. + ManaCost * original = NEW ManaCost(); + ManaCost * alternate = NEW ManaCost(); + original->copy(card->model->data->getManaCost()); + alternate->copy(card->model->data->getManaCost()->getAlternative()); + if (card->has(Constants::PAYZERO)) + original = ManaCost::parseManaCost("{0}",NULL,card);//can't figure out 2 or more alternative... + //have to run alter cost before affinity or the 2 cancel each other out. + if(card->getIncreasedManaCost()->getConvertedCost()||card->getReducedManaCost()->getConvertedCost()) { - for(unsigned int i = 0; i < card->getManaCost()->extraCosts->costs.size();i++) + if(card->getIncreasedManaCost()->getConvertedCost()) { - card->getManaCost()->extraCosts->costs[i]->setSource(card); + original->add(card->getIncreasedManaCost()); + for(int kc = Constants::MTG_COLOR_ARTIFACT; kc < Constants::NB_Colors;kc++) + { + if (card->getManaCost()->getAlternative()) + { + alternate->add(kc,card->getIncreasedManaCost()->getCost(kc)); + } + } + } + if(card->getReducedManaCost()->getConvertedCost()) + { + original->remove(card->getReducedManaCost()); + for(int kc = Constants::MTG_COLOR_ARTIFACT; kc < Constants::NB_Colors;kc++) + { + if (card->getManaCost()->getAlternative()) + { + alternate->remove(kc,card->getReducedManaCost()->getCost(kc)); + } + } + } + card->getManaCost()->copy(original); + card->getManaCost()->setAlternative(alternate); + if(card->getManaCost()->extraCosts) + { + for(unsigned int i = 0; i < card->getManaCost()->extraCosts->costs.size();i++) + { + card->getManaCost()->extraCosts->costs[i]->setSource(card); + } } } - } - int reducem = 0; - bool resetCost = false; - for(unsigned int na = 0; na < card->cardsAbilities.size();na++) - { - ANewAffinity * newAff = dynamic_cast(card->cardsAbilities[na]); - if(newAff) + int reducem = 0; + bool resetCost = false; + for(unsigned int na = 0; na < card->cardsAbilities.size();na++) { - if(!resetCost) + ANewAffinity * newAff = dynamic_cast(card->cardsAbilities[na]); + if(newAff) { - resetCost = true; + if(!resetCost) + { + resetCost = true; + card->getManaCost()->copy(original); + if(card->getManaCost()->extraCosts) + { + for(unsigned int i = 0; i < card->getManaCost()->extraCosts->costs.size();i++) + { + card->getManaCost()->extraCosts->costs[i]->setSource(card); + } + } + } + TargetChooserFactory tf(this); + TargetChooser * tcn = tf.createTargetChooser(newAff->tcString,card,NULL); + + for (int w = 0; w < 2; ++w) + { + Player *p = this->players[w]; + MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library, p->game->stack, p->game->exile }; + for (int k = 0; k < 6; k++) + { + MTGGameZone * z = zones[k]; + if (tcn->targetsZone(z)) + { + reducem += z->countByCanTarget(tcn); + } + } + } + SAFE_DELETE(tcn); + ManaCost * removingCost = ManaCost::parseManaCost(newAff->manaString); + for(int j = 0; j < reducem; j++) + card->getManaCost()->remove(removingCost); + SAFE_DELETE(removingCost); + } + } + if(card->has(Constants::AFFINITYARTIFACTS)|| + card->has(Constants::AFFINITYFOREST)|| + card->has(Constants::AFFINITYGREENCREATURES)|| + card->has(Constants::AFFINITYISLAND)|| + card->has(Constants::AFFINITYMOUNTAIN)|| + card->has(Constants::AFFINITYPLAINS)|| + card->has(Constants::AFFINITYSWAMP)){ + if (card->has(Constants::AFFINITYARTIFACTS)) + { + type = "artifact"; + } + else if (card->has(Constants::AFFINITYSWAMP)) + { + type = "swamp"; + } + else if (card->has(Constants::AFFINITYMOUNTAIN)) + { + type = "mountain"; + } + else if (card->has(Constants::AFFINITYPLAINS)) + { + type = "plains"; + } + else if (card->has(Constants::AFFINITYISLAND)) + { + type = "island"; + } + else if (card->has(Constants::AFFINITYFOREST)) + { + type = "forest"; + } + else if (card->has(Constants::AFFINITYGREENCREATURES)) + { + color = 1; + type = "creature"; + } card->getManaCost()->copy(original); if(card->getManaCost()->extraCosts) { @@ -1002,94 +1178,27 @@ void GameObserver::Affinity() card->getManaCost()->extraCosts->costs[i]->setSource(card); } } - } - TargetChooserFactory tf(this); - TargetChooser * tcn = tf.createTargetChooser(newAff->tcString,card,NULL); - - for (int w = 0; w < 2; ++w) - { - Player *p = this->players[w]; - MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library, p->game->stack, p->game->exile }; - for (int k = 0; k < 6; k++) + int reduce = 0; + if(card->has(Constants::AFFINITYGREENCREATURES)) { - MTGGameZone * z = zones[k]; - if (tcn->targetsZone(z)) - { - reducem += z->countByCanTarget(tcn); - } + TargetChooserFactory tf(this); + TargetChooser * tc = tf.createTargetChooser("creature[green]",NULL); + reduce = card->controller()->game->battlefield->countByCanTarget(tc); + SAFE_DELETE(tc); } - } - SAFE_DELETE(tcn); - ManaCost * removingCost = ManaCost::parseManaCost(newAff->manaString); - for(int j = 0; j < reducem; j++) - card->getManaCost()->remove(removingCost); - SAFE_DELETE(removingCost); + else + { + reduce = card->controller()->game->battlefield->countByType(type); + } + for(int i = 0; i < reduce;i++) + { + if(card->getManaCost()->getCost(color) > 0) + card->getManaCost()->remove(color,1); + } + } - } - if(card->has(Constants::AFFINITYARTIFACTS)|| - card->has(Constants::AFFINITYFOREST)|| - card->has(Constants::AFFINITYGREENCREATURES)|| - card->has(Constants::AFFINITYISLAND)|| - card->has(Constants::AFFINITYMOUNTAIN)|| - card->has(Constants::AFFINITYPLAINS)|| - card->has(Constants::AFFINITYSWAMP)){ - if (card->has(Constants::AFFINITYARTIFACTS)) - { - type = "artifact"; - } - else if (card->has(Constants::AFFINITYSWAMP)) - { - type = "swamp"; - } - else if (card->has(Constants::AFFINITYMOUNTAIN)) - { - type = "mountain"; - } - else if (card->has(Constants::AFFINITYPLAINS)) - { - type = "plains"; - } - else if (card->has(Constants::AFFINITYISLAND)) - { - type = "island"; - } - else if (card->has(Constants::AFFINITYFOREST)) - { - type = "forest"; - } - else if (card->has(Constants::AFFINITYGREENCREATURES)) - { - color = 1; - type = "creature"; - } - card->getManaCost()->copy(original); - if(card->getManaCost()->extraCosts) - { - for(unsigned int i = 0; i < card->getManaCost()->extraCosts->costs.size();i++) - { - card->getManaCost()->extraCosts->costs[i]->setSource(card); - } - } - int reduce = 0; - if(card->has(Constants::AFFINITYGREENCREATURES)) - { - TargetChooserFactory tf(this); - TargetChooser * tc = tf.createTargetChooser("creature[green]",NULL); - reduce = card->controller()->game->battlefield->countByCanTarget(tc); - SAFE_DELETE(tc); - } - else - { - reduce = card->controller()->game->battlefield->countByType(type); - } - for(int i = 0; i < reduce;i++) - { - if(card->getManaCost()->getCost(color) > 0) - card->getManaCost()->remove(color,1); - } - - } - SAFE_DELETE(original); + SAFE_DELETE(original); + }//end } } } diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index c08e6288c..870927178 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -1079,6 +1079,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG MTGGameZone * dest) { size_t found; + bool asAlternate = false; trim(s); //TODO This block redundant with calling function if (!card && spell) @@ -1088,7 +1089,9 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG MTGCardInstance * target = card->target; if (!target) target = card; - + //pay and castcard? + if(s.find("pay(") != string::npos || s.find("pay[[") != string::npos && s.find("castcard(restricted") != string::npos) + asAlternate = true; //MTG Specific rules //adds the bonus credit system found = s.find("bonusrule"); @@ -1586,7 +1589,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG vector splitMayPay = parseBetween(s, "pay(", ")", true); if(splitMayPay.size()) { - GenericPaidAbility * a = NEW GenericPaidAbility(observer, id, card, target,newName,castRestriction,splitMayPay[1],storedPayString); + GenericPaidAbility * a = NEW GenericPaidAbility(observer, id, card, target,newName,castRestriction,splitMayPay[1],storedPayString,asAlternate); a->oneShot = 1; a->canBeInterrupted = false; return a; @@ -2091,7 +2094,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG vector splitMayPaysub = parseBetween(s, "pay[[","]]", true); if (splitMayPaysub.size()) { - GenericPaidAbility * a = NEW GenericPaidAbility(observer, id, card, target,newName,castRestriction,splitMayPaysub[1],storedPayString); + GenericPaidAbility * a = NEW GenericPaidAbility(observer, id, card, target,newName,castRestriction,splitMayPaysub[1],storedPayString,asAlternate); a->oneShot = 1; a->canBeInterrupted = false; return a; diff --git a/projects/mtg/src/MTGCardInstance.cpp b/projects/mtg/src/MTGCardInstance.cpp index 140c4f5cf..287acfdb7 100644 --- a/projects/mtg/src/MTGCardInstance.cpp +++ b/projects/mtg/src/MTGCardInstance.cpp @@ -65,6 +65,8 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * arg_belongs_to LKItoughness = toughness; cardistargetted = 0; cardistargetter = 0; + tmodifier = 0; + tmodifierb = 0; } MTGCardInstance * MTGCardInstance::createSnapShot() diff --git a/projects/mtg/src/MTGDefinitions.cpp b/projects/mtg/src/MTGDefinitions.cpp index 91bbc8148..a2530cdb4 100644 --- a/projects/mtg/src/MTGDefinitions.cpp +++ b/projects/mtg/src/MTGDefinitions.cpp @@ -148,7 +148,8 @@ const char* Constants::MTGBasicAbilities[] = { "protectionfromcoloredspells", "mygcreatureexiler", "oppgcreatureexiler", - "payzero" + "payzero", + "trinisphere" }; map Constants::MTGBasicAbilitiesMap; diff --git a/projects/mtg/src/MTGRules.cpp b/projects/mtg/src/MTGRules.cpp index 396b46c70..458e63789 100644 --- a/projects/mtg/src/MTGRules.cpp +++ b/projects/mtg/src/MTGRules.cpp @@ -1139,8 +1139,6 @@ int MTGPlayFromGraveyardRule::isReactingToClick(MTGCardInstance * card, ManaCost { Player * player = game->currentlyActing(); ManaCost * cost = card->getManaCost(); - if (card->has(Constants::PAYZERO)) - cost = ManaCost::parseManaCost("{0}",NULL,NULL); if (!player->game->graveyard->hasCard(card)) return 0; @@ -1156,8 +1154,7 @@ int MTGPlayFromGraveyardRule::reactToClick(MTGCardInstance * card) return 0; ManaCost * cost = card->getManaCost(); - if (card->has(Constants::PAYZERO)) - cost = ManaCost::parseManaCost("{0}",NULL,NULL); + card->paymenttype = MTGAbility::PUT_INTO_PLAY; return MTGAlternativeCostRule::reactToClick(card, cost, ManaCost::MANA_PAID);