It is currently 26 Apr 2024, 15:42
   
Text Size

Giltspire Avenger

Moderator: CCGHQ Admins

Giltspire Avenger

Postby --Dream-- » 14 Aug 2012, 16:04

I'm having some trouble coding Giltspire Avenger 's activated ability... How do I pick a creature that dealt damage to a player? :?
--Dream--
 
Posts: 65
Joined: 28 Jul 2012, 12:01
Has thanked: 4 times
Been thanked: 0 time

Re: Giltspire Avenger

Postby RiiakShiNal » 14 Aug 2012, 17:12

Since we don't have an Interrogate function that would help you here you would probably need to code a trigger (would probably need to work in all zones so that if Giltspire Avenger is given haste the ability would still work correctly) that saves all the cards that do damage to Giltspire Avenger's controller into a chest on the ObjectDC (or if necessary in the player's DC) which is then referenced for the activated ability. And a second trigger that clears the chest on the ObjectDC (or if necessary the player's DC) at the end of every turn.

It's a bit of work, but it can be done.
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: Giltspire Avenger

Postby --Dream-- » 14 Aug 2012, 20:22

Oh boy this isnt going to be easy :(
--Dream--
 
Posts: 65
Joined: 28 Jul 2012, 12:01
Has thanked: 4 times
Been thanked: 0 time

Re: Giltspire Avenger

Postby --Dream-- » 15 Aug 2012, 08:27

Would I be able to use something like No Mercy uses?

Code: Select all
<TRIGGERED_ABILITY dangerous="1" filter_zone="ZONE_IN_PLAY">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever a creature deals damage to you, destroy it.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[À chaque fois qu’une créature vous inflige des blessures, détruisez-la.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Siempre que una criatura te haga daño, destrúyela.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Immer wenn eine Kreatur dir Schaden zufügt, zerstöre sie.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Ogniqualvolta una creatura ti infligge danno, distruggila.]]></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[Toda vez que uma criatura causar dano a você, destrua-a.]]></LOCALISED_TEXT>
    <TRIGGER value="CREATURE_DEALS_DAMAGE">
    return TriggerPlayer() == EffectController()
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    if TriggerObject() ~= nil then   
       TriggerObject():Destroy() 
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
--Dream--
 
Posts: 65
Joined: 28 Jul 2012, 12:01
Has thanked: 4 times
Been thanked: 0 time

Re: Giltspire Avenger

Postby sadlyblue » 15 Aug 2012, 12:16

That will destroy every creature that damaged you.
It's like RiiakShiNal said.
sadlyblue
 
Posts: 175
Joined: 06 Feb 2012, 13:18
Has thanked: 18 times
Been thanked: 16 times

Re: Giltspire Avenger

Postby --Dream-- » 15 Aug 2012, 13:03

Here's what I have so far:

Code: Select all
<?xml version='1.0'?>
<CARD_V2>
  <FILENAME text="GILTSPIRE_AVENGER_186614" />
  <CARDNAME text="GILTSPIRE_AVENGER" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Giltspire Avenger]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Giltspire Avenger]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Giltspire Avenger]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Giltspire Avenger]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Giltspire Avenger]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Giltspire Avenger]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Giltspire Avenger]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Giltspire Avenger]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Giltspire Avenger]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="186614" />
  <ARTID value="186614" />
  <ARTIST name="Chris Rahn" />
  <CASTING_COST cost="{G}{W}{U}" />
  <FLAVOURTEXT>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[“To trespass so far from home is to ask for a lonesome grave.”]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[“To trespass so far from home is to ask for a lonesome grave.”]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[“To trespass so far from home is to ask for a lonesome grave.”]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[“To trespass so far from home is to ask for a lonesome grave.”]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[“To trespass so far from home is to ask for a lonesome grave.”]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[“To trespass so far from home is to ask for a lonesome grave.”]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[“To trespass so far from home is to ask for a lonesome grave.”]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[“To trespass so far from home is to ask for a lonesome grave.”]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[“To trespass so far from home is to ask for a lonesome grave.”]]></LOCALISED_TEXT>
  </FLAVOURTEXT>
  <TYPE metaname="Creature" />
  <SUB_TYPE metaname="Human" order_de-DE="0" order_es-ES="1" order_fr-FR="0" order_it-IT="1" order_jp-JA="0" order_ko-KR="0" order_pt-BR="0" order_ru-RU="0" />
  <SUB_TYPE metaname="Soldier" order_de-DE="1" order_es-ES="0" order_fr-FR="1" order_it-IT="0" order_jp-JA="1" order_ko-KR="1" order_pt-BR="1" order_ru-RU="1" />
  <EXPANSION value="DPG" />
  <RARITY metaname="R" />
  <POWER value="2" />
  <TOUGHNESS value="2" />
  <TRIGGERED_ABILITY badge="BADGE_EXALTED" filter_zone="ZONE_IN_PLAY">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Exalted]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Exaltation]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Exaltado.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Edelmut]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Esaltato]]></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[Exaltado]]></LOCALISED_TEXT>
    <TRIGGER value="ATTACKING_ALONE" simple_qualifier="objectyoucontrol" />
    <CONTINUOUS_ACTION layer="7C">
    if TriggerObject() ~= nil  then   
       local characteristics = TriggerObject():GetCurrentCharacteristics()
       characteristics:Power_Add( 1 )   
       characteristics:Toughness_Add( 1 ) 
    end 
    </CONTINUOUS_ACTION>
    <DURATION simple_duration="UntilEOT" />
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY internal="1">
   -- create chest at beginning of turn
    <TRIGGER value="BEGINNING_OF_STEP">
      return ( MTG():GetStep() == STEP_UPKEEP )
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
      local player = TriggerPlayer()
        local player_index = -1
        local nsp = MTG():GetNumberOfStartingPlayers()
        for i=0,nsp-1 do
         if MTG():GetNthStartingPlayer(i) == player then
            player_index = i
            end
      end
        local player_chest = ObjectDC():Make_Chest(player_index)
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY internal="1">
   -- remove chest at end of turn
    <TRIGGER value="BEGINNING_OF_STEP">
      return ( MTG():GetStep() == STEP_END_OF_TURN )
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
      local player_index = -1
      local nsp = MTG():GetNumberOfStartingPlayers()
      for i=0,nsp-1 do
         if MTG():GetNthStartingPlayer(i) == player then
            player_index = i
         end
      end
      local player_chest = ObjectDC():Get_Chest(player_index)
      if player_chest ~= nil then
         player_chest:Clear()
      end
      ObjectDC():Set_Int(nsp+player_index, 0)
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY internal="1">
  -- store all creatures that dealt damage to Giltspire Avengers controller this turn
    <TRIGGER value="CREATURE_DEALS_DAMAGE">
      return TriggerPlayer() == EffectController()
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
      local player = TriggerPlayer()
      local creature = TriggerObject()
        local player_index = -1
        local nsp = MTG():GetNumberOfStartingPlayers()
        for i=0,nsp-1 do
         if MTG():GetNthStartingPlayer(i) == player then
            player_index = i
         end
        end
        local player_chest = ObjectDC():Get_Chest(player_index)
      local num_creatures_so_far = player_chest:Count()
      player_chest:Set_CardPtr(num_creatures_so_far, creature)
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <ACTIVATED_ABILITY auto_skip="1" dangerous="1" filter_zone="ZONE_IN_PLAY">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{T}: Destroy target creature that dealt damage to you this turn.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[{T}: Destroy target creature that dealt damage to you this turn.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[{T}: Destroy target creature that dealt damage to you this turn.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[{T}: Destroy target creature that dealt damage to you this turn.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[{T}: Destroy target creature that dealt damage to you this turn.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[{T}: Destroy target creature that dealt damage to you this turn.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[{T}: Destroy target creature that dealt damage to you this turn.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[{T}: Destroy target creature that dealt damage to you this turn.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[{T}: Destroy target creature that dealt damage to you this turn.]]></LOCALISED_TEXT>
   <COST type="TapSelf" />
   <TARGET_DEFINITION id="0">
      local player = EffectController()
      local player_index = -1
        local nsp = MTG():GetNumberOfStartingPlayers()
        for i=0,nsp-1 do
         if MTG():GetNthStartingPlayer(i) == player then
            player_index = i
         end
        end
        local player_chest = ObjectDC():Get_Chest(player_index)
      local target_creatures = player_chest:Count()
      MTG():ClearFilterMarkedObjectsInZone(ZONE_IN_PLAY)
      local filter = Object():GetFilter()
      filter:Clear()
      filter:NotTargetted()
      filter:SetZone( ZONE_IN_PLAY )
      filter:AddCardType( CARD_TYPE_CREATURE )
      local filter_count = filter:EvaluateObjects()
      for i=0,filter_count-1 do
         local ok = 0
            local candidate = filter:GetNthEvaluatedObject(i)
            for j=0,target_creatures-1 do
                if candidate == player_chest:Get_CardPtr(i) then
               ok = 1
                end
            end
            if ok == 1 then
            candidate:MarkForFilter()
            end
      filter:SetMarkedObjectsOnly()
      filter:SetHint( HINT_ENEMY_ONLY, EffectController() )
    </TARGET_DEFINITION>
    <TARGET_DETERMINATION>
      return AtLeastOneTargetFromDefinition(0)
    </TARGET_DETERMINATION>
    <PLAY_TIME_ACTION target_choosing="1">
      EffectController():ChooseTarget( 0, "CARD_QUERY_CHOOSE_CREATURE_TO_DESTROY", EffectDC():Make_Targets(0) )
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
      local target_card = EffectDC():Get_Targets(0):Get_CardPtr(0)
      if target_card ~= nil then 
         target_card:Destroy() 
      end
    </RESOLUTION_TIME_ACTION>
  </ACTIVATED_ABILITY>
  <HELP title="MORE_INFO_BADGE_TITLE_33" body="MORE_INFO_BADGE_BODY_33" zone="ZONE_ANY" />
</CARD_V2>
So I'm making a new chest at the beggining of each turn. A triggered ability stores all creatures that dealt damage to Giltspire Avenger 's controller in the chest. Then the activated ability marks all creatures that are in the chest. Unfortunately, it doesnt work. When I use the activated ability, I'm able to choose any creature I want, whether or not it dealt damage to me. :? :? :?
--Dream--
 
Posts: 65
Joined: 28 Jul 2012, 12:01
Has thanked: 4 times
Been thanked: 0 time

Re: Giltspire Avenger

Postby thefiremind » 15 Aug 2012, 13:36

Haven't you missed an "end" in the target definition? The weird indentation could have confused me, but I think that "for i=0,filter_count-1 do" isn't closed.

You should also change
Code: Select all
    <TRIGGER value="CREATURE_DEALS_DAMAGE">
    return TriggerPlayer() == EffectController()
    </TRIGGER>
to
Code: Select all
    <TRIGGER value="CREATURE_DEALS_DAMAGE">
    return TriggerPlayer() ~= nil
    </TRIGGER>
because you want to store the creatures for all the players in case someone gains control of Giltspire Avenger.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times

Re: Giltspire Avenger

Postby RiiakShiNal » 15 Aug 2012, 13:47

--Dream-- wrote:Would I be able to use something like No Mercy uses?
If you modify it to something like this then you could use it as part of the ability (putting creatures into a somewhat permanent data chest to check against later).
Code: Select all
<TRIGGERED_ABILITY internal="1" filter_zone="ZONE_IN_PLAY" active_zone="ZONE_ANY">
    <TRIGGER value="CREATURE_DEALS_DAMAGE">
      return TriggerPlayer() ~= nil
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
      if TriggerObject() ~= nil then
        local pDC = TriggerPlayer():PlayerDataChest():Get_Chest( 87345 )
        if (pDC == nil) then
          TriggerPlayer():PlayerDataChest():Make_Chest( 87345 )
          pDC = TriggerPlayer():PlayerDataChest():Get_Chest( 87345 )
        end
        local nCount = pDC:Int_Get( 0 )
        pDC:Set_CardPtr( nCount + 1, TriggerObject() )
        pDC:Int_Inc( 0 )
      end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
I chose to use the Player Data Chest because I believe that if the card changes zones (such as being cast or brought back from the graveyard) the ObjectDC may be cleared. The index 87345 can be replaced by whatever as long as it is unique and does not overlap with any other cards using the player data chest.

You will still need a triggered ability to clear that chest and the activated ability to pick a creature from the chest to destroy.

Edit: Man two posts in the time it took to write mine, I'll look over them and update my post as necessary.

Edit 2: You seem to only be creating/removing 1 chest at the beginning and end of each turn, but if it is brought into play, or changes controllers then adding to the chest will fail. If it leaves play before end of turn it will fail to remove the chests at all (which could lead to partially filled chests if brought back out).

Also because you are not storing the cards with an active_zone="ZONE_ANY" if a creature does damage before Giltspire Avenger comes into play and you give Giltspire Avenger haste then you won't be able to target the creature that damaged you because you did not store it.

You aren't missing an end in the target definition, but it's hard to see that you're not missing it.

This line seems to be useless (I can't see anywhere it is used or set to any value other than 0):
Code: Select all
ObjectDC():Set_Int(nsp+player_index, 0)
Edit 3: This line:
Code: Select all
if candidate == player_chest:Get_CardPtr(i) then
should probably be this:
Code: Select all
if candidate == player_chest:Get_CardPtr(j) then
And you should probably be checking to make sure card pointers aren't nil.

Edit 4: You could also try putting "candidate:MarkForFilter()" in where you have "ok = 1" and just remove the "ok" variable all together, that way it should only mark the candidate if it finds it.

Edit 5: You'll probably also want to remove "filter:NotTargetted()" as you are actually targeting a creature.
Last edited by RiiakShiNal on 15 Aug 2012, 14:21, edited 1 time in total.
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: Giltspire Avenger

Postby thefiremind » 15 Aug 2012, 14:20

If you need to make ObjectDC() undeletable because you prefer to use it, you can add this trigger:
Code: Select all
  <TRIGGERED_ABILITY internal="1" active_zone="ZONE_ANY">
    <TRIGGER value="ZONECHANGE_BEGIN" simple_qualifier="self" to_zone="ZONE_ANY" from_zone="ZONE_ANY">
    if ObjectDC() ~= nil then
       Object():RetainDataChest()
    end
    return false
    </TRIGGER>
  </TRIGGERED_ABILITY>
I used it for my Serra Avenger and it 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: 721 times

Re: Giltspire Avenger

Postby --Dream-- » 15 Aug 2012, 14:44

Thanks for all the help guys! It seems to work now, but I still need to test some special conditions.

Code: Select all
<?xml version='1.0'?>
<CARD_V2>
  <FILENAME text="GILTSPIRE_AVENGER_186614" />
  <CARDNAME text="GILTSPIRE_AVENGER" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Giltspire Avenger]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Giltspire Avenger]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Giltspire Avenger]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Giltspire Avenger]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Giltspire Avenger]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Giltspire Avenger]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Giltspire Avenger]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Giltspire Avenger]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Giltspire Avenger]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="186614" />
  <ARTID value="186614" />
  <ARTIST name="Chris Rahn" />
  <CASTING_COST cost="{G}{W}{U}" />
  <FLAVOURTEXT>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[“To trespass so far from home is to ask for a lonesome grave.”]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[“To trespass so far from home is to ask for a lonesome grave.”]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[“To trespass so far from home is to ask for a lonesome grave.”]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[“To trespass so far from home is to ask for a lonesome grave.”]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[“To trespass so far from home is to ask for a lonesome grave.”]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[“To trespass so far from home is to ask for a lonesome grave.”]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[“To trespass so far from home is to ask for a lonesome grave.”]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[“To trespass so far from home is to ask for a lonesome grave.”]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[“To trespass so far from home is to ask for a lonesome grave.”]]></LOCALISED_TEXT>
  </FLAVOURTEXT>
  <TYPE metaname="Creature" />
  <SUB_TYPE metaname="Human" order_de-DE="0" order_es-ES="1" order_fr-FR="0" order_it-IT="1" order_jp-JA="0" order_ko-KR="0" order_pt-BR="0" order_ru-RU="0" />
  <SUB_TYPE metaname="Soldier" order_de-DE="1" order_es-ES="0" order_fr-FR="1" order_it-IT="0" order_jp-JA="1" order_ko-KR="1" order_pt-BR="1" order_ru-RU="1" />
  <EXPANSION value="DPG" />
  <RARITY metaname="R" />
  <POWER value="2" />
  <TOUGHNESS value="2" />
  <TRIGGERED_ABILITY badge="BADGE_EXALTED" filter_zone="ZONE_IN_PLAY">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Exalted]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Exaltation]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Exaltado.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Edelmut]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Esaltato]]></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[Exaltado]]></LOCALISED_TEXT>
    <TRIGGER value="ATTACKING_ALONE" simple_qualifier="objectyoucontrol" />
    <CONTINUOUS_ACTION layer="7C">
    if TriggerObject() ~= nil  then   
       local characteristics = TriggerObject():GetCurrentCharacteristics()
       characteristics:Power_Add( 1 )   
       characteristics:Toughness_Add( 1 ) 
    end 
    </CONTINUOUS_ACTION>
    <DURATION simple_duration="UntilEOT" />
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY internal="1">
   -- create chest at beginning of turn
    <TRIGGER value="BEGINNING_OF_STEP">
      return ( MTG():GetStep() == STEP_UPKEEP )
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
      local player = TriggerPlayer()
        local player_index = -1
        local nsp = MTG():GetNumberOfStartingPlayers()
        for i=0,nsp-1 do
         if MTG():GetNthStartingPlayer(i) == player then
            player_index = i
            end
      end
        local player_chest = ObjectDC():Make_Chest(player_index)
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY internal="1">
   -- remove chest at end of turn
    <TRIGGER value="BEGINNING_OF_STEP">
      return ( MTG():GetStep() == STEP_END_OF_TURN )
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
      local player_index = -1
      local nsp = MTG():GetNumberOfStartingPlayers()
      for i=0,nsp-1 do
         if MTG():GetNthStartingPlayer(i) == player then
            player_index = i
         end
      end
      local player_chest = ObjectDC():Get_Chest(player_index)
      if player_chest ~= nil then
         player_chest:Clear()
      end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY internal="1">
  -- store all creatures that dealt damage to Giltspire Avengers controller this turn
    <TRIGGER value="CREATURE_DEALS_DAMAGE">
      return TriggerPlayer() ~= nil
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
      local player = TriggerPlayer()
      local creature = TriggerObject()
        local player_index = -1
        local nsp = MTG():GetNumberOfStartingPlayers()
        for i=0,nsp-1 do
         if MTG():GetNthStartingPlayer(i) == player then
            player_index = i
         end
        end
        local player_chest = ObjectDC():Get_Chest(player_index)
      local num_creatures_so_far = player_chest:Count()
      player_chest:Set_CardPtr(num_creatures_so_far, creature)
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <ACTIVATED_ABILITY auto_skip="1" dangerous="1" filter_zone="ZONE_IN_PLAY">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{T}: Destroy target creature that dealt damage to you this turn.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[{T}: Destroy target creature that dealt damage to you this turn.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[{T}: Destroy target creature that dealt damage to you this turn.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[{T}: Destroy target creature that dealt damage to you this turn.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[{T}: Destroy target creature that dealt damage to you this turn.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[{T}: Destroy target creature that dealt damage to you this turn.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[{T}: Destroy target creature that dealt damage to you this turn.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[{T}: Destroy target creature that dealt damage to you this turn.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[{T}: Destroy target creature that dealt damage to you this turn.]]></LOCALISED_TEXT>
   <COST type="TapSelf" />
   <TARGET_DEFINITION id="0">
      local player = EffectController()
      local player_index = -1
        local nsp = MTG():GetNumberOfStartingPlayers()
        for i=0,nsp-1 do
         if MTG():GetNthStartingPlayer(i) == player then
            player_index = i
         end
        end
        local player_chest = ObjectDC():Get_Chest(player_index)
      local target_creatures = player_chest:Count()
      MTG():ClearFilterMarkedObjectsInZone(ZONE_IN_PLAY)
      local filter = Object():GetFilter()
      filter:Clear()
      filter:SetZone( ZONE_IN_PLAY )
      filter:AddCardType( CARD_TYPE_CREATURE )
      local filter_count = filter:EvaluateObjects()
      for i=0,filter_count-1 do
            local candidate = filter:GetNthEvaluatedObject(i)
            for j=0,target_creatures-1 do
                if candidate == player_chest:Get_CardPtr(j) then
               candidate:MarkForFilter()
                end
            end
      end
      filter:SetMarkedObjectsOnly()
      filter:SetHint( HINT_ENEMY_ONLY, EffectController() )
    </TARGET_DEFINITION>
    <TARGET_DETERMINATION>
      return AtLeastOneTargetFromDefinition(0)
    </TARGET_DETERMINATION>
    <PLAY_TIME_ACTION target_choosing="1">
      EffectController():ChooseTarget( 0, "CARD_QUERY_CHOOSE_CREATURE_TO_DESTROY", EffectDC():Make_Targets(0) )
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
      local target_card = EffectDC():Get_Targets(0):Get_CardPtr(0)
      if target_card ~= nil then 
         target_card:Destroy() 
      end
    </RESOLUTION_TIME_ACTION>
  </ACTIVATED_ABILITY>
  <HELP title="MORE_INFO_BADGE_TITLE_33" body="MORE_INFO_BADGE_BODY_33" zone="ZONE_ANY" />
</CARD_V2>
--Dream--
 
Posts: 65
Joined: 28 Jul 2012, 12:01
Has thanked: 4 times
Been thanked: 0 time

Re: Giltspire Avenger

Postby RiiakShiNal » 15 Aug 2012, 15:02

These issues still apply (from my Edit 2 above):

You seem to only be creating/removing 1 chest at the beginning and end of each turn, but if it is brought into play, or changes controllers then adding to the chest will fail. If it leaves play before end of turn it will fail to remove the chests at all (which could lead to partially filled chests if brought back out).

Also because you are not storing the cards with an active_zone="ZONE_ANY" if a creature does damage before Giltspire Avenger comes into play and you give Giltspire Avenger haste then you won't be able to target the creature that damaged you because you did not store it.
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: Giltspire Avenger

Postby --Dream-- » 15 Aug 2012, 15:10

RiiakShiNal wrote:Edit 2: You seem to only be creating/removing 1 chest at the beginning and end of each turn, but if it is brought into play, or changes controllers then adding to the chest will fail. If it leaves play before end of turn it will fail to remove the chests at all (which could lead to partially filled chests if brought back out).
So I should make a chest for each player right? And make a trigger that deletes all chests when the card leaves the battlefield.
--Dream--
 
Posts: 65
Joined: 28 Jul 2012, 12:01
Has thanked: 4 times
Been thanked: 0 time

Re: Giltspire Avenger

Postby RiiakShiNal » 15 Aug 2012, 15:35

--Dream-- wrote:So I should make a chest for each player right? And make a trigger that deletes all chests when the card leaves the battlefield.
Ultimately you should be making/deleting a chest for all players with an active_zone="ZONE_ANY" AND storing cards with active_zone="ZONE_ANY".

That way if the card is in your hand and you cast it then while it is on the stack a player uses Prodigal Pyromancer on you (for example) then it enters play and you give it haste then you should actually be able to destroy the Prodigal Pyromancer.

Also using ZONE_ANY would also allow this to work:
3 or 4 Player FFA match, you have Giltspire Avenger in play, Opponent A uses Prodigal Pyromancer against Opponent B at the beginning of Opponent B's turn. Opponent B casts Act of Treason or Threaten on Giltspire Avenger then uses its ability to destroy Prodigal Pyromancer.

Imagine this scenario (using just what you described):
You have a Prodigal Sorcerer in play and Giltspire Avenger. During your opponent's turn he casts Terror on Giltspire Avenger and you trigger Prodigal Sorcerer before the Terror resolves (not really necessary, but just for example's sake). The Prodigal Sorcerer does damage to opponent, Giltspire Avenger stores Prodigal Sorcerer in chest, then Terror resolves and Giltspire Avenger goes to graveyard (in your method it then clears chests). Now opponent triggers Agadeem Occultist (with enough allies) on your Giltspire Avenger which now comes into play on his side and he gives it haste (with something like Accelerate or something). Then tries to use Giltspire Avenger's ability on Prodigal Sorcerer. With your method it has already cleared the chests and can't use the ability, but it should be able to.

So chests can either be created at beginning of turn for all players or created in the same ability as storing the creatures (creates a chest if it doesn't exist). However, chests should only be cleared at end of turn. All the related abilities (except the Activated ability) should function in ALL zones hence active_zone="ZONE_ANY".
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: Giltspire Avenger

Postby --Dream-- » 15 Aug 2012, 15:50

RiiakShiNal wrote:
--Dream-- wrote:So I should make a chest for each player right? And make a trigger that deletes all chests when the card leaves the battlefield.
Ultimately you should be making/deleting a chest for all players with an active_zone="ZONE_ANY" AND storing cards with active_zone="ZONE_ANY".

That way if the card is in your hand and you cast it then while it is on the stack a player uses Prodigal Pyromancer on you (for example) then it enters play and you give it haste then you should actually be able to destroy the Prodigal Pyromancer.

Also using ZONE_ANY would also allow this to work:
3 or 4 Player FFA match, you have Giltspire Avenger in play, Opponent A uses Prodigal Pyromancer against Opponent B at the beginning of Opponent B's turn. Opponent B casts Act of Treason or Threaten on Giltspire Avenger then uses its ability to destroy Prodigal Pyromancer.

Imagine this scenario (using just what you described):
You have a Prodigal Sorcerer in play and Giltspire Avenger. During your opponent's turn he casts Terror on Giltspire Avenger and you trigger Prodigal Sorcerer before the Terror resolves (not really necessary, but just for example's sake). The Prodigal Sorcerer does damage to opponent, Giltspire Avenger stores Prodigal Sorcerer in chest, then Terror resolves and Giltspire Avenger goes to graveyard (in your method it then clears chests). Now opponent triggers Agadeem Occultist (with enough allies) on your Giltspire Avenger which now comes into play on his side and he gives it haste (with something like Accelerate or something). Then tries to use Giltspire Avenger's ability on Prodigal Sorcerer. With your method it has already cleared the chests and can't use the ability, but it should be able to.

So chests can either be created at beginning of turn for all players or created in the same ability as storing the creatures (creates a chest if it doesn't exist). However, chests should only be cleared at end of turn. All the related abilities (except the Activated ability) should function in ALL zones hence active_zone="ZONE_ANY".
So in essence, adding active_zone="ZONE_ANY" to the three triggered abilities that deal with the chests should do the trick :)
--Dream--
 
Posts: 65
Joined: 28 Jul 2012, 12:01
Has thanked: 4 times
Been thanked: 0 time

Re: Giltspire Avenger

Postby RiiakShiNal » 15 Aug 2012, 16:31

--Dream-- wrote:So in essence, adding active_zone="ZONE_ANY" to the three triggered abilities that deal with the chests should do the trick :)
You also need to make sure that chests are built and cleared for all players, but yeah.

Though if you use ObjectDC() then you need to make it undeleteable like thefiremind mentioned in his post.
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times


Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 35 guests


Who is online

In total there are 35 users online :: 0 registered, 0 hidden and 35 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 35 guests

Login Form