diff --git a/projects/mtg/bin/Res/test/_tests.txt b/projects/mtg/bin/Res/test/_tests.txt index 0cc4d719d..e9979b4f7 100644 --- a/projects/mtg/bin/Res/test/_tests.txt +++ b/projects/mtg/bin/Res/test/_tests.txt @@ -145,6 +145,7 @@ hellfire.txt howl_from_beyond.txt howl_of_the_night_pack.txt hymn_of_rebirth.txt +hypnotic_specter.txt icatian_priest.txt imaginary_pet.txt immaculate_magistrate.txt diff --git a/projects/mtg/bin/Res/test/hypnotic_specter.txt b/projects/mtg/bin/Res/test/hypnotic_specter.txt new file mode 100644 index 000000000..688475bbc --- /dev/null +++ b/projects/mtg/bin/Res/test/hypnotic_specter.txt @@ -0,0 +1,24 @@ +#Bug: Hypnotic specter doesn't draw a card +# http://code.google.com/p/wagic/issues/detail?id=150 +[INIT] +COMBATATTACKERS +[PLAYER1] +inplay:hypnotic specter +[PLAYER2] +hand:swamp +[DO] +hypnotic specter +next +#blockers +next +#damage +next +#end combat +[ASSERT] +COMBATEND +[PLAYER1] +inplay:hypnotic specter +[PLAYER2] +graveyard:swamp +life:18 +[END] \ No newline at end of file diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index a4c0aa045..17715303e 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -3006,52 +3006,19 @@ class AFastbond:public TriggeredAbility{ //1165 Hypnotic Specter class AHypnoticSpecter:public MTGAbility{ public: - int nbdamagesthisturn[2]; + AHypnoticSpecter(int _id, MTGCardInstance * _source):MTGAbility(_id, _source){ - currentPhase = -1; - for (int i = 0; i < 2; i++){ - nbdamagesthisturn[i] = 0; - } - } + } - void Update(float dt){ - if (newPhase != currentPhase && newPhase == Constants::MTG_PHASE_UNTAP){ - for (int i = 0; i < 2; i++){ - nbdamagesthisturn[i] = 0; - } - } - - ActionStack * as = game->mLayers->stackLayer(); - int nbdamages[2]; - for (int i = 0; i < 2; i++){ - nbdamages[i] = 0; - } - - Damage * current = ((Damage *)as->getNext(NULL,ACTION_DAMAGE,RESOLVED_OK)); - while(current){ - if (current->source == source){ - for (int j=0; j < 2; j++){ - if(current->target == game->players[j]) nbdamages[j]++; - } - } - current = ((Damage *)as->getNext(current,ACTION_DAMAGE,RESOLVED_OK)); - - } - - for (int i = 0; i < 2; i++){ - while(nbdamages[i] > nbdamagesthisturn[i]){ - nbdamagesthisturn[i]++; - game->players[i]->game->discardRandom(game->players[i]->game->hand); - } - } - } - - virtual ostream& toString(ostream& out) const - { - out << "AHypnoticSpecter ::: nbdamagesthisturn : " << nbdamagesthisturn - << " ("; - return MTGAbility::toString(out) << ")"; - } + int receiveEvent(WEvent * event){ + WEventDamage * e = dynamic_cast(event); + if (!e) return 0; + if (e->damage->source != source) return 0; + Player * p = dynamic_cast(e->damage->target); + if (!p) return 0; + p->game->discardRandom(p->game->hand); + } + AHypnoticSpecter * clone() const{ AHypnoticSpecter * a = NEW AHypnoticSpecter(*this); a->isClone = 1; diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 2613105b3..ba9d82fc9 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -820,7 +820,6 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card, int result++; }else{ OutputDebugString("ABILITYFACTORY ERROR: Parser returned NULL\n"); - //return result; } } return result; @@ -1133,13 +1132,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){ game->addObserver(ability); break; } - /*case 1164: //Howl from beyond - { - int x = computeX(spell,card); - AInstantPowerToughnessModifierUntilEOT * ability = NEW AInstantPowerToughnessModifierUntilEOT( _id, card, card->target, x, 0); - game->addObserver(ability); - break; - }*/ case 1202: //Hurkyl's Recall { Player * player = spell->getNextPlayerTarget();