From 708af7b675e780899355fc8eaba644c0791903c9 Mon Sep 17 00:00:00 2001 From: "wagic.laurent" Date: Fri, 26 Jun 2009 01:03:56 +0000 Subject: [PATCH] Laurent - Added a generic ankh of mishra/dingus egg. Tested ok on ankh of mishra. Also added Soul Warden (10E) with this and Angelic Chorus (10E). Also could be made more generic and eventually at a certain point of time put in the parser.... Test suite passed with exception of Hymn of rebirth ?? also at least dingus egg is also OK. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ideally the whenever thing should be coupled with a kind of targetchooser thing to be put in the parser (would also allow colored cards...) .. Todo: add a may ability option since lot of cards with this function use "may" (e.g. Deathgreeter - ALA and Leonin Elder - MRD) I did not remove the now obsolete code dingus egg and ankh of mishra...will wait until new portion of code is tested more.. GrĂ¼ --- projects/mtg/bin/Res/sets/10E/_cards.dat | 21 ++++ projects/mtg/bin/Res/sets/10E/todo.dat | 31 ----- projects/mtg/include/AllAbilities.h | 138 +++++++++++++++++++++++ projects/mtg/src/MTGAbility.cpp | 28 +++-- 4 files changed, 180 insertions(+), 38 deletions(-) diff --git a/projects/mtg/bin/Res/sets/10E/_cards.dat b/projects/mtg/bin/Res/sets/10E/_cards.dat index bf10693c1..f98eaef97 100644 --- a/projects/mtg/bin/Res/sets/10E/_cards.dat +++ b/projects/mtg/bin/Res/sets/10E/_cards.dat @@ -124,6 +124,15 @@ subtype=Angel toughness=3 [/card] [card] +text=Whenever a creature comes into play under your control, you gain life equal to its toughness. +id=129710 +name=Angelic Chorus +rarity=R +color=White +type=Enchantment +mana={3}{W}{W} +[/card] +[card] text={T}: Add {1} to your mana pool. {T}: Add {W} or {U} to your mana pool. Adarkar Wastes deals 1 damage to you. auto={T}:Add {1} auto={T}:Add {W} && Damage 1 controller @@ -2428,6 +2437,18 @@ subtype=Drake toughness=2 [/card] [card] +text=Whenever another creature comes into play, you gain 1 life. +id=129740 +name=Soul Warden +rarity=U +color=White +type=Creature +mana={W} +power=1 +subtype=Human Cleric +toughness=1 +[/card] +[card] text=As an additional cost to play Soulblast, sacrifice all creatures you control. Soulblast deals damage to target creature or player equal to the total power of the sacrificed creatures. id=130369 target=creature,player diff --git a/projects/mtg/bin/Res/sets/10E/todo.dat b/projects/mtg/bin/Res/sets/10E/todo.dat index e2922ee98..476619d9b 100644 --- a/projects/mtg/bin/Res/sets/10E/todo.dat +++ b/projects/mtg/bin/Res/sets/10E/todo.dat @@ -29,15 +29,6 @@ type=Sorcery mana={2}{B}{B} [/card] [card] -text=Whenever a creature comes into play under your control, you gain life equal to its toughness. -id=129710 -name=Angelic Chorus -rarity=R -color=White -type=Enchantment -mana={3}{W}{W} -[/card] -[card] text=Enchant creature (Target a creature as you play this. This card comes into play attached to that creature.) Enchanted creature gets +2/+2 and has "{T}: This creature deals 1 damage to target creature or player." id=130530 name=Arcane Teachings @@ -1014,28 +1005,6 @@ subtype=Minion toughness=3 [/card] [card] -text=Whenever another creature comes into play, you gain 1 life. -id=129740 -name=Soul Warden -rarity=U -color=White -type=Creature -mana={W} -power=1 -subtype=Human Cleric -toughness=1 -[/card] -[card] -text=As an additional cost to play Soulblast, sacrifice all creatures you control. Soulblast deals damage to target creature or player equal to the total power of the sacrificed creatures. -id=130369 -target=creature,player -name=Soulblast -rarity=R -color=Red -type=Instant -mana={3}{R}{R}{R} -[/card] -[card] text=Spawning Pool comes into play tapped. {T}: Add {B} to your mana pool. {1}{B}: Spawning Pool becomes a 1/1 black Skeleton creature with "{B}: Regenerate this creature" until end of turn. It's still a land. (If it regenerates, the next time it would be destroyed this turn, it isn't. Instead tap it, remove all damage from it, and remove it from combat.) id=106556 name=Spawning Pool diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 91390fab2..6a853806e 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -3673,6 +3673,144 @@ class AInstantControlSteal: public InstantAbility{ } }; +//Angelic Chorus (10E) +class AAngelicChorus: public ListMaintainerAbility{ + public: + int init; + AAngelicChorus(int id, MTGCardInstance * _source):ListMaintainerAbility(id, _source){ + init = 0; + } + + void Update(float dt){ + ListMaintainerAbility::Update(dt); + init = 1; + } + + int canBeInList(MTGCardInstance * card){ + if (card->hasType("creature") && game->isInPlay(card)) return 1; + return 0; + } + + int added(MTGCardInstance * card){ + if (!init) return 0; + if (source->controller() == game->currentlyActing()){ + card->controller()->life+= card->toughness; + } + return 1; + } + + int removed(MTGCardInstance * card){ + return 1; + } + + virtual ostream& toString(ostream& out) const + { + out << "AAngelicChorus ::: init : " << init + << " ("; + return ListMaintainerAbility::toString(out) << ")"; + } +}; + +//Life/Damage for type removed/added from game - Generic Ankh of Mishra/dingus Egg +class ALifeModifierPutinplay: public ListMaintainerAbility{ + public: + int init; + char type[20]; + int life; + int PlayerTarget; + int AddOrRemove; + ALifeModifierPutinplay(int id, MTGCardInstance * _source,const char * _type, int _life, int _PlayerTarget, int _AddOrRemove):ListMaintainerAbility(id, _source){ + sprintf(type,"%s",_type); + init = 0; + PlayerTarget = _PlayerTarget; + AddOrRemove = _AddOrRemove; + life = _life; + } + + void Update(float dt){ + ListMaintainerAbility::Update(dt); + init = 1; + } + + int canBeInList(MTGCardInstance * card){ + if (card->hasType(type) && game->isInPlay(card)) return 1; + return 0; + } + + int added(MTGCardInstance * card){ + if (!init) return 0; + if (AddOrRemove == 1){ + if (life < 0){ + int damage = life * -1; + if (PlayerTarget == 2){ + game->mLayers->stackLayer()->addDamage(source,card->controller(), damage); + } + if (PlayerTarget == 1){ + game->mLayers->stackLayer()->addDamage(source,source->controller(), damage); + } + if (PlayerTarget == 0){ + game->mLayers->stackLayer()->addDamage(source,source->controller()->opponent(), damage); + } + } + if (life > 0){ + if (PlayerTarget == 2){ + card->controller()->life+=life; + } + if (PlayerTarget == 1){ + source->controller()->life+=life; + } + if (PlayerTarget == 0){ + source->controller()->opponent()->life+=life; + } + } + } + return 1; + } + + int removed(MTGCardInstance * card){ + if (AddOrRemove == 0){ + if (life < 0){ + int damage = life * -1; + if (PlayerTarget == 2){ + game->mLayers->stackLayer()->addDamage(source,card->controller(), damage); + } + if (PlayerTarget == 1){ + game->mLayers->stackLayer()->addDamage(source,source->controller(), damage); + } + if (PlayerTarget == 0){ + game->mLayers->stackLayer()->addDamage(source,source->controller()->opponent(), damage); + } + } + if (life > 0){ + if (PlayerTarget == 2){ + card->controller()->life+=life; + } + if (PlayerTarget == 1){ + source->controller()->life+=life; + } + if (PlayerTarget == 0){ + source->controller()->opponent()->life+=life; + } + } + } + return 1; + } + + virtual ostream& toString(ostream& out) const + { + out << "ALifeModifierPutinplay ::: init : " << init + << " ; type : " << type + << " ; life : " << life + << " ; PlayerTarget : " << PlayerTarget + << " ; AddOrRemove : " << AddOrRemove + << " ("; + return ListMaintainerAbility::toString(out) << ")"; + } +}; + + + + /// Work in Progress also from no on all code could be removed... //Draft for counters diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 87bc3045c..de28da6d5 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -691,7 +691,7 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){ if (trigger){ DrawEvent * action = NEW DrawEvent(card->controller(),nbcards); game->addObserver(NEW GenericTriggeredAbility(id, card,trigger,action)); - }else{ + }else{ if (tc){ //TODO ? }else{ @@ -755,7 +755,7 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){ MTGCardInstance * current = game->players[i]->game->inPlay->cards[j]; if (tc->canTarget(current)){ MTGCardInstance * canBlock = tc->source; - current->canBlock(0); + current->canBlock(); } } } @@ -1068,9 +1068,10 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){ } case 1094: //Ank Of Mishra { - AAnkhOfMishra * ability = NEW AAnkhOfMishra(_id,card); - game->addObserver(ability); - break; + // AAnkhOfMishra * ability = NEW AAnkhOfMishra(_id,card); + // game->addObserver(ability); + game->addObserver (NEW ALifeModifierPutinplay(_id,card,"land",-2,2,1)); + break; } case 1095: //Armageddon clock { @@ -1193,8 +1194,10 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){ } case 1105: //dingus Egg { - ADingusEgg * ability = NEW ADingusEgg(_id,card); - game->addObserver(ability); +// ADingusEgg * ability = NEW ADingusEgg(_id,card); +// game->addObserver(ability); + game->addObserver (NEW ALifeModifierPutinplay(_id,card,"land",-2,2,0)); + break; } case 1106: //Disrupting Scepter @@ -1918,6 +1921,17 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){ //-- addon 10E--- + case 129740: // Soul Warden + { + game->addObserver ( NEW ALifeModifierPutinplay(_id,card,"creature",1,1,1)); + break; + } + + case 129710: //Angelic Chorus + { + game->addObserver( NEW AAngelicChorus(_id,card)); + break; + } case 129767: //Threaten {