Board index
Programs with AI or Rules Enforcement
Magic: The Gathering - Duels of the Planeswalkers
Programming Talk
Programs with AI or Rules Enforcement
Magic: The Gathering - Duels of the Planeswalkers
Programming Talk
Miracle
Moderator: CCGHQ Admins
19 posts
• Page 2 of 2 • 1, 2
Re: Miracle
by 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:
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.
- 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>
- Code: Select all
assert(false, table.show({
ncards = MTG():Interrogate_CardsDrawnThisTurn(TriggerPlayer()),
}, "DREW_CARD_TRIGGER_FIRED"))
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.
— Ben Kuchera, Mordern Warfare 3 review.
-

pcastellazzi - Posts: 184
- Joined: 25 Apr 2012, 00:40
- Location: Montevideo, Uruguay
- Has thanked: 11 times
- Been thanked: 30 times
Re: Miracle
by BlindWillow » 29 Oct 2012, 01:23
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.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.
Anyway, pcastellazzi's clean code it is.
- BlindWillow
- Posts: 213
- Joined: 19 Jul 2012, 00:26
- Has thanked: 11 times
- Been thanked: 46 times
Re: Miracle
by 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
by pcastellazzi » 30 Oct 2012, 00:30
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.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.
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.
— Ben Kuchera, Mordern Warfare 3 review.
-

pcastellazzi - Posts: 184
- Joined: 25 Apr 2012, 00:40
- Location: Montevideo, Uruguay
- Has thanked: 11 times
- Been thanked: 30 times
19 posts
• Page 2 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 8 guests