It is currently 07 Jul 2021, 07:22
   
Text Size

[Card help needed] Glimpse of Nature

Moderators: Xander9009, CCGHQ Admins

[Card help needed] Glimpse of Nature

Postby kevorz » 06 Aug 2012, 16:16

Hey all,

I'm currently trying to recreate Glimpse of Nature, anyhow i figured i should take Primordial Sage as an example, but it's not really working out for me at all.

Code: Select all
<?xml version='1.0'?>
<CARD_V2>
  <FILENAME text="GLIMPSE_OF_NATURE_75241" />
  <CARDNAME text="GLIMPSE_OF_NATURE" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Glimpse of Nature]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Glimpse of Nature]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Glimpse of Nature]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Glimpse of Nature]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Glimpse of Nature]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Glimpse of Nature]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Glimpse of Nature]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Glimpse of Nature]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Glimpse of Nature]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="75241" />
  <ARTID value="75241" />
  <ARTIST name="Shishizaru" />
  <CASTING_COST cost="{G}" />
  <FLAVOURTEXT>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Dosan sat in repose for many hours. He made no motion, no sound at all. And as he sat, nature revealed itself to him.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Dosan sat in repose for many hours. He made no motion, no sound at all. And as he sat, nature revealed itself to him.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Dosan sat in repose for many hours. He made no motion, no sound at all. And as he sat, nature revealed itself to him.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Dosan sat in repose for many hours. He made no motion, no sound at all. And as he sat, nature revealed itself to him.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Dosan sat in repose for many hours. He made no motion, no sound at all. And as he sat, nature revealed itself to him.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Dosan sat in repose for many hours. He made no motion, no sound at all. And as he sat, nature revealed itself to him.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Dosan sat in repose for many hours. He made no motion, no sound at all. And as he sat, nature revealed itself to him.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Dosan sat in repose for many hours. He made no motion, no sound at all. And as he sat, nature revealed itself to him.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Dosan sat in repose for many hours. He made no motion, no sound at all. And as he sat, nature revealed itself to him.]]></LOCALISED_TEXT>
  </FLAVOURTEXT>
  <TYPE metaname="Sorcery" />
  <EXPANSION value="DPG" />
  <RARITY metaname="R" />
  <SPELL_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever you cast a creature spell this turn, draw a card.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Whenever you cast a creature spell this turn, draw a card.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Whenever you cast a creature spell this turn, draw a card.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Whenever you cast a creature spell this turn, draw a card.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Whenever you cast a creature spell this turn, draw a card.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Whenever you cast a creature spell this turn, draw a card.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Whenever you cast a creature spell this turn, draw a card.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Whenever you cast a creature spell this turn, draw a card.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Whenever you cast a creature spell this turn, draw a card.]]></LOCALISED_TEXT>
   <TRIGGER value="SPELL_PLAYED" simple_qualifier="objectyoucontrol">
      return TriggerObject():GetCardType():Test( CARD_TYPE_CREATURE ) ~= 0
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
       EffectController():DrawCard()
    </RESOLUTION_TIME_ACTION>
   <DURATION simple_duration="UntilEOT" />
  </SPELL_ABILITY>
</CARD_V2>
I think my problem is SPELL_ABILITY having a trigger, and RESOLUTION_TIME_ACTION activating anyway when my sorcery resolves.

My Glimpse of Nature just draws one card this way, and nothing happens when i cast a creature afterwards.


Thanks alot for your patience and expertise :)

Greets,
Kevorz
kevorz
 
Posts: 14
Joined: 04 Aug 2012, 15:01
Has thanked: 6 times
Been thanked: 2 times

Re: [Card help needed] Glimpse of Nature

Postby thefiremind » 06 Aug 2012, 16:34

That card gave some modders a hard time in DotP2012, but in DotP2013 we have my favorite new feature: delayed triggers. :D

Before posting the code, I'll tell you that inserting a TRIGGER block inside something that isn't a TRIGGERED_ABILITY will never work. :wink:

Substitute your SPELL_ABILITY with this:
Code: Select all
  <SPELL_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever you cast a creature spell this turn, draw a card.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Ogniqualvolta lanci una magia creatura in questo turno, pesca una carta.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Immer wenn du in diesem Zug einen Kreaturenzauber wirkst, ziehe eine Karte.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[À chaque fois que vous lancez un sort de créature ce tour-ci, piochez une carte.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Siempre que lances una carta de criatura este turno, roba una carta.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[このターン、あなたがクリーチャー呪文をプレイするたび、カードを1枚引く。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Whenever you cast a creature spell this turn, draw a card.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Whenever you cast a creature spell this turn, draw a card.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Toda vez que você conjurar uma mágica de criatura neste turno, compre um card.]]></LOCALISED_TEXT>
    <RESOLUTION_TIME_ACTION>
    local delayDC = EffectDC():Make_Chest(1)
    delayDC:Set_PlayerPtr(0, EffectController())
    MTG():CreateDelayedTrigger(1, delayDC)
    </RESOLUTION_TIME_ACTION>
  </SPELL_ABILITY>
  <TRIGGERED_ABILITY auto_skip="1" resource_id="1">
    <CLEANUP simple_cleanup="EndOfTurn" />
    <TRIGGER value="SPELL_PLAYED">
    local player = EffectDC():Get_PlayerPtr(0)
    return player ~= nil and TriggerObject():GetPlayer() == player and
    TriggerObject():GetCardType():Test( CARD_TYPE_CREATURE ) ~= 0
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    local player = EffectDC():Get_PlayerPtr(0)
    local NumCards = 1
    while (NumCards &gt; 0) do
       NumCards = NumCards - 1
       player:DrawCard()
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
(In order to draw just one card you don't need that while loop, you see it often in the original cards because it's faster to edit it for drawing more cards, so I'm using it, too.)

EDIT: sorry, I forgot to write the check for a creature spell. Now the code is OK.
< 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: 719 times

Re: [Card help needed] Glimpse of Nature

Postby kevorz » 06 Aug 2012, 16:45

Thank you for your response!

Just a quick question, does the resource_id="1" equal a Creature? I'm just trying to understand the code so i can learn more ^^

EDIT: oops :p asked a question before you edited the code, what does the resource_id stand for anyway?
kevorz
 
Posts: 14
Joined: 04 Aug 2012, 15:01
Has thanked: 6 times
Been thanked: 2 times

Re: [Card help needed] Glimpse of Nature

Postby RiiakShiNal » 06 Aug 2012, 18:18

The resource_id is a way to reference a specific ability such as granting an ability or for delayed triggers (as in the code above). When you have an ability that has a resource_id that ability itself doesn't do anything unless it is granted or used for a delayed trigger.
RiiakShiNal
Programmer
 
Posts: 2160
Joined: 16 May 2011, 21:37
Has thanked: 74 times
Been thanked: 483 times

Re: [Card help needed] Glimpse of Nature

Postby kevorz » 06 Aug 2012, 19:37

Thank you for the insight :)

//Request move to the correct forum (Programming?)
kevorz
 
Posts: 14
Joined: 04 Aug 2012, 15:01
Has thanked: 6 times
Been thanked: 2 times


Return to 2013

Who is online

Users browsing this forum: No registered users and 2 guests


Who is online

In total there are 2 users online :: 0 registered, 0 hidden and 2 guests (based on users active over the past 10 minutes)
Most users ever online was 1922 on 07 Jun 2021, 06:01

Users browsing this forum: No registered users and 2 guests

Login Form