Page 1 of 1

Help with Buyback

PostPosted: 30 Jul 2012, 12:34
by Zambooo
I was trying to code the Buyback in Reiterate inspiring myself at the Zenith's effect "Then shuffle it in your library", just changing the resolution zone to ZONE_HAND. Everything worked fine except for the "Kicked effect" which still remain in my hand (I mean that the card return to my hand but the lightining still wrap it up).

Code: Select all
<?xml version='1.0'?>
<CARD_V2>
  <FILENAME text="REITERATE_109729" />
  <CARDNAME text="REITERATE" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Reiterate]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Ripetere]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="109729" />
  <ARTID value="109729" />
  <ARTIST name="Dan Scott" />
  <CASTING_COST cost="{1}{R}{R}" />
  <FLAVOURTEXT>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA["Echoes of the Mirari's power yet linger."
—Zyd, Kamahlite druid]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA["Ancora permane l'eco della potenza di Mirari."
—Zyd, druido di Kamahl]]></LOCALISED_TEXT>
  </FLAVOURTEXT>
  <TYPE metaname="Instant" />
  <EXPANSION value="DPG" />
  <RARITY metaname="R" />
 
  <UTILITY_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Buyback {3} (You may pay an additional {3} as you cast this spell. If you do, put this card into your hand as it resolves.)]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Riscatto {3} (Puoi pagare {3} addizionale mentre giochi questa magia). Se lo fai, riprendi in mano questa carta quando si risolve.)]]></LOCALISED_TEXT>
    <COST type="Mana" cost="{3}" qualifier="Kicker" />
  </UTILITY_ABILITY>

  <SPELL_ABILITY filter_zone="ZONE_IN_PLAY">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Copy target instant or sorcery spell. You may choose new targets for the copy.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Copia una magia istantaneo o stregoneria bersaglio. Puoi scegliere nuovi bersagli per la copia.]]></LOCALISED_TEXT>
    <TARGET_DEFINITION id="0">
    local filter = Object():GetFilter()
    filter:Clear()
    filter:AddCardType( CARD_TYPE_INSTANT )
    filter:AddCardType( CARD_TYPE_SORCERY )
    filter:SetZone( ZONE_STACK )
    filter:SetHint( HINT_ALLIED, EffectController() )
    </TARGET_DEFINITION>
    <TARGET_DETERMINATION>
    return AtLeastOneTargetFromDefinition(0)
    </TARGET_DETERMINATION>
    <PLAY_TIME_ACTION target_choosing="1">
    EffectController():ChooseTarget( 0, "CARD_QUERY_CHOOSE_SPELL_TO_COPY", EffectDC():Make_Targets(0) )
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
       EffectController():CopySpellWithNewTargets( target )
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
   if Object():Kicked() ~= 0 then
      Object():SetResolutionZone(ZONE_HAND)
   end
    </RESOLUTION_TIME_ACTION>
  </SPELL_ABILITY>
  <TWINCAST_TYPE_EFFECT />

  <HELP title="MORE_INFO_TITLE_KICKER" body="MORE_INFO_BODY_KICKER" zone="ZONE_ANY" />
  <AI_BASE_SCORE score="900" zone="ZONE_HAND" />
</CARD_V2>
I've also tried with
Code: Select all
   if Object():Kicked() ~= 0 then
      Object():PutInHand()
   end
but it has the same effect. Solution?

(I know thefiremind made a buyback for dotp2012 but I wasn't able to use or "convert" it to dotp2013 :s)

Re: Help with Buyback

PostPosted: 30 Jul 2012, 13:48
by thefiremind
Have you tried with a simple Object():PutInHand()? (maybe it's what you wanted to write in the second code block, but you just wrote the same code)

Re: Help with Buyback

PostPosted: 30 Jul 2012, 14:22
by Zambooo
thefiremind wrote:Have you tried with a simple Object():PutInHand()? (maybe it's what you wanted to write in the second code block, but you just wrote the same code)
yeah it's what I wanted to write :D, I've already tried it with the same effect

Re: Help with Buyback

PostPosted: 30 Jul 2012, 15:10
by thefiremind
I guess it's time to try a more complicated alternative. Try with this:
Code: Select all
  <SPELL_ABILITY filter_zone="ZONE_IN_PLAY">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Copy target instant or sorcery spell. You may choose new targets for the copy.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Copia una magia istantaneo o stregoneria bersaglio. Puoi scegliere nuovi bersagli per la copia.]]></LOCALISED_TEXT>
    <TARGET_DEFINITION id="0">
    local filter = Object():GetFilter()
    filter:Clear()
    filter:AddCardType( CARD_TYPE_INSTANT )
    filter:AddCardType( CARD_TYPE_SORCERY )
    filter:SetZone( ZONE_STACK )
    filter:SetHint( HINT_ALLIED, EffectController() )
    </TARGET_DEFINITION>
    <TARGET_DETERMINATION>
    return AtLeastOneTargetFromDefinition(0)
    </TARGET_DETERMINATION>
    <PLAY_TIME_ACTION target_choosing="1">
    EffectController():ChooseTarget( 0, "CARD_QUERY_CHOOSE_SPELL_TO_COPY", EffectDC():Make_Targets(0) )
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    if Object():Kicked() &gt; 0 then
       MTG():CreateDelayedTrigger(1, nil)
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
       EffectController():CopySpellWithNewTargets( target )
    end
    </RESOLUTION_TIME_ACTION>
  </SPELL_ABILITY>
  <TRIGGERED_ABILITY internal="1" pre_trigger="1" active_zone="ZONE_ANY" resource_id="1">
    <CLEANUP fire_once="1" />
    <TRIGGER value="ZONECHANGE_CONSIDERED" simple_qualifier="self" to_zone="ZONE_GRAVEYARD" from_zone="ZONE_STACK">
    override = 1
    TriggerObject():PutInHand()
    return true
    </TRIGGER>
  </TRIGGERED_ABILITY>
If the spell is kicked, it should fire a trigger that overrides the zone change to the graveyard. I also moved the kicker check as the first action just to be sure that the trigger has the time to perform its duty (it shouldn't be needed, but better be sure).

Re: Help with Buyback

PostPosted: 30 Jul 2012, 16:55
by Zambooo
The "Kicked effect" still remain even with your solution...

Re: Help with Buyback

PostPosted: 30 Jul 2012, 18:07
by thefiremind
I didn't understand the problem correctly until now. I'm afraid it's a visual bug related to the kicker mechanic and there's nothing we can do about it. You could make the buyback a conditional cost that is requested when the spell is played, but it wouldn't be a very clean solution... well, better than nothing.
Code: Select all
  <TRIGGERED_ABILITY priority="10" forced_skip="1" active_zone="ZONE_STACK">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Buyback {3} (You may pay an additional {3} as you cast this spell. If you do, put this card into your hand as it resolves.)]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Riscatto {3} (Puoi pagare {3} addizionale mentre giochi questa magia). Se lo fai, riprendi in mano questa carta quando si risolve.)]]></LOCALISED_TEXT>
    <TRIGGER value="SPELL_PLAYED" simple_qualifier="self" />
    <COST type="Mana" cost="{3}" qualifier="conditional" />
    <RESOLUTION_TIME_ACTION conditional="if">
    MTG():CreateDelayedTrigger(1, nil)
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>

  <SPELL_ABILITY filter_zone="ZONE_IN_PLAY">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Copy target instant or sorcery spell. You may choose new targets for the copy.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Copia una magia istantaneo o stregoneria bersaglio. Puoi scegliere nuovi bersagli per la copia.]]></LOCALISED_TEXT>
    <TARGET_DEFINITION id="0">
    local filter = Object():GetFilter()
    filter:Clear()
    filter:AddCardType( CARD_TYPE_INSTANT )
    filter:AddCardType( CARD_TYPE_SORCERY )
    filter:SetZone( ZONE_STACK )
    filter:SetHint( HINT_ALLIED, EffectController() )
    </TARGET_DEFINITION>
    <TARGET_DETERMINATION>
    return AtLeastOneTargetFromDefinition(0)
    </TARGET_DETERMINATION>
    <PLAY_TIME_ACTION target_choosing="1">
    EffectController():ChooseTarget( 0, "CARD_QUERY_CHOOSE_SPELL_TO_COPY", EffectDC():Make_Targets(0) )
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
       EffectController():CopySpellWithNewTargets( target )
    end
    </RESOLUTION_TIME_ACTION>
  </SPELL_ABILITY>
  <TRIGGERED_ABILITY internal="1" pre_trigger="1" active_zone="ZONE_ANY" resource_id="1">
    <CLEANUP fire_once="1" />
    <TRIGGER value="ZONECHANGE_CONSIDERED" simple_qualifier="self" to_zone="ZONE_GRAVEYARD" from_zone="ZONE_STACK">
    override = 1
    TriggerObject():PutInHand()
    return true
    </TRIGGER>
  </TRIGGERED_ABILITY>
(priority="10" makes it as close as possible to the real deal: it should always resolve before any similar trigger)