Board index Programs with AI or Rules Enforcement Magic: The Gathering - Duels of the Planeswalkers Programming Talk
Military Intelligence
Moderator: CCGHQ Admins
Military Intelligence
by volrathxp » 26 Jul 2014, 15:47
Can someone look at my code here for Military Intelligence? I just tried it and it doesn't trigger when I attack with two or more creatures. I'm not really sure why, either, since it looks fine to me.
Thanks!
Thanks!
- Code: Select all
<TRIGGERED_ABILITY>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever you attack with two or more creatures, draw a card.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[À chaque fois que vous attaquez avec deux créatures ou plus, piochez une carte.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Siempre que ataques con dos o más criaturas, roba una carta.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Immer wenn du mit zwei oder mehr Kreaturen angreifst, ziehe eine Karte.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Ogniqualvolta attacchi con due o più creature, pesca una carta.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[あなたが2体以上のクリーチャーで攻撃するたび、カードを1枚引く。]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[당신이 생물 두 개 이상으로 공격할 때마다, 카드 한 장을 뽑는다.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Каждый раз, когда вы атакуете двумя или более существами, возьмите карту.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Toda vez que você atacar com duas ou mais criaturas, compre um card.]]></LOCALISED_TEXT>
<TRIGGER value="ATTACKING" simple_qualifier="self">
local filter = ClearFilter()
filter:Add( FE_IS_ATTACKING, true )
filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
if filter:CountStopAt(2) == 2 then
return true
end
return false
</TRIGGER>
<RESOLUTION_TIME_ACTION>
EffectController():DrawCards(1)
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
volrathxp
Re: Military Intelligence
by sweetLu » 26 Jul 2014, 16:09
It is checking if itself is attacking . Remove simple_qualifier="self" from the trigger tag. You might be able to use controller as the simple qualifier. If not you will have to check who owns the attacking creators in the trigger.
Re: Military Intelligence
by volrathxp » 26 Jul 2014, 20:34
Derp. Yeah that was it. Thanks!sweetLu wrote:It is checking if itself is attacking . Remove simple_qualifier="self" from the trigger tag. You might be able to use controller as the simple qualifier. If not you will have to check who owns the attacking creators in the trigger.
volrathxp
Re: Military Intelligence
by volrathxp » 26 Jul 2014, 21:40
Well now it triggers, but it triggers twice.
It's almost as if the CountStopAt() function isn't working or something. I'm not sure.
It's almost as if the CountStopAt() function isn't working or something. I'm not sure.
volrathxp
Re: Military Intelligence
by thefiremind » 26 Jul 2014, 22:00
That's because the ATTACKING trigger triggers once for each attacking creature, so if there are 2, it will trigger twice. Use the ATTACKERS_DECLARED trigger, and add a check for FE_CONTROLLER being EffectController in the filter:volrathxp wrote:Well now it triggers, but it triggers twice.
- Code: Select all
<TRIGGER value="ATTACKERS_DECLARED">
local filter = ClearFilter()
filter:Add( FE_IS_ATTACKING, true )
filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
return filter:CountStopAt(2) == 2
</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: 721 times
Re: Military Intelligence
by RiiakShiNal » 26 Jul 2014, 22:04
If you use the ATTACKING trigger it will trigger once for each attacking creature. You can use ATTACKERS_DECLARED instead to trigger just once for each attack in which attackers were declared (just make sure you check to make sure it is the controller's turn so it doesn't trigger on the opponent's turn).
Edit: thefiremind beat me to it this time.
Edit: thefiremind beat me to it this time.
Just getting started: Xander9009's DotP 2014 Community Wad
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
- RiiakShiNal
- Programmer
- Posts: 2185
- Joined: 16 May 2011, 21:37
- Has thanked: 75 times
- Been thanked: 497 times
Re: Military Intelligence
by volrathxp » 26 Jul 2014, 22:43
Ahh I see now. Thanks again! I hopefully will be sharing my work soon. XD
volrathxp
7 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 28 guests