Support transforms for nonpermanent

fix startled awake to persistent nightmare
This commit is contained in:
Anthony Calosa
2016-08-01 03:52:10 +08:00
parent 89a30ae5ee
commit 71a9ef00ee
5 changed files with 43 additions and 5 deletions

View File

@@ -79025,7 +79025,9 @@ type=Sorcery
[/card]
[card]
name=Persistent Nightmare
auto=@combatdamaged(player) from(this):moveto(myhand) and!(flip(Startled Awake) )!
abilities=skulk
auto=@combatdamaged(player) from(this):moveto(ownerhand)
color=blue
text=Skulk (This creature can't be blocked by creatures with greater power.) -- When Persistent Nightmare deals combat damage to a player, return it to its owner's hand.
type=Creature
subtype=Nightmare
@@ -104779,8 +104781,9 @@ type=Instant
[/card]
[card]
name=Startled Awake
auto=deplete:13 opponent
autograveyard={3}{U}{U}:moveto(mybattlefield) and!(flip(Persistant Nightmare) )! assorcery
target=opponent
auto=deplete:13 targetedplayer
autograveyard={{3}{U}{U}}:moveto(mybattlefield) and!(flip(Persistent Nightmare))! assorcery
text=Target opponent puts the top thirteen cards of his or her library into his or her graveyard. -- {3}{U}{U}: Put Startled Awake from your graveyard onto the battlefield transformed. Activate this ability only any time you could cast a sorcery.
mana={2}{U}{U}
type=Sorcery

View File

@@ -301,6 +301,12 @@ struct WEventCardControllerChange : public WEventCardUpdate {
virtual Targetable * getTarget(int target);
};
//event when card transforms
struct WEventCardTransforms : public WEventCardUpdate {
WEventCardTransforms(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
};
std::ostream& operator<<(std::ostream&, const WEvent&);
#endif

View File

@@ -3280,6 +3280,11 @@ int AAFlip::resolve()
}
SAFE_DELETE(myFlip);
_target->mPropertiesChangedSinceLastUpdate = true;
if(!isflipcard)
{
WEvent * e = NEW WEventCardTransforms(_target);
game->receiveEvent(e);
}
}
currentAbilities.clear();
@@ -4112,7 +4117,7 @@ int AAMover::resolve()
//inplay is a special zone !
for (int i = 0; i < 2; i++)
{
if (!_target->hasSubtype(Subtypes::TYPE_AURA) && destZone == game->players[i]->game->inPlay && fromZone != game->players[i]->game->inPlay && fromZone
if (!_target->hasSubtype(Subtypes::TYPE_INSTANT) && !_target->hasSubtype(Subtypes::TYPE_SORCERY) && !_target->hasSubtype(Subtypes::TYPE_AURA) && destZone == game->players[i]->game->inPlay && fromZone != game->players[i]->game->inPlay && fromZone
!= game->players[i]->opponent()->game->inPlay)
{
MTGCardInstance * copy = game->players[i]->game->putInZone(_target, fromZone, game->players[i]->game->temp);
@@ -4172,6 +4177,17 @@ int AAMover::resolve()
}
else
{
if(_target->hasSubtype(Subtypes::TYPE_INSTANT) || _target->hasSubtype(Subtypes::TYPE_SORCERY) &&
(destZone == game->players[0]->game->inPlay || destZone == game->players[1]->game->inPlay))
{
if(andAbility)
{
if(!dynamic_cast<AAFlip *>(andAbility))
return 0;
}
else
return 0;
}
p->game->putInZone(_target, fromZone, destZone);
while(_target->next)
_target = _target->next;
@@ -7077,7 +7093,7 @@ void ABlink::resolveBlink()
void ABlink::returnCardIntoPlay(MTGCardInstance* _target) {
MTGCardInstance * Blinker = NULL;
if(!_target->blinked)
if(!_target->blinked || _target->hasSubtype(Subtypes::TYPE_INSTANT) || _target->hasSubtype(Subtypes::TYPE_SORCERY))
{
this->forceDestroy = 1;
return;

View File

@@ -424,6 +424,8 @@ int GuiPlay::receiveEventPlus(WEvent * e)
Replace();
else if (dynamic_cast<WEventCardControllerChange*> (e))
Replace();
else if (dynamic_cast<WEventCardTransforms*> (e))
Replace();
Replace();
return 0;
}

View File

@@ -231,6 +231,11 @@ WEventCardControllerChange::WEventCardControllerChange(MTGCardInstance * card) :
{
}
WEventCardTransforms::WEventCardTransforms(MTGCardInstance * card) :
WEventCardUpdate(card)
{
}
WEventCombatStepChange::WEventCombatStepChange(CombatStep step) :
WEvent(), step(step)
{
@@ -397,6 +402,12 @@ Targetable * WEventCardControllerChange::getTarget(int target)
return NULL;
}
Targetable * WEventCardTransforms::getTarget(int target)
{
if (target) return card;
return NULL;
}
std::ostream& WEvent::toString(std::ostream& out) const
{
return out << "EVENT";