help with custom card - delayed triggers
Posted: 03 Nov 2016, 22:36
I'm porting this over from the 2014 section where I originally posted it.
For some reason the first ability below (activated trigger) (1) doesn't query about drawing a card, it just draws and (2) causes the player to draw two cards instead of one.
thefiremind suggested this
For some reason the first ability below (activated trigger) (1) doesn't query about drawing a card, it just draws and (2) causes the player to draw two cards instead of one.
- Code: Select all
<ACTIVATED_ABILITY>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{2}{G}{B}: The next time this source would deal damage to an opponent this turn, you may draw a card.]]></LOCALISED_TEXT>
<COST mana_cost="{2}{G}{B}" type="Mana" />
<RESOLUTION_TIME_ACTION>
MTG():CreateDelayedTrigger(1, nil)
</RESOLUTION_TIME_ACTION>
</ACTIVATED_ABILITY>
<TRIGGERED_ABILITY resource_id="1" replacement_effect="1">
<TRIGGER value="SOURCE_DEALS_DAMAGE_TO_PLAYER" pre_trigger="1" simple_qualifier="self" damage_type="all" />
<MAY tag="CARD_QUERY_DRAW_A_CARD" always_prompt="1">
-- AI behaviour
if EffectController():Library_Count() < 10 then
return false
else
return true
end
</MAY>
<CLEANUP fire_once="1" />
<RESOLUTION_TIME_ACTION>
EffectController():DrawCards(1)
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
<ACTIVATED_ABILITY>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{3}{G}{G}: Until end of turn, whenever a creature you control is dealt damage, put a +1/+1 counter on it.]]></LOCALISED_TEXT>
<COST mana_cost="{3}{G}{G}" type="Mana" />
<RESOLUTION_TIME_ACTION>
MTG():CreateDelayedTrigger(2, nil)
</RESOLUTION_TIME_ACTION>
</ACTIVATED_ABILITY>
<TRIGGERED_ABILITY resource_id="2" replacement_effect="2">
<TRIGGER value="OBJECT_TAKES_DAMAGE" pre_trigger="1" damage_type="all" simple_qualifier="objectyoucontrol" >
return (TriggerObject():GetCardType():Test(CARD_TYPE_CREATURE))
</TRIGGER>
<RESOLUTION_TIME_ACTION>
if TriggerObject() ~= nil then
TriggerObject():AddCounters( MTG():PlusOnePlusOneCounters(), 1 )
end
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
<CLEANUP simple_cleanup="EndOfTurn" />
thefiremind suggested this
so I removed the <CLEANUP simple_cleanup="EndOfTurn" /> from both ability blocks and added one to the end (which is how it appears above); I left the <CLEANUP fire_once="1" /> in the block of the first ability, because I only want the first ability to fire once, but the second should last until end of turn. However, it's still drawing 2 cards, and still not querying about card draw.thefiremind wrote:The fact that you draw twice could be because you have 2 CLEANUP blocks and the game probably doesn't read both so you get the current delayed trigger plus all the past ones who haven't run at least once. You should keep only 1 CLEANUP with both attributes in it.