Board index
Programs with AI or Rules Enforcement
Magic: The Gathering - Duels of the Planeswalkers
Programming Talk



Kira, Great Glass-Spinner
Moderator: CCGHQ Admins
Kira, Great Glass-Spinner
by --Dream-- » 07 Sep 2012, 11:31
I'm trying to code Kira, Great Glass-Spinner. Granting the ability to other creatures is easy, but how can I make sure it only gets triggered once per turn?
- Code: Select all
<TRIGGERED_ABILITY resource_id="1" auto_skip="1" filter_zone="ZONE_IN_PLAY">
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever this creature becomes the target of a spell or ability for the first time in a turn, counter that spell or ability.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Whenever this creature becomes the target of a spell or ability for the first time in a turn, counter that spell or ability.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Whenever this creature becomes the target of a spell or ability for the first time in a turn, counter that spell or ability.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Whenever this creature becomes the target of a spell or ability for the first time in a turn, counter that spell or ability.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Whenever this creature becomes the target of a spell or ability for the first time in a turn, counter that spell or ability.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Whenever this creature becomes the target of a spell or ability for the first time in a turn, counter that spell or ability.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Whenever this creature becomes the target of a spell or ability for the first time in a turn, counter that spell or ability.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Whenever this creature becomes the target of a spell or ability for the first time in a turn, counter that spell or ability.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Whenever this creature becomes the target of a spell or ability for the first time in a turn, counter that spell or ability.]]></LOCALISED_TEXT>
<TRIGGER value="BECAME_TARGET" simple_qualifier="self">
return SecondaryObject() ~= nil
</TRIGGER>
<RESOLUTION_TIME_ACTION>
local target_spell = SecondaryObject()
if target_spell ~= nil then
target_spell:CounterSpell()
end
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
Re: Kira, Great Glass-Spinner
by thefiremind » 07 Sep 2012, 11:38
I'm afraid that per_turn_limit only works with activated abilities. If that's the case, you'll have to make another similar trigger that saves TriggerObject() in a chest, and another one that clears the chest at end of turn. The added triggers will have to work in any zone. Finally, the trigger that you already coded will check if the TriggerObject() is already saved in the chest, and in that case, it won't trigger.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-
thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 722 times
Re: Kira, Great Glass-Spinner
by --Dream-- » 07 Sep 2012, 11:48
Damn. So I need to grant 3 triggered abilities to each creature, right?thefiremind wrote:I'm afraid that per_turn_limit only works with activated abilities. If that's the case, you'll have to make another similar trigger that saves TriggerObject() in a chest, and another one that clears the chest at end of turn. The added triggers will have to work in any zone. Finally, the trigger that you already coded will check if the TriggerObject() is already saved in the chest, and in that case, it won't trigger.
Re: Kira, Great Glass-Spinner
by thefiremind » 07 Sep 2012, 12:04
I forgot that this ability has to be granted... this complicates things a bit. My idea was based on keeping the checks on Kira, and it can be still applied: make a copy of your triggered ability, give it a different resource_id, and delete the code so that it does nothing at all (you can call it static instead of triggered if you want). You'll grant the "real" triggered ability to the creatures that haven't been targetted this turn, and the other one to the others. By keeping the same localised text, players won't see the trick while playing.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-
thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 722 times
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest