Board index Programs with AI or Rules Enforcement Magic: The Gathering - Duels of the Planeswalkers Programming Talk
New card - Overwhelming Instinct
Moderator: CCGHQ Admins
New card - Overwhelming Instinct
by PhilistineAu » 29 May 2014, 12:55
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.
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
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" />
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
- PhilistineAu
- Posts: 22
- Joined: 29 Sep 2012, 19:37
- Has thanked: 0 time
- Been thanked: 1 time
Re: New card - Overwhelming Instinct
by thefiremind » 29 May 2014, 14:08
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() )
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:I needed to trigger on attackers declared instead of attacking
It's totally equivalent: "return" exits the code block, so you don't reach "return false" when you already reached "return true" anyway.PhilistineAu wrote:On the wording of the end of the trigger, could I instead have said:
"return true
else
return false
end
< 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: New card - Overwhelming Instinct
by PhilistineAu » 29 May 2014, 21:41
Thanks! I've added the filter and will give it a go today. Thanks for the explanations as well.
Cheers,
Phil
Cheers,
Phil
- PhilistineAu
- Posts: 22
- Joined: 29 Sep 2012, 19:37
- Has thanked: 0 time
- Been thanked: 1 time
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 30 guests