It is currently 11 May 2025, 10:30
   
Text Size

Help with Buyback

Moderator: CCGHQ Admins

Help with Buyback

Postby Zambooo » 30 Jul 2012, 12:34

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)
Last edited by Zambooo on 30 Jul 2012, 14:22, edited 1 time in total.
User avatar
Zambooo
 
Posts: 242
Joined: 01 Jul 2012, 21:33
Has thanked: 19 times
Been thanked: 17 times

Re: Help with Buyback

Postby thefiremind » 30 Jul 2012, 13:48

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)
< 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: 722 times

Re: Help with Buyback

Postby Zambooo » 30 Jul 2012, 14:22

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
User avatar
Zambooo
 
Posts: 242
Joined: 01 Jul 2012, 21:33
Has thanked: 19 times
Been thanked: 17 times

Re: Help with Buyback

Postby thefiremind » 30 Jul 2012, 15:10

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).
< 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: 722 times

Re: Help with Buyback

Postby Zambooo » 30 Jul 2012, 16:55

The "Kicked effect" still remain even with your solution...
User avatar
Zambooo
 
Posts: 242
Joined: 01 Jul 2012, 21:33
Has thanked: 19 times
Been thanked: 17 times

Re: Help with Buyback

Postby thefiremind » 30 Jul 2012, 18:07

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)
< 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: 722 times


Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 5 guests


Who is online

In total there are 5 users online :: 0 registered, 0 hidden and 5 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 5 guests

Login Form