It is currently 26 Apr 2024, 13:52
   
Text Size

Miracle

Moderator: CCGHQ Admins

Miracle

Postby BlindWillow » 24 Oct 2012, 21:14

Might as well post what I've come up with for the Miracle ability, while I'm at it (I've only tested this on Temporal Mastery):

Code: Select all
  <TRIGGERED_ABILITY auto_skip="1" active_zone="ZONE_ANY">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Miracle {1}{U}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Miracolo {1}{U}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Mirakulum {1}{U}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Miracle {1}{U}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Milagro {1}{U}.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[奇跡 {1}{U}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[기적 {1}{U}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Чудо {1}{U}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Milagre {1}{U}]]></LOCALISED_TEXT>
    <TRIGGER value="DREW_CARD">
    return ( TriggerPlayer() == EffectController() and MTG():Interrogate_CardsDrawnThisTurn(EffectController()) &lt; 2 and ObjectDC():Get_Int(0) == 1 )
    </TRIGGER>
    <COST type="Mana" cost="{1}{U}" qualifier="conditional" />
    <RESOLUTION_TIME_ACTION conditional="if">
    Object():PlayFreeFromAnywhere( EffectController() )   
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY internal="1" active_zone="ZONE_ANY">
    <TRIGGER value="ZONECHANGE_CONSIDERED" simple_qualifier="self" from_zone="ZONE_LIBRARY" to_zone="ZONE_HAND">
    if ObjectDC():Get_Int(0) ~= 1 then
   ObjectDC():Set_Int(0, 1)
   return true
    end
    return false
    </TRIGGER>
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY internal="1" active_zone="ZONE_ANY">
    <TRIGGER value="ZONECHANGE_END" simple_qualifier="self" from_zone="ZONE_LIBRARY" to_zone="ZONE_HAND">
    if ObjectDC():Get_Int(0) == 1 then
   ObjectDC():Set_Int(0, 0)
   return true
    end
    return false
    </TRIGGER>
  </TRIGGERED_ABILITY>
BlindWillow
 
Posts: 213
Joined: 19 Jul 2012, 00:26
Has thanked: 11 times
Been thanked: 46 times

Re: Miracle

Postby pcastellazzi » 25 Oct 2012, 13:22

You may find my own here. I made different choices about the triggers, i only used a zone change trigger, and checked for MTG():Interrogate_CardsDrawnThisTurn() == 1. Meaning at the time of evaluation the current card is the first card drawn.

Your aproach to actually paying the miracle cost is a lot better than mine. I used a Object():TapLands() in a resolution action which works but is not as user friendly as it should. Also does not work for {X}.
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: Miracle

Postby BlindWillow » 25 Oct 2012, 15:57

pcastellazzi wrote:You may find my own here. I made different choices about the triggers, i only used a zone change trigger, and checked for MTG():Interrogate_CardsDrawnThisTurn() == 1. Meaning at the time of evaluation the current card is the first card drawn.
I was initially going to go solely with zone change triggers, but I wanted to be absolutely sure that the ability triggers only on actual card draw. It's probably just paranoia, but I think there could actually be instances where you've drawn a different card and something puts a miracle card into your hand via a non-draw method. That would satisfy the interrogation, but shouldn't trigger the miracle ability. It's not a likely event, to be sure, and it probably doesn't matter one way or the other.

I do recommend the conditional cost route for the reasons you mention.
BlindWillow
 
Posts: 213
Joined: 19 Jul 2012, 00:26
Has thanked: 11 times
Been thanked: 46 times

Re: Miracle

Postby RiiakShiNal » 25 Oct 2012, 17:16

A miracle card could be put into hand via a non-draw method such as a Demonic Tutor. Player draws a Demonic Tutor searches for a miracle card which is then put in hand (but not drawn). In that case the zone changed from Library to Hand, but not due to a draw event so using the DREW_CARD trigger is more than likely the better solution.
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: Miracle

Postby BlindWillow » 25 Oct 2012, 17:56

RiiakShiNal wrote:A miracle card could be put into hand via a non-draw method such as a Demonic Tutor. Player draws a Demonic Tutor searches for a miracle card which is then put in hand (but not drawn). In that case the zone changed from Library to Hand, but not due to a draw event so using the DREW_CARD trigger is more than likely the better solution.
I was more worried about instant search effects (for some reason the only one that comes to mind right now is Gifts Ungiven) happening during another player's turn (when you wouldn't have already drawn a card). In any case, I see no reason not to play it safe here.
BlindWillow
 
Posts: 213
Joined: 19 Jul 2012, 00:26
Has thanked: 11 times
Been thanked: 46 times

Re: Miracle

Postby RiiakShiNal » 25 Oct 2012, 18:09

I just gave one example of how someone could put a miracle card into their hand without drawing it, I never said it was the only possibility. Archmage Ascension with say an Archivist could be used to search for cards in instant time basically at will. You could even use a Howling Mine to get counters faster and search for even more cards.
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: Miracle

Postby BlindWillow » 25 Oct 2012, 20:41

RiiakShiNal wrote:I just gave one example of how someone could put a miracle card into their hand without drawing it, I never said it was the only possibility. Archmage Ascension with say an Archivist could be used to search for cards in instant time basically at will. You could even use a Howling Mine to get counters faster and search for even more cards.
My code should be able to handle that (I hope), but I see I'll have to do some testing later tonight.
BlindWillow
 
Posts: 213
Joined: 19 Jul 2012, 00:26
Has thanked: 11 times
Been thanked: 46 times

Re: Miracle

Postby BlindWillow » 26 Oct 2012, 04:10

That does cause problems. Not sure why an overridden draw ability still triggers the "drew card" trigger, but apparently it does. Maybe it is considered as having triggered before the override? Anyway, back to the drawing board...
BlindWillow
 
Posts: 213
Joined: 19 Jul 2012, 00:26
Has thanked: 11 times
Been thanked: 46 times

Re: Miracle

Postby thefiremind » 26 Oct 2012, 08:39

BlindWillow wrote:That does cause problems. Not sure why an overridden draw ability still triggers the "drew card" trigger, but apparently it does. Maybe it is considered as having triggered before the override? Anyway, back to the drawing board...
If it works like DotP2012, the override variable is shared between triggers of the same type, so if you don't want 2 overriding triggers to "overlap", make them trigger only if override == 0 (or override == true, I always forget which one works). That would mean that no other trigger is already overriding.
< 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: Miracle

Postby BlindWillow » 26 Oct 2012, 09:46

Never mind. False alarm. I just hadn't copied over my newer code to my laptop. :lol: The old code had a zone change trigger instead of a card draw trigger, so of course it would trigger.

Edit: Even worse than that. Apparently I have been working on a file that included both my old code and new code (forgot to delete the old after copying what I needed from it, I assume). From the top, the miracle code is off-screen, and from the bottom, only the miracle code is on-screen. I have been happily pressing ctrl+end to work on the miracle ability, never realizing that the entire time the game has merely been reading my old code at the top. #-o It really is back to the drawing board...
BlindWillow
 
Posts: 213
Joined: 19 Jul 2012, 00:26
Has thanked: 11 times
Been thanked: 46 times

Re: Miracle

Postby BlindWillow » 26 Oct 2012, 13:40

Alright, here we go (and this time I'll post the whole xml file so someone can check if I'm doing something careless):

Code: Select all
<?xml version='1.0'?>
<CARD_V2>
  <FILENAME text="TEMPORAL_MASTERY_38240133" />
  <CARDNAME text="TEMPORAL_MASTERY" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Temporal Mastery]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Dominio Temporale]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Zeitliche Überlegenheit]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Maîtrise temporelle]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Maestría del tiempo]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[時間の熟達]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[시간의 지배]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Управление Временем]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Maestria Temporal]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="38240133" />
  <ARTID value="38240133" />
  <ARTIST name="Franz Vohwinkel" />
  <CASTING_COST cost="{5}{U}{U}" />
  <FLAVOURTEXT>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Time is a marvelous plaything.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Il tempo è un giocattolo prodigioso.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Zeit ist ein wundersames Spielzeug.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Le temps est un merveilleux terrain de jeu.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[El tiempo es un juguete maravilloso.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[時間とは素晴らしい遊び道具である。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[시간은 놀라운 장난감이다.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Время — чудесная игрушка.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[O tempo é um brinquedo maravilhoso.]]></LOCALISED_TEXT>
  </FLAVOURTEXT>
  <TYPE metaname="Sorcery" />
  <EXPANSION value="DPG" />
  <RARITY metaname="M" />
  <SPELL_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Take an extra turn after this one. Exile Temporal Mastery.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Gioca un altro turno dopo questo. Esilia il Dominio Temporale.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Du erhältst nach diesem Zug einen weiteren Zug. Schicke Zeitliche Überlegenheit ins Exil.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Jouez un tour supplémentaire après celui-ci. Exilez la Maîtrise temporelle.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Toma un turno adicional después de éste. Exilia la Maestría del tiempo.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[このターンの後に追加の1ターンを行う。 時間の熟達を追放する。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[이 턴이 끝난 후 추가로 턴을 가진다. 시간의 지배를 추방한다.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Сделайте дополнительный ход вслед за этим. Изгоните Управление Временем.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Jogue um turno extra após este. Exile Maestria Temporal.]]></LOCALISED_TEXT>
    <RESOLUTION_TIME_ACTION>
    if EffectController() ~= nil then
       EffectController():GetTeam():TakeExtraTurn() 
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    Object():SetResolutionZone(ZONE_REMOVED_FROM_GAME)
    </RESOLUTION_TIME_ACTION>
    <SFX text="GLOBAL_WARP_PLAY" />
  </SPELL_ABILITY>
  <TRIGGERED_ABILITY internal="1" active_zone="ZONE_ANY">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Miracle {1}{U}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Miracolo {1}{U}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Mirakulum {1}{U}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Miracle {1}{U}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Milagro {1}{U}.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[奇跡 {1}{U}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[기적 {1}{U}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Чудо {1}{U}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Milagre {1}{U}]]></LOCALISED_TEXT>
    <TRIGGER value="DREW_CARD" simple_qualifier="controller">
    if MTG():Interrogate_CardsDrawnThisTurn(EffectController()) == 1 then
   ObjectDC():Set_Int(0, 1)
   return true
    end
    return false
    </TRIGGER>
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY forced_skip="1" active_zone="ZONE_ANY">
    <TRIGGER value="ZONECHANGE_BEGIN" simple_qualifier="self" to_zone="ZONE_HAND" from_zone="ZONE_LIBRARY">
    return ( ObjectDC():Get_Int(0) == 1 and EffectController():CanAfford("{1}{U}") == 1 )
    </TRIGGER>
    <COST type="Mana" cost="{1}{U}" qualifier="conditional" />
    <RESOLUTION_TIME_ACTION conditional="if">
    Object():PlayFreeFromAnywhere( EffectController() )   
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY internal="1" active_zone="ZONE_ANY">
    <TRIGGER value="ZONECHANGE_END" to_zone="ZONE_HAND" from_zone="ZONE_LIBRARY">
    if ObjectDC():Get_Int(0) == 1 then
   ObjectDC():Set_Int(0, 0)
   return true
    end
    return false
    </TRIGGER>
  </TRIGGERED_ABILITY>
  <HELP title="MORE_INFO_MIRACLE_TITLE_1138" body="MORE_INFO_MIRACLE_BODY_1138" zone="ZONE_ANY" />
</CARD_V2>
Conditions tested:
1) draw step draw
2) draw effect positive (i.e. multiple cards drawn with Temporal Mastery the first)
3) draw effect negative (i.e. multiple cards drawn with TM not the first)
4) overridden draw effect
5) card search
Everything seems to be working, but I would definitely appreciate confirmation from someone else.
BlindWillow
 
Posts: 213
Joined: 19 Jul 2012, 00:26
Has thanked: 11 times
Been thanked: 46 times

Re: Miracle

Postby BlindWillow » 26 Oct 2012, 21:39

Man, I feel like this ability is more of a curse than a miracle. I swear the only thing I changed after testing it this morning was the cost of the ability and CanAfford check (I had it set to {1} for testing). Now I get back and try it and see it's not working at all.

Well, I don't know why I didn't just go with a delayed trigger in the first place, but that's what I'll switch to now. I'm thinking I'll have to use a state based effects trigger and make sure it triggers just once.
BlindWillow
 
Posts: 213
Joined: 19 Jul 2012, 00:26
Has thanked: 11 times
Been thanked: 46 times

Re: Miracle

Postby pcastellazzi » 28 Oct 2012, 17:06

BlindWillow wrote:Well, I don't know why I didn't just go with a delayed trigger in the first place, but that's what I'll switch to now. I'm thinking I'll have to use a state based effects trigger and make sure it triggers just once.
Code: Select all
<TRIGGERED_ABILITY active_zone="ZONE_HAND" internal="1">
  <!-- text shown in the card -->
  <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Miracle {G}]]></LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Mirakulum {G}]]></LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Milagro {G}]]></LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Miracle {G}]]></LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Miracolo {G}]]></LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[奇跡 {G}]]></LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[기적 {G}]]></LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Чудо {G}]]></LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Milagre {G}]]></LOCALISED_TEXT>

  <TRIGGER value="ZONECHANGE_END" to_zone="ZONE_HAND" from_zone="ZONE_LIBRARY" simple_qualifier="self" />

  <RESOLUTION_TIME_ACTION>
  <![CDATA[
    local chest = EffectDC():Make_Chest(1)
    chest:Set_CardPtr(0, Object())
    MTG():CreateDelayedTrigger(1, chest)
  ]]>
  </RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
<HELP title="MORE_INFO_TITLE_MIRACLE" body="MORE_INFO_BODY_MIRACLE" zone="ZONE_ANY" />

<TRIGGERED_ABILITY active_zone="ZONE_HAND" resource_id="1">
  <!-- text shown in the conditional cost dialog -->
  <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Miracle {G} (You may cast this card for its miracle cost when you draw it if it's the first card you drew this turn.)]]></LOCALISED_TEXT>^
  <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Mirakulum {G} (Du kannst diese Karte zu ihren Mirakulum-Kosten wirken, wenn du sie ziehst, falls es die erste Karte ist, die du in diesem Zug gezogen hast.)]]></LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Milagro {G}. (Puedes lanzar esta carta pagando su coste de milagro cuando la robes si es la primera carta que robaste este turno.)]]></LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Miracle {G} (Vous pouvez lancer cette carte pour son coût de miracle quand vous la piochez si c'est la première carte que vous avez piochée ce tour-ci.)]]></LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Miracolo {G} (Puoi lanciare questa carta pagando il suo costo di miracolo quando la peschi, se è la prima che hai pescato in questo turno.)]]></LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[奇跡 {G} (あなたがこのカードを引いたとき、これがこのターンに最初に引いたカードだった場合、あなたはこれの奇跡コストを支払うこと>でこれを唱えてもよい。)]]></LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[기적 {G} (당신이 이 카드를 뽑을 때, 이 카드가 당신이 이번 턴에 뽑은 첫 번째 카드라면 당신은 기적 비용을 지불하고 이 카드를 발동>할 수 있다.)]]></LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Чудо {G} (Вы можете разыграть эту карту за ее стоимость Чуда, когда вы берете ее, если это первая карта, которую вы взяли в этом ходу).]]></LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Milagre {G} (Você pode conjurar este card pagando seu custo de milagre ao comprá-lo se este for o primeiro card que você compra neste turno.)]]></LOCALISED_TEXT>

  <CLEANUP fire_once="1" />

  <TRIGGER value="DREW_CARD" simple_qualifier="controller">
  <![CDATA[
    return MTG():Interrogate_CardsDrawnThisTurn(TriggerPlayer()) == 1
  ]]>
  </TRIGGER>

  <COST type="Mana" cost="{G}" qualifier="conditional" />

  <RESOLUTION_TIME_ACTION conditional="if">
  <![CDATA[
    Object():PlayFreeFromAnywhere(EffectController())
  ]]>
  </RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
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: Miracle

Postby BlindWillow » 28 Oct 2012, 20:38

pcastellazzi wrote:
Code: Select all
<TRIGGERED_ABILITY active_zone="ZONE_HAND" internal="1">
  <!-- text shown in the card -->
  <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Miracle {G}]]></LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Mirakulum {G}]]></LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Milagro {G}]]></LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Miracle {G}]]></LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Miracolo {G}]]></LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[奇跡 {G}]]></LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[기적 {G}]]></LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Чудо {G}]]></LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Milagre {G}]]></LOCALISED_TEXT>

  <TRIGGER value="ZONECHANGE_END" to_zone="ZONE_HAND" from_zone="ZONE_LIBRARY" simple_qualifier="self" />

  <RESOLUTION_TIME_ACTION>
  <![CDATA[
    local chest = EffectDC():Make_Chest(1)
    chest:Set_CardPtr(0, Object())
    MTG():CreateDelayedTrigger(1, chest)
  ]]>
  </RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
<HELP title="MORE_INFO_TITLE_MIRACLE" body="MORE_INFO_BODY_MIRACLE" zone="ZONE_ANY" />

<TRIGGERED_ABILITY active_zone="ZONE_HAND" resource_id="1">
  <!-- text shown in the conditional cost dialog -->
  <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Miracle {G} (You may cast this card for its miracle cost when you draw it if it's the first card you drew this turn.)]]></LOCALISED_TEXT>^
  <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Mirakulum {G} (Du kannst diese Karte zu ihren Mirakulum-Kosten wirken, wenn du sie ziehst, falls es die erste Karte ist, die du in diesem Zug gezogen hast.)]]></LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Milagro {G}. (Puedes lanzar esta carta pagando su coste de milagro cuando la robes si es la primera carta que robaste este turno.)]]></LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Miracle {G} (Vous pouvez lancer cette carte pour son coût de miracle quand vous la piochez si c'est la première carte que vous avez piochée ce tour-ci.)]]></LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Miracolo {G} (Puoi lanciare questa carta pagando il suo costo di miracolo quando la peschi, se è la prima che hai pescato in questo turno.)]]></LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[奇跡 {G} (あなたがこのカードを引いたとき、これがこのターンに最初に引いたカードだった場合、あなたはこれの奇跡コストを支払うこと>でこれを唱えてもよい。)]]></LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[기적 {G} (당신이 이 카드를 뽑을 때, 이 카드가 당신이 이번 턴에 뽑은 첫 번째 카드라면 당신은 기적 비용을 지불하고 이 카드를 발동>할 수 있다.)]]></LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Чудо {G} (Вы можете разыграть эту карту за ее стоимость Чуда, когда вы берете ее, если это первая карта, которую вы взяли в этом ходу).]]></LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Milagre {G} (Você pode conjurar este card pagando seu custo de milagre ao comprá-lo se este for o primeiro card que você compra neste turno.)]]></LOCALISED_TEXT>

  <CLEANUP fire_once="1" />

  <TRIGGER value="DREW_CARD" simple_qualifier="controller">
  <![CDATA[
    return MTG():Interrogate_CardsDrawnThisTurn(TriggerPlayer()) == 1
  ]]>
  </TRIGGER>

  <COST type="Mana" cost="{G}" qualifier="conditional" />

  <RESOLUTION_TIME_ACTION conditional="if">
  <![CDATA[
    Object():PlayFreeFromAnywhere(EffectController())
  ]]>
  </RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
Thanks for the help. This ability is a tough one. My testing of the above code indicates there's still a problem with a multiple card draw. When I put TM on top of the library and draw several cards (in my testing with a Tezzeret's Gambit) it doesn't trigger.

This is what I came up with:

Code: Select all
  <TRIGGERED_ABILITY internal="1" active_zone="ZONE_LIBRARY">
    <TRIGGER value="BEGINNING_OF_TURN">
    if ObjectDC():Get_Int(0) == 1 then
   ObjectDC():Set_Int(0, 0)
   return TriggeredForMe()
    end
    return false
    </TRIGGER>
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY internal="1" active_zone="ZONE_LIBRARY">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Miracle {1}{U}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Miracolo {1}{U}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Mirakulum {1}{U}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Miracle {1}{U}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Milagro {1}{U}.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[奇跡 {1}{U}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[기적 {1}{U}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Чудо {1}{U}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Milagre {1}{U}]]></LOCALISED_TEXT>
    <TRIGGER value="STATE_BASED_EFFECTS">
    if ( EffectController():Library_GetNth(0) == Object() and ObjectDC():Get_Int(0) ~= 1 ) then
   ObjectDC():Set_Int(0, 1)
   local delayDC = EffectDC():Make_Chest(1)
   delayDC:Set_CardPtr(0, Object())
   MTG():CreateDelayedTrigger(1, delayDC)
   return TriggeredForMe()
    end
    return false
    </TRIGGER>
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY forced_skip="1" active_zone="ZONE_ANY" resource_id="1">
    <CLEANUP simple_cleanup="EndOfTurn" />
    <TRIGGER value="DREW_CARD" simple_qualifier="controller">
    return ( TriggerPlayer() == EffectController() and EffectController():CanAfford("{1}{U}") == 1 and EffectDC():Get_CardPtr(0) == Object() )
    </TRIGGER>
    <COST type="Mana" cost="{1}{U}" qualifier="conditional" />
    <RESOLUTION_TIME_ACTION conditional="if">
    Object():PlayFreeFromAnywhere( EffectController() )   
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
I sure like the look of your cleaner code, though.
BlindWillow
 
Posts: 213
Joined: 19 Jul 2012, 00:26
Has thanked: 11 times
Been thanked: 46 times

Re: Miracle

Postby thefiremind » 28 Oct 2012, 22:20

BlindWillow wrote:When I put TM on top of the library and draw several cards (in my testing with a Tezzeret's Gambit) it doesn't trigger.
That's probably because when you draw more than 1 card without checking state-based effects in between, the ZONECHANGE trigger sets the delayed DREW_CARD trigger ready to be fired, but when it's time to see if it can actually be fired, the cards you drew are already more than 1, and the delayed trigger fails.
Too bad that the DREW_CARD trigger carries only the player who drew, and not the drawn card, otherwise it would be really easy.

Did someone try to use a pre_trigger DREW_CARD trigger? If it fires when the miracle card is still on top of the library, you can actually check that it's the card you are about to draw. Something like:
Code: Select all
  <TRIGGERED_ABILITY internal="1" pre_trigger="1" active_zone="ZONE_LIBRARY">
    <TRIGGER value="DREW_CARD">
    if TriggerPlayer() == EffectController() and
    EffectController():Library_GetNth(0) == Object() and
    MTG():Interrogate_CardsDrawnThisTurn(EffectController()) == 0 then
       local delayDC = EffectDC():Make_Chest(1)
       delayDC:Set_CardPtr(0, Object())
       delayDC:Protect_CardPtr(0)
       MTG():CreateDelayedTrigger(1, delayDC)
    end
    return false
    </TRIGGER>
  </TRIGGERED_ABILITY>

  <TRIGGERED_ABILITY forced_skip="1" active_zone="ZONE_ANY" resource_id="1">
    <CLEANUP simple_cleanup="EndOfTurn" />
    <TRIGGER value="ZONECHANGE_END" to_zone="ZONE_HAND" from_zone="ZONE_LIBRARY" />
    return EffectDC():Get_CardPtr(0) ~= nil and TriggerObject() == EffectDC():Get_CardPtr(0)
    </TRIGGER>
    <COST type="Mana" cost="{1}{U}" qualifier="conditional" />
    <RESOLUTION_TIME_ACTION conditional="if">
    if EffectDC():Get_CardPtr(0) ~= nil then
       EffectDC():Get_CardPtr(0):PlayFreeFromAnywhere(EffectController())
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
I wrote "== 0" instead of "== 1" because the draw hasn't happened yet. About the Protect_CardPtr, I'm not 100% sure if it's needed, but the card moves from the library to the hand, so I think that the pointer needs protection from 1 zone change. See if you can get something good out of this (given that the pre_trigger works as I would expect).
< 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

Next

Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 47 guests


Who is online

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

Login Form