diff --git a/projects/mtg/bin/Res/sets/M10/_cards.dat b/projects/mtg/bin/Res/sets/M10/_cards.dat index 73cd35a81..2c378308d 100644 --- a/projects/mtg/bin/Res/sets/M10/_cards.dat +++ b/projects/mtg/bin/Res/sets/M10/_cards.dat @@ -919,8 +919,8 @@ subtype=Merfolk power=2 toughness=2 text=Other Merfolk creatures you control get +1/+1. {T}: Target Merfolk creature is unblockable this turn. -auto=lord(merfolk|myBattlefield) 1/1 -auto={T}:unblockable target(merfolk) +auto=lord(merfolk|myBattlefield) 1/1 other +auto={T}:unblockable target(merfolk) other rarity=R [/card] [card] diff --git a/projects/mtg/bin/Res/sets/TSP/_cards.dat b/projects/mtg/bin/Res/sets/TSP/_cards.dat index d88761601..ffa978b8c 100644 --- a/projects/mtg/bin/Res/sets/TSP/_cards.dat +++ b/projects/mtg/bin/Res/sets/TSP/_cards.dat @@ -591,7 +591,7 @@ rarity=R [/card] [card] text=Put a 1/1 green Saproling creature token into play. -auto={G}:token(Saproling,creature saproling, 1/1, green) +auto=token(Saproling,Creature Saproling,1/1,green) id=122079 name=Sprout rarity=C diff --git a/projects/mtg/bin/Res/test/_tests.txt b/projects/mtg/bin/Res/test/_tests.txt index 306ea4cb1..0fae06841 100644 --- a/projects/mtg/bin/Res/test/_tests.txt +++ b/projects/mtg/bin/Res/test/_tests.txt @@ -70,6 +70,7 @@ dragon_fodder.txt drain_life.txt drift_of_the_dead.txt elvish_piper.txt +elvish_promenade.txt fastbond.txt flare.txt fledgling_imp.txt @@ -132,6 +133,7 @@ siege_gang_commander.txt shivan_hellkite.txt shock.txt slate_of_ancestry.txt +soulblast.txt sphinx_summoner.txt spitting_earth.txt spark_elemental.txt diff --git a/projects/mtg/bin/Res/test/elvish_promenade.txt b/projects/mtg/bin/Res/test/elvish_promenade.txt new file mode 100644 index 000000000..650289536 --- /dev/null +++ b/projects/mtg/bin/Res/test/elvish_promenade.txt @@ -0,0 +1,19 @@ +#Testing Elvish Promenade +#Put a 1/1 green Elf Warrior creature token onto the battlefield for each Elf you control. +[INIT] +FIRSTMAIN +[PLAYER1] +hand:elvish promenade +inplay:elvish champion,llanowar elves +manapool:{3}{G} +[PLAYER2] +[DO] +elvish promenade +[ASSERT] +FIRSTMAIN +[PLAYER1] +graveyard:elvish promenade +inplay:elvish champion,llanowar elves,*,* +manapool:{0} +[PLAYER2] +[END] \ No newline at end of file diff --git a/projects/mtg/bin/Res/test/soulblast.txt b/projects/mtg/bin/Res/test/soulblast.txt new file mode 100644 index 000000000..84c88c461 --- /dev/null +++ b/projects/mtg/bin/Res/test/soulblast.txt @@ -0,0 +1,22 @@ +#Testing Soulblast +[INIT] +FIRSTMAIN +[PLAYER1] +hand:soulblast,Flowstone embrace +inplay:raging goblin,grizzly bears +manapool:{2}{R}{R}{R}{R}{R}{R} +[PLAYER2] +inplay:dragon engine +[DO] +Flowstone embrace +grizzly bears +soulblast +dragon engine +[ASSERT] +FIRSTMAIN +[PLAYER1] +graveyard:soulblast,Flowstone embrace,raging goblin,grizzly bears +manapool:{0} +[PLAYER2] +graveyard:dragon engine +[END] \ No newline at end of file diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 3dd3e2d97..0bc9184be 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -206,6 +206,7 @@ class GenericActivatedAbility:public ActivatedAbility{ int counters; GenericActivatedAbility(int _id, MTGCardInstance * card, MTGAbility * a, ManaCost * _cost, int _tap = 1, int limit = 0):ActivatedAbility(_id, card,_cost,0,_tap),ability(a),limitPerTurn(limit){ counters = 0; + target = ability->target; } int resolve(){ diff --git a/projects/mtg/src/AIPlayer.cpp b/projects/mtg/src/AIPlayer.cpp index 11a560cc6..f2b257dbd 100644 --- a/projects/mtg/src/AIPlayer.cpp +++ b/projects/mtg/src/AIPlayer.cpp @@ -79,6 +79,7 @@ void AIPlayer::tapLandsForMana(ManaCost * potentialMana, ManaCost * cost){ if (amp){ MTGCardInstance * card = amp->source; if (!used[card] && amp->isReactingToClick(card) && amp->output->getConvertedCost()==1){ + used[card] = true; int doTap = 1; for (int i=Constants::MTG_NB_COLORS-1; i>= 0; i--){ if (diff->getCost(i) && amp->output->getCost(i) ){ @@ -90,7 +91,6 @@ void AIPlayer::tapLandsForMana(ManaCost * potentialMana, ManaCost * cost){ if (doTap){ AIAction * action = NEW AIAction(amp,card); clickstream.push(action); - used[card] = true; } } } @@ -147,8 +147,8 @@ int AIAction::getEfficiency(){ } //Can't handle sacrifice costs that require a target yet :( - if (a->cost){ - ExtraCosts * ec = a->cost->extraCosts; + if (ability->cost){ + ExtraCosts * ec = ability->cost->extraCosts; if (ec){ for (size_t i = 0; i < ec->costs.size(); i++){ if (ec->costs[i]->tc) return 0; diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 4daf1cae7..b1fd3b22b 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -790,12 +790,19 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){ void AbilityFactory::addAbilities(int _id, Spell * spell){ MTGCardInstance * card = spell->source; + + if (card->hasType("instant") || card->hasType("sorcery")){ + MTGPlayerCards * zones = card->controller()->game; + zones->putInGraveyard(card); + } + if (spell->cursor==1) card->target = spell->getNextCardTarget(); _id = magicText(_id, spell); - int putSourceInGraveyard = 0; //For spells that are not already InstantAbilities; - GameObserver * game = GameObserver::GetInstance(); + + + int id = card->getId(); if (card->alias) id = card->alias; switch (id){ @@ -1804,17 +1811,16 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){ case 130369: // Soulblast { - int damage = 0; - Damageable * target = spell->getNextDamageableTarget(); - GameObserver * game = GameObserver::GetInstance(); - for (int j = 0; j < card->controller()->game->inPlay->nb_cards; j++){ - MTGCardInstance * current = card->controller()->game->inPlay->cards[j]; - if (current->hasType("Creature")){ - card->controller()->game->putInGraveyard(current); - damage+= current->power; - } - } - game->mLayers->stackLayer()->addDamage(card, target, damage); + int damage = 0; + Damageable * target = spell->getNextDamageableTarget(); + for (int j = card->controller()->game->inPlay->nb_cards-1; j >=0 ; --j){ + MTGCardInstance * current = card->controller()->game->inPlay->cards[j]; + if (current->hasType("Creature")){ + card->controller()->game->putInGraveyard(current); + damage+= current->power; + } + } + game->mLayers->stackLayer()->addDamage(card, target, damage); break; } @@ -1944,16 +1950,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){ game->addObserver(NEW AStrongLandLinkCreature(_id, card,"plains")); } - //Instants are put in the graveyard automatically if that's not already done - if (!putSourceInGraveyard){ - if (card->hasType("instant") || card->hasType("sorcery")){ - putSourceInGraveyard = 1; - } - } - if (putSourceInGraveyard == 1){ - MTGPlayerCards * zones = card->controller()->game; - card = zones->putInGraveyard(card); - } } MTGAbility::MTGAbility(int id, MTGCardInstance * card):ActionElement(id){ diff --git a/projects/mtg/src/MTGRules.cpp b/projects/mtg/src/MTGRules.cpp index f66a35fb4..fe5ff490f 100644 --- a/projects/mtg/src/MTGRules.cpp +++ b/projects/mtg/src/MTGRules.cpp @@ -349,16 +349,15 @@ int HUDDisplay::receiveEvent(WEvent * event){ WEventZoneChange * ezc = dynamic_cast(event); if (ezc) { - int ok = 0; for (int i = 0; i < 2 ; i++){ Player * p = game->players[i]; - if (ezc->from == p->game->graveyard || ezc->to == p->game->graveyard ) ok = 1; + if (ezc->to == p->game->graveyard ){ + char buffer[512]; + sprintf(buffer,_("%s goes to graveyard").c_str(), _(ezc->card->getName()).c_str()); + string s = buffer; + return addEvent(s); + } } - if (!ok) return 0; - char buffer[512]; - sprintf(buffer,_("%s goes to graveyard").c_str(), _(ezc->card->getName()).c_str()); - string s = buffer; - return addEvent(s); } WEventDamage * ed = dynamic_cast(event);