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



Mardu Heart-Piercer (Raid Ability)
Moderator: CCGHQ Admins
Mardu Heart-Piercer (Raid Ability)
by Chakan » 22 Aug 2014, 17:52
I wasn't quite sure where to start with the Raid ability for Mardu Heart-Piercer (it's a trigger if a creature you control attacked and you put a card with raid, it can do 2 damage to target creature or player.) There wasn't anything really that I could base this ability on, so I sort of used Angelic Arbiter and Sparkmage Apprentice as bases, but I know this isn't right. Can anybody point me in the right direction here? I'd appreciate the help. Here's what I got so far.
<TRIGGERED_ABILITY>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[|Raid| — When Mardu Heart-Piercer enters the battlefield, if you attacked with a creature this turn, Mardu Heart-Piercer deals 2 damage to target creature or player.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[|Raid| — When Mardu Heart-Piercer enters the battlefield, if you attacked with a creature this turn, Mardu Heart-Piercer deals 2 damage to target creature or player.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[|Raid| — When Mardu Heart-Piercer enters the battlefield, if you attacked with a creature this turn, Mardu Heart-Piercer deals 2 damage to target creature or player.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[|Raid| — When Mardu Heart-Piercer enters the battlefield, if you attacked with a creature this turn, Mardu Heart-Piercer deals 2 damage to target creature or player.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[|Raid| — When Mardu Heart-Piercer enters the battlefield, if you attacked with a creature this turn, Mardu Heart-Piercer deals 2 damage to target creature or player.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[|Raid| — When Mardu Heart-Piercer enters the battlefield, if you attacked with a creature this turn, Mardu Heart-Piercer deals 2 damage to target creature or player.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[|Raid| — When Mardu Heart-Piercer enters the battlefield, if you attacked with a creature this turn, Mardu Heart-Piercer deals 2 damage to target creature or player.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[|Raid| — When Mardu Heart-Piercer enters the battlefield, if you attacked with a creature this turn, Mardu Heart-Piercer deals 2 damage to target creature or player.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[|Raid| — When Mardu Heart-Piercer enters the battlefield, if you attacked with a creature this turn, Mardu Heart-Piercer deals 2 damage to target creature or player.]]></LOCALISED_TEXT>
<TRIGGER value="ZONECHANGE_END" simple_qualifier="self" to_zone="ZONE_BATTLEFIELD" from_zone="ZONE_ANY"/>
local num_starting_players= MTG():GetNumberOfStartingPlayers()
for i=0,(num_starting_players-1) do
local player = MTG():GetNthStartingPlayer( i )
if (player ~= nil and player:GetTeam() ~= EffectController():GetTeam()) then
local interrogation = MTG():ClearInterrogationQuery()
interrogation:SetPlayer( player )
if interrogation:Test( INTERROGATE_ATTACKS, INTERROGATE_THIS_TURN ) then
<SFX text="TARGET_SPARKS_PLAY" />
<TARGET tag="CARD_QUERY_CHOOSE_DEAL_2_DAMAGE" definition="0" compartment="0" count="1" />
<TARGET_DEFINITION id="0">
local filter = ClearFilter()
filter:SetFilterType( FILTER_TYPE_CARDS + FILTER_TYPE_PLAYERS )
filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
</TARGET_DEFINITION>
<RESOLUTION_TIME_ACTION>
local target_creature = EffectDC():Get_Targets(0):Get_CardPtr(0)
local target_player = EffectDC():Get_Targets(0):Get_PlayerPtr(0)
if ( target_creature ~= nil ) then
EffectSourceLKI():DealDamageTo( 2, target_creature )
elseif ( target_player ~= nil ) then
EffectSourceLKI():DealDamageTo( 2, target_player )
end
</RESOLUTION_TIME_ACTION>
<AI_SIMPLIFIED_TARGETING compartment="0" hint="HINT_ENEMY_ONLY" />
</TRIGGERED_ABILITY>
Re: Mardu Heart-Piercer (Raid Ability)
by sweetLu » 22 Aug 2014, 19:13
I'm sorry, apparently I cannot read well. I didn't see you were already using interrogations
Last edited by sweetLu on 22 Aug 2014, 20:42, edited 1 time in total.
Re: Mardu Heart-Piercer (Raid Ability)
by thefiremind » 22 Aug 2014, 20:33
I think you are actually very close, but the problem is that you can't make code that says: if ... then <...>another block of code</...>, each block must contain code that works by itself. You are also never closing the "for", which is useless by the way, because you can already address yourself as EffectController().
Try this trigger condition:
Try this trigger condition:
- Code: Select all
<TRIGGER value="ZONECHANGE_END" simple_qualifier="self" to_zone="ZONE_BATTLEFIELD" from_zone="ZONE_ANY">
local interrogation = MTG():ClearInterrogationQuery()
interrogation:SetPlayer( EffectController() )
return interrogation:Test( INTERROGATE_ATTACKS, INTERROGATE_THIS_TURN )
</TRIGGER>
<SFX text="TARGET_SPARKS_PLAY" />
Last edited by thefiremind on 22 Aug 2014, 22:30, edited 1 time in total.
< 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: Mardu Heart-Piercer (Raid Ability)
by NeoAnderson » 22 Aug 2014, 21:09
It shoud work Fire but you have to remove a "/", otherwise the interrogation instructions will be not condidered.thefiremind wrote:I think you are actually very close, but the problem is that you can't make code that says: if ... then <...>another block of code</...>, each block must contain code that works by itself. You are also never closing the "for", which is useless by the way, because you can already address yourself as EffectController().
Try this trigger condition:below this point it should be correct.
- Code: Select all
<TRIGGER value="ZONECHANGE_END" simple_qualifier="self" to_zone="ZONE_BATTLEFIELD" from_zone="ZONE_ANY" />
local interrogation = MTG():ClearInterrogationQuery()
interrogation:SetPlayer( EffectController() )
return interrogation:Test( INTERROGATE_ATTACKS, INTERROGATE_THIS_TURN )
</TRIGGER>
<SFX text="TARGET_SPARKS_PLAY" />
- Code: Select all
<TRIGGER value="ZONECHANGE_END" simple_qualifier="self" to_zone="ZONE_BATTLEFIELD" from_zone="ZONE_ANY" >
local interrogation = MTG():ClearInterrogationQuery()
interrogation:SetPlayer( EffectController() )
return interrogation:Test( INTERROGATE_ATTACKS, INTERROGATE_THIS_TURN )
</TRIGGER>
<SFX text="TARGET_SPARKS_PLAY" />
- NeoAnderson
- Posts: 914
- Joined: 10 Sep 2013, 07:49
- Has thanked: 18 times
- Been thanked: 139 times
Re: Mardu Heart-Piercer (Raid Ability)
by thefiremind » 22 Aug 2014, 22:30
Right...
Fixed in the original post.

< 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: Mardu Heart-Piercer (Raid Ability)
by Chakan » 23 Aug 2014, 01:07
Thanks everyone. I'm getting better with this stuff every day thanks to all of you.
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 4 guests