diff --git a/projects/mtg/bin/Res/test/_tests.txt b/projects/mtg/bin/Res/test/_tests.txt index 6e54e9825..37f3ce4c7 100644 --- a/projects/mtg/bin/Res/test/_tests.txt +++ b/projects/mtg/bin/Res/test/_tests.txt @@ -61,7 +61,8 @@ drift_of_the_dead.txt elvish_piper.txt fastbond.txt flare.txt -#fledgling_imp.txt TODO Understand why this one fails +fledgling_imp.txt +fledgling_imp2.txt foratog.txt force_of_nature.txt force_of_nature2.txt diff --git a/projects/mtg/bin/Res/test/fledgling_imp.txt b/projects/mtg/bin/Res/test/fledgling_imp.txt index 5e076c594..61c8555f3 100644 --- a/projects/mtg/bin/Res/test/fledgling_imp.txt +++ b/projects/mtg/bin/Res/test/fledgling_imp.txt @@ -1,30 +1,20 @@ #Bug: fledgling imp ability doesn't work # text={B}, Discard a card from your hand: Fledgling Imp gains flying until end of turn. [INIT] -COMBATATTACKERS +FIRSTMAIN [PLAYER1] -inplay:air elemental -[PLAYER2] inplay:fledgling imp hand:grizzly bears manapool:{B} -[DO] -air elemental -next -#blockers -fledgling imp -choice 1 -grizzly bears -fledgling imp -next -#combat damage -next -#combat end -[ASSERT] -COMBATEND -[PLAYER1] -inplay:air elemental [PLAYER2] -graveyard:grizzly bears,fledgling imp +[DO] +fledgling imp +grizzly bears +[ASSERT] +FIRSTMAIN +[PLAYER1] +inplay:fledgling imp +graveyard:grizzly bears manapool:{0} +[PLAYER2] [END] \ No newline at end of file diff --git a/projects/mtg/bin/Res/test/fledgling_imp2.txt b/projects/mtg/bin/Res/test/fledgling_imp2.txt new file mode 100644 index 000000000..5e076c594 --- /dev/null +++ b/projects/mtg/bin/Res/test/fledgling_imp2.txt @@ -0,0 +1,30 @@ +#Bug: fledgling imp ability doesn't work +# text={B}, Discard a card from your hand: Fledgling Imp gains flying until end of turn. +[INIT] +COMBATATTACKERS +[PLAYER1] +inplay:air elemental +[PLAYER2] +inplay:fledgling imp +hand:grizzly bears +manapool:{B} +[DO] +air elemental +next +#blockers +fledgling imp +choice 1 +grizzly bears +fledgling imp +next +#combat damage +next +#combat end +[ASSERT] +COMBATEND +[PLAYER1] +inplay:air elemental +[PLAYER2] +graveyard:grizzly bears,fledgling imp +manapool:{0} +[END] \ No newline at end of file diff --git a/projects/mtg/include/ManaCost.h b/projects/mtg/include/ManaCost.h index c4f823cba..8fefd846d 100644 --- a/projects/mtg/include/ManaCost.h +++ b/projects/mtg/include/ManaCost.h @@ -20,7 +20,7 @@ class ManaCost{ public: ExtraCosts * extraCosts; - static ManaCost * parseManaCost(string value, ManaCost * _manacost = NULL); + static ManaCost * parseManaCost(string value, ManaCost * _manacost = NULL, MTGCardInstance * c = NULL); void init(); void x(); ManaCost(int _cost[], int nb_elems = 1); diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 7db4d4ffe..0d388a8c8 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -195,7 +195,7 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){ unsigned int delimiter = line.find("}:"); ManaCost * cost = NULL; if (delimiter!= string::npos){ - cost = ManaCost::parseManaCost(line.substr(0,delimiter+1)); + cost = ManaCost::parseManaCost(line.substr(0,delimiter+1),NULL,card); } OutputDebugString("Parsing cost\n"); if (cost && cost->isNull()){ diff --git a/projects/mtg/src/ManaCost.cpp b/projects/mtg/src/ManaCost.cpp index 202c6b006..283ed1161 100644 --- a/projects/mtg/src/ManaCost.cpp +++ b/projects/mtg/src/ManaCost.cpp @@ -11,7 +11,7 @@ #include #endif -ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost){ +ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstance * c){ #if defined (WIN32) || defined (LINUX) char buf[4096]; #endif @@ -63,7 +63,7 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost){ size_t target_end = value.find(")"); if (target_start!=string::npos && target_end!=string::npos){ string target = value.substr(target_start+1, target_end-1 - target_start); - tc = tcf.createTargetChooser(target,NULL); + tc = tcf.createTargetChooser(target,c); } manaCost->addExtraCost(NEW SacrificeCost(tc)); }else{ diff --git a/projects/mtg/src/TestSuiteAI.cpp b/projects/mtg/src/TestSuiteAI.cpp index 73f250979..fe061a1fd 100644 --- a/projects/mtg/src/TestSuiteAI.cpp +++ b/projects/mtg/src/TestSuiteAI.cpp @@ -119,6 +119,8 @@ int TestSuiteAI::Act(float dt){ }else{ MTGCardInstance * card = suite->getCardByMTGId(mtgid); if (card) { + OutputDebugString("Clicking ON: "); + OutputDebugString(card->name.c_str()); g->cardClick(card,card); } }