diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index 898605725..e39702b49 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -20600,7 +20600,7 @@ toughness=1 [card] name=Crypt Ghast auto=@movedto(*|mystack):pay({WB}) life:-1 opponent && life:1 controller -auto=@tappedformana(swamp|mybattlefield):Add{B} +auto=lord(swamp|mybattlefield) transforms((,newability[produceextra:{B}])) text=Extort (Whenever you cast a spell, you may pay {WB}. If you do, each opponent loses 1 life and you gain that much life.) -- Whenever you tap a Swamp for mana, add {B} to your mana pool (in addition to the mana the land produces). mana={3}{B} type=Creature @@ -37695,8 +37695,7 @@ toughness=3 [card] name=Gauntlet of Might auto=lord(creature[red]) 1/1 -auto=@tappedformana(mountain|mybattlefield):Add{R} controller -auto=@tappedformana(mountain|opponentbattlefield):Add{R} opponent +auto=lord(mountain|battlefield) transforms((,newability[produceextra:{R}])) text=Red creatures get +1/+1. -- Whenever a Mountain is tapped for mana, its controller adds {R} to his or her mana pool (in addition to the mana the land produces). mana={4} type=Artifact @@ -45724,7 +45723,7 @@ toughness=4 [/card] [card] name=High Tide -auto=all(island) transforms((,newability[@tappedformana(this):add{U}])) ueot +auto=all(island) transforms((,newability[produceextra:{U}])) ueot text=Until end of turn, whenever a player taps an Island for mana, that player adds {U} to his or her mana pool (in addition to the mana the land produces). mana={U} type=Instant @@ -67601,7 +67600,7 @@ toughness=2 [/card] [card] name=Nirkana Revenant -auto=@tappedformana(swamp|mybattlefield):Add{B} +auto=lord(swamp|mybattlefield) transforms((,newability[produceextra:{B}])) auto={B}:1/1 text=Whenever you tap a Swamp for mana, add {B} to your mana pool (in addition to the mana the land produces). -- {B}:Nirkana Revenant gets +1/+1 until end of turn. type=Creature @@ -70229,7 +70228,7 @@ subtype=Swamp Forest [card] name=Overgrowth target=land -auto=@tappedformana(mytgt):Add{G}{G} targetcontroller +auto=teach(land) transforms((,newability[produceextra:{G}{G}])) text=Enchant land (Target a land as you cast this. This card enters the battlefield attached to that land.) -- Whenever enchanted land is tapped for mana, its controller adds {G}{G} to his or her mana pool (in addition to the mana the land produces). mana={2}{G} type=Enchantment @@ -108293,8 +108292,7 @@ toughness=1 [/card] [card] name=Vernal Bloom -auto=@tappedformana(forest|mybattlefield):Add{G} controller -auto=@tappedformana(forest|opponentbattlefield):Add{G} opponent +auto=lord(forest|battlefield) transforms((,newability[produceextra:{G}])) text=Whenever a Forest is tapped for mana, its controller adds {G} to his or her mana pool (in addition to the mana the land produces). mana={3}{G} type=Enchantment @@ -113018,7 +113016,7 @@ toughness=2 [card] name=Wild Growth target=land -auto=@tappedformana(mytgt):add{g} targetcontroller +auto=teach(land) transforms((,newability[produceextra:{G}])) text=Enchant land -- Whenever enchanted land is tapped for mana, its controller adds {G} to his or her mana pool (in addition to the mana the land produces). mana={G} type=Enchantment diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index e553a284b..eadb8ee5c 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -654,11 +654,11 @@ private: } else if (s == "p" || s == "power") { - intValue = target->getPower(); + intValue = target->getCurrentPower(); } else if (s == "t" || s == "toughness") { - intValue = target->getToughness(); + intValue = target->getCurrentToughness(); } else if (s == "kicked") { @@ -5966,6 +5966,37 @@ public: } }; +//ProduceExtra Mana when tapped for mana +class AProduceExtraAbility: public MTGAbility +{ +public: + string ManaDescription; + + AProduceExtraAbility(GameObserver* observer, int _id, MTGCardInstance * _source, string _ManaDescription) : + MTGAbility(observer, _id, _source) + { + ManaDescription = _ManaDescription; + } + int receiveEvent(WEvent * event) + { + if(WEventCardTappedForMana * isTappedForMana = dynamic_cast (event)) + { + if ((isTappedForMana->card == source) && (isTappedForMana->card->controller() == source->controller())) + { + AManaProducer *amp = NEW AManaProducer(game, game->mLayers->actionLayer()->getMaxId(), source, source->controller(), ManaCost::parseManaCost(ManaDescription,NULL,source), NULL, 0,"",false); + amp->resolve(); + SAFE_DELETE(amp); + } + } + return 1; + } + + AProduceExtraAbility * clone() const + { + return NEW AProduceExtraAbility(*this); + } +}; + //flanking ability class AFlankerAbility: public MTGAbility { diff --git a/projects/mtg/include/CardPrimitive.h b/projects/mtg/include/CardPrimitive.h index 057698922..8f6041baf 100644 --- a/projects/mtg/include/CardPrimitive.h +++ b/projects/mtg/include/CardPrimitive.h @@ -59,6 +59,7 @@ public: typedef std::bitset BasicAbilitiesSet; BasicAbilitiesSet basicAbilities; BasicAbilitiesSet origbasicAbilities; + BasicAbilitiesSet LKIbasicAbilities; map magicTexts; string magicText; diff --git a/projects/mtg/include/MTGCardInstance.h b/projects/mtg/include/MTGCardInstance.h index 635eaab23..fe5d78c5d 100644 --- a/projects/mtg/include/MTGCardInstance.h +++ b/projects/mtg/include/MTGCardInstance.h @@ -233,6 +233,10 @@ public: void addbaseT(int t = 0); void revertbaseP(); void revertbaseT(); + int getCurrentPower(); + int LKIpower; + int LKItoughness; + int getCurrentToughness(); void cdaPT(int p = 0, int t = 0); bool isCDA; void switchPT(bool apply = false); diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 4eaff7a7f..901b631cb 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -2081,16 +2081,16 @@ int AADynamic::resolve() switch(type) { case DYNAMIC_ABILITY_TYPE_POWER: - sourceamount = ((MTGCardInstance *) source)->power; - targetamount = ((MTGCardInstance *) _target)->power; + sourceamount = ((MTGCardInstance *) source)->getCurrentPower(); + targetamount = ((MTGCardInstance *) _target)->getCurrentPower(); if(eachother ) - sourceamount = ((MTGCardInstance *) source)->power; + sourceamount = ((MTGCardInstance *) source)->getCurrentPower(); break; case DYNAMIC_ABILITY_TYPE_TOUGHNESS: - sourceamount = ((MTGCardInstance *) source)->toughness; - targetamount = ((MTGCardInstance *) _target)->toughness; + sourceamount = ((MTGCardInstance *) source)->getCurrentToughness(); + targetamount = ((MTGCardInstance *) _target)->getCurrentToughness(); if(eachother ) - sourceamount = ((MTGCardInstance *) source)->toughness; + sourceamount = ((MTGCardInstance *) source)->getCurrentToughness(); break; case DYNAMIC_ABILITY_TYPE_MANACOST: if(amountsource == 1) diff --git a/projects/mtg/src/CardPrimitive.cpp b/projects/mtg/src/CardPrimitive.cpp index 566b1c03e..0ed61cd68 100644 --- a/projects/mtg/src/CardPrimitive.cpp +++ b/projects/mtg/src/CardPrimitive.cpp @@ -42,6 +42,7 @@ CardPrimitive::CardPrimitive(CardPrimitive * source) return; basicAbilities = source->basicAbilities; origbasicAbilities = source->basicAbilities; + LKIbasicAbilities = source->basicAbilities; for (size_t i = 0; i < source->types.size(); ++i) types.push_back(source->types[i]); diff --git a/projects/mtg/src/GameObserver.cpp b/projects/mtg/src/GameObserver.cpp index 342e2db97..ee226cdb8 100644 --- a/projects/mtg/src/GameObserver.cpp +++ b/projects/mtg/src/GameObserver.cpp @@ -608,6 +608,9 @@ void GameObserver::gameStateBasedEffects() for (int j = zone->nb_cards - 1; j >= 0; j--) { MTGCardInstance * card = zone->cards[j]; + card->LKIpower = card->power; + card->LKItoughness = card->toughness; + card->LKIbasicAbilities = card->basicAbilities; card->afterDamage(); card->mPropertiesChangedSinceLastUpdate = false; if(card->hasType(Subtypes::TYPE_PLANESWALKER) && (!card->counters||!card->counters->hasCounter("loyalty",0,0))) diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index eca1ae89a..f543c950b 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -2659,6 +2659,12 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG return NEW AEvolveAbility(observer, id, card); } + //produce additional mana when tapped for mana + if (s.find("produceextra:") != string::npos) + { + return NEW AProduceExtraAbility(observer, id, card,s.substr(13)); + } + //flanking if (s.find("flanker") != string::npos) { @@ -4259,7 +4265,7 @@ void AbilityFactory::addAbilities(int _id, Spell * spell) if (current->hasType(Subtypes::TYPE_CREATURE)) { card->controller()->game->putInGraveyard(current); - damage += current->power; + damage += current->getCurrentPower(); } } observer->mLayers->stackLayer()->addDamage(card, target, damage); diff --git a/projects/mtg/src/MTGCardInstance.cpp b/projects/mtg/src/MTGCardInstance.cpp index abe1ea1be..e4ff9beb1 100644 --- a/projects/mtg/src/MTGCardInstance.cpp +++ b/projects/mtg/src/MTGCardInstance.cpp @@ -61,6 +61,8 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * arg_belongs_to discarded = false; copiedID = getId(); modifiedbAbi = 0; + LKIpower = power; + LKItoughness = toughness; } MTGCardInstance * MTGCardInstance::createSnapShot() @@ -723,6 +725,20 @@ void MTGCardInstance::switchPT(bool apply) } } +int MTGCardInstance::getCurrentPower() +{ + if(!isInPlay(observer)) + return LKIpower; + return power; +} + +int MTGCardInstance::getCurrentToughness() +{ + if(!isInPlay(observer)) + return LKItoughness; + return toughness; +} + int MTGCardInstance::canBlock() { if (tapped) diff --git a/projects/mtg/src/MTGRules.cpp b/projects/mtg/src/MTGRules.cpp index b58090b21..a935992db 100644 --- a/projects/mtg/src/MTGRules.cpp +++ b/projects/mtg/src/MTGRules.cpp @@ -2707,7 +2707,7 @@ int MTGLifelinkRule::receiveEvent(WEvent * event) WEventDamage * e = (WEventDamage *) event; Damage * d = e->damage; MTGCardInstance * card = d->source; - if (d->damage > 0 && card && card->basicAbilities[(int)Constants::LIFELINK]) + if (d->damage > 0 && card && (card->basicAbilities[(int)Constants::LIFELINK]||card->LKIbasicAbilities[(int)Constants::LIFELINK])) { card->controller()->gainLife(d->damage); return 1; @@ -2751,7 +2751,7 @@ int MTGDeathtouchRule::receiveEvent(WEvent * event) return 0; MTGCardInstance * _target = (MTGCardInstance *) (d->target); - if (card->basicAbilities[(int)Constants::DEATHTOUCH]) + if (card->basicAbilities[(int)Constants::DEATHTOUCH]||card->LKIbasicAbilities[(int)Constants::DEATHTOUCH]) { _target->destroy(); return 1;