Erwan
-fix Issue 150 (hypnotic specter)
This commit is contained in:
@@ -145,6 +145,7 @@ hellfire.txt
|
|||||||
howl_from_beyond.txt
|
howl_from_beyond.txt
|
||||||
howl_of_the_night_pack.txt
|
howl_of_the_night_pack.txt
|
||||||
hymn_of_rebirth.txt
|
hymn_of_rebirth.txt
|
||||||
|
hypnotic_specter.txt
|
||||||
icatian_priest.txt
|
icatian_priest.txt
|
||||||
imaginary_pet.txt
|
imaginary_pet.txt
|
||||||
immaculate_magistrate.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]
|
||||||
@@ -3006,52 +3006,19 @@ class AFastbond:public TriggeredAbility{
|
|||||||
//1165 Hypnotic Specter
|
//1165 Hypnotic Specter
|
||||||
class AHypnoticSpecter:public MTGAbility{
|
class AHypnoticSpecter:public MTGAbility{
|
||||||
public:
|
public:
|
||||||
int nbdamagesthisturn[2];
|
|
||||||
AHypnoticSpecter(int _id, MTGCardInstance * _source):MTGAbility(_id, _source){
|
AHypnoticSpecter(int _id, MTGCardInstance * _source):MTGAbility(_id, _source){
|
||||||
currentPhase = -1;
|
}
|
||||||
for (int i = 0; i < 2; i++){
|
|
||||||
nbdamagesthisturn[i] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Update(float dt){
|
int receiveEvent(WEvent * event){
|
||||||
if (newPhase != currentPhase && newPhase == Constants::MTG_PHASE_UNTAP){
|
WEventDamage * e = dynamic_cast<WEventDamage *>(event);
|
||||||
for (int i = 0; i < 2; i++){
|
if (!e) return 0;
|
||||||
nbdamagesthisturn[i] = 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);
|
||||||
|
}
|
||||||
|
|
||||||
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) << ")";
|
|
||||||
}
|
|
||||||
AHypnoticSpecter * clone() const{
|
AHypnoticSpecter * clone() const{
|
||||||
AHypnoticSpecter * a = NEW AHypnoticSpecter(*this);
|
AHypnoticSpecter * a = NEW AHypnoticSpecter(*this);
|
||||||
a->isClone = 1;
|
a->isClone = 1;
|
||||||
|
|||||||
@@ -820,7 +820,6 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card, int
|
|||||||
result++;
|
result++;
|
||||||
}else{
|
}else{
|
||||||
OutputDebugString("ABILITYFACTORY ERROR: Parser returned NULL\n");
|
OutputDebugString("ABILITYFACTORY ERROR: Parser returned NULL\n");
|
||||||
//return result;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -1133,13 +1132,6 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
|||||||
game->addObserver(ability);
|
game->addObserver(ability);
|
||||||
break;
|
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
|
case 1202: //Hurkyl's Recall
|
||||||
{
|
{
|
||||||
Player * player = spell->getNextPlayerTarget();
|
Player * player = spell->getNextPlayerTarget();
|
||||||
|
|||||||
Reference in New Issue
Block a user