It is currently 26 Apr 2024, 10:30
   
Text Size

Military Intelligence

Moderator: CCGHQ Admins

Military Intelligence

Postby 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!

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
User avatar
volrathxp
 
Posts: 362
Joined: 23 Jul 2014, 17:34
Has thanked: 9 times
Been thanked: 17 times

Re: Military Intelligence

Postby 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.
sweetLu
 
Posts: 181
Joined: 16 Jul 2014, 01:24
Has thanked: 21 times
Been thanked: 22 times

Re: Military Intelligence

Postby volrathxp » 26 Jul 2014, 20:34

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.
Derp. Yeah that was it. Thanks! :)
volrathxp
User avatar
volrathxp
 
Posts: 362
Joined: 23 Jul 2014, 17:34
Has thanked: 9 times
Been thanked: 17 times

Re: Military Intelligence

Postby 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.
volrathxp
User avatar
volrathxp
 
Posts: 362
Joined: 23 Jul 2014, 17:34
Has thanked: 9 times
Been thanked: 17 times

Re: Military Intelligence

Postby thefiremind » 26 Jul 2014, 22:00

volrathxp wrote:Well now it triggers, but it triggers twice.
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:
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...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times

Re: Military Intelligence

Postby 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. :lol:
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: Military Intelligence

Postby volrathxp » 26 Jul 2014, 22:43

Ahh I see now. Thanks again! I hopefully will be sharing my work soon. XD
volrathxp
User avatar
volrathxp
 
Posts: 362
Joined: 23 Jul 2014, 17:34
Has thanked: 9 times
Been thanked: 17 times


Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 47 guests


Who is online

In total there are 47 users online :: 0 registered, 0 hidden and 47 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 47 guests

Login Form