Board index Programs with AI or Rules Enforcement Magic: The Gathering - Duels of the Planeswalkers Programming Talk
DASH (mechanic)
Moderator: CCGHQ Admins
Re: DASH (mechanic)
by Tejahn » 09 Feb 2015, 05:36
Xander9009, I added the trigger code you provided up top to the card but it still returned to my hand even after going to the graveyard and exile. Can you supply the full code? I actually learn better studying entire codes.
Re: DASH (mechanic)
by Xander9009 » 11 Feb 2015, 14:46
Alright, I'm confused. The code did prevent the card from returning to my hand (I suspect you forgot to create the delayed trigger). However, it prevented ALL copies of Mardu Shadowspear from returning to my hand when I used Cloudshift on just one of them. Same result whether I created triggered ability 4 at the same time as abilities 1 and 3 or at the same time as triggered ability 2. Not understanding what was wrong, I tried switching to use a linked ability group and an int, but that STILL prevented all of them instead of only the one that was affected. I'll keep tinkering with it, but I don't understand why it one would affect another.
- Mardu Shadowspear - Bugged | Open
- Code: Select all
<?xml version="1.0"?>
<CARD_V2 ExportVersion="1">
<FILENAME text="MARDU_SHADOWSPEAR_CW_391875" />
<CARDNAME text="MARDU_SHADOWSPEAR" />
<TITLE>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Mardu Shadowspear]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Ombrelance marduenne]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Lanzasombría mardu]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Mardu-Schattenspeer]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Lancia Oscura Mardu]]></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[Lança Sombria Mardu]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="zh-CN"><![CDATA[玛尔都影矛兵]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="zh-HK"><![CDATA[瑪爾都影矛兵]]></LOCALISED_TEXT>
</TITLE>
<MULTIVERSEID value="391875" />
<ARTID value="CW391875" />
<ARTIST name="Mark Poole" />
<CASTING_COST cost="{B}" />
<TYPE metaname="Creature" />
<SUB_TYPE metaname="Human" />
<SUB_TYPE metaname="Warrior" />
<EXPANSION value="FRF" />
<RARITY metaname="U" />
<POWER value="1" />
<TOUGHNESS value="1" />
<TRIGGERED_ABILITY>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever Mardu Shadowspear attacks, each opponent loses 1 life.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[À chaque fois que l’Ombrelance marduenne attaque, chaque adversaire perd 1 point de vie.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Siempre que la Lanzasombría mardu ataque, cada oponente pierde 1 vida.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Immer wenn der Mardu-Schattenspeer angreift, verliert jeder Gegner 1 Lebenspunkt.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Ogniqualvolta la Lancia Oscura Mardu attacca, ogni avversario perde 1 punto vita.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[マルドゥの影槍が攻撃するたび、各対戦相手はそれぞれ1点のライフを失う。]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[마르두 그림자창이 공격할 때마다, 각 상대는 생명 1점을 잃는다.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Каждый раз, когда Копейщица Тени Марду атакует, каждый оппонент теряет 1 жизнь.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Toda vez que Lança Sombria Mardu ataca, cada oponente perde 1 ponto de vida.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="zh-CN"><![CDATA[每当玛尔都影矛兵攻击时,每位对手各失去1点生命。]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="zh-HK"><![CDATA[每當瑪爾都影矛兵攻擊時,每位對手各失去1點生命。]]></LOCALISED_TEXT>
</TRIGGERED_ABILITY>
<STATIC_ABILITY>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Dash {1}{B}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Précipitation {1}{B}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Rapidez {1}{B}.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Sturmangriff {1}{B}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Accelerare {1}{B}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[疾駆{1}{B}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[질주 {1}{B}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Рывок {1}{B}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Investida {1}{B}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="zh-CN"><![CDATA[掩袭{1}{B}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="zh-HK"><![CDATA[掩襲{1}{B}]]></LOCALISED_TEXT>
</STATIC_ABILITY>
<UTILITY_ABILITY qualifier="Alternate">
<COST mana_cost="{1}{B}" type="Mana" />
<COST type="Generic">
<PREREQUISITE>
return true
</PREREQUISITE>
<RESOLUTION_TIME_ACTION>
if EffectSource() ~= nil then
local delayDC = EffectDC():Make_Chest(1)
delayDC:Set_CardPtr(0, EffectSource())
delayDC:Protect_CardPtr(0)
MTG():CreateDelayedTrigger(1, delayDC)
MTG():CreateDelayedTrigger(3, delayDC)
end
</RESOLUTION_TIME_ACTION>
</COST>
<ABILITY_TEXT tag="CARD_QUERY_PAY_DASH_COST" />
</UTILITY_ABILITY>
<TRIGGERED_ABILITY replacement_effect="1" resource_id="1">
<CLEANUP simple_cleanup="EndOfTurn" fire_once="1" />
<TRIGGER value="SPELL_RESOLVED">
return TriggerObject() == EffectDC():Get_CardPtr(0)
</TRIGGER>
<RESOLUTION_TIME_ACTION>
local delayDC = EffectDC():Make_Chest(1)
MTG():CreateDelayedTrigger(2, delayDC)
MTG():CreateDelayedTrigger(4, nil)
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
<TRIGGERED_ABILITY resource_id="2" priority="-1">
<CLEANUP simple_cleanup="EndOfTurn" fire_once="1" />
<TRIGGER value="BEGINNING_OF_STEP">
return MTG():GetStep() == STEP_END_OF_TURN and LinkedDC() ~= nil and LinkedDC():Get_Int(10) == 1
</TRIGGER>
<RESOLUTION_TIME_ACTION>
if EffectSource() ~= nil then
EffectSource():PutInHand()
end
</RESOLUTION_TIME_ACTION>
<AUTO_SKIP no_effect_source="1" />
</TRIGGERED_ABILITY>
<TRIGGERED_ABILITY resource_id="3">
<CLEANUP simple_cleanup="EndOfTurn" fire_once="1" />
<TRIGGER value="ZONECHANGE_END" simple_qualifier="self" to_zone="ZONE_BATTLEFIELD" />
<CONTINUOUS_ACTION layer="6">
if EffectSource() ~= nil then
EffectSource():GetCurrentCharacteristics():Bool_Set(CHARACTERISTIC_HASTE, 1)
end
</CONTINUOUS_ACTION>
<DURATION simple_duration="UntilEOT" />
</TRIGGERED_ABILITY>
<TRIGGERED_ABILITY resource_id="4" priority="-1">
<CLEANUP fire_once="1" />
<TRIGGER value="ZONECHANGE_BEGIN" simple_qualifier="self" to_zone="ZONE_ANY" from_zone="ZONE_BATTLEFIELD" />
<RESOLUTION_TIME_ACTION>
MTG():RemoveDelayedTrigger(1)
MTG():RemoveDelayedTrigger(2)
MTG():RemoveDelayedTrigger(3)
</RESOLUTION_TIME_ACTION>
<AUTO_SKIP no_effect_source="1" />
</TRIGGERED_ABILITY>
<SFX text="COMBAT_BLUNT_LARGE_ATTACK" power_boundary_min="4" power_boundary_max="-1" />
<SFX text="COMBAT_BLUNT_SMALL_ATTACK" power_boundary_min="1" power_boundary_max="3" />
</CARD_V2>
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
-
Xander9009 - Programmer
- Posts: 2905
- Joined: 29 Jun 2013, 07:44
- Location: Indiana, United States
- Has thanked: 121 times
- Been thanked: 445 times
Re: DASH (mechanic)
by Tejahn » 11 Feb 2015, 16:48
I'll inspect the XML further when I get chance. Thanks for looking at it again.
Re: DASH (mechanic)
by Xander9009 » 11 Feb 2015, 17:09
Nice timing. I just got the email as I pulled up my browser to post the working code.
So, the problem was that simple_qualifier="self" wasn't working. I have no idea why it wasn't, but when I added in TriggerObject() == EffectSource() to the trigger, it worked. However, there was one other issue: the dash deactivating code (trigger 4) would fire when the dash bounce code ran (2), and because the deactivating code turned off the bounce code, it would stop the bounce. I expected the bounce to continue, but apparently removing a delayed trigger mid-resolution will, in fact, stop the resolution (I expected it to simply stop any further triggering). So, I made them linked abilities with a variable to track whether or not the removal was due to the dash bounce. If it's NOT due to the dash bounce, then the dash bounce is turned off.
You'll want to test this some more. I only got one good test in the case where it was previously failing (it was deactivating all dashed cards instead of only itself if one was bounced/removed) before posting this code.
So, the problem was that simple_qualifier="self" wasn't working. I have no idea why it wasn't, but when I added in TriggerObject() == EffectSource() to the trigger, it worked. However, there was one other issue: the dash deactivating code (trigger 4) would fire when the dash bounce code ran (2), and because the deactivating code turned off the bounce code, it would stop the bounce. I expected the bounce to continue, but apparently removing a delayed trigger mid-resolution will, in fact, stop the resolution (I expected it to simply stop any further triggering). So, I made them linked abilities with a variable to track whether or not the removal was due to the dash bounce. If it's NOT due to the dash bounce, then the dash bounce is turned off.
You'll want to test this some more. I only got one good test in the case where it was previously failing (it was deactivating all dashed cards instead of only itself if one was bounced/removed) before posting this code.
- Mardu Shadowspear - partially tested and apparently working | Open
- Code: Select all
<?xml version="1.0"?>
<CARD_V2 ExportVersion="1">
<FILENAME text="MARDU_SHADOWSPEAR_CW_391875" />
<CARDNAME text="MARDU_SHADOWSPEAR" />
<TITLE>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Mardu Shadowspear]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Ombrelance marduenne]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Lanzasombría mardu]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Mardu-Schattenspeer]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Lancia Oscura Mardu]]></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[Lança Sombria Mardu]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="zh-CN"><![CDATA[玛尔都影矛兵]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="zh-HK"><![CDATA[瑪爾都影矛兵]]></LOCALISED_TEXT>
</TITLE>
<MULTIVERSEID value="391875" />
<ARTID value="CW391875" />
<ARTIST name="Mark Poole" />
<CASTING_COST cost="{B}" />
<TYPE metaname="Creature" />
<SUB_TYPE metaname="Human" />
<SUB_TYPE metaname="Warrior" />
<EXPANSION value="FRF" />
<RARITY metaname="U" />
<POWER value="1" />
<TOUGHNESS value="1" />
<TRIGGERED_ABILITY>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever Mardu Shadowspear attacks, each opponent loses 1 life.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[À chaque fois que l’Ombrelance marduenne attaque, chaque adversaire perd 1 point de vie.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Siempre que la Lanzasombría mardu ataque, cada oponente pierde 1 vida.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Immer wenn der Mardu-Schattenspeer angreift, verliert jeder Gegner 1 Lebenspunkt.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Ogniqualvolta la Lancia Oscura Mardu attacca, ogni avversario perde 1 punto vita.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[マルドゥの影槍が攻撃するたび、各対戦相手はそれぞれ1点のライフを失う。]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[마르두 그림자창이 공격할 때마다, 각 상대는 생명 1점을 잃는다.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Каждый раз, когда Копейщица Тени Марду атакует, каждый оппонент теряет 1 жизнь.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Toda vez que Lança Sombria Mardu ataca, cada oponente perde 1 ponto de vida.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="zh-CN"><![CDATA[每当玛尔都影矛兵攻击时,每位对手各失去1点生命。]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="zh-HK"><![CDATA[每當瑪爾都影矛兵攻擊時,每位對手各失去1點生命。]]></LOCALISED_TEXT>
</TRIGGERED_ABILITY>
<STATIC_ABILITY>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Dash {1}{B}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Précipitation {1}{B}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Rapidez {1}{B}.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Sturmangriff {1}{B}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Accelerare {1}{B}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[疾駆{1}{B}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[질주 {1}{B}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Рывок {1}{B}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Investida {1}{B}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="zh-CN"><![CDATA[掩袭{1}{B}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="zh-HK"><![CDATA[掩襲{1}{B}]]></LOCALISED_TEXT>
</STATIC_ABILITY>
<UTILITY_ABILITY qualifier="Alternate">
<COST mana_cost="{1}{B}" type="Mana" />
<COST type="Generic">
<PREREQUISITE>
return true
</PREREQUISITE>
<RESOLUTION_TIME_ACTION>
if EffectSource() ~= nil then
local delayDC = EffectDC():Make_Chest(1)
delayDC:Set_CardPtr(0, EffectSource())
delayDC:Protect_CardPtr(0)
MTG():CreateDelayedTrigger(1, delayDC)
MTG():CreateDelayedTrigger(3, delayDC)
end
</RESOLUTION_TIME_ACTION>
</COST>
<ABILITY_TEXT tag="CARD_QUERY_PAY_DASH_COST" />
</UTILITY_ABILITY>
<TRIGGERED_ABILITY replacement_effect="1" resource_id="1" linked_ability_group="1">
<CLEANUP simple_cleanup="EndOfTurn" fire_once="1" />
<TRIGGER value="SPELL_RESOLVED">
return TriggerObject() == EffectDC():Get_CardPtr(0)
</TRIGGER>
<RESOLUTION_TIME_ACTION>
LinkedDC():Set_Int(10, 0)
local delayDC = EffectDC():Make_Chest(1)
MTG():CreateDelayedTrigger(2, delayDC)
MTG():CreateDelayedTrigger(4, delayDC)
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
<TRIGGERED_ABILITY resource_id="2" priority="-1" linked_ability_group="1">
<CLEANUP simple_cleanup="EndOfTurn" fire_once="1" />
<TRIGGER value="BEGINNING_OF_STEP">
return MTG():GetStep() == STEP_END_OF_TURN
</TRIGGER>
<RESOLUTION_TIME_ACTION>
if EffectSource() ~= nil then
LinkedDC():Set_Int(10, 1)
EffectSource():PutInHand()
end
</RESOLUTION_TIME_ACTION>
<AUTO_SKIP no_effect_source="1" />
</TRIGGERED_ABILITY>
<TRIGGERED_ABILITY resource_id="3">
<CLEANUP simple_cleanup="EndOfTurn" fire_once="1" />
<TRIGGER value="ZONECHANGE_END" simple_qualifier="self" to_zone="ZONE_BATTLEFIELD" />
<CONTINUOUS_ACTION layer="6">
if EffectSource() ~= nil then
EffectSource():GetCurrentCharacteristics():Bool_Set(CHARACTERISTIC_HASTE, 1)
end
</CONTINUOUS_ACTION>
<DURATION simple_duration="UntilEOT" />
</TRIGGERED_ABILITY>
<TRIGGERED_ABILITY resource_id="4" linked_ability_group="1" forced_skip="1">
<CLEANUP simple_cleanup="EndOfTurn" fire_once="1" />
<TRIGGER value="ZONECHANGE_BEGIN" simple_qualifier="self" to_zone="ZONE_ANY" from_zone="ZONE_BATTLEFIELD">
return LinkedDC():Get_Int(10) == 0 and TriggerObject() == EffectSource()
</TRIGGER>
<RESOLUTION_TIME_ACTION>
MTG():RemoveDelayedTrigger(2)
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
<SFX text="COMBAT_BLUNT_LARGE_ATTACK" power_boundary_min="4" power_boundary_max="-1" />
<SFX text="COMBAT_BLUNT_SMALL_ATTACK" power_boundary_min="1" power_boundary_max="3" />
</CARD_V2>
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
-
Xander9009 - Programmer
- Posts: 2905
- Joined: 29 Jun 2013, 07:44
- Location: Indiana, United States
- Has thanked: 121 times
- Been thanked: 445 times
Re: DASH (mechanic)
by Kithkin » 12 Feb 2015, 17:57
In which time zone do you live?Tejahn wrote:Great! I'll test it when I leave the office.
-
Kithkin - Posts: 456
- Joined: 21 Feb 2014, 07:12
- Location: Cologne, GERMANY
- Has thanked: 11 times
- Been thanked: 56 times
23 posts
• Page 2 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 10 guests