"Provoke" ability

by Zambooo
this is a "sample" from Goblin Grappler I made. To code the "Provoke" ability I used the second ability from Vortex Elemental (coded by NEO I think..)
There's something not ok with the code though: when I attack with two different Goblins and provoke two different creatures, at first the blocking creatures are assigned as expected, but then the AI can decide to let both of them block only 1 Goblin.. the Provoke ability shouldn't allow that.
Can it be "fixed" to work properly?
- | Open
- Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
<FILENAME text="GOBLIN_GRAPPLER_45125" />
<CARDNAME text="GOBLIN_GRAPPLER" />
<TITLE>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Goblin Grappler]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Accrocheur gobelin]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Peleador trasgo]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Goblin-Kettenkämpfer]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Rampinatore Goblin]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Goblin Grappler]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Goblin Grappler]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Goblin Grappler]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Goblin Agarrador]]></LOCALISED_TEXT>
</TITLE>
<MULTIVERSEID value="45125" />
<ARTID value="A45125" />
<ARTIST name="Christopher Moeller" />
<CASTING_COST cost="{R}" />
<FLAVOURTEXT>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Daru soldiers learned it’s better to have a clean death from a sharp blade than to tangle with a goblin’s rusted chains.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Les soldats daru préfèrent la mort rapide causée par une lame aiguisée à l’agonie causée par les chaînes rouillées des gobelins.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Los soldados de Daru aprendieron que es mejor que los maten rápidamente con una hoja afilada que lidiar con las cadenas oxidadas de un trasgo.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Daru-Soldaten lernten schnell, dass ein sauberer Tod durch eine scharfe Klinge den rostigen Ketten der Goblins bei weitem vorzuziehen ist.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[I soldati daru hanno imparato che è meglio una morte pulita per un colpo di spada che non uno scontro con le catene arrugginite dei goblin.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Daru soldiers learned it’s better to have a clean death from a sharp blade than to tangle with a goblin’s rusted chains.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Daru soldiers learned it’s better to have a clean death from a sharp blade than to tangle with a goblin’s rusted chains.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Daru soldiers learned it’s better to have a clean death from a sharp blade than to tangle with a goblin’s rusted chains.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Os soldados de Daru aprenderam que é melhor ter uma morte limpa vinda de uma lâmina afiada a se emaranhar nas correntes enferrujadas de um goblin.]]></LOCALISED_TEXT>
</FLAVOURTEXT>
<TYPE metaname="Creature" />
<SUB_TYPE metaname="Goblin" />
<EXPANSION value="LGN" />
<RARITY metaname="C" />
<POWER value="1" />
<TOUGHNESS value="1" />
<TRIGGERED_ABILITY>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Provoke]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Provocation]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Provocar.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Provozieren]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Provocazione |(Quando questa creatura attacca, puoi decidere che una creatura bersaglio controllata dal giocatore in difesa STAPpi e la blocchi se può farlo.)|]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Provoke]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Provoke]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Provoke]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Provocar]]></LOCALISED_TEXT>
<TRIGGER value="ATTACKING" simple_qualifier="self" />
<TARGET tag="CARD_QUERY_CHOOSE_CREATURE_UNTAP" definition="0" compartment="0" count="1" />
<TARGET_DEFINITION id="0">
local filter = ClearFilter()
filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
filter:Add( FE_CONTROLLER, OP_IS, TriggerPlayer() )
</TARGET_DEFINITION>
<RESOLUTION_TIME_ACTION>
local delayDC = EffectDC():Make_Chest(1)
local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
if target ~= nil then
delayDC:Set_CardPtr(0, target)
MTG():CreateDelayedTrigger(2, delayDC)
end
</RESOLUTION_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
if target ~= nil then
target:Untap()
end
</RESOLUTION_TIME_ACTION>
<CONTINUOUS_ACTION layer="6">
local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
if target ~= nil then
local characteristics = target:GetCurrentCharacteristics()
characteristics:Bool_Set( CHARACTERISTIC_MUST_BLOCK, 1 )
end
</CONTINUOUS_ACTION>
<DURATION simple_duration="UntilEOT" />
<AI_SIMPLIFIED_TARGETING compartment="0" hint="HINT_ENEMY_ONLY" />
</TRIGGERED_ABILITY>
<MAY />
<TRIGGERED_ABILITY resource_id="2" replacement_effect="1">
<TRIGGER value="EVASION_TEST" pre_trigger="1">
local card = EffectDC():Get_CardPtr(0)
if card ~= nil then
return TriggerObject() == card and SecondaryObject() ~= Object()
end
</TRIGGER>
<CLEANUP simple_cleanup="EndOfTurn"/>
</TRIGGERED_ABILITY>
<SFX text="COMBAT_BLUNT_LARGE_ATTACK" power_boundary_min="4" power_boundary_max="-1" />
<SFX text="COMBAT_BLUNT_SMALL_ATTACK" power_boundary_min="1" power_boundary_max="3" />
</CARD_V2>
- | Open
- 702.38. Provoke
702.38a Provoke is a triggered ability. “Provoke” means “Whenever this creature attacks, you may choose to have target creature defending player controls block this creature this combat if able. If you do, untap that creature.”
702.38b If a creature has multiple instances of provoke, each triggers separately
There's something not ok with the code though: when I attack with two different Goblins and provoke two different creatures, at first the blocking creatures are assigned as expected, but then the AI can decide to let both of them block only 1 Goblin.. the Provoke ability shouldn't allow that.
Can it be "fixed" to work properly?