Board index Programs with AI or Rules Enforcement Magic: The Gathering - Duels of the Planeswalkers Programming Talk
Giltspire Avenger
Moderator: CCGHQ Admins
Giltspire Avenger
by --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?
Re: Giltspire Avenger
by 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.
It's a bit of work, but it can be done.
Just getting started: Xander9009's DotP 2014 Community Wad
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
- RiiakShiNal
- Programmer
- Posts: 2183
- Joined: 16 May 2011, 21:37
- Has thanked: 75 times
- Been thanked: 496 times
Re: Giltspire Avenger
by --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>
Re: Giltspire Avenger
by sadlyblue » 15 Aug 2012, 12:16
That will destroy every creature that damaged you.
It's like RiiakShiNal said.
It's like RiiakShiNal said.
Re: Giltspire Avenger
by --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>
Re: Giltspire Avenger
by 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
You should also change
- Code: Select all
<TRIGGER value="CREATURE_DEALS_DAMAGE">
return TriggerPlayer() == EffectController()
</TRIGGER>
- Code: Select all
<TRIGGER value="CREATURE_DEALS_DAMAGE">
return TriggerPlayer() ~= nil
</TRIGGER>
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-
thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 721 times
Re: Giltspire Avenger
by RiiakShiNal » 15 Aug 2012, 13:47
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).--Dream-- wrote:Would I be able to use something like No Mercy uses?
- 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>
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)
- Code: Select all
if candidate == player_chest:Get_CardPtr(i) then
- Code: Select all
if candidate == player_chest:Get_CardPtr(j) then
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.
Just getting started: Xander9009's DotP 2014 Community Wad
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
- RiiakShiNal
- Programmer
- Posts: 2183
- Joined: 16 May 2011, 21:37
- Has thanked: 75 times
- Been thanked: 496 times
Re: Giltspire Avenger
by 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>
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-
thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 721 times
Re: Giltspire Avenger
by --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>
Re: Giltspire Avenger
by 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.
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.
Just getting started: Xander9009's DotP 2014 Community Wad
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
- RiiakShiNal
- Programmer
- Posts: 2183
- Joined: 16 May 2011, 21:37
- Has thanked: 75 times
- Been thanked: 496 times
Re: Giltspire Avenger
by --Dream-- » 15 Aug 2012, 15:10
So I should make a chest for each player right? And make a trigger that deletes all chests when the card leaves the battlefield.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).
Re: Giltspire Avenger
by RiiakShiNal » 15 Aug 2012, 15:35
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".--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.
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".
Just getting started: Xander9009's DotP 2014 Community Wad
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
- RiiakShiNal
- Programmer
- Posts: 2183
- Joined: 16 May 2011, 21:37
- Has thanked: 75 times
- Been thanked: 496 times
Re: Giltspire Avenger
by --Dream-- » 15 Aug 2012, 15:50
So in essence, adding active_zone="ZONE_ANY" to the three triggered abilities that deal with the chests should do the trickRiiakShiNal wrote: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".--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.
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".
Re: Giltspire Avenger
by RiiakShiNal » 15 Aug 2012, 16:31
You also need to make sure that chests are built and cleared for all players, but yeah.--Dream-- wrote:So in essence, adding active_zone="ZONE_ANY" to the three triggered abilities that deal with the chests should do the trick
Though if you use ObjectDC() then you need to make it undeleteable like thefiremind mentioned in his post.
Just getting started: Xander9009's DotP 2014 Community Wad
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
- RiiakShiNal
- Programmer
- Posts: 2183
- Joined: 16 May 2011, 21:37
- Has thanked: 75 times
- Been thanked: 496 times
15 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 6 guests