-fix Issue 150 (hypnotic specter)
This commit is contained in:
wagic.the.homebrew@gmail.com
2009-11-01 12:15:37 +00:00
parent 5b92639cca
commit 18293ba07c
4 changed files with 36 additions and 52 deletions
+1
View File
@@ -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
@@ -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]
+11 -44
View File
@@ -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<WEventDamage *>(event);
if (!e) return 0;
if (e->damage->source != source) return 0;
Player * p = dynamic_cast<Player *>(e->damage->target);
if (!p) return 0;
p->game->discardRandom(p->game->hand);
}
AHypnoticSpecter * clone() const{
AHypnoticSpecter * a = NEW AHypnoticSpecter(*this);
a->isClone = 1;
-8
View File
@@ -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();