It is currently 20 Jun 2019, 21:20
   
Text Size

Split Cards - Two Sets of Copiable Values

Moderators: Xander9009, CCGHQ Admins

Split Cards - Two Sets of Copiable Values

Postby Xander9009 » 12 Apr 2017, 12:36

I've spent the last day or so working on trying to get split cards to work. To begin with, I'm focusing on the new ones from Amonkhet, where the first half is castable normally, but the second half is only castable from the graveyard. Thanks to the rules changes regarding split cards, they should be fully codable, since they always have the combined characteristics except when they're on the stack. They never return two answers to a question like "What's your CMC?" Now, they just return the combined value.

In order to manage this, I've set it up so they have the full combined characteristics on the card. The card then gets a static which reduces the cost by the Aftermath's cost, which will leave it at the normal cost (I don't know the rules regarding increasing the cost of split cards, but I'm not worried about that fringe case for the moment...). At the beginning of the game, it creates a copy of each of the two separate cards, storing their copiable values. Then, when it goes to the stack, it'll use the copiable values of one or the other. When to use each (for aftermath cards) is pretty simple, so choosing which to use is working fine. What's not is actually using the second one.

The card I'm testing with is Onward to Victory (Onward//Victory).

Onward
{2} {R}
Instant
Target creature gets +X/+0 until end of turn, where X is its power.

Victory
{2} {W}
Sorcery
Aftermath (only castable from graveyard; exile it when it resolves.)
Target creature gets double strike until end of turn.

See, I've set it up so it creates each in turn using a function "CW_Flip_StoreA("_ONWARD", "ONWARD", 1, 1)" and "CW_Flip_StoreA("_VICTORY", "VICTORY", 2, 1)". Then, in a delayed triggered ability created inside that function, it calls "CW_Flip_StoreB("_ONWARD", "ONWARD", 1, 1)" and "CW_Flip_StoreB("_VICTORY", "VICTORY", 2, 1)". The functions have the same parameters for clarity at the moment, but that'll all be cleaned up once it's fully working. Anyway, here are the functions and the card.

functions | Open
Code: Select all
CW_Flip_StoreA = function(sFileName, sCardName, iChestIndex, iDelayedTriggerIndex)
   if sFileName ~= nil and sCardName ~= nil and iChestIndex ~= nil then
      if iDelayedTriggerIndex == nil then
         iDelayedTriggerIndex = 0
      end
      MTG():CreateDelayedTrigger(iDelayedTriggerIndex)
      MTG():PutTokensOntoBattlefield(sFileName, 1, EffectController(), CW_DC_ObjectDC(iChestIndex))
   end
end

CW_Flip_StoreB = function(sFileName, sCardName, iChestIndex, iDelayedTriggerIndex)
   local oTokenChest = CW_DC_ObjectDC(iChestIndex)
   if oTokenChest ~= nil then
      local oToken = oTokenChest:Get_NthCardPtr(0)
      if oToken ~= nil and oToken:GetCardName() == sCardName then
         oTokenChest:Clear()
         oToken:StoreCopiableValues(oTokenChest)
         Debug(sCardName, iChestIndex)
      end
   end
end
Onward to Victory | Open
Code: Select all
<?xml version="1.0"?>
<CARD_V2 ExportVersion="1">
   <FILENAME text="ONWARD_TO_VICTORY" />
   <CARDNAME text="ONWARD_TO_VICTORY" />
   <TITLE>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Onward to Victory]]></LOCALISED_TEXT>
   </TITLE>
   <MULTIVERSEID value="30170" />
   <ARTID value="ONWARD_TO_VICTORY" />
   <ARTIST name="Unknown" />
   <CASTING_COST cost="{4}{R}{W}" />
   <TYPE metaname="Instant" />
   <TYPE metaname="Sorcery" />
   <EXPANSION value="AKH" />
   <RARITY metaname="R" />
   <TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_ANY">
      <TRIGGER value="BEGINNING_OF_STEP">
         return MTG():GetStep() == STEP_UPKEEP and MTG():GetTurnNumber() == 0
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
         CW_Flip_StoreA("_ONWARD", "ONWARD", 0, 1)
         CW_Flip_StoreA("_VICTORY", "VICTORY", 1, 1)
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_ANY" resource_id="1" priority="-1">
      <TRIGGER value="ZONECHANGE_CONSIDERED" to_zone="ZONE_BATTLEFIELD" from_zone="ZONE_ANY" pre_trigger="1" simple_qualifier="objectyoucontrol">
         if TriggerObject() ~= nil then
            MTG():OverrideEvent()
            return true
         end
         return false
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
         CW_Flip_StoreB("_ONWARD", "ONWARD", 0, 1)
         CW_Flip_StoreB("_VICTORY", "VICTORY", 1, 1)
      </RESOLUTION_TIME_ACTION>
      <CLEANUP fire_once="1" />
   </TRIGGERED_ABILITY>
   <TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_ANY">
      <TRIGGER value="CONSIDERED_FOR_CAST" simple_qualifier="self" pre_trigger="1" />
      <RESOLUTION_TIME_ACTION>
         if TriggerObject() ~= nil then
            TriggerObject():DecreaseColouredCost(COLOUR_WHITE, 1)
            TriggerObject():DecreaseCost(2)
         end
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <STATIC_ABILITY linked_ability_group="1" active_zone="ZONE_ANY">
      <CONTINUOUS_ACTION layer="0">
         local oOwner = EffectSource():GetPlayer()
         local iRefID = EffectSource():GetRef()
         local oRefChest = oOwner:PlayerDataChest():Get_Chest(iRefID)
         if oRefChest ~= nil then
            if oRefChest:Get_Int(0) ~= 1 and LinkedDC():Get_Int(0) ~= 1 then
               EffectSource():GetCurrentCharacteristics():GrantAbility(10)
            else
               EffectSource():GetCurrentCharacteristics():GrantAbility(20)
            end
         else
            oRefChest = oOwner:PlayerDataChest():Make_Chest(iRefID)
            oRefChest:Set_Int(0, 0)
         end
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <TRIGGERED_ABILITY active_zone="ZONE_ANY" linked_ability_group="1" replacement_effect="1">
      <TRIGGER value="ZONECHANGE_END" to_zone="ZONE_STACK" from_zone="ZONE_ANY">
         local oOwner = Object():GetPlayer()
         local iRefID = Object():GetRef()
         local oRefChest = oOwner:PlayerDataChest():Get_Chest(iRefID)
         if oRefChest ~= nil then
            if oRefChest:Get_Int(0) ~= 1 and LinkedDC():Get_Int(0) ~= 1 then
               EffectDC():Set_Int(0, 0)
            else
               EffectDC():Set_Int(0, 1)
            end
            return true
         end
         return false
      </TRIGGER>
      <CONTINUOUS_ACTION layer="1">
         Debug(EffectDC():Get_Int(0))
         Object():UseCopiableValues(CW_DC_ObjectDC(EffectDC():Get_Int(0)))
      </CONTINUOUS_ACTION>
      <DURATION>
         if EffectSource() == nil or EffectSource():GetZone() ~= ZONE_STACK then
            Debug("End")
         end
         return EffectSource() == nil or EffectSource():GetZone() ~= ZONE_STACK
      </DURATION>
   </TRIGGERED_ABILITY>
   <TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_ANY"> -- Permanently protect ObjectDC
      <TRIGGER value="ZONECHANGE_CONSIDERED" pre_trigger="1" simple_qualifier="self" />
      <RESOLUTION_TIME_ACTION>
         RSN_ProtectObjectDC()
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <STATIC_ABILITY linked_ability_group="1" active_zone="ZONE_GRAVEYARD">
      <CONTINUOUS_ACTION layer="1">
         local oOwner = EffectSource():GetPlayer()
         local iRefID = EffectSource():GetRef()
         local oRefChest = oOwner:PlayerDataChest():Get_Chest(iRefID)
         if oRefChest ~= nil then
            local iState = LinkedDC():Get_Int(0)
            LinkedDC():Set_Int(0, 1)
            if EffectController():CanCastSpellUsingResourceCost(EffectSource(), 0) then
               oRefChest:Set_Int(1,1)
            else
               oRefChest:Set_Int(1,0)
            end
            LinkedDC():Set_Int(0, iState)
         else
            oRefChest = oOwner:PlayerDataChest():Make_Chest(iRefID)
            oRefChest:Set_Int(1,0)
         end
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   
   <SPELL_ABILITY>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Target creature gets +X/+0 until end of turn, where X is its power.]]></LOCALISED_TEXT>
   </SPELL_ABILITY>
   
   <ACTIVATED_ABILITY forced_skip="1" qualifier="Alternate" active_zone="ZONE_GRAVEYARD" linked_ability_group="1">
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Aftermath {2}{W}: Target creature gains double strike until end of turn.]]></LOCALISED_TEXT>
      <COST type="Generic">
         <PREREQUISITE>
            local oRefChest = EffectSource():GetPlayer():PlayerDataChest():Get_Chest(EffectSource():GetRef())
            return oRefChest ~= nil and oRefChest:Get_Int(1) == 1 and EffectController():IsSorceryTime()
         </PREREQUISITE>
         <PLAY_TIME_ACTION>
            RSN_MarkManaAbilityStart()
         </PLAY_TIME_ACTION>
         <PLAY_TIME_ACTION>
            EffectSource():GetPlayer():PlayerDataChest():Make_Chest(EffectSource():GetRef()):Set_Int(0, 1)
         </PLAY_TIME_ACTION>
      </COST>
      <RESOLUTION_TIME_ACTION>
         MTG():CreateDelayedTrigger(2, nil)
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         EffectController():CastSpellUsingResourceCost(EffectSource(), 0)
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         RSN_MarkManaAbilityEnd()
      </RESOLUTION_TIME_ACTION>
   </ACTIVATED_ABILITY>
   <TRIGGERED_ABILITY resource_id="2" replacement_effect="1" linked_ability_group="1">
      <TRIGGER value="SPELL_RESOLVED" simple_qualifier="self" />
      <PLAY_TIME_ACTION>
         Object():GetPlayer():PlayerDataChest():Make_Chest(Object():GetRef()):Set_Int(0, 0)
         LinkedDC():Set_Int(0, 1)
      </PLAY_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         Object():Exile()
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <SPELL_ABILITY resource_id="10">
      <TARGET tag="CARD_QUERY_CHOOSE_CREATURE_TO_GET_X_0" definition="0" compartment="0" count="1" />
      <TARGET_DEFINITION id="0">
         local oFilter = ClearFilter()
         oFilter:Add(FE_TYPE, OP_IS, CARD_TYPE_CREATURE)
      </TARGET_DEFINITION>
      <RESOLUTION_TIME_ACTION>
         local oTarget = EffectDC():Get_Targets(0) and EffectDC():Get_Targets(0):Get_CardPtr(0)
         if oTarget ~= nil then
            EffectDC():Set_Int(1, oTarget:GetCurrentCharacteristics():Power_Get())
         end
      </RESOLUTION_TIME_ACTION>
      <CONTINUOUS_ACTION layer="7C">
         local oTarget = EffectDC():Get_Targets(0) and EffectDC():Get_Targets(0):Get_CardPtr(0)
         if oTarget ~= nil then
            oTarget:GetCurrentCharacteristics():Power_Add(EffectDC():Get_Int(1))
         end
      </CONTINUOUS_ACTION>
      <DURATION simple_duration="UntilEOT" />
      <AI_SIMPLIFIED_TARGETING compartment="0" hint="HINT_ALLIED_ONLY" />
   </SPELL_ABILITY>
   <SPELL_ABILITY resource_id="20" linked_ability_group="1">
      <TARGET tag="CARD_QUERY_CHOOSE_CREATURE" definition="0" compartment="0" count="1" />
      <TARGET_DEFINITION id="0">
         local oFilter = ClearFilter()
         oFilter:Add(FE_TYPE, OP_IS, CARD_TYPE_CREATURE)
      </TARGET_DEFINITION>
      <CONTINUOUS_ACTION layer="7C">
         local oTarget = EffectDC():Get_Targets(0) and EffectDC():Get_Targets(0):Get_CardPtr(0)
         if oTarget ~= nil then
            oTarget:GetCurrentCharacteristics():Bool_Set(CHARACTERISTIC_DOUBLE_STRIKE, 1)
         end
      </CONTINUOUS_ACTION>
      <DURATION simple_duration="UntilEOT" />
      <AI_SIMPLIFIED_TARGETING compartment="0" hint="HINT_ALLIED_ONLY" />
   </SPELL_ABILITY>
   <TRIGGERED_ABILITY linked_ability_group="1" replacement_effect="1" active_zone="ZONE_ANY">
      <TRIGGER value="SPELL_RESOLVED">
         return TriggerObject() == Object()
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
         EffectSource():GetPlayer():PlayerDataChest():Make_Chest(EffectSource():GetRef()):Clear()
         LinkedDC():Clear()
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <UTILITY_ABILITY resource_id="0">
      <COST mana_cost="{4}{W}{W}" type="Mana" />
   </UTILITY_ABILITY>
   <AUTHOR><![CDATA[Xander9009]]></AUTHOR>
   <EDITORS><![CDATA[Xander9009]]></EDITORS>
   <DATE><![CDATA[09-04-17]]></DATE>
</CARD_V2>
Onward | Open
Code: Select all
<?xml version="1.0"?>
<CARD_V2 ExportVersion="1">
   <FILENAME text="_ONWARD" />
   <CARDNAME text="ONWARD" />
   <TITLE>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Onward]]></LOCALISED_TEXT>
   </TITLE>
   <MULTIVERSEID value="90090001" />
   <ARTID value="ONWARD_TO_VICTORY" />
   <ARTIST name="Unknown" />
   <CASTING_COST cost="{2}{R}" />
   <TYPE metaname="Instant" />
   <EXPANSION value="AKH" />
   <RARITY metaname="R" />
   <SPELL_ABILITY>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Target creature gets +X/+0 until end of turn, where X is its power.]]></LOCALISED_TEXT>
      <TARGET tag="CARD_QUERY_CHOOSE_CREATURE_TO_GET_X_0" definition="0" compartment="0" count="1" />
      <TARGET_DEFINITION id="0">
         local oFilter = ClearFilter()
         oFilter:Add(FE_TYPE, OP_IS, CARD_TYPE_CREATURE)
      </TARGET_DEFINITION>
      <RESOLUTION_TIME_ACTION>
         local oTarget = EffectDC():Get_Targets(0) and EffectDC():Get_Targets(0):Get_CardPtr(0)
         if oTarget ~= nil then
            EffectDC():Set_Int(1, oTarget:GetCurrentCharacteristics():Power_Get())
         end
      </RESOLUTION_TIME_ACTION>
      <CONTINUOUS_ACTION layer="7C">
         local oTarget = EffectDC():Get_Targets(0) and EffectDC():Get_Targets(0):Get_CardPtr(0)
         if oTarget ~= nil then
            oTarget:GetCurrentCharacteristics():Power_Add(EffectDC():Get_Int(1))
         end
      </CONTINUOUS_ACTION>
      <DURATION simple_duration="UntilEOT" />
      <AI_SIMPLIFIED_TARGETING compartment="0" hint="HINT_ALLIED_ONLY" />
   </SPELL_ABILITY>
   <AUTHOR><![CDATA[Xander9009]]></AUTHOR>
   <EDITORS><![CDATA[Xander9009]]></EDITORS>
   <DATE><![CDATA[09-04-17]]></DATE>
</CARD_V2>
Victory | Open
Code: Select all
<?xml version="1.0"?>
<CARD_V2 ExportVersion="1">
   <FILENAME text="_VICTORY" />
   <CARDNAME text="VICTORY" />
   <TITLE>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Victory]]></LOCALISED_TEXT>
   </TITLE>
   <MULTIVERSEID value="90090002" />
   <ARTID value="ONWARD_TO_VICTORY" />
   <ARTIST name="Unknown" />
   <CASTING_COST cost="{2}{W}" />
   <TYPE metaname="Sorcery" />
   <EXPANSION value="AKH" />
   <RARITY metaname="R" />
   <SPELL_ABILITY>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Target creature gains double strike until end of turn.]]></LOCALISED_TEXT>
      <TARGET tag="CARD_QUERY_CHOOSE_CREATURE" definition="0" compartment="0" count="1" />
      <TARGET_DEFINITION id="0">
         local oFilter = ClearFilter()
         oFilter:Add(FE_TYPE, OP_IS, CARD_TYPE_CREATURE)
      </TARGET_DEFINITION>
      <CONTINUOUS_ACTION layer="7C">
         local oTarget = EffectDC():Get_Targets(0) and EffectDC():Get_Targets(0):Get_CardPtr(0)
         if oTarget ~= nil then
            oTarget:GetCurrentCharacteristics():Bool_Set(CHARACTERISTIC_DOUBLE_STRIKE, 1)
         end
      </CONTINUOUS_ACTION>
      <DURATION simple_duration="UntilEOT" />
      <AI_SIMPLIFIED_TARGETING compartment="0" hint="HINT_ALLIED_ONLY" />
   </SPELL_ABILITY>
   <AUTHOR><![CDATA[Xander9009]]></AUTHOR>
   <EDITORS><![CDATA[Xander9009]]></EDITORS>
   <DATE><![CDATA[09-04-17]]></DATE>
</CARD_V2>
So, the thing to really notice is in the fifth ability on line 65. In this ability, it figures out whether it should use the copiable values stored in chest 0 or chest 1 and stores that value to be used for the duration of the ability. Then, the CA uses the copiable values found in the chest indicated. When it's cast from your hand, it shows 0 and then when it goes to the graveyard it shows end, and it actually uses the copiable values (it doesn't display the mana cost correctly, but it does work correctly, despite displaying wrong). That's exactly what it should do.

When you cast it from your graveyard with its Aftermath ability, it shows the debug message "1" to show it's using the right chest, and then it shows "end" when it leaves the stack, which is all correct. But it never actually uses the copiable values, tested by seeing if Thoughtbind can counter it, which it can't.

Now, I thought maybe it's an issue with the values being stored improperly and thus retrieving them is failing. The method of storing them is a bit unorthodox, so it made sense. But swapping the values on lines 72 and 74 made it properly use the values from Victory, showing the values are retrievable. The only problem is that when it's cast from the graveyard via the Aftermath ability, it doesn't properly use the copiable values.

If the spell is copied, it copies the spell that was actually chosen for casting, which is correct. I'm not sure how it would react to a few other situations, but at the very least, it mostly works normally. But I can't seem to make this particular bit work, and I've run out of ideas for how I might fix it. (I've tried several things, but nothing works.)
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2880
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 116 times
Been thanked: 435 times

Re: Split Cards - Two Sets of Copiable Values

Postby Splinterverse » 12 Apr 2017, 21:36

Wow. You've made it so far. It's a bummer that it's not working. I can't really think of anything to try.

When I was thinking about how we could do it, I was thinking of having the card actually spawn the split card like a token, but I guess that wouldn't work since it technically would be a different card. I don't know if there would be a way to use the hidden second battlefield like is done with flip cards or not in that scenario.

Hopefully somebody will have some ideas.
---------------------------------------------
The DOTP2014 CW is updated nightly between 11 PM and 12 AM EST.
Impossible Cards List | Update Your Land Pools | Multiplayer Tips
Splinterverse
 
Posts: 774
Joined: 04 Sep 2016, 13:32
Has thanked: 96 times
Been thanked: 41 times

Re: Split Cards - Two Sets of Copiable Values

Postby Splinterverse » 15 Apr 2017, 13:33

Just some thoughts for process of elimination of the problem . . .

-- There are a few of the new split cards where both sides are the same card type, such as Never // Return and Insult // Injury. Have you tried making both card types the same? (Just to rule this out as the problem.)
-- I'm wondering if one of the older split cards would be worth trying since you wouldn't need it to work from the graveyard. (This would eliminate that the graveyard is the problem.)

These might not be helpful, but just putting them here in case they are.
---------------------------------------------
The DOTP2014 CW is updated nightly between 11 PM and 12 AM EST.
Impossible Cards List | Update Your Land Pools | Multiplayer Tips
Splinterverse
 
Posts: 774
Joined: 04 Sep 2016, 13:32
Has thanked: 96 times
Been thanked: 41 times

Re: Split Cards - Two Sets of Copiable Values

Postby Xander9009 » 15 Apr 2017, 16:09

Splinterverse wrote:Just some thoughts for process of elimination of the problem . . .

-- There are a few of the new split cards where both sides are the same card type, such as Never // Return and Insult // Injury. Have you tried making both card types the same? (Just to rule this out as the problem.)
-- I'm wondering if one of the older split cards would be worth trying since you wouldn't need it to work from the graveyard. (This would eliminate that the graveyard is the problem.)

These might not be helpful, but just putting them here in case they are.
Very helpful, actually. I definitely should try one of the older ones (preferably one without fuse). I don't think the card type should matter, but certainly worth a shot. Unfortunately, Windows' last update has made my laptop hibernated about 5 minutes after starting up. So, until I an get that dealt with, I won't be trying anything. Tonight will be getting the 's running from my roommate's computer because it'll probably be about a week before I can get it fixed...
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2880
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 116 times
Been thanked: 435 times

Re: Split Cards - Two Sets of Copiable Values

Postby Xander9009 » 16 Apr 2017, 01:53

Well, the bad news is I didn't have time to try these tonight.

The good news, however, is that I fixed my laptop. Windows 10's latest update apparently included a new "feature" wherein if your battery is detected to be critically low, it'll perform an action which defaults to hibernate. My battery is completely shot. In case it's not obvious, this combination results in windows starting up, seeing that the battery is critically low (0%), and immediately hibernating. (Which is at least better than the Anniversary edition, which simply shut down instead of hibernating, and this newest one also gave a low battery warning, which is what led to my realization of what was happening.) So, I found the setting and disabled it (and also discovered it works fine if I simply leave the battery out altogether... go figure).

And the other good news is that I should have all of tomorrow free. I might end up at my parents' for Easter, but even if I do, I'll still have most of the day to mess with the normal flip cards. Hopefully they work out well. And I've also realized it might have to do not with the graveyard, but rather the fact that they're being cast with an alternate cost. Either one would make a sort of sense (in that they're both differences between the two methods). I'm going to try to put the cast-from-hand side of things into an alternate cost as well and see what that does to the whole thing.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2880
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 116 times
Been thanked: 435 times

Re: Split Cards - Two Sets of Copiable Values

Postby Splinterverse2 » 16 Apr 2017, 01:55

Sounds good. Glad you figured out the Windows 10 issue. I am free most of tomorrow too, so bit me up if you need anything.
Splinterverse2
 
Posts: 52
Joined: 20 Sep 2016, 13:52
Has thanked: 13 times
Been thanked: 0 time

Re: Split Cards - Two Sets of Copiable Values

Postby Xander9009 » 16 Apr 2017, 02:00

Splinterverse2 wrote:I am free most of tomorrow too, so bit me up if you need anything.
I'm not much into cannibalism... :lol:

But yeah, that's good. I might end up having you test a few things if they seem to work on my end, and if they do, then we can start on the rest of the cards it would work for... But first I want to make sure they're as compatible as possible.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2880
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 116 times
Been thanked: 435 times

Re: Split Cards - Two Sets of Copiable Values

Postby Splinterverse » 16 Apr 2017, 12:24

Xander9009 wrote:
Splinterverse2 wrote:I am free most of tomorrow too, so bit me up if you need anything.
I'm not much into cannibalism... :lol:

But yeah, that's good. I might end up having you test a few things if they seem to work on my end, and if they do, then we can start on the rest of the cards it would work for... But first I want to make sure they're as compatible as possible.
Lol. That's what I get for typing on my phone. :)
---------------------------------------------
The DOTP2014 CW is updated nightly between 11 PM and 12 AM EST.
Impossible Cards List | Update Your Land Pools | Multiplayer Tips
Splinterverse
 
Posts: 774
Joined: 04 Sep 2016, 13:32
Has thanked: 96 times
Been thanked: 41 times

Re: Split Cards - Two Sets of Copiable Values

Postby Xander9009 » 19 Apr 2017, 19:44

So, I got a bit distracted (by being sick, mostly) so it took awhile to get around to testing this out. The first change I made corrected the issue: changing it to be cast from the hand. So, normal split cards that have both sides cast from the hand will work fine. Not sure yet how to get the aftermath ability to work if I can't get it to copy values from the graveyard, but not I know it's zone-related. Just an update.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2880
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 116 times
Been thanked: 435 times

Re: Split Cards - Two Sets of Copiable Values

Postby tmxk2012917 » 27 Apr 2017, 00:28

just played some duels in Magic dual. As for the split cards in AKH, they are changed as double-side cards. They will change to another side when they are put into the graveyard.
tmxk2012917
 
Posts: 164
Joined: 15 Mar 2015, 09:52
Has thanked: 20 times
Been thanked: 12 times

Re: Split Cards - Two Sets of Copiable Values

Postby PhilistineAu » 14 Oct 2017, 10:42

I apologize if this is a stupid idea. It's early in the morning and I can't sleep, so I've been pondering on how to fix this. If I understand what you are saying correctly, split cards work if cast from the hand with the code you have setup. However when cast from the graveyard, it costs the correct mana but retains the prior ability selection and will only cast the first half, instead of the aftermath half.

Is it possible to modify the first half then? Basically use its own error against it, by nesting an IF statement in the first half. I was thinking something like an IF statement, where the first ability would have code that would cast a certain effect based on whether it was cast from the hand or the graveyard.

Ability 1
Onward 2R
IF cast from hand
Creature gets power +X
IF cast from graveyard (i.e. this is actually the aftermath half hidden under ability 1)
Creature gets double strike

Ability 2
Victory 2W
Creature gets double strike


My apologies if this is a stupid idea. Thank you for everything that you do on this program. It's what keeps me coming back and making my own decks to test.

Phil


PS here is how I thought the card would interact with it being granted the flashback ability.

Onward 2R
IF cast from hand
Creature gets power +X
IF cast from graveyard
IF Flashback (not sure if this bit is necessary and could be left out while testing. I'm not even sure if flashback works by moving the card out of the graveyard zone, making this bit redundant.)
Creature gets power +X
Other (i.e. this is actually the aftermath half)
Creature gets double strike
PhilistineAu
 
Posts: 22
Joined: 29 Sep 2012, 19:37
Has thanked: 0 time
Been thanked: 1 time

Re: Split Cards - Two Sets of Copiable Values

Postby Xander9009 » 14 Oct 2017, 14:56

It's not a bad idea. One issue I see with this is that we can't decide which parts of the ability to have active *at* cast time, it needs to be *before* it's actually cast. Otherwise, the targeting system gets in the way and you wouldn't be able to choose appropriate targets. I'll have a look tonight if I can, and otherwise Monday when I'm off.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2880
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 116 times
Been thanked: 435 times

Re: Split Cards - Two Sets of Copiable Values

Postby fallenangle » 30 Mar 2018, 18:57

I think there are still some bugs in the split cards I coded because, while they work fine in-game, the game almost always crashes on me at exit when I play a deck using a split card. I'm posting the commented code for Commit//Memory here in the hopes that someone with a keener eye than mine can point out the errors that might be causing the game to crash. My thanks in advance to anyone who helps with this.

Code: Select all
<?xml version="1.0"?>
<CARD_V2 ExportVersion="1">
   <FILENAME text="COMMIT_TO_MEMORY" />
   <CARDNAME text="COMMIT" />
   <CARDNAME text="MEMORY" />
   <TITLE>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Commit // Memory]]></LOCALISED_TEXT>
   </TITLE>
   <MULTIVERSEID value="4269131" />
   <ARTID value="COMMIT_TO_MEMORY" />
   <ARTIST name="Ryan Alexander Lee" />
   <CASTING_COST cost="{7}{U}{U}{U}" />
   <TYPE metaname="Instant" />
   <TYPE metaname="Sorcery" />
   <EXPANSION value="AKH" />
   <RARITY metaname="R" />
   
   <!--1. Stop the AI from using this.-->
   <SPELL_ABILITY>
      <AVAILABILITY>
         return EffectController():IsAI() == false
      </AVAILABILITY>
   </SPELL_ABILITY>
   <!--2. Give the card the Split_Card characteristic always.-->
   <STATIC_ABILITY active_zone="ZONE_ANY">
      <CONTINUOUS_ACTION layer="6">
         RSN_Characteristics_Set( EffectSource(), CW_CHARACTERISTIC_SPLIT_CARD, 1 )
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   
   <!--3. Set half 1 so it's ready to go at the start of the game.-->
   
   <TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_ANY">
      <TRIGGER value="BEGINNING_OF_STEP">
         return MTG():GetStep() == STEP_UPKEEP and MTG():GetTurnNumber() == 0
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
      MTG():CreateDelayedTrigger(1, nil)
      MTG():PutTokensOntoBattlefield( "COMMIT", 1, EffectController(), EffectDC():Make_Chest(0) )
      CW_Flip_StoreA("COMMIT", "COMMIT", 0, 1)
      CW_Flip_StoreB("COMMIT", "COMMIT", 0, 1)
      </RESOLUTION_TIME_ACTION>
      </TRIGGERED_ABILITY>
      
<!--4. Reset the card to half 1 if it moves somewhere from the graveyard.-->

<TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_ANY">      
<TRIGGER value="ZONECHANGE_END" to_zone="ZONE_LIBRARY" from_zone="ZONE_GRAVEYARD" simple_qualifier="self"/>
<TRIGGER value="ZONECHANGE_END" to_zone="ZONE_EXILE" from_zone="ZONE_GRAVEYARD" simple_qualifier="self"/>
<TRIGGER value="ZONECHANGE_END" to_zone="ZONE_HAND" from_zone="ZONE_GRAVEYARD" simple_qualifier="self"/>
<RESOLUTION_TIME_ACTION>
      local chest = EffectDC():Get_Chest(0)
if chest ~= nil then
chest:Clear()
CW_DC_ObjectDC():Clear()
      end
      MTG():CreateDelayedTrigger(1, nil)
      MTG():PutTokensOntoBattlefield( "COMMIT", 1, EffectController(), EffectDC():Make_Chest(0) )
      CW_Flip_StoreA("COMMIT", "COMMIT", 0, 1)
      CW_Flip_StoreB("COMMIT", "COMMIT", 0, 1)
      </RESOLUTION_TIME_ACTION>
      </TRIGGERED_ABILITY>
      
<!--5. Set the card to half 2 if it goes to the graveyard from anywhere.-->
      
<TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_ANY">      
<TRIGGER value="ZONECHANGE_END" to_zone="ZONE_GRAVEYARD" from_zone="ZONE_ANY" simple_qualifier="self"/>
<RESOLUTION_TIME_ACTION>
local chest = EffectDC():Get_Chest(0)
if chest ~= nil then
chest:Clear()
CW_DC_ObjectDC():Clear()
      end
MTG():CreateDelayedTrigger(1, nil)
MTG():PutTokensOntoBattlefield( "MEMORY", 1, EffectController(), EffectDC():Make_Chest(0) )
CW_Flip_StoreA("MEMORY", "MEMORY", 0, 1)
CW_Flip_StoreB("MEMORY", "MEMORY", 0, 1)
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
   
   <!--6. Prevent the spell tokens from spawning from nowhere. The card won't properly gain abilities if this fires continuously.-->
   <TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_ANY" resource_id="1" priority="-1">
      <TRIGGER value="ZONECHANGE_CONSIDERED" to_zone="ZONE_BATTLEFIELD" from_zone="ZONE_ANY" pre_trigger="1">
         if TriggerObject() ~= nil and TriggerObject():GetCardName() == "COMMIT" or TriggerObject():GetCardName() == "MEMORY" then
            if TriggerObject():GetErstwhileZone() == 0 then
               MTG():OverrideEvent()
               return true
            end
         end
         return false
      </TRIGGER>
      <CLEANUP fire_once="1" />
   </TRIGGERED_ABILITY>

   <!--7. Protect the ObjectDC through zone changes.-->
   <TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_ANY"> -- Permanently protect ObjectDC
      <TRIGGER value="ZONECHANGE_CONSIDERED" pre_trigger="1" simple_qualifier="self" />
      <RESOLUTION_TIME_ACTION>
         RSN_ProtectObjectDC()
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   
   <!--8. Cut each half's casting cost by the other half, checked through zone and LinkedDC.-->
   <TRIGGERED_ABILITY replacement_effect="1" linked_ability_group="1" active_zone="ZONE_ANY">
      <TRIGGER value="CONSIDERED_FOR_CAST" simple_qualifier="self" pre_trigger="1"/>
      <RESOLUTION_TIME_ACTION>
         if TriggerObject() ~= nil and LinkedDC():Get_Int(20) == 1 and (EffectSource():GetZone() ~= ZONE_GRAVEYARD and EffectSource():GetZone() ~= ZONE_LIBRARY) or (EffectSource():GetZone() == ZONE_LIBRARY and EffectSource() ~= EffectController():Library_GetTop() and EffectController():GetCurrentCharacteristics():Bool_Get(PLAYER_CHARACTERISTIC_CAN_PLAY_TOP_CARD_OF_LIBRARY) == 1 and EffectController():GetCurrentCharacteristics():Bool_Get(PLAYER_CHARACTERISTIC_CAN_PLAY_TOP_CARD_OF_LIBRARY) == 1) then
            TriggerObject():DecreaseColouredCost(COLOUR_BLUE, 2)
            TriggerObject():DecreaseCost(4)
         elseif TriggerObject() ~= nil and LinkedDC():Get_Int(20) == 2 and EffectSource():GetZone() == ZONE_GRAVEYARD then
            TriggerObject():DecreaseColouredCost(COLOUR_BLUE, 1)
            TriggerObject():DecreaseCost(3)
         end
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <!--9. Prevent the combined halves from being simultaneously cast to no effect, and enable casting of single halves in special situations.-->
   <TRIGGERED_ABILITY replacement_effect="1" linked_ability_group="1" active_zone="ZONE_ANY">
      <TRIGGER value="CONSIDERED_FOR_CAST" simple_qualifier="self" pre_trigger="1">
         if EffectSource() ~= nil then
            if (EffectSource():GetZone() == ZONE_GRAVEYARD and LinkedDC():Get_Int(20) ~= 2 and LinkedDC():Get_Int(60) ~= 1) or
               (EffectSource():GetZone() ~= ZONE_GRAVEYARD and LinkedDC():Get_Int(20) ~= 1 and LinkedDC():Get_Int(60) ~= 1) or
               (LinkedDC():Get_Int(20) == 0 or LinkedDC():Get_Int(20) == nil) then
               MTG():OverrideEvent()
               return true
            end
         end
         return false
      </TRIGGER>
   </TRIGGERED_ABILITY>
   
   <!--10. If both halves could be cast, ask a multiple choice question, then set the half based on the answer. Otherwise, set the top half.-->
   <TRIGGERED_ABILITY replacement_effect="1" linked_ability_group="1" active_zone="ZONE_ANY">
      <TRIGGER value="BECAME_TARGET_OF_SPELL" simple_qualifier="self"/>
      <TRIGGER value="BECAME_TARGET_OF_ABILITY" simple_qualifier="self"/>
      <PLAY_TIME_ACTION>
         LinkedDC():Set_Int(60, 1)
      </PLAY_TIME_ACTION>
      <PLAY_TIME_ACTION>
         LinkedDC():Set_Int(20, 0)
      </PLAY_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         MTG():CreateDelayedTrigger(40, nil)
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         if EffectSource() ~= nil then
            if EffectSource():GetZone() ~= ZONE_GRAVEYARD then
               LinkedDC():Set_Int(20, 1)
            elseif EffectSource():GetZone() == ZONE_GRAVEYARD then
               local effectController = EffectController()
               if effectController ~= nil then
                  effectController:BeginNewMultipleChoice()
                     effectController:AddMultipleChoiceAnswer( "CARD_QUERY_HALF_1" )
                     effectController:AddMultipleChoiceAnswer( "CARD_QUERY_HALF_2" )
                  effectController:AskMultipleChoiceQuestion( "CARD_QUERY_SPLIT_CARD", TriggerObject() )
               end
            end
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         local chest = EffectDC():Get_Chest(0)
if chest ~= nil then
chest:Clear()
CW_DC_ObjectDC():Clear()
      end
         if LinkedDC():Get_Int(20) == 2 then
         local result = EffectController():GetMultipleChoiceResult()
         if result == 0 then
         MTG():CreateDelayedTrigger(1, nil)
      MTG():PutTokensOntoBattlefield( "COMMIT", 1, EffectController(), EffectDC():Make_Chest(0) )
      CW_Flip_StoreA("COMMIT", "COMMIT", 0, 1)
      CW_Flip_StoreB("COMMIT", "COMMIT", 0, 1)
      elseif result == 1 then
      MTG():CreateDelayedTrigger(1, nil)
MTG():PutTokensOntoBattlefield( "MEMORY", 1, EffectController(), EffectDC():Make_Chest(0) )
CW_Flip_StoreA("MEMORY", "MEMORY", 0, 1)
CW_Flip_StoreB("MEMORY", "MEMORY", 0, 1)
end
   end
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <!--11. Reset LinkedDC(60) when the spell is played.-->
   <TRIGGERED_ABILITY replacement_effect="1" linked_ability_group="1" resource_id="40" active_zone="ZONE_ANY">
      <TRIGGER value="SPELL_PLAYED" simple_qualifier="self" />
      <RESOLUTION_TIME_ACTION>
         LinkedDC():Set_Int(60, 0)
      </RESOLUTION_TIME_ACTION>
      <CLEANUP fire_once="1" />
   </TRIGGERED_ABILITY>
   
   <!--12.If the card is considered for targeting, reset LinkedDC(20) to 0. -->
   
   <TRIGGERED_ABILITY replacement_effect="1" linked_ability_group="1" active_zone="ZONE_ANY">
   <TRIGGER value="CARD_CONSIDERED_FOR_TARGETTING" simple_qualifier="self" pre_trigger="1">
   if EffectSource():GetZone() ~= ZONE_STACK then
   LinkedDC():Set_Int(20, 0)
   return true
   end
   return false
   </TRIGGER>
   </TRIGGERED_ABILITY>
   
<!--13. Set the proper value of LinkedDC(20) for each half based on the cards present zone to enable casting.-->
   
      <STATIC_ABILITY linked_ability_group="1" active_zone="ZONE_ANY">
   <CONTINUOUS_ACTION layer="0">
         if Object() ~= nil then
         if Object():GetZone() ~= ZONE_GRAVEYARD then
         LinkedDC():Set_Int(20, 1)
         else
         LinkedDC():Set_Int(20, 2)
         end
            end
   </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   
   <!--14. Dummy abilities that merely show what the card can do at all times when it's not on the stack.-->
   <SPELL_ABILITY>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{3}{U} |Commit - Instant| Put target spell or nonland permanent into its owner's library second from the top.]]></LOCALISED_TEXT>
   </SPELL_ABILITY>
   <SPELL_ABILITY>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{4}{U}{U} |Memory - Sorcery| Aftermath. Each player shuffles his or her hand into his or her library, then draws seven cards.]]></LOCALISED_TEXT>
   </SPELL_ABILITY>
   <!--15. The actual abilities of each half.-->
   
   <!--15a. Since the card is both an instant and a sorcery, the game needs to be told when not to allow the card to be cast at instant speed.
   This only works in a considered for cast trigger and not when granting abilities, for some reason.-->
   
      <TRIGGERED_ABILITY replacement_effect="1" linked_ability_group="1" active_zone="ZONE_ANY">
   <TRIGGER value="CONSIDERED_FOR_CAST" simple_qualifier="self" pre_trigger="1">
   if LinkedDC():Get_Int(20) == 2 and EffectController():IsSorceryTime() == false then
   MTG():OverrideEvent()
   return true
   end
   return false
   </TRIGGER>
   </TRIGGERED_ABILITY>
   
<!--15b. A ststic ability to grant the 3 Utility abilities.-->
   
   <STATIC_ABILITY linked_ability_group="1" active_zone="ZONE_ANY">
      <CONTINUOUS_ACTION layer="8">
         local characteristics = EffectSource():GetCurrentCharacteristics()
         if EffectSource():GetZone() ~= ZONE_EXILE and EffectSource():GetZone() ~= ZONE_STACK then
         if EffectSource() ~= nil and LinkedDC():Get_Int(20) == 1 then
            characteristics:GrantAbility(13)
            characteristics:GrantAbility(15)
         elseif EffectSource() ~= nil and LinkedDC():Get_Int(20) == 2 then
            characteristics:GrantAbility(14)
         end
            end
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   
   <!--15c. 13 and 14 are normal casts for the 2 spells. Because the combined spell is a blank, it needs to be told when it can legally be cast
   as Commit, and when as Memory. Giving the card Commit's ability, which goes away when the card hits the stack, seems the easiest way
   to achieve this. Making Memory only castable as a sorcery was taken care of in 15a. Cut to Ribbons uses a similar trick to achieve X on
   only the bottom half's casting cost.-->
   
   <!--15d. The Utility abilities for each half.-->
   
   <UTILITY_ABILITY qualifier="Normal_Cast" resource_id="13" active_zone="ZONE_ANY">
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{3}{U} |Commit - Instant| Put target spell or nonland permanent into its owner's library second from the top.]]></LOCALISED_TEXT>
   </UTILITY_ABILITY>
   <UTILITY_ABILITY resource_id="14" qualifier="Normal_Cast" active_zone="ZONE_GRAVEYARD">
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{4}{U}{U} |Memory - Sorcery| Aftermath. Each player shuffles his or her hand into his or her library, then draws seven cards.]]></LOCALISED_TEXT>
   </UTILITY_ABILITY>
   <UTILITY_ABILITY qualifier="Additional" resource_id="15" active_zone="ZONE_ANY">
   <TARGET tag="CARD_QUERY_COMMIT_CHOOSE_SPELL_TO_PUT_INTO_LIBRARY" definition="0" compartment="0" count="1" up_to="1" mode="1" />
      <TARGET_DEFINITION id="0">
         local filter = ClearFilter()
         filter:SetZone(ZONE_STACK)
      </TARGET_DEFINITION>
      <TARGET tag="CARD_QUERY_COMMIT_CHOOSE_NONLAND_PERMANENT_TO_PUT_INTO_LIBRARY" definition="1" compartment="1">
         local numTargets = 1
         local targetDC = EffectDC():Get_Targets(0)
         if targetDC ~= nil then
            numTargets = numTargets - targetDC:Count()
         end
         MTG():SetTargetCount(numTargets)
      </TARGET>
      <TARGET_DEFINITION id="1">
         local filter = ClearFilter()
         CW_Filter_AddPermanents(filter)
         filter:Add(FE_TYPE, OP_NOT, CARD_TYPE_LAND)
      </TARGET_DEFINITION>
      <RESOLUTION_TIME_ACTION>
         local Spell = EffectDC():Get_Targets(0) and EffectDC():Get_Targets(0):Get_CardPtr(0)
         local Creature = EffectDC():Get_Targets(1) and EffectDC():Get_Targets(1):Get_CardPtr(0)
         if Spell ~= nil then
            local player = Spell:GetOwner()
            if player ~= nil  then
               local cardsInLibrary = player:Library_Count()
               local filter = ClearFilter()
               local Xplace = 1
               if cardsInLibrary &lt; Xplace then
                  Spell:PutOnTopOfLibrary()
               else
                  Spell:PutInLibrary(Xplace)
               end
            end
         elseif Creature ~= nil then
            local player = Creature:GetOwner()
            if player ~= nil  then
               local cardsInLibrary = player:Library_Count()
               local filter = ClearFilter()
               local Xplace = 1
               if cardsInLibrary &lt; Xplace then
                  Creature:PutOnTopOfLibrary()
               else
                  Creature:PutInLibrary(Xplace)
               end
            end
         end
      </RESOLUTION_TIME_ACTION>
   </UTILITY_ABILITY>
   <!--16. Make the card use the copiable values when on the stack. It never changes the name and casting cost due to a visual bug,
   but the copiable values are indeed used.-->
   <STATIC_ABILITY active_zone="ZONE_STACK">
      <CONTINUOUS_ACTION layer="1">
Object():UseCopiableValues(CW_DC_ObjectDC())
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <!--17. Everywhere but on the stack, the card has the double-faced characteristics of the two combined halves. However,
   the rules also say that you can choose which half to put on the stack as you cast it. This means, as I
   understand it, that if something prevents you from casting blue cards, you could cast Spring, but not Mind.
   To get around effects which might be less discriminating, this ability sets the card's color to the
   appropriate color for each half.-->
   <STATIC_ABILITY linked_ability_group="1" active_zone="ZONE_ANY">
      <CONTINUOUS_ACTION layer="5">
         local Source = EffectSource()
         if Source ~= nil then
            if LinkedDC():Get_Int(20) == 1 then
               Source:GetCurrentCharacteristics():Colour_Set(COLOUR_BLUE)
            elseif LinkedDC():Get_Int(20) == 2 then
               Source:GetCurrentCharacteristics():Colour_Set(COLOUR_BLUE)
            end
         end
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <!--18. Since the Aftermath ability can ONLY be cast from the graveyard, and is then exiled no matter what happens to it,
   exile it on resolution, counter, or zone change.-->
   
   <!--18a. Make the exile trigger only happen if LinkedDC(20) is 2, at which point the card should be in the graveyard.-->
   <TRIGGERED_ABILITY linked_ability_group="1" replacement_effect="1" active_zone="ZONE_ANY">
      <TRIGGER value="SPELL_PLAYED" simple_qualifier="self">
         if LinkedDC():Get_Int(20) == 2 then
            return true
         end
         return false
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
         if LinkedDC():Get_Int(50) ~= 1 then
            LinkedDC():Set_Int(50, 1)
         end
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   
   <!--18b. The actual exile trigger.-->
   <TRIGGERED_ABILITY replacement_effect="1" linked_ability_group="1" active_zone="ZONE_ANY">
      <TRIGGER value="SPELL_RESOLVED" simple_qualifier="self"/>
      <TRIGGER value="SPELL_BEING_COUNTERED" simple_qualifier="self"/>
      <TRIGGER value="ZONECHANGE_BEGIN" to_zone="ZONE_ANY" from_zone="ZONE_STACK" simple_qualifier="self" pre_trigger="1">
         if LinkedDC():Get_Int(50) == 1 then
            return true
         end
         return false
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
         if Object():GetErstwhileErstwhileZone() == ZONE_GRAVEYARD and Object():WasCast() then
            Object():Exile()
         end
      </RESOLUTION_TIME_ACTION>
      <CLEANUP fire_once="1" />
   </TRIGGERED_ABILITY>
   
   <!--18c. Reset the exile trigger when the card is in exile.-->
   
   <STATIC_ABILITY linked_ability_group="1" active_zone="ZONE_EXILE">
      <CONTINUOUS_ACTION layer="0">
         if LinkedDC():Get_Int(50) == 1 then
            LinkedDC():Set_Int(50, 0)
         end
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
      
      <!--19. Remove the delayed trigger when another spell or ability is played. This could probably be omitted, but was the source of a bug before-->
      
<TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_ANY">
      <TRIGGER value="SPELL_PLAYED"/>
      <TRIGGER value="ABILITY_PLAYED">
      return (TriggerObject():GetCardName() ~= "COMMIT" or TriggerObject():GetCardName() ~= "MEMORY") and EffectSource():GetZone() ~= ZONE_STACK
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
MTG():RemoveDelayedTrigger(1)
</RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   
   <!--20. Make the Managers and register the tokens.-->
   <TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_ANY">
      <TRIGGER value="BEGINNING_OF_STEP">
         return MTG():GetStep() == STEP_UPKEEP and MTG():GetTurnNumber() == 0
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
   CW_General_CreateManagers("_MANAGER_CHARACTERISTICS", "_MANAGER_ABILITIES_ACTIVE")
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         if EffectController():PlayerDataChest():Get_Chest(NEO_CHEST_AAM) == nil then
            EffectController():PlayerDataChest():Make_Chest(NEO_CHEST_AAM)
         end
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   
   <TOKEN_REGISTRATION reservation="1" type="_MANAGER_CHARACTERISTICS" />
   <TOKEN_REGISTRATION reservation="1" type="_MANAGER_ABILITIES_ACTIVE" />
   
<TOKEN_REGISTRATION reservation="1" type="COMMIT" />
<TOKEN_REGISTRATION reservation="1" type="MEMORY" />
   
   <AUTHOR><![CDATA[fallenangle]]></AUTHOR>
   <EDITORS><![CDATA[fallenangle]]></EDITORS>
   <DATE><![CDATA[01-08-18]]></DATE>
</CARD_V2>
fallenangle
 
Posts: 275
Joined: 20 Jul 2013, 02:31
Has thanked: 72 times
Been thanked: 24 times


Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 2 guests


Who is online

In total there are 2 users online :: 0 registered, 0 hidden and 2 guests (based on users active over the past 10 minutes)
Most users ever online was 287 on 31 Mar 2019, 04:11

Users browsing this forum: No registered users and 2 guests

Login Form