From 27af442cb528eef54c7dd52f7ed1a02b9e8ec8ea Mon Sep 17 00:00:00 2001 From: "wagic.the.homebrew@gmail.com" Date: Mon, 10 Aug 2009 12:15:49 +0000 Subject: [PATCH] Erwan -a few card fixes --- projects/mtg/bin/Res/sets/MIR/_cards.dat | 2 +- projects/mtg/bin/Res/sets/RAV/_cards.dat | 12 ------------ projects/mtg/bin/Res/sets/RAV/todo.dat | 13 ++++++++++++- projects/mtg/bin/Res/sets/TSP/_cards.dat | 3 ++- projects/mtg/bin/Res/test/_tests.txt | 1 + projects/mtg/bin/Res/test/hellfire.txt | 19 +++++++++++++++++++ projects/mtg/include/AllAbilities.h | 5 +++++ projects/mtg/src/MTGAbility.cpp | 9 ++++++++- 8 files changed, 48 insertions(+), 16 deletions(-) create mode 100644 projects/mtg/bin/Res/test/hellfire.txt diff --git a/projects/mtg/bin/Res/sets/MIR/_cards.dat b/projects/mtg/bin/Res/sets/MIR/_cards.dat index ce855cfac..caab36ac4 100644 --- a/projects/mtg/bin/Res/sets/MIR/_cards.dat +++ b/projects/mtg/bin/Res/sets/MIR/_cards.dat @@ -850,7 +850,7 @@ rarity=U [card] text=Spitting Earth deals damage equal to the number of Mountains you control to target creature. id=3464 -alias=136509 +auto=foreach(mountain|myBattlefield) damage:1 target=creature name=Spitting Earth rarity=C diff --git a/projects/mtg/bin/Res/sets/RAV/_cards.dat b/projects/mtg/bin/Res/sets/RAV/_cards.dat index 5aa11af74..c16d84a86 100644 --- a/projects/mtg/bin/Res/sets/RAV/_cards.dat +++ b/projects/mtg/bin/Res/sets/RAV/_cards.dat @@ -1069,18 +1069,6 @@ power=3 toughness=3 [/card] [card] -text=When Vedalken Dismisser comes into play, put target creature on top of its owner's library. -auto=moveTo(ownerLibrary) target(creature) -id=87898 -name=Vedalken Dismisser -rarity=C -type=Creature -mana={5}{U} -power=2 -subtype=Vedalken Wizard -toughness=2 -[/card] -[card] text={U}, {T}: Target player puts the top two cards of his or her library into his or her graveyard. id=89028 auto={U}{T}:deplete:2 target(player) diff --git a/projects/mtg/bin/Res/sets/RAV/todo.dat b/projects/mtg/bin/Res/sets/RAV/todo.dat index 02c9de345..6a230d15c 100644 --- a/projects/mtg/bin/Res/sets/RAV/todo.dat +++ b/projects/mtg/bin/Res/sets/RAV/todo.dat @@ -1838,7 +1838,18 @@ rarity=U type=Sorcery mana={4}{U}{B} [/card] - +[card] +text=When Vedalken Dismisser comes into play, put target creature on top of its owner's library. +auto=moveTo(ownerLibrary) target(creature) #Can't target anything when come into play unless it is a "may" ability +id=87898 +name=Vedalken Dismisser +rarity=C +type=Creature +mana={5}{U} +power=2 +subtype=Vedalken Wizard +toughness=2 +[/card] [card] text=Return target creature card from your graveyard to play. If {G} was spent to play Vigor Mortis, that creature comes into play with an additional +1/+1 counter on it. id=88986 diff --git a/projects/mtg/bin/Res/sets/TSP/_cards.dat b/projects/mtg/bin/Res/sets/TSP/_cards.dat index 09f280555..c46f44c52 100644 --- a/projects/mtg/bin/Res/sets/TSP/_cards.dat +++ b/projects/mtg/bin/Res/sets/TSP/_cards.dat @@ -694,8 +694,9 @@ name=Tendrils of Corruption mana={3}{B} type=Instant text=Tendrils of Corruption deals X damage to target creature and you gain X life, where X is the number of Swamps you control. +target=creature auto=foreach(swamp|myinplay) damage:1 target(creature) -auto=foreach(swamp|myinplay) life:1 +auto=foreach(swamp|myinplay) life:1 controller rarity=C [/card] [card] diff --git a/projects/mtg/bin/Res/test/_tests.txt b/projects/mtg/bin/Res/test/_tests.txt index 241618f06..2b65c06e6 100644 --- a/projects/mtg/bin/Res/test/_tests.txt +++ b/projects/mtg/bin/Res/test/_tests.txt @@ -103,6 +103,7 @@ goblin_king.txt gravedigger.txt #hammerfist_giant.txt hannas_custody.txt +hellfire.txt howl_of_the_night_pack.txt hymn_of_rebirth.txt icatian_priest.txt diff --git a/projects/mtg/bin/Res/test/hellfire.txt b/projects/mtg/bin/Res/test/hellfire.txt new file mode 100644 index 000000000..96c636199 --- /dev/null +++ b/projects/mtg/bin/Res/test/hellfire.txt @@ -0,0 +1,19 @@ +#Bug:hellfire doesn't destroy +[INIT] +FIRSTMAIN +[PLAYER1] +hand:hellfire +manapool:{2}{B}{B}{B} +[PLAYER2] +inplay:grizzly bears,dragon engine,scathe zombies +[DO] +hellfire +[ASSERT] +FIRSTMAIN +[PLAYER1] +life:15 +graveyard:hellfire +[PLAYER2] +inplay:scathe zombies +graveyard:grizzly bears,dragon engine +[END] \ No newline at end of file diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 8555ca6be..1722e8b37 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -218,6 +218,11 @@ public: } } + const char * getMenuText(){ + if (abilities.size()) return abilities[0]->getMenuText(); + return ""; + } + MultiAbility * clone() const{ MultiAbility * a = NEW MultiAbility(*this); a->isClone = 1; diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 79f516ce5..852ae52a4 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -133,7 +133,14 @@ TriggeredAbility * AbilityFactory::parseTrigger(string magicText, int id, Spell // Returns NULL if parsing failed MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTGCardInstance *card, int activated){ size_t found; - + + string whitespaces (" \t\f\v\n\r"); + + found=s.find_last_not_of(whitespaces); + if (found!=string::npos) + s.erase(found+1); + else return NULL; + //TODO This block redundant with calling function if (!card && spell) card = spell->source; if (!card) return NULL;