It is currently 07 May 2024, 15:06
   
Text Size

Tar Fiend problem.

Moderator: CCGHQ Admins

Tar Fiend problem.

Postby alexandreonly » 13 Oct 2012, 20:39

The devour work, but the discard effect not. I can't find the problem:

Code: Select all
<?xml version='1.0'?>
<CARD_V2>
  <FILENAME text="TAR_FIEND_175101" />
  <CARDNAME text="TAR_FIEND" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Tar Fiend]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Tar Fiend]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Tar Fiend]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Tar Fiend]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Tar Fiend]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Tar Fiend]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Tar Fiend]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Tar Fiend]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Tar Fiend]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="175101" />
  <ARTID value="175101" />
  <ARTIST name="Anthony S. Waters" />
  <CASTING_COST cost="{5}{B}" />
  <TYPE metaname="Creature" />
  <SUB_TYPE metaname="Elemental" />
  <EXPANSION value="DPG" />
  <RARITY metaname="R" />
  <POWER value="4" />
  <TOUGHNESS value="4" />
  <TRIGGERED_ABILITY replacement_query="1" filter_zone="ZONE_IN_PLAY" active_zone="ZONE_TRANSITION">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Devour 2]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Dévorement 2]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Devorar 2.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Verschlingen 2]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Divorare 2]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[貪食 2]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[포식 2]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Пожирание 2]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Devorar 2]]></LOCALISED_TEXT>
    <TRIGGER value="ZONECHANGE_TRANSITION" simple_qualifier="self" to_zone="ZONE_IN_PLAY" />
    <TARGET_DEFINITION id="0">
    local filter = Object():GetFilter()
    filter:Clear()
    filter:AddCardType( CARD_TYPE_CREATURE )
    filter:SetPlayer( EffectController() )
    filter:May()
    filter:SetZone( ZONE_IN_PLAY )
    filter:SetHint( HINT_ENEMY, EffectController() )
    filter:AIMay()
    filter:IgnoreIfChangingZone()
    </TARGET_DEFINITION>
    <TARGET_DETERMINATION>
    return AtLeastOneTargetFromDefinition(0)
    </TARGET_DETERMINATION>
    <PLAY_TIME_ACTION>
    local filter = Object():LoadTargetDefinition(0)
    local max_victims = filter:Count()
    local player = EffectController()         
    if max_victims &gt; 0 then
       player:SetTargetCount(max_victims)
       for i=0,max_victims-1 do
          player:SetTargetPrompt( i, "CARD_QUERY_CHOOSE_CREATURE_TO_DEVOUR_2" )
       end
           
       player:ChooseTargets( 0, EffectDC():Make_Targets(0) )
    end
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local filter = Object():LoadTargetDefinition(0)
    local max_victims = filter:Count()
    local player = EffectController()
    local devour_count = 0         
    for i=0,max_victims-1 do
       local victim = EffectDC():Get_Targets(0):Get_CardPtr(i)
       if victim ~= nil then
          player:Sacrifice(victim)
          devour_count = devour_count + 1
       end
    end
    if devour_count &gt; 0 then
       local delayDC = EffectDC():Make_Chest(1)
       delayDC:Set_Int(1, devour_count)
       MTG():CreateDelayedTrigger(1, delayDC)
    end   
    if EffectSource() ~= nil then
       EffectSource():AddCounters( MTG():PlusOnePlusOneCounters(), devour_count*2 )
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <STATIC_ABILITY internal="1">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[When Tar Fiend enters the battlefield, target player discards a card for each creature it devoured.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[When Tar Fiend enters the battlefield, target player discards a card for each creature it devoured.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[When Tar Fiend enters the battlefield, target player discards a card for each creature it devoured.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[When Tar Fiend enters the battlefield, target player discards a card for each creature it devoured.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[When Tar Fiend enters the battlefield, target player discards a card for each creature it devoured.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[When Tar Fiend enters the battlefield, target player discards a card for each creature it devoured.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[When Tar Fiend enters the battlefield, target player discards a card for each creature it devoured.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[When Tar Fiend enters the battlefield, target player discards a card for each creature it devoured.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[When Tar Fiend enters the battlefield, target player discards a card for each creature it devoured.]]></LOCALISED_TEXT>
  </STATIC_ABILITY>
  <TRIGGERED_ABILITY resource_id="1" LKI_shield_effect_source="1">
  <CLEANUP fire_once="1" />
    <TARGET_DEFINITION id="0">
    local filter = Object():GetFilter()
    filter:Clear()
    filter:SetFilterType( FILTER_TYPE_PLAYERS )
    filter:SetHint( HINT_ENEMY_ONLY, EffectController() )
    </TARGET_DEFINITION>
    <TARGET_DETERMINATION>
    return AtLeastOneTargetFromDefinition(0)
    </TARGET_DETERMINATION>
    <PLAY_TIME_ACTION target_choosing="1">
    EffectController():ChooseTarget( 0, "CARD_QUERY_CHOOSE_PLAYER", EffectDC():Make_Targets(0) )
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local player = EffectDC():Get_Targets(0):Get_PlayerPtr(0)
    if player ~= nil then
       local filter = Object():GetFilter()
      local devour_count = EffectDC():Get_Int(1)
       filter:Clear()
       filter:SetZone( ZONE_HAND )
       filter:SetPlayer( player )
       filter:NotTargetted()
       player:SetTargetCount( devour_count )
       for i=0,(devour_count-1) do
          player:SetTargetPrompt( i, "CARD_QUERY_CHOOSE_CARD_TO_DISCARD_2" )
       end
       player:ChooseTargets( NO_VALIDATION, EffectDC():Make_Targets(1) )
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local player = EffectDC():Get_Targets(0):Get_PlayerPtr(0)
   local devour_count = EffectDC():Get_Int(1)
    if player ~= nil then
       for i = 0,(devour_count-1) do
          local target_card = EffectDC():Get_Targets(1):Get_CardPtr(i)
          if target_card ~= nil  then
             target_card:Discard()
          end
       end
    end
    </RESOLUTION_TIME_ACTION>
    <SFX text="TARGET_PESTS_PLAY" />
  </TRIGGERED_ABILITY>
  <SFX text="COMBAT_PESTS_LARGE_ATTACK" power_boundary_min="4" power_boundary_max="-1" />
<SFX text="COMBAT_PESTS_SMALL_ATTACK" power_boundary_min="1" power_boundary_max="3" />
</CARD_V2>
alexandreonly
 
Posts: 145
Joined: 04 Jul 2011, 17:27
Has thanked: 0 time
Been thanked: 8 times

Re: Tar Fiend problem.

Postby thefiremind » 13 Oct 2012, 20:44

In the delayed trigger you are using EffectDC():Get_Int(1) and EffectDC():Make_Targets(1). Try to change the register position for one of them, maybe they are conflicting.
< 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: Tar Fiend problem.

Postby BlindWillow » 13 Oct 2012, 21:57

I'm not seeing a trigger for the delayed trigger ability either.

I believe you need to add this:

<TRIGGER value="ZONECHANGE_END" simple_qualifier="self" to_zone="ZONE_IN_PLAY" />
BlindWillow
 
Posts: 213
Joined: 19 Jul 2012, 00:26
Has thanked: 11 times
Been thanked: 46 times

Re: Tar Fiend problem.

Postby thefiremind » 13 Oct 2012, 23:00

BlindWillow wrote:I'm not seeing a trigger for the delayed trigger ability either.

I believe you need to add this:

<TRIGGER value="ZONECHANGE_END" simple_qualifier="self" to_zone="ZONE_IN_PLAY" />
You're right, I didn't notice that. :oops:
Add this first, then follow my advice only if it still doesn't work.
< 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: Tar Fiend problem.

Postby alexandreonly » 14 Oct 2012, 04:17

thefiremind wrote:In the delayed trigger you are using EffectDC():Get_Int(1) and EffectDC():Make_Targets(1). Try to change the register position for one of them, maybe they are conflicting.
Fixed. Working now. Thanks.
alexandreonly
 
Posts: 145
Joined: 04 Jul 2011, 17:27
Has thanked: 0 time
Been thanked: 8 times


Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 4 guests


Who is online

In total there are 4 users online :: 0 registered, 0 hidden and 4 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 4 guests

Login Form