It is currently 01 Sep 2025, 22:49
   
Text Size

Renamed :Are you looking for a Godsend? Suggested by gorem2k

Moderator: CCGHQ Admins

Renamed :Are you looking for a Godsend? Suggested by gorem2k

Postby NeoAnderson » 23 Aug 2014, 11:55

I need help to resolve this issue :
I am tryng to exile a card from a chest after blockers are declared and before the damage is assigned.
The problem encountered is that the game doesn't let me select the card, i can see the available choices but i can select them, the selection has a may condition so i still can quit the selection without any card, if I do the game go forward normally.


Code: Select all
<TRIGGERED_ABILITY replacement_query="1" linked_ability_group ="1">
  <TRIGGER value="BEGINNING_OF_PLAYERS_STEP" pre_trigger="1">
    local chest = LinkedDC():Get_Chest(1)
      if chest ~= nil and MTG():GetStep() == STEP_COMBAT_DAMAGE then
         return true
      end
    </TRIGGER>

   <RESOLUTION_TIME_ACTION>
    local chest = LinkedDC():Get_Chest(1)
        EffectController():SetItemCount(1)
        for i = 0, (1 - 1) do
           EffectController():SetItemPrompt(i, "CARD_QUERY_CHOOSE_CARD_TO_EXILE" )
        end
        EffectController():ChooseItemsFromDC( chest, EffectDC():Make_Targets(0), QUERY_FLAG_MAY )
     </RESOLUTION_TIME_ACTION>

         <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0) and EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
   EffectDC():Get_Targets(0):Protect_CardPtr(0)
       target:Exile()
        local chest = LinkedDC():Get_Chest(1)
        chest:Clear()   
    end
  </RESOLUTION_TIME_ACTION>

   <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    local source = EffectSource()
    if target ~= nil and source ~= nil then
       local chest = LinkedDC():Get_Chest(100)
       if chest == nil then
          chest = LinkedDC():Make_Chest(100)
       end
       local index = 1
       while chest:Get_CardPtr(index) ~= nil do
          index = index + 1
       end
       chest:Set_CardPtr(index, target)
        chest:Protect_CardPtr(index)
        chest:Set_Int(0, index)
       target:NailOnto(source)
    end
    </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
Any suggestion?


**************************************************************************
Updated final solution :
Here you can find my last one i have tested and it seems to works fine!


GodSend Neo Rev 1.1 | Open
Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
  <FILENAME text="JOU_012_NEO_GODSEND_995380426" />
  <CARDNAME text="GODSEND" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Godsend]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Don du ciel]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Filo divino]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Gottesheil]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Nemesi degli Dei]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[神送り]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[신의 선물]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Божий Дар]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Mensageira dos Deuses]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="995380426" />
  <ARTID value="995380426" />
  <ARTIST name="Daniel Ljunggren" />
  <CASTING_COST cost="{1}{W}{W}" />
  <SUPERTYPE metaname="Legendary" />
  <TYPE metaname="Artifact" />
  <SUB_TYPE metaname="Equipment" />
  <EXPANSION value="JOU" />
  <RARITY metaname="M" />
  <STATIC_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Equipped creature gets +3/+3.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[La créature équipée gagne +3/+3.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[La criatura equipada obtiene +3/+3.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Die ausgerüstete Kreatur erhält +3/+3.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[La creatura equipaggiata prende +3/+3.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[装備しているクリーチャーは+3/+3の修整を受ける。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[장착된 생물은 +3/+3을 받는다.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Снаряженное существо получает +3/+3.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[A criatura equipada recebe +3/+3.]]></LOCALISED_TEXT>
      <CONTINUOUS_ACTION layer="7C">
    if EffectSource()~= nil then
       local parent = EffectSource():GetParent()
       if parent ~= nil then
          parent:GetCurrentCharacteristics():Power_Add( 3 )
          parent:GetCurrentCharacteristics():Toughness_Add( 3 )
       end
    end
    </CONTINUOUS_ACTION>
  </STATIC_ABILITY>



  <TRIGGERED_ABILITY linked_ability_group="1" replacement_effect="1" priority="20">
    <TRIGGER value="BLOCKS_A_CREATURE" >
      return TriggerObject() == EffectSourceLKI():GetParent() or SecondaryObject() == EffectSourceLKI():GetParent()
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    local chest = LinkedDC():Get_Chest(1)
    if chest == nil then
       chest = LinkedDC():Make_Chest(1)
       LinkedDC():Set_Int(0, 0)
    end
    if TriggerObject() == EffectSourceLKI():GetParent() then
       chest:Set_CardPtr( LinkedDC():Get_Int(0), SecondaryObject() )
    else
       chest:Set_CardPtr( LinkedDC():Get_Int(0), TriggerObject() )
    end
    LinkedDC():Int_Inc(0)
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>


  <TRIGGERED_ABILITY linked_ability_group="1">   
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever equipped creature blocks or becomes blocked by one or more creatures, you may exile one of those creatures.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[À chaque fois que la créature équipée bloque ou devient bloquée par au moins une créature, vous pouvez exiler une de ces créatures.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Siempre que la criatura equipada bloquee o sea bloqueada por una o más criaturas, puedes exiliar una de esas criaturas.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Immer wenn die ausgerüstete Kreatur eine oder mehrere Kreaturen blockt oder von einer oder mehreren Kreaturen geblockt wird, kannst du eine dieser Kreaturen ins Exil schicken.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Ogniqualvolta la creatura equipaggiata blocca o viene bloccata da una o più creature, puoi esiliare una di quelle creature.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[装備しているクリーチャーが、1体以上のクリーチャーをブロックするか1体以上のクリーチャーにブロックされた状態になるたび、あなたはそれらのクリーチャーのうち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 a criatura equipada bloquear ou for bloqueada por uma ou mais criaturas, você poderá exilar uma daquelas criaturas.]]></LOCALISED_TEXT>
    <TRIGGER value="WAS_BLOCKED_BY_A_CREATURE" to_zone="ZONE_ANY" from_zone="ZONE_ANY" >
        return TriggerObject() == EffectSourceLKI():GetParent()
    </TRIGGER>
    <TRIGGER value="BLOCKING">
        return TriggerObject() == EffectSourceLKI():GetParent()
    </TRIGGER>

   <RESOLUTION_TIME_ACTION>
    local chest = LinkedDC():Get_Chest(1)
        EffectController():SetItemCount(1)
        for i = 0, (1 - 1) do
           EffectController():SetItemPrompt(i, "CARD_QUERY_CHOOSE_CARD_TO_EXILE" )
        end
        EffectController():ChooseItemsFromDC( chest, EffectDC():Make_Targets(0), QUERY_FLAG_MAY )
    </RESOLUTION_TIME_ACTION>

         <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0) and EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
   EffectDC():Get_Targets(0):Protect_CardPtr(0)
       target:Exile()
    end
  </RESOLUTION_TIME_ACTION>

   <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    local source = EffectSource()
    if target ~= nil and source ~= nil then
       local chest = LinkedDC():Get_Chest(100)
       if chest == nil then
          chest = LinkedDC():Make_Chest(100)
       end
       local index = 1
       while chest:Get_CardPtr(index) ~= nil do
          index = index + 1
       end
       chest:Set_CardPtr(index, target)
        chest:Protect_CardPtr(index)
        chest:Set_Int(0, index)
       target:NailOnto(source)
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>

  <TRIGGERED_ABILITY linked_ability_group="1" replacement_effect="1" priority="20">
    <TRIGGER value="BEGINNING_OF_STEP">
    return MTG():GetStep() == STEP_BEGIN_COMBAT or MTG():GetStep() == STEP_END_OF_COMBAT
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
     local chest = LinkedDC():Get_Chest(1)
     if chest ~= nil then
        chest:Clear()
     end
     LinkedDC():Set_Int(0, 0)
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>

 <TRIGGERED_ABILITY replacement_effect="1" linked_ability_group="1">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Opponents can’t cast cards with the same name as cards exiled with Godsend.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Les adversaires ne peuvent pas lancer de cartes ayant le même nom que les cartes exilées par le Don du ciel.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Los oponentes no pueden lanzar cartas con el mismo nombre que las cartas exiliadas con el Filo divino.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Gegner können keine Karten mit dem gleichen Namen wie Karten wirken, die mit Gottesheil ins Exil geschickt wurden.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Gli avversari non possono lanciare carte con lo stesso nome delle carte esiliate dalla Nemesi degli Dei.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[対戦相手は、神送りによって追放されているカードと同じ名前を持つカードを唱えられない。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[상대들은 신의 선물로 추방한 카드들과 같은 이름을 가진 카드들을 발동할 수 없다.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Оппоненты не могут разыгрывать карты с такими же именами, как у карт, изгнанных Божьим Даром.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Os oponentes não podem conjurar cards com o mesmo nome de cards exilados por Mensageira dos Deuses.]]></LOCALISED_TEXT>
    <TRIGGER value="CONSIDERED_FOR_CAST" pre_trigger="1">
    local chest = LinkedDC():Get_Chest(100)
    if chest ~= nil then
       local count_so_far = chest:Get_Int(0)
       if count_so_far &gt; 0 and TriggerPlayer():GetTeam() ~= EffectController():GetTeam() and TriggerObject():GetCardType():Test( CARD_TYPE_LAND ) == false then
          for i=1,count_so_far do
              if chest:Get_CardPtr(i) ~= nil and TriggerObject():GetCardName() == chest:Get_CardPtr(i):GetCardName() then
                MTG():OverrideEvent()
                return true
              end
          end
       end
    end
    return false
    </TRIGGER>
   </TRIGGERED_ABILITY>


   <TRIGGERED_ABILITY replacement_effect="1" linked_ability_group="1">
   <TRIGGER value="ZONECHANGE_BEGIN" simple_qualifier="self" to_zone="ZONE_ANY" from_zone="ZONE_BATTLEFIELD" />
      <RESOLUTION_TIME_ACTION>
    LinkedDC():Clear()
    </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>

    <ACTIVATED_ABILITY>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Equip {3}]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Équipement {3}]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Equipar {3}.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Ausrüsten {3}]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Equipaggiare {3}]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[装備 {3}]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[장착 {3}]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Снарядить {3}]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Equipar {3}]]></LOCALISED_TEXT>
      <COST mana_cost="{3}" type="Mana" />
      <AVAILABILITY sorcery_time="1" />
      <AI_AVAILABILITY type="restriction" restriction_type="equip" />
      <TARGET tag="CARD_QUERY_CHOOSE_CREATURE_TO_EQUIP" definition="0" compartment="0" count="1" />
      <TARGET_DEFINITION id="0">
    local filter = ClearFilter()
    filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
    filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
    </TARGET_DEFINITION>
      <RESOLUTION_TIME_ACTION>
    local target_card = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if (target_card ~= nil and EffectSource() ~= nil) then
       EffectSource():Attach( target_card )   
    end
    </RESOLUTION_TIME_ACTION>
      <AUTO_SKIP>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
       return false
    else
       return true
    end
    </AUTO_SKIP>
   </ACTIVATED_ABILITY>
   <HELP title="MORE_INFO_BADGE_TITLE_1" body="MORE_INFO_BADGE_BODY_1" zone="ZONE_ANY" />
   <HELP title="MORE_INFO_BADGE_TITLE_4" body="MORE_INFO_BADGE_BODY_4" zone="ZONE_ANY" />
   <AI_BASE_SCORE score="600" zone="ZONE_BATTLEFIELD" />
</CARD_V2>
Many thx to RiiakShiNal - thefiremind - gorem2k
Last edited by NeoAnderson on 25 Aug 2014, 15:59, edited 4 times in total.
NeoAnderson
 
Posts: 914
Joined: 10 Sep 2013, 07:49
Has thanked: 18 times
Been thanked: 139 times

Re: Trigger issue - Need Help

Postby RiiakShiNal » 23 Aug 2014, 12:27

Instead of using BEGINNING_OF_PLAYERS_STEP have you tried using BLOCKERS_DECLARED (it would still be between blockers being declared and damage being assigned (maybe the problem is you are trying to trigger it too late). For Example:
Code: Select all
    <TRIGGER value="BLOCKERS_DECLARED">
      return (LinkedDC():Get_Chest(1) ~= nil) and (EffectController():MyTurn())
    </TRIGGER>
RiiakShiNal
Programmer
 
Posts: 2188
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: Trigger issue - Need Help

Postby NeoAnderson » 23 Aug 2014, 12:40

RiiakShiNal wrote:Instead of using BEGINNING_OF_PLAYERS_STEP have you tried using BLOCKERS_DECLARED (it would still be between blockers being declared and damage being assigned (maybe the problem is you are trying to trigger it too late). For Example:
Code: Select all
    <TRIGGER value="BLOCKERS_DECLARED">
      return (LinkedDC():Get_Chest(1) ~= nil) and (EffectController():MyTurn())
    </TRIGGER>
Thanks for your prompt reply Riiak, yes i tried but i cannot use that trigger because i am coding Godsend, and LinkedDC():Get_Chest(1) is made using Triggers BLOCKS_A_CREATURE and WAS_BLOCKED_BY_A_CREATURE so if use BLOCKERS_DECLARED for that trigger it fire before all blocking/blocked creatures are into the chest.

I post the whole card code so you can better understand my problem.

GodSend | Open
Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
  <FILENAME text="JOU_012_NEO_GODSEND_995380426" />
  <CARDNAME text="GODSEND" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Godsend]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Don du ciel]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Filo divino]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Gottesheil]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Nemesi degli Dei]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[神送り]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[신의 선물]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Божий Дар]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Mensageira dos Deuses]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="995380426" />
  <ARTID value="995380426" />
  <ARTIST name="Daniel Ljunggren" />
  <CASTING_COST cost="{1}{W}{W}" />
  <SUPERTYPE metaname="Legendary" />
  <TYPE metaname="Artifact" />
  <SUB_TYPE metaname="Equipment" />
  <EXPANSION value="JOU" />
  <RARITY metaname="M" />
  <STATIC_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Equipped creature gets +3/+3.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[La créature équipée gagne +3/+3.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[La criatura equipada obtiene +3/+3.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Die ausgerüstete Kreatur erhält +3/+3.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[La creatura equipaggiata prende +3/+3.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[装備しているクリーチャーは+3/+3の修整を受ける。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[장착된 생물은 +3/+3을 받는다.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Снаряженное существо получает +3/+3.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[A criatura equipada recebe +3/+3.]]></LOCALISED_TEXT>
      <CONTINUOUS_ACTION layer="7C">
    if EffectSource()~= nil then
       local parent = EffectSource():GetParent()
       if parent ~= nil then
          parent:GetCurrentCharacteristics():Power_Add( 3 )
          parent:GetCurrentCharacteristics():Toughness_Add( 3 )
       end
    end
    </CONTINUOUS_ACTION>
  </STATIC_ABILITY>
   <TRIGGERED_ABILITY forced_skip="1" linked_ability_group="1">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever equipped creature blocks or becomes blocked by one or

more creatures, you may exile one of those creatures.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[À chaque fois que la créature équipée bloque ou devient bloquée

par au moins une créature, vous pouvez exiler une de ces créatures.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Siempre que la criatura equipada bloquee o sea bloqueada por una

o más criaturas, puedes exiliar una de esas criaturas.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Immer wenn die ausgerüstete Kreatur eine oder mehrere Kreaturen

blockt oder von einer oder mehreren Kreaturen geblockt wird, kannst du eine dieser Kreaturen ins Exil schicken.]]

></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Ogniqualvolta la creatura equipaggiata blocca o viene bloccata da

una o più creature, puoi esiliare una di quelle creature.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[装備しているクリーチャーが、1体以上のクリーチャーをブロックするか1体以上のクリーチャーにブロックされた状態になるたび、あなたはそ

れらのクリーチャーのうち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 a criatura equipada bloquear ou for bloqueada por

uma ou mais criaturas, você poderá exilar uma daquelas criaturas.]]></LOCALISED_TEXT>
    <TRIGGER value="BLOCKS_A_CREATURE" to_zone="ZONE_ANY" from_zone="ZONE_ANY" >
        return TriggerObject() == EffectSourceLKI():GetParent()
    </TRIGGER>
    <TRIGGER value="WAS_BLOCKED_BY_A_CREATURE" to_zone="ZONE_ANY" from_zone="ZONE_ANY" >
        return TriggerObject() == EffectSourceLKI():GetParent()
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
       local chest = LinkedDC():Get_Chest(1)
       if chest == nil then
          chest = LinkedDC():Make_Chest(1)
       end
      local card = SecondaryObject()
      if card ~= nil then
       local index = 0
       while chest:Get_CardPtr(index) ~= nil do
          index = index + 1
       end
         chest:Set_CardPtr(index, card)
         chest:Protect_CardPtr(index)
      end
    </RESOLUTION_TIME_ACTION>

    </TRIGGERED_ABILITY>


<TRIGGERED_ABILITY replacement_query="1" linked_ability_group ="1">
  <TRIGGER value="BEGINNING_OF_PLAYERS_STEP" pre_trigger="1">
    local chest = LinkedDC():Get_Chest(1)
      if chest ~= nil and MTG():GetStep() == STEP_COMBAT_DAMAGE then
         return true
      end
    </TRIGGER>

   <RESOLUTION_TIME_ACTION>
    local chest = LinkedDC():Get_Chest(1)
        EffectController():SetItemCount(1)
        for i = 0, (1 - 1) do
           EffectController():SetItemPrompt(i, "CARD_QUERY_CHOOSE_CARD_TO_EXILE" )
        end
        EffectController():ChooseItemsFromDC( chest, EffectDC():Make_Targets(0), QUERY_FLAG_MAY )
     </RESOLUTION_TIME_ACTION>

         <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0) and EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
   EffectDC():Get_Targets(0):Protect_CardPtr(0)
       target:Exile()
        local chest = LinkedDC():Get_Chest(1)
        chest:Clear()   
    end
  </RESOLUTION_TIME_ACTION>

   <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    local source = EffectSource()
    if target ~= nil and source ~= nil then
       local chest = LinkedDC():Get_Chest(100)
       if chest == nil then
          chest = LinkedDC():Make_Chest(100)
       end
       local index = 1
       while chest:Get_CardPtr(index) ~= nil do
          index = index + 1
       end
       chest:Set_CardPtr(index, target)
        chest:Protect_CardPtr(index)
        chest:Set_Int(0, index)
       target:NailOnto(source)
    end
    </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>

 <TRIGGERED_ABILITY replacement_effect="1" linked_ability_group="1">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Opponents can’t cast cards with the same name as cards exiled

with Godsend.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Les adversaires ne peuvent pas lancer de cartes ayant le même nom

que les cartes exilées par le Don du ciel.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Los oponentes no pueden lanzar cartas con el mismo nombre que las

cartas exiliadas con el Filo divino.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Gegner können keine Karten mit dem gleichen Namen wie Karten

wirken, die mit Gottesheil ins Exil geschickt wurden.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Gli avversari non possono lanciare carte con lo stesso nome delle

carte esiliate dalla Nemesi degli Dei.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[対戦相手は、神送りによって追放されているカードと同じ名前を持つカードを唱えられない。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[상대들은 신의 선물로 추방한 카드들과 같은 이름을 가진 카드들을 발동할 수

없다.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Оппоненты не могут разыгрывать карты с такими же именами, как у

карт, изгнанных Божьим Даром.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Os oponentes não podem conjurar cards com o mesmo nome de cards

exilados por Mensageira dos Deuses.]]></LOCALISED_TEXT>
    <TRIGGER value="CONSIDERED_FOR_CAST" pre_trigger="1">
    local chest = LinkedDC():Get_Chest(100)
    if chest ~= nil then
       local count_so_far = chest:Get_Int(0)
       if count_so_far &gt; 0 and TriggerPlayer():GetTeam() ~= EffectController():GetTeam() and TriggerObject

():GetCardType():Test( CARD_TYPE_LAND ) == false then
          for i=1,count_so_far do
              if chest:Get_CardPtr(i) ~= nil and TriggerObject():GetCardName() == chest:Get_CardPtr(i):GetCardName

() then
                MTG():OverrideEvent()
                return true
              end
          end
       end
    end
    return false
    </TRIGGER>
   </TRIGGERED_ABILITY>
   <TRIGGERED_ABILITY replacement_effect="1" linked_ability_group="1">
      <TRIGGER value="ZONECHANGE_BEGIN" simple_qualifier="self" to_zone="ZONE_ANY"

from_zone="ZONE_BATTLEFIELD" />
      <RESOLUTION_TIME_ACTION>
    EffectController():DisplayMessage("Pulizia di Zona")
    LinkedDC():Clear()
    </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>


<TRIGGERED_ABILITY replacement_effect="1" linked_ability_group="1">
  <TRIGGER value="CONTROLLER_CHANGED" simple_qualifier="self">
      local PrevController = LinkedDC():Get_PlayerPtr(900)
      if EffectController() ~= PrevController then
         MTG():MessageAllPlayers("Cambio controllore")
         LinkedDC():Clear()
         LinkedDC():Set_PlayerPtr(900, EffectController())
      end
         return false
    </TRIGGER>
   </TRIGGERED_ABILITY>

    <ACTIVATED_ABILITY>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Equip {3}]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Équipement {3}]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Equipar {3}.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Ausrüsten {3}]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Equipaggiare {3}]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[装備 {3}]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[장착 {3}]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Снарядить {3}]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Equipar {3}]]></LOCALISED_TEXT>
      <COST mana_cost="{3}" type="Mana" />
      <AVAILABILITY sorcery_time="1" />
      <AI_AVAILABILITY type="restriction" restriction_type="equip" />
      <TARGET tag="CARD_QUERY_CHOOSE_CREATURE_TO_EQUIP" definition="0" compartment="0" count="1" />
      <TARGET_DEFINITION id="0">
    local filter = ClearFilter()
    filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
    filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
    </TARGET_DEFINITION>
      <RESOLUTION_TIME_ACTION>
    local target_card = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if (target_card ~= nil and EffectSource() ~= nil) then
       EffectSource():Attach( target_card )   
    end
    </RESOLUTION_TIME_ACTION>
      <AUTO_SKIP>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
       return false
    else
       return true
    end
    </AUTO_SKIP>
   </ACTIVATED_ABILITY>
   <HELP title="MORE_INFO_BADGE_TITLE_1" body="MORE_INFO_BADGE_BODY_1" zone="ZONE_ANY" />
   <HELP title="MORE_INFO_BADGE_TITLE_4" body="MORE_INFO_BADGE_BODY_4" zone="ZONE_ANY" />
   <AI_BASE_SCORE score="600" zone="ZONE_BATTLEFIELD" />
</CARD_V2>
NeoAnderson
 
Posts: 914
Joined: 10 Sep 2013, 07:49
Has thanked: 18 times
Been thanked: 139 times

Re: Trigger issue - Need Help

Postby RiiakShiNal » 23 Aug 2014, 15:13

I still don't see why you can't use BLOCKERS_DECLARED. You can always just use one TRIGGERED_ABILITY instead of three. On BLOCKERS_DECLARED you first look to see if the creature Godsend is equipped on is attacking or blocking. Then if blocking you simply get the EffectSource():GetParent():GetBlockVictim() and put it in the chest (DotP does not allow using 1 creature to block more than 1 creature). If attacking then you use a filter to get and evaluate all blocking creature to see if their Block Victim equals the creature Godsend is equipped on, if so then add that creature to the chest. Finally, if the chest has at least 1 card in it return true (so that the ability will execute).

That way you can use an EffectDC() for the temporary chest, and use the LinkedDC() for just keeping track of the exiled cards.

Additionally, you have a couple of problems with your current card beyond just the unable to select a card. You are clearing the LinkedDC() when Godsend changes controllers, but that isn't right because even if the controller changes it doesn't change the parent or the creatures blocked at that point. So for example as a response to BLOCKERS_DECLARED an opponent could use an ability that takes control of Godsend (for example Memnarch) and he/she would then get to choose what gets exiled or not, but you would have cleared the chest at that point (which also clears the list of exiled creatures which should not be cleared). Also you are protecting the card pointers, but if a creature gets destroyed as a response to BLOCKERS_DECLARED (for example a Terror gets cast) you are still giving the player the option to exile that creature even though it is already in the graveyard, which is wrong. Instead you should keep a count of how many creatures are put into the chest then process based on the count (for example you would want to iterate through the chest you created initially to create a new chest which only contains valid pointers once you are ready to have the player choose, because some of the pointers may have become invalid at that point for good reasons).
RiiakShiNal
Programmer
 
Posts: 2188
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: Trigger issue - Need Help

Postby NeoAnderson » 23 Aug 2014, 15:51

RiiakShiNal wrote:I still don't see why you can't use BLOCKERS_DECLARED. You can always just use one TRIGGERED_ABILITY instead of three. On BLOCKERS_DECLARED you first look to see if the creature Godsend is equipped on is attacking or blocking. Then if blocking you simply get the EffectSource():GetParent():GetBlockVictim() and put it in the chest (DotP does not allow using 1 creature to block more than 1 creature). If attacking then you use a filter to get and evaluate all blocking creature to see if their Block Victim equals the creature Godsend is equipped on, if so then add that creature to the chest. Finally, if the chest has at least 1 card in it return true (so that the ability will execute).

That way you can use an EffectDC() for the temporary chest, and use the LinkedDC() for just keeping track of the exiled cards.

Additionally, you have a couple of problems with your current card beyond just the unable to select a card. You are clearing the LinkedDC() when Godsend changes controllers, but that isn't right because even if the controller changes it doesn't change the parent or the creatures blocked at that point. So for example as a response to BLOCKERS_DECLARED an opponent could use an ability that takes control of Godsend (for example Memnarch) and he/she would then get to choose what gets exiled or not, but you would have cleared the chest at that point (which also clears the list of exiled creatures which should not be cleared). Also you are protecting the card pointers, but if a creature gets destroyed as a response to BLOCKERS_DECLARED (for example a Terror gets cast) you are still giving the player the option to exile that creature even though it is already in the graveyard, which is wrong. Instead you should keep a count of how many creatures are put into the chest then process based on the count (for example you would want to iterate through the chest you created initially to create a new chest which only contains valid pointers once you are ready to have the player choose, because some of the pointers may have become invalid at that point for good reasons).
Thanks a lot Riiak you always give me a different perspective.
I would also point something :
1. Until now i didnt' know about GetBlockVictim() so i think i can recode the card with one single trigger as you pointed before, but i also want to tell you that "DotP does not allow using 1 creature to block more than 1 creature" this is not true i have made a full working Hundred-Handed One, and Dotp allow a creature to block more than 1 creature using characteristics:CanBlockAdditionalCreature().
So now my question is what will return GetBlockVictim() applied on Hundred-Handed One when is blocking more creatures?

2.About the controller change honestly i had a doubt because the Godsend rulings says : If Godsend leaves the battlefield, and later another Godsend enters the battlefield, it is a new object (even if the two were represented by the same card). The new Godsend won’t stop opponents from casting cards with the same name as cards exiled with the first one.
Anyway i can remove the controller check so it will be also easier to handle.

3. About the protection of the pointers you're right i will fix it.
NeoAnderson
 
Posts: 914
Joined: 10 Sep 2013, 07:49
Has thanked: 18 times
Been thanked: 139 times

Re: Trigger issue - Need Help

Postby RiiakShiNal » 23 Aug 2014, 16:36

NeoAnderson wrote:Thanks a lot Riiak you always give me a different perspective.
I would also point something :
1. Until now i didnt' know about GetBlockVictim() so i think i can recode the card with one single trigger as you pointed before, but i also want to tell you that "DotP does not allow using 1 creature to block more than 1 creature" this is not true i have made a full working Hundred-Handed One, and Dotp allow a creature to block more than 1 creature using characteristics:CanBlockAdditionalCreature().
I keep forgetting about CanBlockAdditionalCreature() since that was new with DotP 2014. GetBlockVictim() may not work when a card blocks multiple cards. So there may not be a way to do it in a single trigger. If we could use filters or interrogation to figure out the blockers then it would, but I'm not sure if we can at this point.

NeoAnderson wrote:2.About the controller change honestly i had a doubt because the Godsend rulings says : If Godsend leaves the battlefield, and later another Godsend enters the battlefield, it is a new object (even if the two were represented by the same card). The new Godsend won’t stop opponents from casting cards with the same name as cards exiled with the first one.
Anyway i can remove the controller check so it will be also easier to handle.
When the card leaves the battlefield and comes back in the engine will already treat it as a new object (clearing the LinkedDC() on its on) so no coding needs to be done in this instance.
RiiakShiNal
Programmer
 
Posts: 2188
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: Trigger issue - Need Help

Postby thefiremind » 23 Aug 2014, 18:01

Have you tried to take a look at my Guardian of the Gateless?
Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
  <FILENAME text="GUARDIAN_OF_THE_GATELESS_199366260" />
  <CARDNAME text="GUARDIAN_OF_THE_GATELESS" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Guardian of the Gateless]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Vigile des Sans porte]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Guardiana de los sinportal]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Wächterin der Gildenfreien]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Guardiana dei Senza Cancello]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[門なしの守護者]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[관문 없는 자의 수호자]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Хранительница Безвратных]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Guardião dos Sem-portão]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="199366260" />
  <ARTID value="199366260" />
  <ARTIST name="Wesley Burt" />
  <CASTING_COST cost="{4}{W}" />
  <TYPE metaname="Creature" />
  <SUB_TYPE metaname="Angel" />
  <EXPANSION value="GTC" />
  <RARITY metaname="U" />
  <POWER value="3" />
  <TOUGHNESS value="3" />
  <STATIC_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Flying]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Vol]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Vuela.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Fliegend]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Volare]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[飛行]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[비행]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Полет]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Voar]]></LOCALISED_TEXT>
    <INTRINSIC characteristic="CHARACTERISTIC_FLYING" />
  </STATIC_ABILITY>
  <STATIC_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Guardian of the Gateless can block any number of creatures.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[La Vigile des Sans porte peut bloquer n’importe quel nombre de créatures.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[La Guardiana de los sinportal puede bloquear a cualquier cantidad de criaturas.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Die Wächterin der Gildenfreien kann eine beliebige Anzahl an Kreaturen blocken.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[La Guardiana dei Senza Cancello può bloccare un qualsiasi numero di creature.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[門なしの守護者は望む数のクリーチャーをブロックできる。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[관문 없는 자의 수호자는 원하는 만큼의 생물을 방어할 수 있다.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Хранительница Безвратных может блокировать любое количество существ.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Guardião dos Sem-portão pode bloquear qualquer número de criaturas.]]></LOCALISED_TEXT>
    <CONTINUOUS_ACTION layer="8">
    if EffectSource() ~= nil then
       EffectSource():GetCurrentCharacteristics():Bool_Set(CHARACTERISTIC_CAN_BLOCK_ANY_NUMBER_OF_CREATURES, 1)
    end
    </CONTINUOUS_ACTION>
  </STATIC_ABILITY>
  <TRIGGERED_ABILITY linked_ability_group="1" replacement_effect="1" priority="20">
    <TRIGGER value="BLOCKS_A_CREATURE" simple_qualifier="self" />
    <RESOLUTION_TIME_ACTION>
    local chest = LinkedDC():Get_Chest(1)
    if chest == nil then
       chest = LinkedDC():Make_Chest(1)
       LinkedDC():Set_Int(0, 0)
    end
    chest:Set_CardPtr( LinkedDC():Get_Int(0), SecondaryObject() )
    LinkedDC():Int_Inc(0)
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY linked_ability_group="1" replacement_effect="1" priority="20">
    <TRIGGER value="BEGINNING_OF_STEP">
    return MTG():GetStep() == STEP_BEGIN_COMBAT or MTG():GetStep() == STEP_END_OF_COMBAT
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    LinkedDC():Free_Compartment(1)
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY linked_ability_group="1">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever Guardian of the Gateless blocks, it gets +1/+1 until end of turn for each creature it’s blocking.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[À chaque fois que la Vigile des Sans porte bloque, elle gagne +1/+1 jusqu’à la fin du tour pour chaque créature qu’elle bloque.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Siempre que la Guardiana de los sinportal bloquee, obtiene +1/+1 hasta el final del turno por cada criatura a la cual está bloqueando.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Immer wenn die Wächterin der Gildenfreien blockt, erhält sie +1/+1 bis zum Ende des Zuges für jede Kreatur, die sie blockt.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Ogniqualvolta la Guardiana dei Senza Cancello blocca, prende +1/+1 fino alla fine del turno per ogni creatura che blocca.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[門なしの守護者がブロックするたび、これはターン終了時までこれがブロックしているクリーチャー1体につき+1/+1の修整を受ける。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[관문 없는 자의 수호자가 방어할 때마다, 관문 없는 자의 수호자는 턴종료까지 자신이 방어하는 각 생물마다 +1/+1을 받는다.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Каждый раз, когда Хранительница Безвратных блокирует, она получает +1/+1 до конца хода за каждое существо, которое она блокирует.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Toda vez que Guardião dos Sem-portão bloqueia, ele recebe +1/+1 até o final do turno para cada criatura que ele estiver bloqueando.]]></LOCALISED_TEXT>
    <TRIGGER value="BLOCKING" simple_qualifier="self" />
    <RESOLUTION_TIME_ACTION>
    if EffectSource() ~= nil then
       local bonus = 0
       local creaturesDC = LinkedDC():Get_Chest(1)
       if creaturesDC ~= nil then
          local count = LinkedDC():Get_Int(0)
          for i=0,count-1 do
             local creature = creaturesDC:Get_CardPtr(i)
             if creature ~= nil and creature:IsBlocked() then
                bonus = bonus + 1
             end
          end
       end
       EffectDC():Set_Int(2, bonus)
    end
    </RESOLUTION_TIME_ACTION>
    <CONTINUOUS_ACTION layer="7C">
    if EffectSource() ~= nil then
       local bonus = EffectDC():Get_Int(2)
       local characteristics = EffectSource():GetCurrentCharacteristics()
       characteristics:Power_Add(bonus)
       characteristics:Toughness_Add(bonus)
    end
    </CONTINUOUS_ACTION>
    <DURATION simple_duration="UntilEOT" />
    <AUTO_SKIP no_effect_source="1" />
  </TRIGGERED_ABILITY>
  <HELP title="MORE_INFO_BADGE_TITLE_10" body="MORE_INFO_BADGE_BODY_10" zone="ZONE_ANY" />
  <SFX text="COMBAT_ANGEL_LARGE_ATTACK" power_boundary_min="4" power_boundary_max="-1" />
  <SFX text="COMBAT_ANGEL_SMALL_ATTACK" power_boundary_min="1" power_boundary_max="3" />
  <AI_BASE_SCORE score="450" zone="ZONE_BATTLEFIELD" />
</CARD_V2>
Here I'm saving each creature into LinkedDC on a BLOCKS_A_CREATURE trigger with very high priority, and then process the chest on a BLOCKING trigger (with default priority). The trick works.
< 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: 722 times

Re: Trigger issue - Need Help

Postby gorem2k » 23 Aug 2014, 20:24

Godsend almost finished | Open
Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
  <FILENAME text="GODSEND_380426" />
  <CARDNAME text="GODSEND" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Godsend]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Don du ciel]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Filo divino]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Gottesheil]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Nemesi degli Dei]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[神送り]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[신의 선물]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Божий Дар]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Mensageira dos Deuses]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="380426" />
  <ARTID value="380426" />
  <ARTIST name="Daniel Ljunggren" />
  <CASTING_COST cost="{1}{W}{W}" />
  <SUPERTYPE metaname="Legendary" />
  <TYPE metaname="Artifact" />
  <SUB_TYPE metaname="Equipment" />
  <EXPANSION value="JOU" />
  <RARITY metaname="M" />
  <STATIC_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Equipped creature gets +3/+3.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[La créature équipée gagne +3/+3.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[La criatura equipada obtiene +3/+3.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Die ausgerüstete Kreatur erhält +3/+3.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[La creatura equipaggiata prende +3/+3.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[装備しているクリーチャーは+3/+3の修整を受ける。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[장착된 생물은 +3/+3을 받는다.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Снаряженное существо получает +3/+3.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[A criatura equipada recebe +3/+3.]]></LOCALISED_TEXT>
    <CONTINUOUS_ACTION layer="7C">
    local parent = EffectSource() and EffectSource():GetParent()
    if parent ~= nil then
       local characteristics = parent:GetCurrentCharacteristics()
       characteristics:Power_Add(3)
       characteristics:Toughness_Add(3)
    end
    </CONTINUOUS_ACTION>
  </STATIC_ABILITY>
  <TRIGGERED_ABILITY linked_ability_group="1" replacement_effect="1">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever equipped creature blocks or becomes blocked by one or more creatures, you may exile one of those creatures.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[À chaque fois que la créature équipée bloque ou devient bloquée par au moins une créature, vous pouvez exiler une de ces créatures.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Siempre que la criatura equipada bloquee o sea bloqueada por una o más criaturas, puedes exiliar una de esas criaturas.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Immer wenn die ausgerüstete Kreatur eine oder mehrere Kreaturen blockt oder von einer oder mehreren Kreaturen geblockt wird, kannst du eine dieser Kreaturen ins Exil schicken.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Ogniqualvolta la creatura equipaggiata blocca o viene bloccata da una o più creature, puoi esiliare una di quelle creature.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[装備しているクリーチャーが、1体以上のクリーチャーをブロックするか1体以上のクリーチャーにブロックされた状態になるたび、あなたはそれらのクリーチャーのうち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 a criatura equipada bloquear ou for bloqueada por uma ou mais criaturas, você poderá exilar uma daquelas criaturas.]]></LOCALISED_TEXT>
    <TRIGGER value="BLOCKS_A_CREATURE">
    if EffectSource():GetParent() ~= nil and
       (TriggerObject() == EffectSource():GetParent() or
       SecondaryObject() == EffectSource():GetParent() ) then
       return true
    end
    return false
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    local chest = LinkedDC():Get_Chest(1)
    if chest == nil then
       chest = LinkedDC():Make_Chest(1)
       LinkedDC():Set_Int(0, 0)
    end
    if TriggerObject() == EffectSource():GetParent() then
       chest:Set_CardPtr( LinkedDC():Get_Int(0), SecondaryObject() )
    else
       chest:Set_CardPtr( LinkedDC():Get_Int(0), TriggerObject() )
    end
    LinkedDC():Int_Inc(0)
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY linked_ability_group="1">
    <TRIGGER value="BLOCKERS_DECLARED">
    return LinkedDC():Get_Chest(1) ~= nil
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    local parent = EffectSource():GetParent()
    if parent ~= nil then
       local creaturesDC = LinkedDC():Get_Chest(1)
       if creaturesDC ~= nil then
          EffectController():ChooseItemFromDC( "CARD_QUERY_CHOOSE_CREATURE_TO_EXILE", creaturesDC, EffectDC():Make_Targets(2), QUERY_FLAG_MAY )
       end
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(2):Get_CardPtr(0)
    if target ~= nil then
       local exiledDC = LinkedDC():Get_Chest(2)
       if exiledDC == nil then
          exiledDC = LinkedDC():Make_Chest(2)
          LinkedDC():Set_Int(1, 0)
       end
       exiledDC:Set_CardPtr( LinkedDC():Get_Int(1), target )
       exiledDC:Protect_CardPtr( LinkedDC():Get_Int(1) )
       EffectDC():Get_Targets(2):Protect_CardPtr(0)
       target:Exile()
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION> -- nail then inc 1
    local exiledCard = EffectDC():Get_Targets(2) and EffectDC():Get_Targets(2):Get_CardPtr(0)
    if exiledCard ~= nil then
       exiledCard:NailOnto( EffectSource() )
    end
    LinkedDC():Int_Inc(1)
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY linked_ability_group="1" replacement_effect="1" priority="20">
    <TRIGGER value="BEGINNING_OF_STEP">
    return MTG():GetStep() == STEP_BEGIN_COMBAT or MTG():GetStep() == STEP_END_OF_COMBAT
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    LinkedDC():Free_Compartment(1)
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>

  -- this section is not working properly
  <TRIGGERED_ABILITY linked_ability_group="1" replacement_effect="1">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Opponents can’t cast cards with the same name as cards exiled with Godsend.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Les adversaires ne peuvent pas lancer de cartes ayant le même nom que les cartes exilées par le Don du ciel.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Los oponentes no pueden lanzar cartas con el mismo nombre que las cartas exiliadas con el Filo divino.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Gegner können keine Karten mit dem gleichen Namen wie Karten wirken, die mit Gottesheil ins Exil geschickt wurden.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Gli avversari non possono lanciare carte con lo stesso nome delle carte esiliate dalla Nemesi degli Dei.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[対戦相手は、神送りによって追放されているカードと同じ名前を持つカードを唱えられない。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[상대들은 신의 선물로 추방한 카드들과 같은 이름을 가진 카드들을 발동할 수 없다.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Оппоненты не могут разыгрывать карты с такими же именами, как у карт, изгнанных Божьим Даром.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Os oponentes não podem conjurar cards com o mesmo nome de cards exilados por Mensageira dos Deuses.]]></LOCALISED_TEXT>
    <CLEANUP simple_cleanup="EndOfTurn" />
    <TRIGGER value="CONSIDERED_FOR_CAST" pre_trigger="1">
    if (TriggerObject():GetOwner():GetTeam() ~= EffectController():GetTeam() and
       TriggerObject():GetCardType():Test(CARD_TYPE_LAND) == false ) then
       local number = LinkedDC():Get_Int(1)
       if number ~= nil and number &gt; 0 then
          for i=0, number do
             local exiledcard = LinkedDC():Get_Chest(2):Get_CardPtr(i)
             if exiledcard ~= nil and TriggerObject():GetCardName() == exiledcard:GetCardName() then
                MTG():OverrideEvent()
                return true
             else
                return false
             end
          end
       end
    end
    </TRIGGER>
  </TRIGGERED_ABILITY>

  -- added a fake ability that forces AI to attack or block
  <STATIC_ABILITY>
    <FILTER filter_id="0">
    local filter = ClearFilter()
    filter:Add(FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
    filter:Add(FE_CONTROLLER, OP_NOT, EffectController() )
    </FILTER>
    <CONTINUOUS_ACTION layer="8" filter_id="0">
    if FilteredCard() ~= nil and FilteredCard():GetController():IsAI() == true then
       local characteristics = FilteredCard():GetCurrentCharacteristics()
       characteristics:Bool_Set( CHARACTERISTIC_MUST_ATTACK_EACH_TURN, 1 )
       characteristics:Bool_Set( CHARACTERISTIC_MUST_BLOCK, 1 )
    end
    </CONTINUOUS_ACTION>
    <DURATION>
    return EffectController() == nil
    </DURATION>
  </STATIC_ABILITY>

  <ACTIVATED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Equip {3}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Équipement {3}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Equipar {3}.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Ausrüsten {3}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Equipaggiare {3}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[装備{3}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[장착 {3}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Снарядить {3}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Equipar {3}]]></LOCALISED_TEXT>
    <COST mana_cost="{3}" type="Mana" />
    <AVAILABILITY sorcery_time="1" />
    <AI_AVAILABILITY type="restriction" restriction_type="equip" />
    <TARGET tag="CARD_QUERY_CHOOSE_CREATURE_TO_EQUIP" definition="0" compartment="0" count="1" />
    <TARGET_DEFINITION id="0">
    local filter = ClearFilter()
    filter:Add(FE_TYPE, OP_IS, CARD_TYPE_CREATURE)
    filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION>
    local target_card = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target_card ~= nil and EffectSource() ~= nil then
       EffectSource():Attach(target_card)
    end
    </RESOLUTION_TIME_ACTION>
    <AUTO_SKIP>
    return EffectDC():Get_Targets(0):Get_CardPtr(0) == nil
    </AUTO_SKIP>
  </ACTIVATED_ABILITY>
  <AI_BASE_SCORE score="450" zone="ZONE_BATTLEFIELD" />
</CARD_V2>
gorem2k
 
Posts: 464
Joined: 01 Apr 2013, 04:21
Has thanked: 48 times
Been thanked: 33 times

Re: Trigger issue - Need Help

Postby NeoAnderson » 23 Aug 2014, 23:15

RiiakShiNal wrote:I keep forgetting about CanBlockAdditionalCreature() since that was new with DotP 2014. GetBlockVictim() may not work when a card blocks multiple cards. So there may not be a way to do it in a single trigger. If we could use filters or interrogation to figure out the blockers then it would, but I'm not sure if we can at this point.
I can confirm to you is not possible to make it inside one trigger because GetBlockVictim() doesn't work when a creature blocks more creatures.
So the trigger could work only when it is blocked as the follow :

Code: Select all
   <TRIGGERED_ABILITY linked_ability_group="1">
     <TRIGGER value="BLOCKERS_DECLARED">
        if EffectSource() ~= nil then
           local card = EffectSource():GetParent()
           if card ~= nil then
              if (card:IsBlocking() == true) or (card:IsBlocked() == true) then
                 return true
              end
           end   
        end
    </TRIGGER>

   <RESOLUTION_TIME_ACTION>
    if EffectSource() ~= nil then
       local card = EffectSource():GetParent()
       if card ~= nil then

         if card:IsBlocked() == true then
            local chest = EffectDC():Make_Chest(1)
            chest:Set_Int(0, 0)
            local index = chest:Get_Int(0)
            MTG():ClearFilterMark()
            local filter = ClearFilter()
            filter:Add(FE_TYPE, OP_IS, CARD_TYPE_CREATURE)
            filter:Add(FE_IS_BLOCKING, true)
            local filter_count = filter:EvaluateObjects()
            for i=0,filter_count-1 do
                local permanent = filter:GetNthEvaluatedObject(i)
                if permanent ~= nil then
                   if permanent:GetBlockVictim() == card then
                      index = index + 1
                      chest:Set_CardPtr(index, card)
                      chest:Set_Int(0, index)
                   end
                end
            end
         end

         ****  if (card:IsBlocking() == true) condition cannot be implemented! ******
       end
    end

   </RESOLUTION_TIME_ACTION>
    </TRIGGERED_ABILITY>
thefiremind wrote:Have you tried to take a look at my Guardian of the Gateless?
Guardian of the Gateless | Open
Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
  <FILENAME text="GUARDIAN_OF_THE_GATELESS_199366260" />
  <CARDNAME text="GUARDIAN_OF_THE_GATELESS" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Guardian of the Gateless]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Vigile des Sans porte]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Guardiana de los sinportal]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Wächterin der Gildenfreien]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Guardiana dei Senza Cancello]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[門なしの守護者]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[관문 없는 자의 수호자]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Хранительница Безвратных]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Guardião dos Sem-portão]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="199366260" />
  <ARTID value="199366260" />
  <ARTIST name="Wesley Burt" />
  <CASTING_COST cost="{4}{W}" />
  <TYPE metaname="Creature" />
  <SUB_TYPE metaname="Angel" />
  <EXPANSION value="GTC" />
  <RARITY metaname="U" />
  <POWER value="3" />
  <TOUGHNESS value="3" />
  <STATIC_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Flying]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Vol]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Vuela.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Fliegend]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Volare]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[飛行]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[비행]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Полет]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Voar]]></LOCALISED_TEXT>
    <INTRINSIC characteristic="CHARACTERISTIC_FLYING" />
  </STATIC_ABILITY>
  <STATIC_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Guardian of the Gateless can block any number of creatures.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[La Vigile des Sans porte peut bloquer n’importe quel nombre de créatures.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[La Guardiana de los sinportal puede bloquear a cualquier cantidad de criaturas.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Die Wächterin der Gildenfreien kann eine beliebige Anzahl an Kreaturen blocken.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[La Guardiana dei Senza Cancello può bloccare un qualsiasi numero di creature.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[門なしの守護者は望む数のクリーチャーをブロックできる。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[관문 없는 자의 수호자는 원하는 만큼의 생물을 방어할 수 있다.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Хранительница Безвратных может блокировать любое количество существ.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Guardião dos Sem-portão pode bloquear qualquer número de criaturas.]]></LOCALISED_TEXT>
    <CONTINUOUS_ACTION layer="8">
    if EffectSource() ~= nil then
       EffectSource():GetCurrentCharacteristics():Bool_Set(CHARACTERISTIC_CAN_BLOCK_ANY_NUMBER_OF_CREATURES, 1)
    end
    </CONTINUOUS_ACTION>
  </STATIC_ABILITY>
  <TRIGGERED_ABILITY linked_ability_group="1" replacement_effect="1" priority="20">
    <TRIGGER value="BLOCKS_A_CREATURE" simple_qualifier="self" />
    <RESOLUTION_TIME_ACTION>
    local chest = LinkedDC():Get_Chest(1)
    if chest == nil then
       chest = LinkedDC():Make_Chest(1)
       LinkedDC():Set_Int(0, 0)
    end
    chest:Set_CardPtr( LinkedDC():Get_Int(0), SecondaryObject() )
    LinkedDC():Int_Inc(0)
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY linked_ability_group="1" replacement_effect="1" priority="20">
    <TRIGGER value="BEGINNING_OF_STEP">
    return MTG():GetStep() == STEP_BEGIN_COMBAT or MTG():GetStep() == STEP_END_OF_COMBAT
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    LinkedDC():Free_Compartment(1)
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY linked_ability_group="1">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever Guardian of the Gateless blocks, it gets +1/+1 until end of turn for each creature it’s blocking.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[À chaque fois que la Vigile des Sans porte bloque, elle gagne +1/+1 jusqu’à la fin du tour pour chaque créature qu’elle bloque.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Siempre que la Guardiana de los sinportal bloquee, obtiene +1/+1 hasta el final del turno por cada criatura a la cual está bloqueando.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Immer wenn die Wächterin der Gildenfreien blockt, erhält sie +1/+1 bis zum Ende des Zuges für jede Kreatur, die sie blockt.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Ogniqualvolta la Guardiana dei Senza Cancello blocca, prende +1/+1 fino alla fine del turno per ogni creatura che blocca.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[門なしの守護者がブロックするたび、これはターン終了時までこれがブロックしているクリーチャー1体につき+1/+1の修整を受ける。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[관문 없는 자의 수호자가 방어할 때마다, 관문 없는 자의 수호자는 턴종료까지 자신이 방어하는 각 생물마다 +1/+1을 받는다.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Каждый раз, когда Хранительница Безвратных блокирует, она получает +1/+1 до конца хода за каждое существо, которое она блокирует.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Toda vez que Guardião dos Sem-portão bloqueia, ele recebe +1/+1 até o final do turno para cada criatura que ele estiver bloqueando.]]></LOCALISED_TEXT>
    <TRIGGER value="BLOCKING" simple_qualifier="self" />
    <RESOLUTION_TIME_ACTION>
    if EffectSource() ~= nil then
       local bonus = 0
       local creaturesDC = LinkedDC():Get_Chest(1)
       if creaturesDC ~= nil then
          local count = LinkedDC():Get_Int(0)
          for i=0,count-1 do
             local creature = creaturesDC:Get_CardPtr(i)
             if creature ~= nil and creature:IsBlocked() then
                bonus = bonus + 1
             end
          end
       end
       EffectDC():Set_Int(2, bonus)
    end
    </RESOLUTION_TIME_ACTION>
    <CONTINUOUS_ACTION layer="7C">
    if EffectSource() ~= nil then
       local bonus = EffectDC():Get_Int(2)
       local characteristics = EffectSource():GetCurrentCharacteristics()
       characteristics:Power_Add(bonus)
       characteristics:Toughness_Add(bonus)
    end
    </CONTINUOUS_ACTION>
    <DURATION simple_duration="UntilEOT" />
    <AUTO_SKIP no_effect_source="1" />
  </TRIGGERED_ABILITY>
  <HELP title="MORE_INFO_BADGE_TITLE_10" body="MORE_INFO_BADGE_BODY_10" zone="ZONE_ANY" />
  <SFX text="COMBAT_ANGEL_LARGE_ATTACK" power_boundary_min="4" power_boundary_max="-1" />
  <SFX text="COMBAT_ANGEL_SMALL_ATTACK" power_boundary_min="1" power_boundary_max="3" />
  <AI_BASE_SCORE score="450" zone="ZONE_BATTLEFIELD" />
</CARD_V2>
Here I'm saving each creature into LinkedDC on a BLOCKS_A_CREATURE trigger with very high priority, and then process the chest on a BLOCKING trigger (with default priority). The trick works.
Thanks Fire, using your idea of priority and making some modifies i have coded a working card.
I have used the BLOCKS_A_CREATURE trigger with very high priority to store the pointers and 2 different triggers WAS_BLOCKED_BY_A_CREATURE and BLOCKING to retrieve the info to exile the card and store into a new LinkedDC chest.

Godsend Rev 1.0 | Open
Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
  <FILENAME text="JOU_012_NEO_GODSEND_995380426" />
  <CARDNAME text="GODSEND" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Godsend]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Don du ciel]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Filo divino]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Gottesheil]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Nemesi degli Dei]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[神送り]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[신의 선물]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Божий Дар]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Mensageira dos Deuses]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="995380426" />
  <ARTID value="995380426" />
  <ARTIST name="Daniel Ljunggren" />
  <CASTING_COST cost="{1}{W}{W}" />
  <SUPERTYPE metaname="Legendary" />
  <TYPE metaname="Artifact" />
  <SUB_TYPE metaname="Equipment" />
  <EXPANSION value="JOU" />
  <RARITY metaname="M" />
  <STATIC_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Equipped creature gets +3/+3.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[La créature équipée gagne +3/+3.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[La criatura equipada obtiene +3/+3.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Die ausgerüstete Kreatur erhält +3/+3.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[La creatura equipaggiata prende +3/+3.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[装備しているクリーチャーは+3/+3の修整を受ける。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[장착된 생물은 +3/+3을 받는다.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Снаряженное существо получает +3/+3.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[A criatura equipada recebe +3/+3.]]></LOCALISED_TEXT>
      <CONTINUOUS_ACTION layer="7C">
    if EffectSource()~= nil then
       local parent = EffectSource():GetParent()
       if parent ~= nil then
          parent:GetCurrentCharacteristics():Power_Add( 3 )
          parent:GetCurrentCharacteristics():Toughness_Add( 3 )
       end
    end
    </CONTINUOUS_ACTION>
  </STATIC_ABILITY>



  <TRIGGERED_ABILITY linked_ability_group="1" replacement_effect="1" priority="20">
    <TRIGGER value="BLOCKS_A_CREATURE" >
      return TriggerObject() == EffectSourceLKI():GetParent() or SecondaryObject() == EffectSourceLKI():GetParent()
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    local chest = LinkedDC():Get_Chest(1)
    if chest == nil then
       chest = LinkedDC():Make_Chest(1)
       LinkedDC():Set_Int(0, 0)
    end
    if TriggerObject() == EffectSourceLKI():GetParent() then
       chest:Set_CardPtr( LinkedDC():Get_Int(0), SecondaryObject() )
    else
       chest:Set_CardPtr( LinkedDC():Get_Int(0), TriggerObject() )
    end
    LinkedDC():Int_Inc(0)
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>


  <TRIGGERED_ABILITY linked_ability_group="1">   
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever equipped creature blocks or becomes blocked by one or more creatures, you may exile one of those creatures.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[À chaque fois que la créature équipée bloque ou devient bloquée par au moins une créature, vous pouvez exiler une de ces créatures.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Siempre que la criatura equipada bloquee o sea bloqueada por una o más criaturas, puedes exiliar una de esas criaturas.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Immer wenn die ausgerüstete Kreatur eine oder mehrere Kreaturen blockt oder von einer oder mehreren Kreaturen geblockt wird, kannst du eine dieser Kreaturen ins Exil schicken.]]

></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Ogniqualvolta la creatura equipaggiata blocca o viene bloccata da una o più creature, puoi esiliare una di quelle creature.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[装備しているクリーチャーが、1体以上のクリーチャーをブロックするか1体以上のクリーチャーにブロックされた状態になるたび、あなたはそれらのクリーチャーのうち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 a criatura equipada bloquear ou for bloqueada por uma ou mais criaturas, você poderá exilar uma daquelas criaturas.]]></LOCALISED_TEXT>
    <TRIGGER value="WAS_BLOCKED_BY_A_CREATURE" to_zone="ZONE_ANY" from_zone="ZONE_ANY" >
        return TriggerObject() == EffectSourceLKI():GetParent()
    </TRIGGER>
    <TRIGGER value="BLOCKING">
        return TriggerObject() == EffectSourceLKI():GetParent()
    </TRIGGER>

   <RESOLUTION_TIME_ACTION>
    local chest = LinkedDC():Get_Chest(1)
        EffectController():SetItemCount(1)
        for i = 0, (1 - 1) do
           EffectController():SetItemPrompt(i, "CARD_QUERY_CHOOSE_CARD_TO_EXILE" )
        end
        EffectController():ChooseItemsFromDC( chest, EffectDC():Make_Targets(0), QUERY_FLAG_MAY )
    </RESOLUTION_TIME_ACTION>

         <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0) and EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
   EffectDC():Get_Targets(0):Protect_CardPtr(0)
       target:Exile()
    end
  </RESOLUTION_TIME_ACTION>

   <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    local source = EffectSource()
    if target ~= nil and source ~= nil then
       local chest = LinkedDC():Get_Chest(100)
       if chest == nil then
          chest = LinkedDC():Make_Chest(100)
       end
       local index = 1
       while chest:Get_CardPtr(index) ~= nil do
          index = index + 1
       end
       chest:Set_CardPtr(index, target)
        chest:Protect_CardPtr(index)
        chest:Set_Int(0, index)
       target:NailOnto(source)
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>

  <TRIGGERED_ABILITY linked_ability_group="1" replacement_effect="1" priority="20">
    <TRIGGER value="BEGINNING_OF_STEP">
    return MTG():GetStep() == STEP_BEGIN_COMBAT or MTG():GetStep() == STEP_END_OF_COMBAT
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
     local chest = LinkedDC():Get_Chest(1)
     if chest ~= nil then
        chest:Clear()
     end
     LinkedDC():Set_Int(0, 0)
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>

 <TRIGGERED_ABILITY replacement_effect="1" linked_ability_group="1">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Opponents can’t cast cards with the same name as cards exiled with Godsend.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Les adversaires ne peuvent pas lancer de cartes ayant le même nom que les cartes exilées par le Don du ciel.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Los oponentes no pueden lanzar cartas con el mismo nombre que las cartas exiliadas con el Filo divino.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Gegner können keine Karten mit dem gleichen Namen wie Karten wirken, die mit Gottesheil ins Exil geschickt wurden.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Gli avversari non possono lanciare carte con lo stesso nome delle carte esiliate dalla Nemesi degli Dei.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[対戦相手は、神送りによって追放されているカードと同じ名前を持つカードを唱えられない。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[상대들은 신의 선물로 추방한 카드들과 같은 이름을 가진 카드들을 발동할 수 없다.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Оппоненты не могут разыгрывать карты с такими же именами, как у карт, изгнанных Божьим Даром.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Os oponentes não podem conjurar cards com o mesmo nome de cards exilados por Mensageira dos Deuses.]]></LOCALISED_TEXT>
    <TRIGGER value="CONSIDERED_FOR_CAST" pre_trigger="1">
    local chest = LinkedDC():Get_Chest(100)
    if chest ~= nil then
       local count_so_far = chest:Get_Int(0)
       if count_so_far &gt; 0 and TriggerPlayer():GetTeam() ~= EffectController():GetTeam() and TriggerObject():GetCardType():Test( CARD_TYPE_LAND ) == false then
          for i=1,count_so_far do
              if chest:Get_CardPtr(i) ~= nil and TriggerObject():GetCardName() == chest:Get_CardPtr(i):GetCardName() then
                MTG():OverrideEvent()
                return true
              end
          end
       end
    end
    return false
    </TRIGGER>
   </TRIGGERED_ABILITY>


   <TRIGGERED_ABILITY replacement_effect="1" linked_ability_group="1">
   <TRIGGER value="ZONECHANGE_BEGIN" simple_qualifier="self" to_zone="ZONE_ANY" from_zone="ZONE_BATTLEFIELD" />
      <RESOLUTION_TIME_ACTION>
    LinkedDC():Clear()
    </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>

    <ACTIVATED_ABILITY>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Equip {3}]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Équipement {3}]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Equipar {3}.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Ausrüsten {3}]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Equipaggiare {3}]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[装備 {3}]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[장착 {3}]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Снарядить {3}]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Equipar {3}]]></LOCALISED_TEXT>
      <COST mana_cost="{3}" type="Mana" />
      <AVAILABILITY sorcery_time="1" />
      <AI_AVAILABILITY type="restriction" restriction_type="equip" />
      <TARGET tag="CARD_QUERY_CHOOSE_CREATURE_TO_EQUIP" definition="0" compartment="0" count="1" />
      <TARGET_DEFINITION id="0">
    local filter = ClearFilter()
    filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
    filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
    </TARGET_DEFINITION>
      <RESOLUTION_TIME_ACTION>
    local target_card = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if (target_card ~= nil and EffectSource() ~= nil) then
       EffectSource():Attach( target_card )   
    end
    </RESOLUTION_TIME_ACTION>
      <AUTO_SKIP>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
       return false
    else
       return true
    end
    </AUTO_SKIP>
   </ACTIVATED_ABILITY>
   <HELP title="MORE_INFO_BADGE_TITLE_1" body="MORE_INFO_BADGE_BODY_1" zone="ZONE_ANY" />
   <HELP title="MORE_INFO_BADGE_TITLE_4" body="MORE_INFO_BADGE_BODY_4" zone="ZONE_ANY" />
   <AI_BASE_SCORE score="600" zone="ZONE_BATTLEFIELD" />
</CARD_V2>
If you guys would help me to make a stress test we could better check if there are still missing bugs.
Thanks Riiak, Fire and also Gorem.
:wink:
NeoAnderson
 
Posts: 914
Joined: 10 Sep 2013, 07:49
Has thanked: 18 times
Been thanked: 139 times

Re: Trigger issue - Need Help

Postby gorem2k » 24 Aug 2014, 03:12

exiled cards can't be played, almost working :D | Open
Code: Select all
  <TRIGGERED_ABILITY linked_ability_group="1" replacement_effect="1">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Opponents can’t cast cards with the same name as cards exiled with Godsend.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Les adversaires ne peuvent pas lancer de cartes ayant le même nom que les cartes exilées par le Don du ciel.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Los oponentes no pueden lanzar cartas con el mismo nombre que las cartas exiliadas con el Filo divino.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Gegner können keine Karten mit dem gleichen Namen wie Karten wirken, die mit Gottesheil ins Exil geschickt wurden.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Gli avversari non possono lanciare carte con lo stesso nome delle carte esiliate dalla Nemesi degli Dei.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[対戦相手は、神送りによって追放されているカードと同じ名前を持つカードを唱えられない。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[상대들은 신의 선물로 추방한 카드들과 같은 이름을 가진 카드들을 발동할 수 없다.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Оппоненты не могут разыгрывать карты с такими же именами, как у карт, изгнанных Божьим Даром.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Os oponentes não podem conjurar cards com o mesmo nome de cards exilados por Mensageira dos Deuses.]]></LOCALISED_TEXT>
    <TRIGGER value="CONSIDERED_FOR_CAST" pre_trigger="1">
    local exiledcards = LinkedDC():Get_Chest(2)
    if exiledcards ~= nil then
       local count = LinkedDC():Get_Int(1)
       for i = 0, (count) do
          local exiledcard = exiledcards:Get_CardPtr(i)
          if exiledcard ~= nil and
             TriggerObject():GetCardName() == exiledcard:GetCardName() and
             TriggerObject():GetOwner():GetTeam() ~= EffectController():GetTeam() then
             MTG():OverrideEvent()
             return true
          end
       end
    end
    </TRIGGER>
  </TRIGGERED_ABILITY>
I guess we're on our own to figure this out. The problem I have is, with this code, only the last card exiled with Godsend can't be cast. I don't know why it doesn't work for previous exiled cards. I will test the count since it's probably the only thing I haven't tried
Last edited by gorem2k on 24 Aug 2014, 03:23, edited 1 time in total.
gorem2k
 
Posts: 464
Joined: 01 Apr 2013, 04:21
Has thanked: 48 times
Been thanked: 33 times

Re: Trigger issue - Need Help

Postby NeoAnderson » 24 Aug 2014, 03:21

gorem2k wrote:
exiled cards can't be played, almost working :D | Open
Code: Select all
  <TRIGGERED_ABILITY linked_ability_group="1" replacement_effect="1">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Opponents can’t cast cards with the same name as cards exiled with Godsend.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Les adversaires ne peuvent pas lancer de cartes ayant le même nom que les cartes exilées par le Don du ciel.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Los oponentes no pueden lanzar cartas con el mismo nombre que las cartas exiliadas con el Filo divino.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Gegner können keine Karten mit dem gleichen Namen wie Karten wirken, die mit Gottesheil ins Exil geschickt wurden.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Gli avversari non possono lanciare carte con lo stesso nome delle carte esiliate dalla Nemesi degli Dei.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[対戦相手は、神送りによって追放されているカードと同じ名前を持つカードを唱えられない。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[상대들은 신의 선물로 추방한 카드들과 같은 이름을 가진 카드들을 발동할 수 없다.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Оппоненты не могут разыгрывать карты с такими же именами, как у карт, изгнанных Божьим Даром.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Os oponentes não podem conjurar cards com o mesmo nome de cards exilados por Mensageira dos Deuses.]]></LOCALISED_TEXT>
    <TRIGGER value="CONSIDERED_FOR_CAST" pre_trigger="1">
    local exiledcards = LinkedDC():Get_Chest(2)
    if exiledcards ~= nil then
       local count = LinkedDC():Get_Int(1)
       for i = 0, (count) do
          local exiledcard = exiledcards:Get_CardPtr(i)
          if exiledcard ~= nil and
             TriggerObject():GetCardName() == exiledcard:GetCardName() and
             TriggerObject():GetOwner():GetTeam() ~= EffectController():GetTeam() then
             MTG():OverrideEvent()
             return true
          end
       end
    end
    </TRIGGER>
  </TRIGGERED_ABILITY>
You should exclude land cards, i also think you should use TriggerPlayer() instead of TriggerObject():GetOwner():GetTeam() because can happen that a Player_A would be able for some reason to cast a card from the hand of an Opponent_B.
NeoAnderson
 
Posts: 914
Joined: 10 Sep 2013, 07:49
Has thanked: 18 times
Been thanked: 139 times

Re: Trigger issue - Need Help

Postby gorem2k » 24 Aug 2014, 03:26

NeoAnderson wrote:You should exclude land cards, i also think you should use TriggerPlayer() instead of TriggerObject():GetOwner():GetTeam() because can happen that a Player_A would be able for some reason to cast a card from the hand of an Opponent_B.
CONSIDERED_FOR_CAST doesn't return a TriggerPlayer() at all and the card says Opponent so I made sure it's not a person on my side. no prob here. like I said the only thing not working is that it blocks only the last card exiled.

But yes I forgot about lands.

just add this,

Code: Select all
... TriggerObject():GetCardType():Test(CARD_TYPE_LAND) == false and ...
gorem2k
 
Posts: 464
Joined: 01 Apr 2013, 04:21
Has thanked: 48 times
Been thanked: 33 times

Re: Trigger issue - Need Help

Postby NeoAnderson » 24 Aug 2014, 03:41

gorem2k wrote:
NeoAnderson wrote:You should exclude land cards, i also think you should use TriggerPlayer() instead of TriggerObject():GetOwner():GetTeam() because can happen that a Player_A would be able for some reason to cast a card from the hand of an Opponent_B.
CONSIDERED_FOR_CAST doesn't return a TriggerPlayer() at all and the card says Opponent so I made sure it's not a person on my side. no prob here. like I said the only thing not working is that it blocks only the last card exiled.

But yes I forgot about lands.

just add this,

Code: Select all
... TriggerObject():GetCardType():Test(CARD_TYPE_LAND) == false and ...
Gorem my card already works, :lol:
About CONSIDERED_FOR_CAST trigger it returns also TriggerPlayer(), but when i said to use it, iwas meaning to use this confition
Code: Select all
TriggerPlayer():GetTeam() ~= EffectController():GetTeam() and TriggerObject():GetCardType():Test( CARD_TYPE_LAND ) == false
NeoAnderson
 
Posts: 914
Joined: 10 Sep 2013, 07:49
Has thanked: 18 times
Been thanked: 139 times

Re: Trigger issue - Need Help

Postby gorem2k » 24 Aug 2014, 05:38

NeoAnderson wrote:Gorem my card already works, :lol:
I can assure you that
Code: Select all
chest:Set_Int(0, index)
is wrong, you are trying to store a value into LinkedDC():Get_Chest(100) and it should be LinkedDC():Set_Int(0, index) instead...

NOT LinkedDC():Get_Chest(100):Set_Int(0, index) !!!!

And there's plenty more things that don't look right.. sorry to disagree with you.

Anyway, I've finally done a nice and tested Godsend. Looking at your code I've noticed I wasn't using proper indexing, and I completely rewrote from scratch :)

If you care to try, or whenever your card fails or not ? I will post mine for reference.

Godsend with my 444 ID and rem-lined fake ability for testing | Open
Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
  <FILENAME text="GODSEND_444380426" />
  <CARDNAME text="GODSEND" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Godsend]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Don du ciel]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Filo divino]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Gottesheil]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Nemesi degli Dei]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[神送り]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[신의 선물]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Божий Дар]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Mensageira dos Deuses]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="444380426" />
  <ARTID value="444380426" />
  <ARTIST name="Daniel Ljunggren" />
  <CASTING_COST cost="{1}{W}{W}" />
  <SUPERTYPE metaname="Legendary" />
  <TYPE metaname="Artifact" />
  <SUB_TYPE metaname="Equipment" />
  <EXPANSION value="JOU" />
  <RARITY metaname="M" />
  <STATIC_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Equipped creature gets +3/+3.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[La créature équipée gagne +3/+3.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[La criatura equipada obtiene +3/+3.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Die ausgerüstete Kreatur erhält +3/+3.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[La creatura equipaggiata prende +3/+3.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[装備しているクリーチャーは+3/+3の修整を受ける。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[장착된 생물은 +3/+3을 받는다.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Снаряженное существо получает +3/+3.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[A criatura equipada recebe +3/+3.]]></LOCALISED_TEXT>
    <CONTINUOUS_ACTION layer="7C">
    local parent = EffectSource() and EffectSource():GetParent()
    if parent ~= nil then
       local characteristics = parent:GetCurrentCharacteristics()
       characteristics:Power_Add(3)
       characteristics:Toughness_Add(3)
    end
    </CONTINUOUS_ACTION>
  </STATIC_ABILITY>
  <TRIGGERED_ABILITY linked_ability_group="1" replacement_effect="1">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever equipped creature blocks or becomes blocked by one or more creatures, you may exile one of those creatures.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[À chaque fois que la créature équipée bloque ou devient bloquée par au moins une créature, vous pouvez exiler une de ces créatures.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Siempre que la criatura equipada bloquee o sea bloqueada por una o más criaturas, puedes exiliar una de esas criaturas.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Immer wenn die ausgerüstete Kreatur eine oder mehrere Kreaturen blockt oder von einer oder mehreren Kreaturen geblockt wird, kannst du eine dieser Kreaturen ins Exil schicken.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Ogniqualvolta la creatura equipaggiata blocca o viene bloccata da una o più creature, puoi esiliare una di quelle creature.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[装備しているクリーチャーが、1体以上のクリーチャーをブロックするか1体以上のクリーチャーにブロックされた状態になるたび、あなたはそれらのクリーチャーのうち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 a criatura equipada bloquear ou for bloqueada por uma ou mais criaturas, você poderá exilar uma daquelas criaturas.]]></LOCALISED_TEXT>
    <TRIGGER value="BLOCKS_A_CREATURE">
    if EffectSource():GetParent() ~= nil and
       (TriggerObject() == EffectSource():GetParent() or
       SecondaryObject() == EffectSource():GetParent() ) then
       return true
    end
    return false
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    local chest = LinkedDC():Get_Chest(1)
    if chest == nil then
       chest = LinkedDC():Make_Chest(1)
       LinkedDC():Set_Int(0, 0)
    end
    if TriggerObject() == EffectSource():GetParent() then
       chest:Set_CardPtr(LinkedDC():Get_Int(0), SecondaryObject())
    else
       chest:Set_CardPtr(LinkedDC():Get_Int(0), TriggerObject())
    end
    LinkedDC():Int_Inc(0)
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY linked_ability_group="1">
    <TRIGGER value="BLOCKERS_DECLARED">
    return LinkedDC():Get_Chest(1) ~= nil
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    local parent = EffectSource():GetParent()
    if parent ~= nil then
       local creaturesDC = LinkedDC():Get_Chest(1)
       if creaturesDC ~= nil then
          EffectController():ChooseItemFromDC( "CARD_QUERY_CHOOSE_CREATURE_TO_EXILE", creaturesDC, EffectDC():Make_Targets(2), QUERY_FLAG_MAY )
       end
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(2) and EffectDC():Get_Targets(2):Get_CardPtr(0)
    if target ~= nil then
       EffectDC():Get_Targets(2):Protect_CardPtr(0)
       target:Exile()
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local exiledcard = EffectDC():Get_Targets(2) and EffectDC():Get_Targets(2):Get_CardPtr(0)
    local source = EffectSource()
    local index = LinkedDC():Get_Int(9)
    if exiledcard ~= nil and source ~= nil then
       local chest = LinkedDC():Get_Chest(2)
       if chest == nil or index == 0 then
          chest = LinkedDC():Make_Chest(2)
          LinkedDC():Set_Int(9, 1)
       end
       chest:Set_CardPtr(index, exiledcard)
       chest:Protect_CardPtr(index)
       exiledcard:NailOnto(source)
       LinkedDC():Int_Inc(9)
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY linked_ability_group="1" replacement_effect="1" priority="20">
    <TRIGGER value="BEGINNING_OF_STEP">
    return MTG():GetStep() == STEP_BEGIN_COMBAT or MTG():GetStep() == STEP_END_OF_COMBAT
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    LinkedDC():Free_Compartment(1)
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY linked_ability_group="1" replacement_effect="1">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Opponents can’t cast cards with the same name as cards exiled with Godsend.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Les adversaires ne peuvent pas lancer de cartes ayant le même nom que les cartes exilées par le Don du ciel.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Los oponentes no pueden lanzar cartas con el mismo nombre que las cartas exiliadas con el Filo divino.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Gegner können keine Karten mit dem gleichen Namen wie Karten wirken, die mit Gottesheil ins Exil geschickt wurden.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Gli avversari non possono lanciare carte con lo stesso nome delle carte esiliate dalla Nemesi degli Dei.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[対戦相手は、神送りによって追放されているカードと同じ名前を持つカードを唱えられない。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[상대들은 신의 선물로 추방한 카드들과 같은 이름을 가진 카드들을 발동할 수 없다.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Оппоненты не могут разыгрывать карты с такими же именами, как у карт, изгнанных Божьим Даром.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Os oponentes não podem conjurar cards com o mesmo nome de cards exilados por Mensageira dos Deuses.]]></LOCALISED_TEXT>
    <TRIGGER value="CONSIDERED_FOR_CAST" pre_trigger="1">
    local chest = LinkedDC():Get_Chest(2)
    if chest ~= nil then
       local count_so_far = LinkedDC():Get_Int(9)
       local cardtocast = TriggerObject()
       if cardtocast:GetCardType():Test( CARD_TYPE_LAND ) == false then
          for i = 0 ,count_so_far do
             if chest:Get_CardPtr(i) ~= nil and cardtocast:GetCardName() == chest:Get_CardPtr(i):GetCardName() and
                cardtocast:GetOwner():GetTeam() ~= EffectController():GetTeam() then
                MTG():OverrideEvent()
                return true
             end
          end
       end
    end
    return false
    </TRIGGER>
  </TRIGGERED_ABILITY>

--  fake ability to test the card
--  <STATIC_ABILITY>
--    <FILTER filter_id="0">
--    local filter = ClearFilter()
--    filter:Add(FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
--    filter:Add(FE_CONTROLLER, OP_NOT, EffectController() )
--    </FILTER>
--    <CONTINUOUS_ACTION layer="8" filter_id="0">
--    if FilteredCard() ~= nil and FilteredCard():GetController():IsAI() == true then
--       local characteristics = FilteredCard():GetCurrentCharacteristics()
--       characteristics:Bool_Set( CHARACTERISTIC_MUST_ATTACK_EACH_TURN, 1 )
--       characteristics:Bool_Set( CHARACTERISTIC_MUST_BLOCK, 1 )
--    end
--    </CONTINUOUS_ACTION>
--    <DURATION>
--    return EffectController() == nil
--    </DURATION>
--  </STATIC_ABILITY>

  <ACTIVATED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Equip {3}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Équipement {3}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Equipar {3}.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Ausrüsten {3}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Equipaggiare {3}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[装備{3}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[장착 {3}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Снарядить {3}]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Equipar {3}]]></LOCALISED_TEXT>
    <COST mana_cost="{3}" type="Mana" />
    <AVAILABILITY sorcery_time="1" />
    <AI_AVAILABILITY type="restriction" restriction_type="equip" />
    <TARGET tag="CARD_QUERY_CHOOSE_CREATURE_TO_EQUIP" definition="0" compartment="0" count="1" />
    <TARGET_DEFINITION id="0">
    local filter = ClearFilter()
    filter:Add(FE_TYPE, OP_IS, CARD_TYPE_CREATURE)
    filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION>
    local target_card = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target_card ~= nil and EffectSource() ~= nil then
       EffectSource():Attach(target_card)
    end
    </RESOLUTION_TIME_ACTION>
    <AUTO_SKIP>
    return EffectDC():Get_Targets(0):Get_CardPtr(0) == nil
    </AUTO_SKIP>
  </ACTIVATED_ABILITY>
  <AI_BASE_SCORE score="450" zone="ZONE_BATTLEFIELD" />
</CARD_V2>
gorem2k
 
Posts: 464
Joined: 01 Apr 2013, 04:21
Has thanked: 48 times
Been thanked: 33 times

Re: Trigger issue - Need Help

Postby NeoAnderson » 24 Aug 2014, 11:22

gorem2k wrote:
NeoAnderson wrote:Gorem my card already works, :lol:
I can assure you that
Code: Select all
chest:Set_Int(0, index)
is wrong, you are trying to store a value into LinkedDC():Get_Chest(100) and it should be LinkedDC():Set_Int(0, index) instead...

NOT LinkedDC():Get_Chest(100):Set_Int(0, index) !!!!

And there's plenty more things that don't look right.. sorry to disagree with you.
Don't be sorry my friend! :wink: The life is great because everyone is different and have different points of view.
About chest:Set_Int(0, index) the call is right, because i have declared that chest as local chest = LinkedDC():Get_Chest(100)
About the other things you disagree i would like to be informed exactly what they are, because i like to discuss about other guys on possible different implementations.
.
NeoAnderson
 
Posts: 914
Joined: 10 Sep 2013, 07:49
Has thanked: 18 times
Been thanked: 139 times

Next

Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 6 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 6 users online :: 0 registered, 0 hidden and 6 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 6 guests

Login Form