It is currently 12 Nov 2025, 23:02
   
Text Size

Miracle

Moderator: CCGHQ Admins

Re: Miracle

Postby pcastellazzi » 29 Oct 2012, 01:06

The code i posted seems to work ok with multiple card draws and instant draws. To test it i created a card with the following abilities:

Code: Select all
<ACTIVATED_ABILITY>
  <LOCALISED_TEXT LanguageCode="en-US">Draw 1</LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="de-DE">Draw 1</LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="es-ES">Draw 1</LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="fr-FR">Draw 1</LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="it-IT">Draw 1</LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="jp-JA">Draw 1</LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="ko-KR">Draw 1</LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="ru-RU">Draw 1</LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="pt-BR">Draw 1</LOCALISED_TEXT>

  <COST type="Mana" cost="{0}" />

  <RESOLUTION_TIME_ACTION>
  <![CDATA[
    EffectController():DrawCard()
  ]]>
  </RESOLUTION_TIME_ACTION>
</ACTIVATED_ABILITY>

<ACTIVATED_ABILITY>
  <LOCALISED_TEXT LanguageCode="en-US">Draw 3</LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="de-DE">Draw 3</LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="es-ES">Draw 3</LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="fr-FR">Draw 3</LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="it-IT">Draw 3</LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="jp-JA">Draw 3</LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="ko-KR">Draw 3</LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="ru-RU">Draw 3</LOCALISED_TEXT>
  <LOCALISED_TEXT LanguageCode="pt-BR">Draw 3</LOCALISED_TEXT>

  <COST type="Mana" cost="{0}" />

  <RESOLUTION_TIME_ACTION>
  <![CDATA[
    EffectController():DrawCard()
    EffectController():DrawCard()
    EffectController():DrawCard()
  ]]>
  </RESOLUTION_TIME_ACTION>
</ACTIVATED_ABILITY>
Then i used the abilities to trigger draws under different circumstances, my upkeep, my first main, the opponent's turn, drawing a different amount of cards each time. I did it once per turn to make sure the results are always consistent. To make sure the trigger is fired correctly i added the following snippet before the trigger condition.

Code: Select all
assert(false, table.show({
  ncards = MTG():Interrogate_CardsDrawnThisTurn(TriggerPlayer()),
}, "DREW_CARD_TRIGGER_FIRED"))
table.show recursively converts a table to a string. The code can be obtained here.

As i expected DREW_CARD triggers one time for each call to EffectController():DrawCard() and the value of MTG():Interrogate_CardsDrawnThisTurn() is incremented by one each time.

Not a clue about why it does not work for you, may be is something else in your deck affecting the results. In my own test deck i used basic lands, the dummy card i described and my implementation of Revenge of the Hunted.
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 » 29 Oct 2012, 01:23

pcastellazzi wrote:Not a clue about why it does not work for you, may be is something else in your deck affecting the results. In my own test deck i used basic lands, the dummy card i described and my implementation of Revenge of the Hunted.
Actually, I think I was probably just being absent-minded and forgetting that unless I also use my pre-trigger testing card the turn I cast Tezzeret's Gambit, I will already have drawn a card, it being a sorcery after all. It is probably not the best card to use for testing this ability, really. I just liked its ability to be cast for zero mana.

Anyway, pcastellazzi's clean code it is. :D
BlindWillow
 
Posts: 213
Joined: 19 Jul 2012, 00:26
Has thanked: 11 times
Been thanked: 46 times

Re: Miracle

Postby BlindWillow » 29 Oct 2012, 02:26

Just a note: I tried to add my EffectController():CanAfford code to yours (the delayed trigger), and it seems that if you can't afford it when you draw it, the card will wait until the next time you can afford it and you draw the first card in a turn. Not a problem, just an interesting combination of elements. Maybe useful in another situation.
BlindWillow
 
Posts: 213
Joined: 19 Jul 2012, 00:26
Has thanked: 11 times
Been thanked: 46 times

Re: Miracle

Postby pcastellazzi » 30 Oct 2012, 00:30

BlindWillow wrote:Just a note: I tried to add my EffectController():CanAfford code to yours (the delayed trigger), and it seems that if you can't afford it when you draw it, the card will wait until the next time you can afford it and you draw the first card in a turn. Not a problem, just an interesting combination of elements. Maybe useful in another situation.
Actually it's a bug because if MTG():Interrogate_CardsDrawnThisTurn() is not 1, the trigger will not fire, if not fired it will not be removed, then the next turn it will fire with the first card you draw.

I guess it can be fixed with:

Code: Select all
<CLEANUP simple_cleanup="EndOfTurn" />
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

Previous

Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 11 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 11 users online :: 0 registered, 0 hidden and 11 guests (based on users active over the past 10 minutes)
Most users ever online was 9824 on 10 Nov 2025, 04:33

Users browsing this forum: No registered users and 11 guests

Login Form