diff --git a/projects/mtg/bin/Res/sets/SHM/_cards.dat b/projects/mtg/bin/Res/sets/SHM/_cards.dat index 9eb359356..2e09d77a6 100644 --- a/projects/mtg/bin/Res/sets/SHM/_cards.dat +++ b/projects/mtg/bin/Res/sets/SHM/_cards.dat @@ -767,7 +767,7 @@ text={T}: Add {1} to your mana pool. {GW}, {T}: Add {G}{G}, {G}{W}, or {W}{W auto={T}:Add{1} auto={GW}{T}:Add{G}{G} auto={GW}{T}:Add{G}{W} -auto={GW}{T}:Add{G}{W} +auto={GW}{T}:Add{W}{W} id=146747 name=Wooded Bastion rarity=R diff --git a/projects/mtg/bin/Res/sets/TMP/_cards.dat b/projects/mtg/bin/Res/sets/TMP/_cards.dat index e15138a0d..7aa87e405 100644 --- a/projects/mtg/bin/Res/sets/TMP/_cards.dat +++ b/projects/mtg/bin/Res/sets/TMP/_cards.dat @@ -28,7 +28,7 @@ type=Sorcery [/card] [card] text={T}: Add {2} to your mana pool. Ancient Tomb deals 2 damage to you. -auto={T}: Add {2} && Damage 1 controller +auto={T}: Add {2} && Damage 2 controller id=4636 name=Ancient Tomb rarity=U diff --git a/projects/mtg/bin/Res/test/_tests.txt b/projects/mtg/bin/Res/test/_tests.txt index 1c915dab0..8318e3fa6 100644 --- a/projects/mtg/bin/Res/test/_tests.txt +++ b/projects/mtg/bin/Res/test/_tests.txt @@ -6,6 +6,7 @@ generic/first_strike2.txt generic/first_strike3.txt generic/hybrid_mana.txt generic/hybrid_mana_2.txt +generic/hybrid_mana_3.txt generic/legendary.txt generic/persist.txt generic/wither.txt @@ -16,6 +17,7 @@ afflict.txt anarchy.txt animate_dead.txt animate_dead2.txt +ankh_of_mishra.txt ardakar_wastes.txt ascendant_evincar.txt ascendant_evincar2.txt @@ -32,7 +34,9 @@ counsel_of_the_soratami.txt counterspell.txt counterspell2.txt creature_bond.txt +dingus_egg.txt doomed_necromancer.txt +dragon_fodder.txt drain_life.txt flare.txt force_of_nature.txt @@ -45,6 +49,7 @@ goblin_balloon_brigade2.txt goblin_king.txt hymn_of_rebirth.txt keldon_warlord.txt +kird_ape.txt kudzu.txt kudzu2.txt lifeforce.txt diff --git a/projects/mtg/bin/Res/test/ankh_of_mishra.txt b/projects/mtg/bin/Res/test/ankh_of_mishra.txt new file mode 100644 index 000000000..0ae943f00 --- /dev/null +++ b/projects/mtg/bin/Res/test/ankh_of_mishra.txt @@ -0,0 +1,24 @@ +# bug : Ankh of Mishra : Doesnft deal damage if a land was destroyed then a new one is put into play +# Ankh of Mishra : (RV) 1094 +# text=Whenever a land comes into play, Ankh of Mishra deals 2 damage to that land's controller. +# Will destroy a land with stone rain, then put a plains into play +[INIT] +FIRSTMAIN +[PLAYER1] +inplay:1397,1094 +hand:1396,1321 +manapool:{R}{2} +[PLAYER2] +[DO] +1321 +1397 +1396 +[ASSERT] +FIRSTMAIN +[PLAYER1] +graveyard:1397,1321 +inplay:1094,1396 +manapool:{0} +life:18 +[PLAYER2] +[END] \ No newline at end of file diff --git a/projects/mtg/bin/Res/test/dingus_egg.txt b/projects/mtg/bin/Res/test/dingus_egg.txt new file mode 100644 index 000000000..ad376c82f --- /dev/null +++ b/projects/mtg/bin/Res/test/dingus_egg.txt @@ -0,0 +1,26 @@ +# bug : Dingus Egg can be put into play but does not deal damage when a player loses a land +# Dingus Egg : (RV) 1105 +#text=Whenever a land is put into a graveyard from play, Dingus Egg deals 2 damage to that land's controller. +# Will destroy 2 lands with stone rains +[INIT] +FIRSTMAIN +[PLAYER1] +inplay:1397,1105 +hand:1321,1321,1396 +manapool:{R}{2}{R}{2} +[PLAYER2] +[DO] +1321 +1397 +1396 +1321 +1396 +[ASSERT] +FIRSTMAIN +[PLAYER1] +graveyard:1397,1321,1396,1321 +inplay:1105 +manapool:{0} +life:16 +[PLAYER2] +[END] \ No newline at end of file diff --git a/projects/mtg/bin/Res/test/dragon_fodder.txt b/projects/mtg/bin/Res/test/dragon_fodder.txt new file mode 100644 index 000000000..af6bf1058 --- /dev/null +++ b/projects/mtg/bin/Res/test/dragon_fodder.txt @@ -0,0 +1,19 @@ +#Testing Tokens +# Dragon Fodder (ALA) 174936 +# text=Put two 1/1 red Goblin creature tokens into play. +[INIT] +FIRSTMAIN +[PLAYER1] +hand:174936 +manapool:{R}{1} +[PLAYER2] +[DO] +174936 +[ASSERT] +FIRSTMAIN +[PLAYER1] +graveyard:174936 +inplay:-174936,-174936 +manapool:{0} +[PLAYER2] +[END] \ No newline at end of file diff --git a/projects/mtg/bin/Res/test/generic/hybrid_mana_3.txt b/projects/mtg/bin/Res/test/generic/hybrid_mana_3.txt new file mode 100644 index 000000000..322e2007e --- /dev/null +++ b/projects/mtg/bin/Res/test/generic/hybrid_mana_3.txt @@ -0,0 +1,18 @@ +#Testing Hybrid Mana +# Spectral possession: text=({2W} can be paid with any two mana or with {W}. This card's converted mana cost is 6.) Put three 1/1 white Spirit creature tokens with flying into play. +[INIT] +FIRSTMAIN +[PLAYER1] +hand:152070 +manapool:{R}{R}{G}{G}{W}{W} +[PLAYER2] +[DO] +152070 +[ASSERT] +FIRSTMAIN +[PLAYER1] +graveyard:152070 +inplay:-152070,-152070,-152070 +manapool:{0} +[PLAYER2] +[END] \ No newline at end of file diff --git a/projects/mtg/bin/Res/test/kird_ape.txt b/projects/mtg/bin/Res/test/kird_ape.txt new file mode 100644 index 000000000..2a7d09dc1 --- /dev/null +++ b/projects/mtg/bin/Res/test/kird_ape.txt @@ -0,0 +1,43 @@ +# bug : Kird Ape : keeps his power/toughness bonus when unsummoned. This allows to cheat and bost the Kird ape like crazy. +# Kird Ape : (RV) 1302 +# text=Kird Ape gets +1/+2 as long as you control a Forest. +# Will unsummon and reput into play +[INIT] +FIRSTMAIN +[PLAYER1] +inplay:1386,1302 +hand:1229 +manapool:{R}{U} +[PLAYER2] +[DO] +1229 +1302 +1302 +eot +eot +next +#upkeep +next +#draw +next +#firstmain +next +#combatbegins +next +#attackers +1302 +next +#blockers +next +#damage +next +#combatend +[ASSERT] +COMBATEND +[PLAYER1] +graveyard:1229 +inplay:1386,1302 +manapool:{0} +[PLAYER2] +life:18 +[END] \ No newline at end of file diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index d8f72e40d..72bd925bd 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -1217,23 +1217,31 @@ class AAladdinsLamp: public TargetAbility{ //Ankh of Mishra -class AAnkhOfMishra: public MTGAbility{ +class AAnkhOfMishra: public ListMaintainerAbility{ public: - int playerLands[2]; - AAnkhOfMishra(int id, MTGCardInstance * _source):MTGAbility(id, _source){ - for (int i=0; i< 2; i++){ - playerLands[i] = GameObserver::GetInstance()->players[i]->game->inPlay->countByType("land"); - } + int init; + AAnkhOfMishra(int id, MTGCardInstance * _source):ListMaintainerAbility(id, _source){ + init = 0; } void Update(float dt){ - for (int i=0; i < 2; i++){ - int lands = GameObserver::GetInstance()->players[i]->game->inPlay->countByType("land"); - while (lands > playerLands[i]){ - GameObserver::GetInstance()->mLayers->stackLayer()->addDamage(source,GameObserver::GetInstance()->players[i], 2); - playerLands[i]++; - } - } + ListMaintainerAbility::Update(dt); + init = 1; + } + + int canBeInList(MTGCardInstance * card){ + if (card->hasType("land")) return 1; + return 0; + } + + int added(MTGCardInstance * card){ + if (!init) return 0; + game->mLayers->stackLayer()->addDamage(source,card->controller(), 2); + return 1; + } + + int removed(MTGCardInstance * card){ + return 1; } }; @@ -1472,23 +1480,23 @@ class ACreatureBond:public TriggeredAbility{ }; //1105: Dingus Egg -class ADingusEgg: public MTGAbility{ +class ADingusEgg: public ListMaintainerAbility{ public: - int playerLands[2]; - ADingusEgg(int id, MTGCardInstance * _source):MTGAbility(id, _source){ - for (int i=0; i< 2; i++){ - playerLands[i] = GameObserver::GetInstance()->players[i]->game->inPlay->countByType("land"); - } + ADingusEgg(int id, MTGCardInstance * _source):ListMaintainerAbility(id, _source){ } - void Update(float dt){ - for (int i=0; i < 2; i++){ - int lands = GameObserver::GetInstance()->players[i]->game->inPlay->countByType("land"); - while (lands < playerLands[i]){ - GameObserver::GetInstance()->mLayers->stackLayer()->addDamage(source,GameObserver::GetInstance()->players[i], 2); - playerLands[i]--; - } - } + int canBeInList(MTGCardInstance * card){ + if (card->hasType("land")) return 1; + return 0; + } + + int added(MTGCardInstance * card){ + return 1; + } + + int removed(MTGCardInstance * card){ + game->mLayers->stackLayer()->addDamage(source,card->controller(), 2); + return 1; } }; @@ -1908,15 +1916,6 @@ class AKudzu: public TargetAbility{ return 0; } - /* - int reactToClick(MTGCardInstance * card){ - if (!waitingForAnswer) { - }else{ - tc->toggleTarget(card); - } - return 1; - } - */ int resolve(){ target = tc->getNextCardTarget(); @@ -2423,30 +2422,7 @@ class AKeldonWarlord:public ListMaintainerAbility{ }; -//1302 : Kird Ape -class AKirdApe:public MTGAbility{ - public: - int init; - AKirdApe(int _id, MTGCardInstance * _source):MTGAbility(_id, _source){ - init = 0; - } - void Update(float dt){ - if (source->controller()->game->inPlay->hasType("forest")){ - if(!init){ - init = 1; - source->power+=1; - source->addToToughness(2); - } - }else{ - if (init){ - init = 0; - source->power-=1; - source->addToToughness(-2); - } - } - } -}; //1309 Orcish Artilery class AOrcishArtillery: public ADamager{ @@ -2589,30 +2565,6 @@ class ANorthernPaladin:public TargetAbility{ }; -//Sedge Troll -class ASedgeTroll:public MTGAbility{ - public: - int init; - ASedgeTroll(int _id, MTGCardInstance * _source):MTGAbility(_id, _source){ - init = 0; - } - - void Update(float dt){ - if (source->controller()->game->inPlay->hasType("swamp")){ - if(!init){ - init = 1; - source->power+=1; - source->addToToughness(1); - } - }else{ - if (init){ - init = 0; - source->power-=1; - source->addToToughness(-1); - } - } - } -}; //Soul Net class ASoulNet:public ActivatedAbility{ @@ -2883,33 +2835,45 @@ class ACreaturePowerToughnessModifierForAllTypeControlled:public ListMaintainerA }; -//GenericKirdApe -//Erwan 2008/11/15 : this cannot work as type is never initialized... -class AGenericKirdApe:public MTGAbility{ +//Generic Kird Ape +class AKirdApe:public ListMaintainerAbility{ public: - int init; - char type [20]; + TargetChooser * tc; int power; int toughness; - AGenericKirdApe(int _id, MTGCardInstance * _source, const char * _type, int _power, int _toughness):MTGAbility(_id, _source){ - init = 0; - } + AKirdApe(int _id, MTGCardInstance * _source, TargetChooser * _tc, int _power, int _toughness):ListMaintainerAbility(_id, _source){ + power = _power; + toughness = _toughness; + tc = _tc; + } + + int canBeInList(MTGCardInstance * card){ + if (card->controller() == source->controller() && tc->canTarget(card)) return 1; + return 0; + } + + int added(MTGCardInstance * card){ + if (cards.size()== 1){ + source->power+=power; + source->addToToughness(toughness); + return 1; + } + return 0; + } + + int removed(MTGCardInstance * card){ + if (cards.size()== 0){ + source->power-=power; + source->addToToughness(-toughness); + return 1; + } + return 0; + } + + ~AKirdApe(){ + delete tc; + } - void Update(float dt){ - if (source->controller()->game->inPlay->hasType(type)){ - if(!init){ - init = 1; - source->power+=power; - source->addToToughness(toughness); - } - }else{ - if (init){ - init = 0; - source->power-=power; - source->addToToughness(-toughness); - } - } - } }; diff --git a/projects/mtg/include/MTGCardInstance.h b/projects/mtg/include/MTGCardInstance.h index 435063f52..a671f89b9 100644 --- a/projects/mtg/include/MTGCardInstance.h +++ b/projects/mtg/include/MTGCardInstance.h @@ -39,6 +39,7 @@ class MTGCardInstance: public MTGCard, public Damageable, public Targetable { public: bool isToken; MTGGameZone * getCurrentZone(); + MTGGameZone * previousZone; int doDamageTest; int summoningSickness; // The recommended method to test for summoning Sickness ! diff --git a/projects/mtg/include/TestSuiteAI.h b/projects/mtg/include/TestSuiteAI.h index d18e0cbe1..fbb4bf6ac 100644 --- a/projects/mtg/include/TestSuiteAI.h +++ b/projects/mtg/include/TestSuiteAI.h @@ -53,7 +53,7 @@ class TestSuite{ TestSuiteState initState; TestSuiteState endState; TestSuiteActions actions; - string files[128]; + string files[1024]; int nbfiles; int currentfile; void load(const char * filename); diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 8bc102140..db7c64949 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -1122,7 +1122,8 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){ } case 1315: //Sedge Troll { - game->addObserver( NEW ASedgeTroll(_id, card)); + TargetChooser * tc = NEW TypeTargetChooser("swamp",card); + game->addObserver(NEW AKirdApe(_id, card,tc,1,1)); break; } case 1221: //Serendib Efreet @@ -1281,7 +1282,8 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){ } case 1302: //Kird Ape { - game->addObserver(NEW AKirdApe(_id, card)); + TargetChooser * tc = NEW TypeTargetChooser("forest",card); + game->addObserver(NEW AKirdApe(_id, card,tc,1,2)); break; } case 1309: //Orcish Artillery @@ -1862,12 +1864,14 @@ void ListMaintainerAbility::Update(float dt){ //Destroy the spell -> remove all targets int ListMaintainerAbility::destroy(){ - map::iterator it; + map::iterator it = cards.begin(); - for ( it=cards.begin() ; it != cards.end(); it++ ){ - removed((*it).first); + while ( it!=cards.end()){ + MTGCardInstance * card = (*it).first; + cards.erase(card); + removed(card); + it = cards.begin(); } - cards.clear(); return 1; } diff --git a/projects/mtg/src/MTGCardInstance.cpp b/projects/mtg/src/MTGCardInstance.cpp index 3a47b1a2a..8c74a3771 100644 --- a/projects/mtg/src/MTGCardInstance.cpp +++ b/projects/mtg/src/MTGCardInstance.cpp @@ -52,6 +52,7 @@ void MTGCardInstance::initMTGCI(){ owner = NULL; changedZoneRecently = 0; counters = NEW Counters(this); + previousZone = NULL; } diff --git a/projects/mtg/src/MTGGameZones.cpp b/projects/mtg/src/MTGGameZones.cpp index 4a51f5203..d5d11a7bc 100644 --- a/projects/mtg/src/MTGGameZones.cpp +++ b/projects/mtg/src/MTGGameZones.cpp @@ -160,6 +160,7 @@ MTGCardInstance * MTGGameZone::removeCard(MTGCardInstance * card){ if (cards[i] == card){ cards[i] = cards[nb_cards -1]; nb_cards--; + card->previousZone = this; return card; } }