diff --git a/projects/mtg/bin/Res/sets/LRW/_cards.dat b/projects/mtg/bin/Res/sets/LRW/_cards.dat index ffe7327fe..99bcf0b0d 100644 --- a/projects/mtg/bin/Res/sets/LRW/_cards.dat +++ b/projects/mtg/bin/Res/sets/LRW/_cards.dat @@ -548,8 +548,8 @@ toughness=2 [/card] [card] text=Other Giant creatures you control get +2/+2 and have trample. -auto=lord(giant) 2/2 other -auto=lord(giant) trample other +auto=lord(giant|myinplay) 2/2 other +auto=lord(giant|myinplay) trample other id=139667 name=Sunrise Sovereign rarity=R diff --git a/projects/mtg/bin/Res/sets/MIR/_cards.dat b/projects/mtg/bin/Res/sets/MIR/_cards.dat index 21040426a..df09a2130 100644 --- a/projects/mtg/bin/Res/sets/MIR/_cards.dat +++ b/projects/mtg/bin/Res/sets/MIR/_cards.dat @@ -1034,7 +1034,7 @@ id=3252 name=Horrible Hordes type=Artifact Creature subtype=Spirit -auto=rampage +abilities=rampage mana={3} power=2 toughness=2 diff --git a/projects/mtg/bin/Res/sets/ODY/_cards.dat b/projects/mtg/bin/Res/sets/ODY/_cards.dat index eb532e355..e1f64554a 100644 --- a/projects/mtg/bin/Res/sets/ODY/_cards.dat +++ b/projects/mtg/bin/Res/sets/ODY/_cards.dat @@ -1074,7 +1074,7 @@ text=Return target creature card from your graveyard to play. id=29847 name=Zombify target=Creature|mygraveyard -alias=1360 +auto=moveTo(myInPlay) mana={3}{B} color=black type=Sorcery diff --git a/projects/mtg/bin/Res/sets/TMP/_cards.dat b/projects/mtg/bin/Res/sets/TMP/_cards.dat index 8e72ac8f5..c878e7799 100644 --- a/projects/mtg/bin/Res/sets/TMP/_cards.dat +++ b/projects/mtg/bin/Res/sets/TMP/_cards.dat @@ -220,6 +220,7 @@ abilities={2}:regenerate [/card] [card] text=Flying When Cloudchaser Eagle comes into play, destroy target enchantment. +abilities=flying id=4871 name=Cloudchaser Eagle auto=may destroy target(enchantment) diff --git a/projects/mtg/bin/Res/test/_tests.txt b/projects/mtg/bin/Res/test/_tests.txt index c5c29ff89..b338dbaef 100644 --- a/projects/mtg/bin/Res/test/_tests.txt +++ b/projects/mtg/bin/Res/test/_tests.txt @@ -103,10 +103,13 @@ sword_to_plowshares.txt terror.txt tranquil_domain.txt volcanic_island.txt +wall_of_diffusion.txt +wall_of_diffusion2.txt white_knight1.txt wrath_of_god.txt zombie_master.txt +zombify.txt ######################## #Momir Basic Tests ######################## -momir/keldon_warlord.txt +momir/keldon_warlord.txt \ No newline at end of file diff --git a/projects/mtg/bin/Res/test/wall_of_diffusion.txt b/projects/mtg/bin/Res/test/wall_of_diffusion.txt new file mode 100644 index 000000000..11d19e143 --- /dev/null +++ b/projects/mtg/bin/Res/test/wall_of_diffusion.txt @@ -0,0 +1,24 @@ +#Bug: Wall of diffusion has reach +[INIT] +COMBATATTACKERS +[PLAYER1] +inplay:air elemental +[PLAYER2] +inplay:wall of diffusion +[DO] +air elemental +next +#blockers +wall of diffusion +next +#damage +next +#end +[ASSERT] +COMBATEND +[PLAYER1] +inplay:air elemental +[PLAYER2] +inplay:wall of diffusion +life:16 +[END] \ No newline at end of file diff --git a/projects/mtg/bin/Res/test/wall_of_diffusion2.txt b/projects/mtg/bin/Res/test/wall_of_diffusion2.txt new file mode 100644 index 000000000..2adae5c32 --- /dev/null +++ b/projects/mtg/bin/Res/test/wall_of_diffusion2.txt @@ -0,0 +1,23 @@ +#Wall of diffusionShadow +[INIT] +COMBATATTACKERS +[PLAYER1] +inplay:dauthi marauder +[PLAYER2] +inplay:wall of diffusion +[DO] +dauthi marauder +next +#blockers +wall of diffusion +next +#damage +next +#end +[ASSERT] +COMBATEND +[PLAYER1] +inplay:dauthi marauder +[PLAYER2] +inplay:wall of diffusion +[END] \ No newline at end of file diff --git a/projects/mtg/bin/Res/test/zombify.txt b/projects/mtg/bin/Res/test/zombify.txt new file mode 100644 index 000000000..e3452cdd7 --- /dev/null +++ b/projects/mtg/bin/Res/test/zombify.txt @@ -0,0 +1,44 @@ +#Bug: zombify on a Roowalla doesn't give the rootwalla it's abilities back +[INIT] +FIRSTMAIN +[PLAYER1] +hand:zombify +graveyard:rootwalla +inplay:swamp,forest +manapool:{3}{B} +[PLAYER2] +[DO] +zombify +rootwalla +eot +eot +#untap +next +#upkeep +next +#draw +next +#main 1 +swamp +forest +rootwalla +next +#combat begins +next +#attackers +rootwalla +next +#blockers +next +#damage +next +#end +[ASSERT] +COMBATEND +[PLAYER1] +graveyard:zombify +inplay:swamp,forest,rootwalla +manapool:{0} +[PLAYER2] +life:16 +[END] \ No newline at end of file diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 94e03e33b..4fe1f56ca 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -243,9 +243,9 @@ public: destinationZone = destZone; } - int resolve(){ - MTGCardInstance * _target = tc->getNextCardTarget(); - if(_target){ + static int moveTarget(MTGCardInstance * _target, string destinationZone, MTGCardInstance * source){ + GameObserver * g = GameObserver::GetInstance(); + if(_target){ Player* p = _target->controller(); if (p){ MTGGameZone * fromZone = _target->getCurrentZone(); @@ -253,8 +253,8 @@ public: //inplay is a special zone ! for (int i=0; i < 2; i++){ - if (destZone == game->players[i]->game->inPlay){ - MTGCardInstance * copy = game->players[i]->game->putInZone(_target, fromZone, game->players[i]->game->stack); + if (destZone == g->players[i]->game->inPlay){ + MTGCardInstance * copy = g->players[i]->game->putInZone(_target, fromZone, g->players[i]->game->stack); Spell * spell = NEW Spell(copy); spell->resolve(); @@ -267,6 +267,11 @@ public: return 1; } return 0; + } + + int resolve(){ + MTGCardInstance * _target = tc->getNextCardTarget(); + return moveTarget(_target,destinationZone, source); } }; diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 14a906a46..6042fdfdd 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -369,9 +369,7 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){ game->addObserver(a); } }else{ - MTGGameZone * fromZone = target->getCurrentZone();//this is technically incorrect. The initial zone should be as described in the targetchooser - MTGGameZone * destZone = MTGGameZone::stringToZone(szone, card, target); - target->controller()->game->putInZone(target,fromZone,destZone); + AZoneMover::moveTarget(target,szone,card); } } result++; diff --git a/projects/mtg/src/MTGDeck.cpp b/projects/mtg/src/MTGDeck.cpp index 26b2c1456..1eea9e2eb 100644 --- a/projects/mtg/src/MTGDeck.cpp +++ b/projects/mtg/src/MTGDeck.cpp @@ -62,10 +62,22 @@ int MTGAllCards::processConfLine(string s, MTGCard *card){ }else if (key.compare("abilities")==0){ //Specific Abilities std::transform( value.begin(), value.end(), value.begin(),::tolower ); - for (int j = 0; j < Constants::NB_BASIC_ABILITIES; j++){ - unsigned int found = value.find(Constants::MTGBasicAbilities[j]); - if (found != string::npos){ - card->basicAbilities[j] = 1; + while (value.size()){ + string attribute; + size_t found2 = value.find(","); + if (found2 != string::npos){ + attribute = value.substr(0,found2); + value = value.substr(found2+1); + }else{ + attribute = value; + value = ""; + } + for (int j = Constants::NB_BASIC_ABILITIES-1; j >=0 ; j--){ + size_t found = attribute.find(Constants::MTGBasicAbilities[j]); + if (found != string::npos){ + card->basicAbilities[j] = 1; + break; + } } } }else if(key.compare("id")==0){ diff --git a/projects/mtg/src/MTGRules.cpp b/projects/mtg/src/MTGRules.cpp index 7cfc8b202..5c1c319b1 100644 --- a/projects/mtg/src/MTGRules.cpp +++ b/projects/mtg/src/MTGRules.cpp @@ -225,8 +225,13 @@ MTGCardInstance * MTGMomirRule::genCreature( int id){ } int MTGMomirRule::genRandomCreatureId(int convertedCost){ - if (convertedCost > 20) return 0; - int total_cards = pool[convertedCost].size(); + if (convertedCost > 20) convertedCost = 20; + int total_cards = 0; + int i = convertedCost; + while (!total_cards && i >=0){ + total_cards = pool[i].size(); + i--; + } if (!total_cards) return 0; int start = (rand() % total_cards); return pool[convertedCost][start]; diff --git a/projects/mtg/src/SimpleMenuItem.cpp b/projects/mtg/src/SimpleMenuItem.cpp index 2bdaa358c..0abf28905 100644 --- a/projects/mtg/src/SimpleMenuItem.cpp +++ b/projects/mtg/src/SimpleMenuItem.cpp @@ -70,6 +70,7 @@ void SimpleMenuItem::Relocate(int x, int y) int SimpleMenuItem::GetWidth() { + mFont->SetScale(1.0); return mFont->GetStringWidth(mText.c_str()); }