It is currently 10 May 2024, 22:14
   
Text Size

Blink ability and attached cards

Moderator: CCGHQ Admins

Blink ability and attached cards

Postby MisterBenn » 07 May 2012, 03:13

Hi there, I am testing a deck making use of a few cards with the blink ability, namely Nephalia Smuggler, Ghostly Flicker, and Conjurer's Closet. The immediate behaviour is OK in that using RemoveFromGame() and then PutIntoPlay() within the same Resolution Time Action works as it should. However I suspect something is not correct when it comes to attached cards. Here are some blink scenarios and what happens as it stands:

1) Blink a token creature - the creature comes back. I understand that is as it should be.
2) Blink a creature with an aura - the creature returns with the aura still. From what I researched (I am no authority in general) I took the rule of thumb that the returning creature is to be considered a new permanaent and that the aura should remain out in exile.
3) Blink a creature with equipment - haven't tested that one yet but expect the same results as 2)
4) Blink a creature with a "for as long as X remains on the battlefield" ability such as Sower of Temptation. I understand that the correct behaviour of this card should be to release control of the controlled creature during the blink, and then to select a target once more as it enters the battlefield once again. The behaviour I have is to retain control of the controlled creature and then to select a new target!

Generally I understand that it's appropriate for state-based effects to not be enforced mid-blink and that is correctly happening. It seems that the blinking card itself should have its attachments removed though, do you experts have any ideas on how this could be achieved? Currently the ability directly reflects Journey to Nowhere:

Code: Select all
  <TRIGGERED_ABILITY>
    <TRIGGER value="BEGINNING_OF_STEP">
    return Object():GetPlayer():MyTurn() ~= 0 and MTG():GetStep() == STEP_END_OF_TURN and TriggeredForMe()
    </TRIGGER>
    <TARGET_DETERMINATION>
      local filter = Object():GetFilter()
      filter:Clear()
      filter:AddCardType( CARD_TYPE_CREATURE )
      filter:SetZone( ZONE_IN_PLAY )
      filter:SetController( Object():GetPlayer() )
      filter:May()
      return TargetGoodF()
    </TARGET_DETERMINATION>
    <PLAY_TIME_ACTION target_choosing="1">
      ChooseTarget( "CARD_QUERY_CHOOSE_CREATURE_TO_EXILE_RETURN" )
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
      local target = Object():GetTargetCard()
      if target ~= nil then
        target:RemoveFromGame()
        target:PutIntoPlay( Object():GetController() )
      end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
Any ideas on this? I suspect auras, equipment, counters etc all remain after the blink. Is there some syntax to remove all attached cards against an object? Is there some more creative solution? I was thinking about exiling the card then putting a copy into play, is there a way to do that without it becoming a token? I'd really appreciate some help with this.
MisterBenn
 
Posts: 97
Joined: 19 Mar 2011, 16:19
Has thanked: 24 times
Been thanked: 11 times

Re: Blink ability and attached cards

Postby Eglin » 07 May 2012, 05:51

Journey to Nowhere properly removes counters/enchants/etc, so I suspect there's a way to get this to work as well. The first thing I'd try is to move the put into play action into a separate play-time action.

To answer one of your other questions, you can use a filter block to query the parent/child relationships for all the cards and remove the children of the card in question. I don't think it will help you here, though, because exiling the card should be enough and I don't think there's an easy way to do the same for counters.
User avatar
Eglin
Programmer
 
Posts: 195
Joined: 01 Mar 2012, 14:44
Has thanked: 39 times
Been thanked: 22 times

Re: Blink ability and attached cards

Postby sadlyblue » 07 May 2012, 09:06

For what i've read:
1) The token shouldn't return. Once a token finishes leaving the battlefield it ceases to exist.
2) Auras shouldn't remain on the creature. They should go to the graveyard, as soon as the permanent leaves play. But doesn't count as being destroyed.
3) Equipment should unattach and remain in the battlefield.
4) It should work as you thought. Release the old target, and make you choose another.

If PutInPlay doesn't work, try PseudoPlaySpell. It won't count as a spell but i think will do the rest.
So, just check if the target is a token, if so it doesn't come back.
Unattach equipment, and put auras in graveyard.
Then blink it...
sadlyblue
 
Posts: 175
Joined: 06 Feb 2012, 13:18
Has thanked: 18 times
Been thanked: 16 times

Re: Blink ability and attached cards

Postby MisterBenn » 07 May 2012, 14:32

Thanks for the replies.

sandyblue - on the blinking of a token I read this on Wizards.com regarding the Momentary Blink card:

For example, did you know that it's possible to remove a token creature from the game and then return it without losing the token? Momentary Blink will actually return a token to play! Normally when a token creature leaves play (if you cast Boomerang on it, for instance) it would disappear as a state-based effect once the spell had resolved. But the way Momentary Blink works, there's no chance to check state-based effects while the token is off in the great beyond, so, it just comes back.
This is the source of my difficulty. If I separate out the removal and return into seperate actions then states such as these will be processed and there will be problems. If I keep them together then attached cards and counters are an issue. When I am on the DOTP PC this evening I will have another crack and see what I can come up with. I need to finish this deck before Warlock: Master of the Arcane releases tomorrow night! :D
MisterBenn
 
Posts: 97
Joined: 19 Mar 2011, 16:19
Has thanked: 24 times
Been thanked: 11 times

Re: Blink ability and attached cards

Postby Eglin » 08 May 2012, 01:01

You can use forced_skip to "fake" comma-space compound statements.
User avatar
Eglin
Programmer
 
Posts: 195
Joined: 01 Mar 2012, 14:44
Has thanked: 39 times
Been thanked: 22 times

Re: Blink ability and attached cards

Postby kevlahnota » 08 May 2012, 01:33

token should not be returned.


110.5f A token that's phased out, or that's in a zone other than the battlefield, ceases to exist. This is a state-based action; see rule 704. (Note that if a token changes zones, applicable triggered abilities will trigger before the token ceases to exist.)

110.5g A token that has left the battlefield can't move to another zone or come back onto the battlefield. If such a token would change zones, it remains in its current zone instead. It ceases to exist the next time state-based actions are checked; see rule 704.


also can you try this code:

Code: Select all
<TARGET_DETERMINATION>
    local filter = Object():GetFilter()
    filter:Clear()
    filter:AddCardType( CARD_TYPE_CREATURE )
    filter:SetZone( ZONE_IN_PLAY )
    if filter:CountStopAt(1) == 1 then
       return TARGET_DETERMINATION_ALL
    else
       return TARGET_DETERMINATION_NONE
    end
    </TARGET_DETERMINATION>
    <PLAY_TIME_ACTION target_choosing="1">
    ChooseTarget( "CARD_QUERY_CHOOSE_CREATURE_TO_EXILE" )
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local card = Object():GetTargetCard()
    if card ~= nil then
       card:RemoveFromGame()
       if card:GetZone() == ZONE_REMOVED_FROM_GAME and card:IsToken() == 0 then
          card:PutIntoPlay( card:GetOwner() )
       end
    end
    </RESOLUTION_TIME_ACTION>
User avatar
kevlahnota
Programmer
 
Posts: 825
Joined: 19 Jul 2010, 17:45
Location: Philippines
Has thanked: 14 times
Been thanked: 264 times

Re: Blink ability and attached cards

Postby thefiremind » 08 May 2012, 08:59

kevlahnota wrote:It ceases to exist the next time state-based actions are checked; see rule 704.
So if state-based actions aren't checked while going away and coming back, the token really returns.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times

Re: Blink ability and attached cards

Postby kevlahnota » 08 May 2012, 10:22

hmmm. just checked gatherer i think this must be the correct one:

9/25/2006 When Momentary Blink resolves, the creature is exiled, then immediately returned to the battlefield. The game sees the returning card as a different permanent from the one that left the battlefield. Any counters, Auras, and so on are removed. Any spells or abilities targeting the creature no longer target it.
9/25/2006 Any "as this enters the battlefield" choices for the affected creature are made by its owner, not its old controller.
2/1/2007 If Momentary Blink is cast on a token creature, the token will not return to the battlefield, because of the rule that says a token that leaves the battlefield can't come back.

User avatar
kevlahnota
Programmer
 
Posts: 825
Joined: 19 Jul 2010, 17:45
Location: Philippines
Has thanked: 14 times
Been thanked: 264 times

Re: Blink ability and attached cards

Postby thefiremind » 08 May 2012, 11:07

OK, finally a ruling we can trust! So the problems should be all solved by using separate actions.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times

Re: Blink ability and attached cards

Postby Pesi » 08 May 2012, 14:08

Checking state-based actions inbetween will bug it up even further; including, but not limited to, causing Copperhoof Vorrac to die when it shouldn't. I've come to believe that the game simply doesn't treat things that enter the battlefield as "new" things, and that this is something we can't do anything about. As evidence, I present the following bug report which was hidden away in an otherwise unremarkable post on the wizards forums:

Player1 equips something to a creature. Player2 responds to the equip by sending the equipment back to Player1's hand. Before the equip resolves, Player1 uses Stoneforge Mystic to put it back into play. The equip resolves and equips it.

Instead of checking state-based actions inbetween, I would suggest something like:

1) Exile it
2) If it's not a token, return it.
3) Unattatch all children.

Finally...
110.5g A token that has left the battlefield can't move to another zone or come back onto the battlefield. If such a token would change zones, it remains in its current zone instead. It ceases to exist the next time state-based actions are checked; see rule 704.
Did everybody miss the underlined bit?
Sorry, this hit a pet peeve.

P.S. How do I keep the post from displaying cardnames that aren't meant to be cardnames?
Pesi
 
Posts: 21
Joined: 03 May 2012, 15:19
Has thanked: 0 time
Been thanked: 0 time

Re: Blink ability and attached cards

Postby thefiremind » 08 May 2012, 15:55

Pesi wrote:I've come to believe that the game simply doesn't treat things that enter the battlefield as "new" things, and that this is something we can't do anything about.
I had this feeling, that's why I never adventured myself in making cards with the "blink" mechanic. Each card gets a pointer when the game starts, and it's always the same pointer no matter where the card goes. I thought the game implemented some check about it, something like "if a card leaves play, clear it from all the targets"... but your example with Stoneforge Mystic shows that there's nothing like that.

Pesi wrote:P.S. How do I keep the post from displaying cardnames that aren't meant to be cardnames?
I think it's not possible, but it's not much of a problem. :wink:
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times

Re: Blink ability and attached cards

Postby sadlyblue » 08 May 2012, 19:25

We can only hope they will fix this on dotp 2013.
That's one of the reasons i'm not coding anything at the time. The new game may not be fully compatible with the current one, and it's a few months away.
But i also thought that leaving play would clear targets. Guess they left a lot of things undone.
sadlyblue
 
Posts: 175
Joined: 06 Feb 2012, 13:18
Has thanked: 18 times
Been thanked: 16 times

Re: Blink ability and attached cards

Postby MisterBenn » 10 May 2012, 01:12

I am satisfied that while I didn't know what I was doing, it was at least a nontrivial issue. :)

I've been distracted by playing Warlock the past couple of nights but I will be trying out your suggestion Kev. Thanks for that.
MisterBenn
 
Posts: 97
Joined: 19 Mar 2011, 16:19
Has thanked: 24 times
Been thanked: 11 times

Re: Blink ability and attached cards

Postby thefiremind » 30 May 2012, 11:42

I don't want to open a new topic for this, and since it's quite on topic with this one, I'll write it here. I coded Flickerform and it seems it works well:
Code: Select all
<?xml version='1.0'?>
<CARD_V2 custom="true">
  <FILENAME text="FLICKERFORM_19991796" />
  <CARDNAME text="FLICKERFORM" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Flickerform]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Guizzoforma]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Flackernde Form]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Danseforme]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Forma fluctuante]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[ちらつく形態]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="19991796" />
  <ARTID value="19991796" />
  <FRAMECOLOUR name="W" />
  <COLOUR value="W" />
  <ARTIST name="Ron Spears" />
  <CASTING_COST cost="{1}{W}" />
  <TYPE metaname="Enchantment" order_de-DE="0" order_es-ES="0" order_fr-FR="0" order_it-IT="0" order_jp-JA="0" />
  <SUB_TYPE metaname="Aura" order_de-DE="0" order_es-ES="0" order_fr-FR="0" order_it-IT="0" order_jp-JA="0" />
  <EXPANSION value="RA" />
  <RARITY metaname="R" />
  <SPELL_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Enchant creature]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Enchanter : créature]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Kreaturenverzauberung]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Encantar criatura.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Incanta creatura]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[エンチャント(クリーチャー)]]></LOCALISED_TEXT>
    <TARGET_DETERMINATION>
    local filter = Object():GetFilter()
    filter:Clear()
    filter:AddCardType( CARD_TYPE_CREATURE )
    filter:SetZone( ZONE_IN_PLAY )
    return TargetGoodF()
    </TARGET_DETERMINATION>
    <RESOLUTION_TIME_ACTION>
    Object():AttachmentFilter_Get():Clear()
    Object():AttachmentFilter_Get():AddCardType( CARD_TYPE_CREATURE )
    Object():Enchant( Object():GetTargetCard() )
    </RESOLUTION_TIME_ACTION>
    <PLAY_TIME_ACTION target_choosing="1">
    ChooseTarget( "CARD_QUERY_CHOOSE_CREATURE_TO_ENCHANT" )
    </PLAY_TIME_ACTION>
  </SPELL_ABILITY>
  <ACTIVATED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{2}{W}{W}: Exile enchanted creature and all Auras attached to it. At the beginning of the next end step, return that card to the battlefield under its owner’s control. If you do, return those Auras to the battlefield under their owners’ control attached to that creature.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[{2}{W}{W}: Esilia la creatura incantata e tutte le Aura ad essa assegnate. All’inizio della prossima sottofase finale, rimetti quella carta sul campo di battaglia sotto il controllo del suo proprietario. Se lo fai, rimetti quelle Aure sul campo di battaglia sotto il controllo dei rispettivi proprietari assegnate a quella creatura.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[{2}{W}{W}: Entferne die verzauberte Kreatur und alle an sie angelegten Auren ganz aus dem Spiel. Bringe diese Karte am Ende des Zuges unter der Kontrolle ihres Besitzers zurück. Falls du dies tust, bringe diese Auren unter der Kontrolle ihres Besitzers ins Spiel zurück, so dass sie diese Kreatur verzaubern.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[{2}{W}{W} : Retirez la créature enchantée et toutes les auras qui lui sont attachées de la partie. À la fin du tour, renvoyez cette carte en jeu sous le contrôle de son propriétaire. Si vous faites ainsi, renvoyez ces auras en jeu sous le contrôle de leurs propriétaires et enchantant cette créature.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[{2}{W}{W}: Remueve del juego la criatura encantada y todas las auras anexadas a ella. Al final del turno, regresa esa carta al juego bajo el control de su propietario. Si lo haces, regresa esas auras al juego bajo el control de sus propietarios encantando a esa criatura.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[{2}{W}{W}:エンチャントされているクリーチャーと、それにつけられているすべてのオーラをゲームから取り除く。 ターン終了時に、そのカードをオーナーのコントロール下で場に戻す。 そうした場合、それらのオーラをそれぞれのオーナーのコントロール下で、そのクリーチャーにエンチャントされている状態で場に戻す。]]></LOCALISED_TEXT>
    <COST type="mana" cost="{2}{W}{W}" />
    <FILTER>
    return FilteredCard() ~= nil and FilteredCard():GetParent() == Object():GetParent()
    </FILTER>
    <RESOLUTION_TIME_ACTION>
    local parent = Object():GetParent()
    if parent ~= nil and parent:GetZone() == ZONE_IN_PLAY then
      Storage( Object() ).set( 0, parent )
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    if FilteredCard():GetZone() == ZONE_IN_PLAY then
      Storage( Object() ).push( FilteredCard() )
      FilteredCard():RemoveFromGame()
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local parent = Storage( Object() ).get( 0 )
    if parent ~= nil and parent:GetZone() == ZONE_IN_PLAY then
      parent:RemoveFromGame()
    end
    </RESOLUTION_TIME_ACTION>
  </ACTIVATED_ABILITY>
  <TRIGGERED_ABILITY auto_skip="1" active_zone="any" zone="any">
    <TRIGGER value="BEGINNING_OF_STEP">
    return MTG():GetStep() == STEP_END_OF_TURN and TriggeredForMe() and Storage( Object() ).get( 0 ) ~= nil
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    local parent = Storage( Object() ).get( 0 )
    if parent ~= nil and parent:GetZone() == ZONE_REMOVED_FROM_GAME and parent:IsToken() == 0 then
      parent:PutIntoPlay( parent:GetOwner() )
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local store = Storage( Object() )
    local parent = store.get( 0 )
    if parent ~= nil and parent:GetZone() == ZONE_IN_PLAY then
      local count = store.count()
      for i=1,count do
        local card = store.get( i )
        if card ~= nil and card:GetZone() == ZONE_REMOVED_FROM_GAME then
          if card:GetSubType():Test( ENCHANTMENT_TYPE_AURA ) ~= 0 then
            card:PutIntoPlayAttachedTo( card:GetOwner(), parent )
          else
            card:PutIntoPlay( card:GetOwner() )
          end
        end
      end
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    Storage( Object() ).clear()
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
</CARD_V2>
Of course you need nabeshin's storage.
It wasn't easy because I needed to put the enchanted creature in a separate and recognizable register, in order to make it come back first. Initially I was filtering auras and enchanted creature together, but that way I couldn't recognize the enchanted creature because it had already stopped being a parent. I finally implemented the best sequence of actions, which is the following:
  • Save the enchanted creature
  • Save and exile the auras
  • Exile the enchanted creature
I hope it can be useful. :)
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times


Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 8 guests


Who is online

In total there are 8 users online :: 0 registered, 0 hidden and 8 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 8 guests

Login Form