It is currently 10 May 2025, 06:42
   
Text Size

Casting from graveyard

Moderator: CCGHQ Admins

Casting from graveyard

Postby BlindWillow » 25 Aug 2012, 17:56

Working on a "you may cast _____ from your graveyard" ability (specifically for Skaab Ruinator). What I've come up with so far is basically to give the card a Flashback cost and then use a pre-triggered ability to prevent the exile from happening. It also checks to see if something else is going on while it's on the stack, so if someone casts something like Dissipate on it, it won't prevent that from exiling it. I just wanted to see if anyone had any ideas on whether that would cause other problems or if there is actually a better way to do it altogether. Here's the code:

Code: Select all
  <TRIGGERED_ABILITY internal="1" active_zone="ZONE_STACK">
    <TRIGGER value="SPELL_PLAYED">
    if Object():GetZone() == ZONE_STACK then
   ObjectDC():Set_Int(0, 1)
    end
    return false
    </TRIGGER>
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY internal="1" active_zone="ZONE_STACK">
    <TRIGGER value="ABILITY_PLAYED">
    if Object():GetZone() == ZONE_STACK then
   ObjectDC():Set_Int(0, 1)
    end
    return false
    </TRIGGER>
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY internal="1" active_zone="ZONE_STACK">
    <TRIGGER value="SPELL_ABOUT_TO_RESOLVE" simple_qualifier="self">
    if ObjectDC():Get_Int(0) == 1 then
   ObjectDC():Set_Int(0, 0)
    end
    return false
    </TRIGGER>
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY internal="1" pre_trigger="1" active_zone="ZONE_STACK">
    <TRIGGER value="ZONECHANGE_CONSIDERED" simple_qualifier="self" to_zone="ZONE_REMOVED_FROM_GAME"

from_zone="ZONE_STACK">
    return ObjectDC():Get_Int(0) ~= 1
    </TRIGGER>
  </TRIGGERED_ABILITY>
BlindWillow
 
Posts: 213
Joined: 19 Jul 2012, 00:26
Has thanked: 11 times
Been thanked: 46 times

Re: Casting from graveyard

Postby thefiremind » 25 Aug 2012, 18:53

I had the same idea back in DotP2012 for Gravecrawler, and I made a DotP2013 version:
viewtopic.php?f=63&t=7759
< 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: Casting from graveyard

Postby BlindWillow » 29 Aug 2012, 14:38

Alright, here's the fully functional code for Skaab Ruinator.

Code: Select all
  <UTILITY_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[As an additional cost to cast Skaab Ruinator, exile three creature cards from your graveyard.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Come costo addizionale per lanciare lo Skaab Distruttore, esilia tre carte creatura dal tuo cimitero.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Schicke als zusätzliche Kosten, um den Skaab-Ruinierer zu wirken, drei Kreaturenkarten aus deinem Friedhof ins Exil.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[En tant que coût supplémentaire pour lancer le Skaab déprédateur, exilez trois cartes de créature de votre cimetière.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Como coste adicional para lanzar el Skaab arruinador, exilia tres cartas de criatura de tu cementerio.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[スカーブの殲滅者を唱えるための追加コストとして、あなたの墓地にあるクリーチャー・カードを3枚追放する。飛行]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[As an additional cost to cast Skaab Ruinator, exile three creature cards from your graveyard.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[В качестве дополнительной стоимости разыгрывания Скааба-Рушителя, изгоните три карты существ из вашего кладбища.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Como custo adicional para conjurar Arruinador Skaab, exile três cards de criatura de seu cemitério.]]></LOCALISED_TEXT>
    <COST type="Remove_from_game" qualifier="Additional" number="3">
      <TARGET_DEFINITION id="6">
      local filter = Object():GetFilter()
      filter:Clear()
      filter:SetZone( ZONE_GRAVEYARD )
      filter:AddCardType( CARD_TYPE_CREATURE )
      filter:SetPlayer( EffectController() )
      filter:SetHint( HINT_ALLIED, EffectController() )
      filter:NotTargetted()
      </TARGET_DEFINITION>
      <TARGET_DETERMINATION>
      return AtLeastOneTargetFromDefinition(6)
      </TARGET_DETERMINATION>
      <PLAYTIME>
      EffectController():ChooseTarget( 6, "CARD_QUERY_CHOOSE_CARD_TO_EXILE", EffectDC():Make_Targets(0) )
      </PLAYTIME></COST>
  </UTILITY_ABILITY>
  <STATIC_ABILITY active_zone="ZONE_ANY">
    <CONTINUOUS_ACTION>
    local filter = Object():GetFilter()
    filter:Clear()
    filter:SetZone( ZONE_GRAVEYARD )
    filter:SetPlayer( EffectController() )
    filter:AddCardType( CARD_TYPE_CREATURE )
    filter:SetCardInstance( Object() )
    filter:AddExtra( FILTER_EXTRA_FLIP_CARD_INSTANCE )
    filter:NotTargetted()
    if filter:CountStopAt(3) &lt; 3 then
      local characteristics = Object():GetCurrentCharacteristics()
      characteristics:Characteristic_Set( CHARACTERISTIC_CANT_BE_PLAYED, 1 )
    end
    </CONTINUOUS_ACTION>
  </STATIC_ABILITY>
  <STATIC_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Flying]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Vol]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Vuela.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Fliegend]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Volare]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[飛行]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Flying]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Полет]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Voar]]></LOCALISED_TEXT>
    <CONTINUOUS_ACTION>
    local characteristics = Object():GetCurrentCharacteristics()
    characteristics:Characteristic_Set( CHARACTERISTIC_FLYING, 1 )
    </CONTINUOUS_ACTION>
  </STATIC_ABILITY>
  <TRIGGERED_ABILITY internal="1" pre_trigger="1" active_zone="ZONE_STACK">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[You may cast Skaab Ruinator from your graveyard.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Puoi lanciare lo Skaab Distruttore dal tuo cimitero.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Du kannst den Skaab-Ruinierer aus deinem Friedhof wirken.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Vous pouvez lancer le Skaab déprédateur depuis votre cimetière.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Puedes lanzar al Skaab arruinador desde tu cementerio.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[ブの殲滅者をあなたの墓地から唱えてもよい。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[You may cast Skaab Ruinator from your graveyard.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Вы можете разыграть Скааба-Рушителя из вашего кладбища.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Você pode conjurar Arruinador Skaab de seu cemitério.]]></LOCALISED_TEXT>
    <TRIGGER value="SPELL_RESOLVED" simple_qualifier="self">
    override = 0
    return Object():GetErstwhileZone() == ZONE_GRAVEYARD
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    local delayDC = EffectDC():Make_Chest(1)
    delayDC:Set_Int(0, 1)
    MTG():CreateDelayedTrigger(1, delayDC)
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY resource_id="1" internal="1" pre_trigger="1" active_zone="ZONE_STACK">
    <CLEANUP fire_once="1" />
    <TRIGGER value="ZONECHANGE_CONSIDERED" simple_qualifier="self" to_zone="ZONE_REMOVED_FROM_GAME" from_zone="ZONE_STACK">
    return EffectDC():Get_Int(0) == 1
    </TRIGGER>
  </TRIGGERED_ABILITY>
I tested it with Dissipate. So it can be exiled on the stack by other effects.
BlindWillow
 
Posts: 213
Joined: 19 Jul 2012, 00:26
Has thanked: 11 times
Been thanked: 46 times

Re: Casting from graveyard

Postby BlindWillow » 01 Sep 2012, 04:12

Interestingly, the simple_qualifier="self" in the zone change trigger doesn't seem to suffice. I found that, after casting Skaab Ruinator from the graveyard, Dissipate wouldn't exile spells. Switching to an explicit "return TriggerObject() == Object()" fixed the problem, thankfully. Odd...
BlindWillow
 
Posts: 213
Joined: 19 Jul 2012, 00:26
Has thanked: 11 times
Been thanked: 46 times

Re: Casting from graveyard

Postby pcastellazzi » 04 Sep 2012, 04:40

BlindWillow wrote:I found that, after casting Skaab Ruinator from the graveyard, Dissipate wouldn't exile spells.
You mean any other spell, or the Skaab Ruinator you casted from the graveyard?
The lights then came up and the crowd erupted in applause, because that's what the crowd does after it watches destruction on a large screen.
— Ben Kuchera, Mordern Warfare 3 review.
User avatar
pcastellazzi
 
Posts: 184
Joined: 25 Apr 2012, 00:40
Location: Montevideo, Uruguay
Has thanked: 11 times
Been thanked: 30 times

Re: Casting from graveyard

Postby thefiremind » 04 Sep 2012, 08:21

BlindWillow wrote:Switching to an explicit "return TriggerObject() == Object()" fixed the problem, thankfully. Odd...
I didn't clearly understand how the delayed triggers are treated, pertaining to this context, yet. But I'd suggest to imagine them as "external" to the cards they belong to: sometimes simple qualifiers work anyway (if I remember well), but if you don't want to risk, avoid them in delayed triggers.
< 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: Casting from graveyard

Postby BlindWillow » 05 Sep 2012, 00:56

pcastellazzi wrote:You mean any other spell, or the Skaab Ruinator you casted from the graveyard?
It wouldn't exile any other spell until I changed to the explicit version of Skaab's trigger conditions. Further experience with delayed triggers definitely leads me to thefiremind's conclusion that it's best to be as explicit as possible with them.
BlindWillow
 
Posts: 213
Joined: 19 Jul 2012, 00:26
Has thanked: 11 times
Been thanked: 46 times


Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 18 guests


Who is online

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

Login Form