Page 1 of 1

New card - Overwhelming Instinct

PostPosted: 29 May 2014, 12:55
by PhilistineAu
Hi,

I read through the tutorial and had a go at coding a card. It seems to work in game but I'd appreciate someone taking a look and letting me know if they see anything I should have done differently. The triggered ability is: Whenever you attack with three or more creatures, draw a card.

Code: Select all
<TRIGGER value="ATTACKERS_DECLARED">
    local filter = ClearFilter()
    filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
    filter:Add( FE_IS_ATTACKING, true )
    if filter:CountStopAt(3) == 3 then
       return true
    end
    return false
    </TRIGGER> 
  <RESOLUTION_TIME_ACTION>
   EffectController():DrawCards(1)
  </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
<AI_BASE_SCORE score="600" zone="ZONE_BATTLEFIELD" />
It took me a while to get it work but I finally worked out I needed to trigger on attackers declared instead of attacking (it would draw more than 1 card - I'm presuming it drew a card for each attacking creature? i.e. it was working and drawing only 1 card each time, but it was doing it for each creature that was attacking - so 4 creatures = 4 cards.

On the wording of the end of the trigger, could I instead have said:
"return true
else
return false
end
</TIGGER>


Lastly, I never saw it draw cards for an opponent - could that happen with this card or does the effectcontroller portion of the draw card stop that?

Thanks!!!

Phil

Re: New card - Overwhelming Instinct

PostPosted: 29 May 2014, 14:08
by thefiremind
Your code means "Whenever three or more creatures attack, draw a card.": you would draw a card when someone else attacks with three or more creatures, too. Add a controller check to the filter:
Code: Select all
filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
PhilistineAu wrote:I needed to trigger on attackers declared instead of attacking
That's perfectly fine when you need to do something that involves all the attacking creatures. There's probably a way to do it with an ATTACKING trigger, but it would get really complicated for no reason.

PhilistineAu wrote:On the wording of the end of the trigger, could I instead have said:
"return true
else
return false
end
It's totally equivalent: "return" exits the code block, so you don't reach "return false" when you already reached "return true" anyway.

Re: New card - Overwhelming Instinct

PostPosted: 29 May 2014, 21:41
by PhilistineAu
Thanks! I've added the filter and will give it a go today. Thanks for the explanations as well.

Cheers,

Phil