It is currently 19 Aug 2019, 19:00
   
Text Size

Need help fixing a custom card

Moderators: Xander9009, CCGHQ Admins

Need help fixing a custom card

Postby Xander9009 » 14 Mar 2014, 10:18

I've made a custom card (for a custom mechanic-based deck) and while it's 99% working, I can't seem to manage the last 1%. It's got three abilities:

Artifact, costs {1}
  • Enters the battlefield with a Charge counter, plus has Sunburst (for a total of 1 counter if paid for with colorless and 2 if paid for with colored mana).
  • Other creatures with the new mechanic (as of now, they're listed by name) enter the battlefield with Sunburst.
  • Permanents you control with the new mechanic (for now, it's those with charge counters) can have a counter removed in exchange for 1 mana of a color based on that card's color(s).

The problem is with the third ability. What it's supposed to do: If it's a colorless card, it's colorless mana, blue cards give blue mana, blue and black cards make you choose blue or black. What it is doing: makes you choose between the card's color(s) (even if only one) and colorless. The thing is, I know more or less how I should remove that prompt if it's only one color or none, but every time I try, the card either starts producing only colorless mana (and always without a prompt) or the game freezes. I've run out of ideas for this annoying should-be-easy-too-fix problem. Anyone feel like helping me out a bit?

While I'm at it, I'll save space and just ask here, does anyone know how to add a custom ability? I know it can't be coded in like the vanilla abilities, but are there any tricks that I can use to easily have certain cards have an ability and other cards be able to know they have the ability? Would the Scry trick made by Sumo work (the one to trigger the new card's "Player scried" condition)? Should I use the original Scry trick by TFM and use an unused ability? Something else entirely?

Book of Shards | Open
Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
   <FILENAME text="BOOK_OF_SHARDS_9009005" />
   <CARDNAME text="BOOK_OF_SHARDS" />
   <TITLE>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Book of Shards]]></LOCALISED_TEXT>
   </TITLE>
   <MULTIVERSEID value="9009005" />
   <ARTID value="9009005" />
   <ARTIST name="Heather Hudson" />
   <CASTING_COST cost="{1}" />
   <FLAVOURTEXT>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Here, young Legionnaire, this will teach you of your origins.]]></LOCALISED_TEXT>
   </FLAVOURTEXT>
   <TYPE metaname="Artifact" />
   <EXPANSION value="M14" />
   <RARITY metaname="C" />
   <TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_TRANSITION">
      <TRIGGER value="ZONECHANGE_TRANSITION" simple_qualifier="self" to_zone="ZONE_BATTLEFIELD" from_zone="ZONE_ANY" />
      <COUNTER_REGISTRATION name="Charge" proliferate="11" />
      <RESOLUTION_TIME_ACTION>
         local sunburst = 1
         if EffectSource() ~= nil then
            for i=1,5 do
               if EffectSource():WasPaidForWithColour(i) then
                  sunburst = sunburst + 1
               end
            end
            EffectSource():AddCounters( MTG():GetCountersType("Charge"), sunburst)
         end
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <TRIGGERED_ABILITY replacement_effect="1">
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Legion: Sunburst]]></LOCALISED_TEXT>
      <TRIGGER value="ZONECHANGE_BEGIN" from_zone="ZONE_ANY" to_zone="ZONE_BATTLEFIELD">
         if TriggerObject() ~= EffectSource() and ( TriggerObject():GetCardName()== "LEAGUES_HEALER" or TriggerObject():GetCardName() == "LEAGUES_ARMORER" or TriggerObject():GetCardName() == "LEAGUES_ASSASSIN" ) and EffectSource():CountCounters( MTG():GetCountersType("Charge") ) &gt; 0 then
            local delayDC = EffectDC():Make_Chest(1)
            delayDC:Set_CardPtr(0, TriggerObject())
            MTG():CreateDelayedTrigger(3, delayDC)
         end
         return false
      </TRIGGER>
   </TRIGGERED_ABILITY>
   <TRIGGERED_ABILITY replacement_effect="1" resource_id="3">
      <CLEANUP fire_once="1" />
      <TRIGGER value="ZONECHANGE_TRANSITION" from_zone="ZONE_ANY" to_zone="ZONE_BATTLEFIELD">
         if TriggerObject() == EffectDC():Get_CardPtr(0) then
            if TriggerObject():GetPlayer() == EffectController() then
               return true
            else
               MTG():RemoveDelayedTrigger(3)
            end
         end
         return false
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
         local sunburst = 0
         if EffectDC():Get_CardPtr(0) ~= nil then
            for i=1,5 do
               if EffectDC():Get_CardPtr(0):WasPaidForWithColour(i) then
                  sunburst = sunburst + 1
               end
            end
            EffectDC():Get_CardPtr(0):AddCounters( MTG():GetCountersType("Charge"), sunburst)
         end
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <STATIC_ABILITY>
      <FILTER filter_id="0">
         local filter = ClearFilter()
         filter:Add( FE_IS_PERMANENT, true )
         filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
         local filter_count = filter:EvaluateObjects()
         if filter_count &gt; 0 then
            for i=0,filter_count-1 do
               local candidate = filter:GetNthEvaluatedObject(i)
               if candidate ~= nil and candidate:CountCounters( MTG():GetCountersType("Charge") ) &gt; 0 then
                  candidate:MarkForFilter()
               end
            end
            filter:SetMarkedObjectsOnly()
         end
      </FILTER>
      <CONTINUOUS_ACTION layer="6" filter_id="0">
         if FilteredCard() ~= nil and EffectSource():CountCounters( MTG():GetCountersType("Charge") ) &gt; 0 and FilteredCard():CountCounters( MTG():GetCountersType("Charge") ) &gt; 0 then
            local characteristics = FilteredCard():GetCurrentCharacteristics()
            characteristics:GrantAbility(0)
            characteristics:GrantAbility(1)
            characteristics:GrantAbility(2)
         end
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <ACTIVATED_ABILITY forced_skip="1"  resource_id="0">
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Remove a charge counter from this permanent: Add to your mana pool 1 mana of any color that shares a color with this permanent.]]></LOCALISED_TEXT>
      <COST type="RemoveCountersSelf" amount="1" counter_type="Charge" />
      <PLAY_TIME_ACTION>
         local oPlayer = EffectController()
         local oCard = EffectSource()
         if (oPlayer ~= nil) then
            oPlayer:BeginNewMultipleChoice()
            oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_C" )
            oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_W", EffectSource():GetColour():Test( COLOUR_WHITE ) == true )
            oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_U", EffectSource():GetColour():Test( COLOUR_BLUE ) == true )
            oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_B", EffectSource():GetColour():Test( COLOUR_BLACK ) == true )
            oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_R", EffectSource():GetColour():Test( COLOUR_RED ) == true )
            oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_G", EffectSource():GetColour():Test( COLOUR_GREEN ) == true )
            oPlayer:AskMultipleChoiceQuestion( "MODE_CHOOSE_ONE", oCard )
         end
      </PLAY_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         local nColour = EffectController():GetMultipleChoiceResult()
         if (nColour == COLOUR_COLOURLESS) then
            RSN_Produce( "{1}", 1 )
         elseif (nColour == COLOUR_WHITE) then
            RSN_Produce( "{W}", 1 )
         elseif (nColour == COLOUR_BLUE) then
            RSN_Produce( "{U}", 1 )
         elseif (nColour == COLOUR_BLACK) then
            RSN_Produce( "{B}", 1 )
         elseif (nColour == COLOUR_RED) then
            RSN_Produce( "{R}", 1 )
         elseif (nColour == COLOUR_GREEN) then
            RSN_Produce( "{G}", 1 )
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         RSN_EliminateExtraManaTokens()
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         S_DisplayManaPool(EffectController())
         RSN_MarkManaAbilityEnd()
      </RESOLUTION_TIME_ACTION>
      <AI_AVAILABILITY window_step="upkeep" type="window" />
      <AI_AVAILABILITY window_step="main_1" window_turn="my_turn" type="window" />
      <AI_AVAILABILITY window_step="begin_combat" window_turn="their_turn" type="window" />
      <AI_AVAILABILITY window_step="declare_attackers" window_turn="their_turn" type="window" />
      <AI_AVAILABILITY window_step="declare_blockers" type="window" />
      <AI_AVAILABILITY window_step="main_2" window_turn="my_turn" type="window" />
      <AI_AVAILABILITY window_step="end_of_turn" type="window" />
      <AI_AVAILABILITY window_step="end_of_turn" window_turn="their_turn" type="window" />
      <AI_AVAILABILITY type="in_response" response_source="1" response_target="1" />
      <AI_AVAILABILITY type="in_response" response_source="1" />
      <AI_AVAILABILITY type="in_response" response_target="1" />
   </ACTIVATED_ABILITY>
   <STATIC_ABILITY resource_id="1">
      <CONTINUOUS_ACTION layer="0">
         RSN_ClearCanProduceMana()
         if EffectSource():CountCounters( MTG():GetCountersType("Charge") ) &gt; 0 then
            local IsColored = 0
            if EffectSource():GetColour():Test( COLOUR_WHITE ) == true then
               RSN_MarkCanProduceMana( "{W}" )
               IsColored = 1
            end
            if EffectSource():GetColour():Test( COLOUR_BLUE ) == true then
               RSN_MarkCanProduceMana( "{U}" )
               IsColored = 1
            end
            if EffectSource():GetColour():Test( COLOUR_BLACK ) == true then
               RSN_MarkCanProduceMana( "{B}" )
               IsColored = 1
            end
            if EffectSource():GetColour():Test( COLOUR_RED ) == true then
               RSN_MarkCanProduceMana( "{R}" )
               IsColored = 1
            end
            if EffectSource():GetColour():Test( COLOUR_GREEN ) == true then
               RSN_MarkCanProduceMana( "{G}" )
               IsColored = 1
            end
            if IsColored == 0 then
               RSN_MarkCanProduceMana( "{1}" )
            end
         else
            RSN_MarkCanProduceMana( "" )
         end
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <TRIGGERED_ABILITY replacement_effect="1" resource_id="2">
      <TRIGGER value="BEGINNING_OF_STEP" pre_trigger="1" />
      <RESOLUTION_TIME_ACTION>
         RSN_ClearProducedMana()
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <TOKEN_REGISTRATION reservation="1" type="RSN_TOKEN_MANA_W" />
   <TOKEN_REGISTRATION reservation="1" type="RSN_TOKEN_MANA_U" />
   <TOKEN_REGISTRATION reservation="1" type="RSN_TOKEN_MANA_B" />
   <TOKEN_REGISTRATION reservation="1" type="RSN_TOKEN_MANA_R" />
   <TOKEN_REGISTRATION reservation="1" type="RSN_TOKEN_MANA_G" />
   <TOKEN_REGISTRATION reservation="1" type="RSN_TOKEN_MANA_C" />
   <HELP title="MORE_INFO_BADGE_TITLE_12" body="MORE_INFO_BADGE_BODY_12" zone="ZONE_ANY" />
</CARD_V2>
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2888
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 119 times
Been thanked: 439 times

Re: Need help fixing a custom card

Postby thefiremind » 14 Mar 2014, 14:49

As you can see on the official Eye of Ugin, if you want to retrieve the number of colors you can use
Code: Select all
EffectSource():GetColour():GetNumColours()
This allows you to switch the colorless option off when it's not needed:
Code: Select all
oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_C", EffectSource():GetColour():GetNumColours() == 0 )
but you could also use it in order to suppress the query when the colors are less than 2. In this case you'll need to check what color the card is, and set nColour manually. If you want to reduce the necessary code you can do something like this:
Code: Select all
...
      <PLAY_TIME_ACTION>
      if EffectSource():GetColour():GetNumColours() &gt; 1 then
          -- Here you put the existing query code, plus the above fix for non-colorless cards
      end
      </PLAY_TIME_ACTION>
      <PLAY_TIME_ACTION>
      if EffectSource():GetColour():GetNumColours() &gt; 1 then
          EffectDC():Set_Int( 0, EffectController():GetMultipleChoiceResult() )
      else
          -- Here you can insert the code for when the query hasn't been displayed.
          -- You put the card's color in register 0 and the rest of the code will work the same way.
      end
      </PLAY_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
      local nColour = EffectDC():Get_Int(0)
...
I still suggest you to display all the options when the colors are 2 or more (appropriately switched off, of course): hiding them would make the code overly complicated, and you wouldn't save any clicks because you always need to make a choice.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 717 times

Re: Need help fixing a custom card

Postby RiiakShiNal » 14 Mar 2014, 15:34

Xander9009 wrote:I've made a custom card (for a custom mechanic-based deck) and while it's 99% working, I can't seem to manage the last 1%. It's got three abilities:

Artifact, costs {1}
  • Enters the battlefield with a Charge counter, plus has Sunburst (for a total of 1 counter if paid for with colorless and 2 if paid for with colored mana).
  • Other creatures with the new mechanic (as of now, they're listed by name) enter the battlefield with Sunburst.
  • Permanents you control with the new mechanic (for now, it's those with charge counters) can have a counter removed in exchange for 1 mana of a color based on that card's color(s).

The problem is with the third ability. What it's supposed to do: If it's a colorless card, it's colorless mana, blue cards give blue mana, blue and black cards make you choose blue or black. What it is doing: makes you choose between the card's color(s) (even if only one) and colorless. The thing is, I know more or less how I should remove that prompt if it's only one color or none, but every time I try, the card either starts producing only colorless mana (and always without a prompt) or the game freezes. I've run out of ideas for this annoying should-be-easy-too-fix problem. Anyone feel like helping me out a bit?
Try this:
Mana Ability | Open
Code: Select all
   <ACTIVATED_ABILITY forced_skip="1"  resource_id="0">
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Remove a charge counter from this permanent: Add to your mana pool 1 mana of any color that shares a color with this permanent.]]></LOCALISED_TEXT>
      <COST type="RemoveCountersSelf" amount="1" counter_type="Charge" />
      <PLAY_TIME_ACTION>
         local nColours = EffectSource():GetColour():GetNumColours()
         EffectDC():Int_Set( 0, nColours )
         if (nColours &lt;= 1) then
            EffectDC():Int_Set( 1, RSN_GetFirstProducibleColour( EffectSource() ) )
         end
      </PLAY_TIME_ACTION>
      <PLAY_TIME_ACTION>
         if (EffectDC():Int_Get( 0 ) &gt; 1) then
            local oPlayer = EffectController()
            local oCard = EffectSource()
            if (oPlayer ~= nil) then
               oPlayer:BeginNewMultipleChoice()
               oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_W", EffectSource():GetColour():Test( COLOUR_WHITE ) == true )
               oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_U", EffectSource():GetColour():Test( COLOUR_BLUE ) == true )
               oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_B", EffectSource():GetColour():Test( COLOUR_BLACK ) == true )
               oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_R", EffectSource():GetColour():Test( COLOUR_RED ) == true )
               oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_G", EffectSource():GetColour():Test( COLOUR_GREEN ) == true )
               oPlayer:AskMultipleChoiceQuestion( "MODE_CHOOSE_ONE", oCard )
            end
         end
      </PLAY_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         local nColour = 0
         if (EffectDC():Int_Get( 0 ) &gt; 1) then
            nColour = EffectController():GetMultipleChoiceResult() + 1
         else
            nColour = EffectDC():Int_Get( 1 )
         end
         if (nColour == COLOUR_COLOURLESS) then
            RSN_Produce( "{1}", 1 )
         elseif (nColour == COLOUR_WHITE) then
            RSN_Produce( "{W}", 1 )
         elseif (nColour == COLOUR_BLUE) then
            RSN_Produce( "{U}", 1 )
         elseif (nColour == COLOUR_BLACK) then
            RSN_Produce( "{B}", 1 )
         elseif (nColour == COLOUR_RED) then
            RSN_Produce( "{R}", 1 )
         elseif (nColour == COLOUR_GREEN) then
            RSN_Produce( "{G}", 1 )
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         RSN_EliminateExtraManaTokens()
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         S_DisplayManaPool(EffectController())
         RSN_MarkManaAbilityEnd()
      </RESOLUTION_TIME_ACTION>
      <AI_AVAILABILITY window_step="upkeep" type="window" />
      <AI_AVAILABILITY window_step="main_1" window_turn="my_turn" type="window" />
      <AI_AVAILABILITY window_step="begin_combat" window_turn="their_turn" type="window" />
      <AI_AVAILABILITY window_step="declare_attackers" window_turn="their_turn" type="window" />
      <AI_AVAILABILITY window_step="declare_blockers" type="window" />
      <AI_AVAILABILITY window_step="main_2" window_turn="my_turn" type="window" />
      <AI_AVAILABILITY window_step="end_of_turn" type="window" />
      <AI_AVAILABILITY window_step="end_of_turn" window_turn="their_turn" type="window" />
      <AI_AVAILABILITY type="in_response" response_source="1" response_target="1" />
      <AI_AVAILABILITY type="in_response" response_source="1" />
      <AI_AVAILABILITY type="in_response" response_target="1" />
   </ACTIVATED_ABILITY>
It first checks how many colours the card has and stores that in a DC register; then if it has 1 or less it stores the first producible colour in another DC register (the function RSN_GetFirstProducibleColour() works because in the next ability you mark what can be produced based on the card's colours). Then in the next action if the stored colours (EffectDC() register) are greater than 1 we ask the question (without the colourless option). In the mana producing action we first check how many colours (our stored EffectDC() register) and if greater than 1 we ask for the result of the question otherwise we look to see what colour was stored in the other EffectDC() register.

Xander9009 wrote:While I'm at it, I'll save space and just ask here, does anyone know how to add a custom ability?
You've already added custom abilities and there is no trick to it.

Xander9009 wrote:I know it can't be coded in like the vanilla abilities, but are there any tricks that I can use to easily have certain cards have an ability and other cards be able to know they have the ability? Would the Scry trick made by Sumo work (the one to trigger the new card's "Player scried" condition)? Should I use the original Scry trick by TFM and use an unused ability? Something else entirely?
What you are describing here is not custom abilities, but custom characteristics and is very different. The scry tricks used won't work because they just signal when scry has been used, not which cards have scry.

A while back in working with Undying and Persist, I developed a system that I designed to allow for custom characteristics, Characteristic Functions (requires my ObjectDC functions as well). Currently, the system is unused as no one has really needed it. There are 2 ways to use these functions:
  1. Use the functions to assign both a fake characteristic and create the ability on each card that you want to have the fake characteristic (GrantAbility() does work if the card is designed to give the fake characteristic to something else).
  2. Use the functions to assign a fake characteristic to a card and have the ability portion of the fake characteristic managed by an invisible manager token.

Regardless of which option you choose the default Characteristic Manager token must be created (this manages the fake characteristics so they get properly removed when they are supposed to be). The Persist and Undying fake characteristics can be ignored since they aren't needed (we found a way to code them without needing extra abilities).

To use it you need to create a LOL file to contain the constants for your fake characteristics each with unique values (to prevent conflicts) like so:
MY_CUSTOM_CHARACTERISTICS.LOL | Open
Code: Select all
MY_CHARACTERISTIC_SOMETHING = 1234001
Then if you are doing the manager route (if not then skip this) you need to create a manager token (a single manager can easily manage multiple custom characteristics):
MY_CUSTOM_MANAGER | Open
Code: Select all
<?xml version="1.0"?>
<CARD_V2 ExportVersion="1">
   <FILENAME text="MY_CUSTOM_CHARACTERISTIC_MANAGER" />
   <CARDNAME text="MY_CUSTOM_CHARACTERISTIC_MANAGER" />
   <TITLE>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[MY CHARACTERISTIC MANAGER]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[MY CHARACTERISTIC MANAGER]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[MY CHARACTERISTIC MANAGER]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[MY CHARACTERISTIC MANAGER]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[MY CHARACTERISTIC MANAGER]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[MY CHARACTERISTIC MANAGER]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[MY CHARACTERISTIC MANAGER]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[MY CHARACTERISTIC MANAGER]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[MY CHARACTERISTIC MANAGER]]></LOCALISED_TEXT>
   </TITLE>
   <ARTID value="0" />
   <ARTIST name="None" />
   <CASTING_COST cost="" />
   <EXPANSION value="MANAGER_TOKENS" />
   <RARITY metaname="T" />
   <!-- Shroud so it can't be targeted. -->
   <STATIC_ABILITY>
      <INTRINSIC characteristic="CHARACTERISTIC_SHROUD" />
   </STATIC_ABILITY>
   <!-- Indestructible so it can't be destroyed. -->
   <STATIC_ABILITY>
      <INTRINSIC characteristic="CHARACTERISTIC_INDESTRUCTIBLE" />
   </STATIC_ABILITY>
   <!-- Protection from everything to prevent unwanted removal. -->
   <STATIC_ABILITY>
      <CONTINUOUS_ACTION layer="0">
         if (EffectSource() ~= nil) then
            local oFilter = ClearFilter()
            local oSubfilter = oFilter:AddSubFilter_Or()
            oSubfilter:Add( FE_TYPE, OP_IS, CARD_TYPE_ARTIFACT )
            oSubfilter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
            oSubfilter:Add( FE_TYPE, OP_IS, CARD_TYPE_ENCHANTMENT )
            oSubfilter:Add( FE_TYPE, OP_IS, CARD_TYPE_INSTANT )
            oSubfilter:Add( FE_TYPE, OP_IS, CARD_TYPE_LAND )
            oSubfilter:Add( FE_TYPE, OP_IS, CARD_TYPE_PHENOMENON )
            oSubfilter:Add( FE_TYPE, OP_IS, CARD_TYPE_PLANE )
            oSubfilter:Add( FE_TYPE, OP_IS, CARD_TYPE_PLANESWALKER )
            oSubfilter:Add( FE_TYPE, OP_IS, CARD_TYPE_SCHEME )
            oSubfilter:Add( FE_TYPE, OP_IS, CARD_TYPE_SORCERY )
            EffectSource():Protection()
         end
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>

   <!-- Now we have extra abilities for those characteristics which are built into this manager. -->
   <!-- In other words these are the functions that make the custom characteristics actually do something. -->
</CARD_V2>
On the card that is going to either have or give the custom characteristic you need to add a couple of abilities. This is required so that the manager(s) get created to handle the custom characteristics (does not matter if RSN_Characteristics_CreateManagers() is called multiple times as it will only ever create the manager(s) once).
This creates the manager(s) | Open
Code: Select all
<TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_HAND">
   <TRIGGER value="BEGINNING_OF_STEP">
      return ((MTG():GetStep() == STEP_UPKEEP) and (MTG():GetTurnNumber() == 0))
   </TRIGGER>
   <RESOLUTION_TIME_ACTION>
      -- If you have created your own manager(s) then you need to add them as parameters to the function call below.  Like this: RSN_Characteristics_CreateManagers("MY_CUSTOM_CHARACTERISTIC_MANAGER", "ANOTHER_MANAGER", "AND_ANOTHER")
      RSN_Characteristics_CreateManagers()
   </RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
<TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_LIBRARY">
   <TRIGGER value="BEGINNING_OF_STEP">
      return ((MTG():GetStep() == STEP_UPKEEP) and (MTG():GetTurnNumber() == 0))
   </TRIGGER>
   <RESOLUTION_TIME_ACTION>
      -- If you have created your own manager(s) then you need to add them as parameters to the function call below.  Like this: RSN_Characteristics_CreateManagers("MY_CUSTOM_CHARACTERISTIC_MANAGER", "ANOTHER_MANAGER", "AND_ANOTHER")
      RSN_Characteristics_CreateManagers()
   </RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
If you are using the non-manager route then you need to create the ability to actually do what the characteristic is supposed to do on the card(s).

Finally, you need to assign the custom characteristic to the card(s). This could be a static ability on the card (like regular characteristics, except use layer 6 or RemoveAllAbilities() may not work right) or granted using GrantAbility() (layer 6 as standard). For example to use the static ability example:
Assign Custom Characteristic | Open
Code: Select all
<STATIC_ABILITY active_zone="ZONE_ANY">
   <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[My Custom Characteristic]]></LOCALISED_TEXT>
   <CONTINUOUS_ACTION layer="6">
      RSN_Characteristics_Set( EffectSource(), MY_CHARACTERISTIC_SOMETHING, 1 )
   </CONTINUOUS_ACTION>
</STATIC_ABILITY>
The active_zone is there to try and ensure it will work in any zone except Exile. If you need to be able to detect it in Exile then you need to add another copy of the ability with active_zone="ZONE_EXILE" as ZONE_ANY does not cover exile for whatever reason.
Problems with base game cards: DotP 2014 Core Fixes
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
RiiakShiNal
Programmer
 
Posts: 2126
Joined: 16 May 2011, 21:37
Has thanked: 73 times
Been thanked: 472 times

Re: Need help fixing a custom card

Postby Xander9009 » 14 Mar 2014, 18:35

TFM: As always, thank you. I tried that method except I was using a local instead of Set_Int. I was testing for colorless the long way (~W and ~U and...) but the result for that bit was the same. It's working now with the Set_Int version. Not sure how Set_Int vs local matters; maybe it's something else subtly different that I'm not noticing.

Ironically, this was my attempt to re-familiarize myself with DotP coding since I've been gone for so long, and I chose the hardest card in the whole deck to start with (just 'cause I was going in order). With any luck, I'll be able to figure out the rest myself.

-----------------

RSN: Since I already tried TFM's and it's working, I'm going to stick with it (unless you think I shouldn't, you're the expert on your mana functions).

And sorry, I didn't mean generic abilities, I did, like you said, mean characteristics. I didn't think the scry trick would work because of exactly what you mentioned, but I didn't know if there was a way to store the card as well. I figured it might be possible to store the card but that they simply hadn't merely because they didn't need to. I'll definitely try this. It figures if there's a set of functions to make this simple, it'd be you behind it. I'll try it out tomorrow (the rest of today is busy) and let you know if (read: when) I have trouble.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2888
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 119 times
Been thanked: 439 times

Re: Need help fixing a custom card

Postby thefiremind » 14 Mar 2014, 18:57

Xander9009 wrote:Not sure how Set_Int vs local matters
Local variables only exist within the same action, you can't take them to different code blocks.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 717 times

Re: Need help fixing a custom card

Postby Xander9009 » 14 Mar 2014, 19:11

thefiremind wrote:Local variables only exist within the same action, you can't take them to different code blocks.
Then it must be some subtle change that I didn't notice or I must have simply screwed it up when I tried it with the local, because it was all in a single resolution time action block (just like it is now). The Set_Int and Get_Int is all happening within a single code block.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2888
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 119 times
Been thanked: 439 times

Re: Need help fixing a custom card

Postby RiiakShiNal » 15 Mar 2014, 01:25

Xander9009 wrote:RSN: Since I already tried TFM's and it's working, I'm going to stick with it (unless you think I shouldn't, you're the expert on your mana functions).
No problem, they are just two different ways of doing the same thing. As long as it works, it works.

Xander9009 wrote:And sorry, I didn't mean generic abilities, I did, like you said, mean characteristics. I didn't think the scry trick would work because of exactly what you mentioned, but I didn't know if there was a way to store the card as well. I figured it might be possible to store the card but that they simply hadn't merely because they didn't need to.
You can store a card pointer as well, but it still wouldn't work because if you have 2+ cards in play with the same characteristic only one would be stored with the counter if you use the scry trick (the other pointers will have been overwritten). The scry trick is used for something completely different than what you want to do so without completely changing it it won't work.

Xander9009 wrote:I'll definitely try this. It figures if there's a set of functions to make this simple, it'd be you behind it. I'll try it out tomorrow (the rest of today is busy) and let you know if (read: when) I have trouble.
Not always, the Scry functions are very simple to use and they were done by sumomole and thefiremind. Most modders creates their own sets of functions to make card coding easier some prefer to make the functions more flexible others prefer to keep the use as simple as possible.

My function sets for DotP 2014 are usually more general use functions (greater flexibility) that try to conquer things that should have been easy to begin with (ObjectDC, Mana Abilities, Custom Characteristics) but aren't due to lack of engine support. If I were tailoring the functions to specific sub-problems or specific abilities then they would probably be easier to use (like my Annihilator functions in the Core Fixes).

Since you will be the first user of the Characteristics functions besides myself I will be paying close attention to your feedback. You could be the driving force behind version 2 if you have ideas for it and/or find bugs (though I did try to test it pretty thoroughly).

Xander9009 wrote:
thefiremind wrote:Local variables only exist within the same action, you can't take them to different code blocks.
Then it must be some subtle change that I didn't notice or I must have simply screwed it up when I tried it with the local, because it was all in a single resolution time action block (just like it is now). The Set_Int and Get_Int is all happening within a single code block.
Since you said you were using thefiremind's version, you should take a closer look as in his version Set_Int() is in a PLAY_TIME_ACTION block and Get_Int() is in a RESOLUTION_TIME_ACTION block (different XML blocks = different actions).
Problems with base game cards: DotP 2014 Core Fixes
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
RiiakShiNal
Programmer
 
Posts: 2126
Joined: 16 May 2011, 21:37
Has thanked: 73 times
Been thanked: 472 times

Re: Need help fixing a custom card

Postby Xander9009 » 15 Mar 2014, 21:45

RiiakShiNal wrote:Since you said you were using thefiremind's version, you should take a closer look as in his version Set_Int() is in a PLAY_TIME_ACTION block and Get_Int() is in a RESOLUTION_TIME_ACTION block (different XML blocks = different actions).
I hadn't noticed that. I had the second play time action block's code in my resolution time action block and it was working. Of course, having it in a play time action is correct, but I didn't even blink at it. Fixed now.

RiiakShiNal wrote:Since you will be the first user of the Characteristics functions besides myself I will be paying close attention to your feedback. You could be the driving force behind version 2 if you have ideas for it and/or find bugs (though I did try to test it pretty thoroughly).
Well, so far, I think I've got it going well. But I do have three should-be-quick questions.

1: For creating a LOL file, I just created a new text file, changed the extension to LOL, copied in the variable = # (I used X_FAKE_CHARACTERISTIC = 90090001), and saved to my Functions folder. Is that all that's necessary for the game to pick it up? It's working, but I've never messed with LOL files, so I want to double check.

2: For the ability the characteristic grants, I decided to go the non-manager-token route (for now). You said I'll need to put my characteristic's ability on each card with the characteristic. So, I'm assuming that means basically what I was already doing; i.e., coding all of the creatures with the same code. So, the fake characteristics (at least when not using a manager token) mainly gives me a way to the hard parts, such as a) filtering for those with the characteristic/querying a card to see if it has the characteristic and b) make the characteristic compatible with RemoveAllAbility effects. Is that right, or did I miss something?

3: If/when I switch to using a manager token, would I simply put the manager token creation code on each card that would use the token? I think the answer is yes, but I want to be certain before changing the mostly working cards.

By the way, I've got three cards so far using this (wanted to keep it a small, focused test). A few bumps along the road, but they were mostly inattentiveness (which is really terrible for coding things). I forgot to change the name of the variable in the LOL file to the actual variable I was using in the cards, so I kept getting errors that your get/set functions were both missing parameters. I figured they were caused by the variable being nul (and I was right) but it certainly took awhile to figure out why. Aside from that, it's been a pretty smooth process. At first glance it all seems to be working perfectly. Once I know for sure about the manager token code going on all cards, I'll start converting to that (which might be a bit more complicated for me since my characteristic inherently grants other, variable characteristics like Likelink or Haste).
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2888
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 119 times
Been thanked: 439 times

Re: Need help fixing a custom card

Postby RiiakShiNal » 16 Mar 2014, 04:11

Xander9009 wrote:Well, so far, I think I've got it going well. But I do have three should-be-quick questions.

1: For creating a LOL file, I just created a new text file, changed the extension to LOL, copied in the variable = # (I used X_FAKE_CHARACTERISTIC = 90090001), and saved to my Functions folder. Is that all that's necessary for the game to pick it up? It's working, but I've never messed with LOL files, so I want to double check.
Yep, that's it. You can use any variable name you want for the fake characteristic value (I recommend descriptive names that follow a pattern so it is easier to remember them later).

Xander9009 wrote:2: For the ability the characteristic grants, I decided to go the non-manager-token route (for now). You said I'll need to put my characteristic's ability on each card with the characteristic. So, I'm assuming that means basically what I was already doing; i.e., coding all of the creatures with the same code. So, the fake characteristics (at least when not using a manager token) mainly gives me a way to the hard parts, such as a) filtering for those with the characteristic/querying a card to see if it has the characteristic and b) make the characteristic compatible with RemoveAllAbility effects. Is that right, or did I miss something?
That's right, though for part b you can make it compatible with RemoveAllAbilities() by simply granting the ability on layer 6.

Xander9009 wrote:3: If/when I switch to using a manager token, would I simply put the manager token creation code on each card that would use the token? I think the answer is yes, but I want to be certain before changing the mostly working cards.
Well, the manager creation code has to be on all cards that use fake characteristics as they need to create my manager token at the very least (it is required for managing the fake characteristics like clearing when it is supposed to). Then later if you decide to go the manager route you just add your manager FILENAME as a parameter to the RSN_Characteristics_CreateManagers() calls in the cards that will use your manager. There is no worry about multiple calls or calls with different parameters as it will check each manager token to see if it exists before trying to create one.

Xander9009 wrote:By the way, I've got three cards so far using this (wanted to keep it a small, focused test). A few bumps along the road, but they were mostly inattentiveness (which is really terrible for coding things). I forgot to change the name of the variable in the LOL file to the actual variable I was using in the cards, so I kept getting errors that your get/set functions were both missing parameters. I figured they were caused by the variable being nul (and I was right) but it certainly took awhile to figure out why. Aside from that, it's been a pretty smooth process. At first glance it all seems to be working perfectly. Once I know for sure about the manager token code going on all cards, I'll start converting to that (which might be a bit more complicated for me since my characteristic inherently grants other, variable characteristics like Likelink or Haste).
Well, keep me informed and I will continue to answer any questions to the best of my ability.
Problems with base game cards: DotP 2014 Core Fixes
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
RiiakShiNal
Programmer
 
Posts: 2126
Joined: 16 May 2011, 21:37
Has thanked: 73 times
Been thanked: 472 times

Re: Need help fixing a custom card

Postby Xander9009 » 16 Mar 2014, 13:52

Alright, so everything appeared to be working fine right up until I added in another non-legion creature. Turns out it's not properly filtering. All of my creatures are being given the abilities instead of only those that have the custom characteristic. Here's the code
Windcrafter Drake | Open
Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
   <FILENAME text="WINDCRAFTER_DRAKE_90090012" />
   <CARDNAME text="WINDCRAFTER_DRAKE" />
   <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Windcrafter Drake]]></LOCALISED_TEXT>
   </TITLE>
   <MULTIVERSEID value="90090012" />
   <ARTID value="90090012" />
   <ARTIST name="James Ryman" />
   <CASTING_COST cost="{U}" />
   <FLAVOURTEXT>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Older than most drakes, he's learned to subtly manipulate the winds for flight. And not just for him.]]></LOCALISED_TEXT>
   </FLAVOURTEXT>
   <TYPE metaname="Creature" />
   <SUB_TYPE metaname="Drake" />
   <EXPANSION value="RTR" />
   <RARITY metaname="C" />
   <POWER value="1" />
   <TOUGHNESS value="1" />
   <STATIC_ABILITY active_zone="ZONE_ANY">
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Legion: Flying]]></LOCALISED_TEXT>
      <CONTINUOUS_ACTION layer="6">
         RSN_Characteristics_Set( EffectSource(), X_CHARACTERISTIC_LEGION, 1 )
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <STATIC_ABILITY>
      <FILTER filter_id="0">
         local filter = ClearFilter()
         filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
         filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
         local filter_count = filter:EvaluateObjects()
         if filter_count &gt; 0 then
            for i=0,filter_count-1 do
               local Candidate = filter:GetNthEvaluatedObject(i)
               if Candidate ~= nil and RSN_Characteristics_Get( Candidate, X_CHARACTERISTIC_LEGION ) then
                  Candidate:MarkForFilter()
               end
            end
            filter:SetMarkedObjectsOnly()
         end
      </FILTER>
      <CONTINUOUS_ACTION layer="6" filter_id="0">
         if FilteredCard() ~= nil then
            FilteredCard():GetCurrentCharacteristics():Bool_Set( CHARACTERISTIC_FLYING, 1 )
         end
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_HAND">
      <TRIGGER value="BEGINNING_OF_STEP">
         return ((MTG():GetStep() == STEP_UPKEEP) and (MTG():GetTurnNumber() == 0))
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
         RSN_Characteristics_CreateManagers()
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_LIBRARY">
      <TRIGGER value="BEGINNING_OF_STEP">
         return ((MTG():GetStep() == STEP_UPKEEP) and (MTG():GetTurnNumber() == 0))
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
         RSN_Characteristics_CreateManagers()
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <HELP title="MORE_INFO_BADGE_TITLE_10" body="MORE_INFO_BADGE_BODY_10" zone="ZONE_ANY" />
   <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>
I suspect the problem is that I can't do calculations and for/do loops in a filter block. But before I add a lua condition, is there an easier way to filter by objects with the custom characteristic? Or is a lua filter condition the easiest?
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2888
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 119 times
Been thanked: 439 times

Re: Need help fixing a custom card

Postby thefiremind » 16 Mar 2014, 15:29

Xander9009 wrote:All of my creatures are being given the abilities instead of only those that have the custom characteristic.
I'm not totally sure because I haven't checked RiiakShiNal's custom characteristics functions in a long time, but I think I spotted the problem.

EDIT: Forget about this. :oops:
Last edited by thefiremind on 16 Mar 2014, 16:31, edited 1 time in total.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 717 times

Re: Need help fixing a custom card

Postby Xander9009 » 16 Mar 2014, 16:22

I remembered looking at his functions and thinking it returned true/false, so I checked, and it does in fact return true/false. The Set function will accept bool or int, but the Get function returns bool. I tried it anyway for good measure, but the creature without the custom characteristic was still given flying. Thanks for the suggestion. I'll keep tinkering until until you or Riiak have another one or until I fix it.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2888
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 119 times
Been thanked: 439 times

Re: Need help fixing a custom card

Postby thefiremind » 16 Mar 2014, 16:30

Xander9009 wrote:I remembered looking at his functions and thinking it returned true/false, so I checked, and it does in fact return true/false. The Set function will accept bool or int, but the Get function returns bool.
OK, then you might be right suspecting that loops inside the FILTER block are screwing it up. Try this way:
Code: Select all
   <STATIC_ABILITY>
      <FILTER filter_id="0">
         local filter = ClearFilter()
         filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
         filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
      </FILTER>
      <CONTINUOUS_ACTION layer="6" filter_id="0">
         if FilteredCard() ~= nil and RSN_Characteristics_Get( FilteredCard(), X_CHARACTERISTIC_LEGION ) then
            FilteredCard():GetCurrentCharacteristics():Bool_Set( CHARACTERISTIC_FLYING, 1 )
         end
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 717 times

Re: Need help fixing a custom card

Postby Xander9009 » 16 Mar 2014, 17:27

That was the problem. So, thank you for pointing out a much simpler way to do it.

Now for the final problem I've been having, and possibly the hardest to solve. My game keeps crashing when I play one of the cards. Why might that be tough to fix? It's not a reliably encountered issue. I might play all the cards I have with the code and not have any problem, and then have the game crash when I try again the next game. The most reliable thing I've found about them is that it's only crashed on the creatures with the custom characteristics. (There's an artifact that hasn't yet crashed the game, and the other cards, custom or vanilla, in the same deck haven't yet crashed it.) It seems like it happens most often with the third card with the custom characteristics (I'm sick of typing that out, how about CChar?). It's tough to test for since I don't know for sure if something has fixed it or if I'm just getting lucky.

I've been encountering the crashing for quite some time, but I didn't initially realize it was only happening when playing the CChar cards. Either of you happen to know what might cause intermittent crashing or have an idea where I might look where others have had the same problems, or is this possibly directly related to either the CCHars or a mistake I made while preparing them?

If you don't know anything off-hand, don't worry about it. I'll try testing with a specific focus on this to see if I can narrow it down a bit and post up any progress.

Thanks again to both of you for your help so far.

EDIT: I don't expect you guys to read through all of this, but I'm going to go ahead and post the code of all 6 cards that are using this code so far. That way if you know something specific that might cause it, you can glance through for that in particular.

Book of Shards | Open
Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
   <FILENAME text="BOOK_OF_SHARDS_90090005" />
   <CARDNAME text="BOOK_OF_SHARDS" />
   <TITLE>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Book of Shards]]></LOCALISED_TEXT>
   </TITLE>
   <MULTIVERSEID value="90090005" />
   <ARTID value="90090005" />
   <ARTIST name="Heather Hudson" />
   <CASTING_COST cost="{1}" />
   <FLAVOURTEXT>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Here, young Legionnaire, this will teach you of your origins.]]></LOCALISED_TEXT>
   </FLAVOURTEXT>
   <TYPE metaname="Artifact" />
   <EXPANSION value="M14" />
   <RARITY metaname="C" />
   <STATIC_ABILITY active_zone="ZONE_ANY">
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[My Custom Characteristic]]></LOCALISED_TEXT>
      <CONTINUOUS_ACTION layer="6">
         RSN_Characteristics_Set( EffectSource(), X_CHARACTERISTIC_LEGION, 1 )
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_TRANSITION">
      <TRIGGER value="ZONECHANGE_TRANSITION" simple_qualifier="self" to_zone="ZONE_BATTLEFIELD" from_zone="ZONE_ANY" />
      <COUNTER_REGISTRATION name="Charge" proliferate="11" />
      <RESOLUTION_TIME_ACTION>
         local sunburst = 0
         if EffectSource() ~= nil then
            for i=1,5 do
               if EffectSource():WasPaidForWithColour(i) then
                  sunburst = sunburst + 1
               end
            end
            EffectSource():AddCounters( MTG():GetCountersType("Charge"), sunburst)
         end
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <TRIGGERED_ABILITY replacement_effect="1">
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Legion: Sunburst]]></LOCALISED_TEXT>
      <TRIGGER value="ZONECHANGE_BEGIN" from_zone="ZONE_ANY" to_zone="ZONE_BATTLEFIELD">
         if TriggerObject() ~= EffectSource() and RSN_Characteristics_Get( TriggerObject(), X_CHARACTERISTIC_LEGION ) then
            local delayDC = EffectDC():Make_Chest(1)
            delayDC:Set_CardPtr(0, TriggerObject())
            MTG():CreateDelayedTrigger(3, delayDC)
         end
         return false
      </TRIGGER>
   </TRIGGERED_ABILITY>
   <TRIGGERED_ABILITY replacement_effect="1" resource_id="3">
      <CLEANUP fire_once="1" />
      <TRIGGER value="ZONECHANGE_TRANSITION" from_zone="ZONE_ANY" to_zone="ZONE_BATTLEFIELD">
         if TriggerObject() == EffectDC():Get_CardPtr(0) then
            if TriggerObject():GetPlayer() == EffectController() then
               return true
            else
               MTG():RemoveDelayedTrigger(3)
            end
         end
         return false
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
         local sunburst = 0
         if EffectDC():Get_CardPtr(0) ~= nil then
            for i=1,5 do
               if EffectDC():Get_CardPtr(0):WasPaidForWithColour(i) then
                  sunburst = sunburst + 1
               end
            end
            EffectDC():Get_CardPtr(0):AddCounters( MTG():GetCountersType("Charge"), sunburst)
         end
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <STATIC_ABILITY>
      <FILTER filter_id="0">
         local filter = ClearFilter()
         filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
         filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
      </FILTER>
      <CONTINUOUS_ACTION layer="6" filter_id="0">
         if FilteredCard() ~= nil and RSN_Characteristics_Get( FilteredCard(), X_CHARACTERISTIC_LEGION ) then
            local characteristics = FilteredCard():GetCurrentCharacteristics()
            characteristics:GrantAbility(0)
            characteristics:GrantAbility(1)
            characteristics:GrantAbility(2)
         end
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <ACTIVATED_ABILITY forced_skip="1"  resource_id="0">
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Remove a charge counter from this permanent: Add to your mana pool 1 mana of any color that shares a color with this permanent.]]></LOCALISED_TEXT>
      <COST type="RemoveCountersSelf" amount="1" counter_type="Charge" />
      <PLAY_TIME_ACTION>
         if EffectSource():GetColour():GetNumColours() &gt; 1 then
            local oPlayer = EffectController()
            local oCard = EffectSource()
            if (oPlayer ~= nil) then
               oPlayer:BeginNewMultipleChoice()
               oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_W", EffectSource():GetColour():Test( COLOUR_WHITE ) == true )
               oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_U", EffectSource():GetColour():Test( COLOUR_BLUE ) == true )
               oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_B", EffectSource():GetColour():Test( COLOUR_BLACK ) == true )
               oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_R", EffectSource():GetColour():Test( COLOUR_RED ) == true )
               oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_G", EffectSource():GetColour():Test( COLOUR_GREEN ) == true )
               oPlayer:AskMultipleChoiceQuestion( "MODE_CHOOSE_ONE", oCard )
            end
         end
      </PLAY_TIME_ACTION>
      <PLAY_TIME_ACTION>
         if EffectSource():GetColour():GetNumColours() &gt; 1 then
            EffectDC():Set_Int( 0, EffectController():GetMultipleChoiceResult()+1 )
         elseif EffectSource():GetColour():GetNumColours() == 0 then
            EffectDC():Set_Int( 0, 0 )
         else
            if ( EffectSource():GetColour():Test( COLOUR_WHITE) == true ) then
               EffectDC():Set_Int( 0, 1 )
            elseif EffectSource():GetColour():Test( COLOUR_BLUE) == true then
               EffectDC():Set_Int( 0, 2 )
            elseif EffectSource():GetColour():Test( COLOUR_BLACK) == true then
               EffectDC():Set_Int( 0, 3 )
            elseif EffectSource():GetColour():Test( COLOUR_RED) == true then
               EffectDC():Set_Int( 0, 4 )
            else
               EffectDC():Set_Int( 0, 5 )
            end
         end
      </PLAY_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         if (EffectDC():Get_Int(0) == 0) then
            RSN_Produce( "{1}", 1 )
         elseif (EffectDC():Get_Int(0) == 1) then
            RSN_Produce( "{W}", 1 )
         elseif (EffectDC():Get_Int(0) == 2) then
            RSN_Produce( "{U}", 1 )
         elseif (EffectDC():Get_Int(0) == 3) then
            RSN_Produce( "{B}", 1 )
         elseif (EffectDC():Get_Int(0) == 4) then
            RSN_Produce( "{R}", 1 )
         else
            RSN_Produce( "{G}", 1 )
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         RSN_EliminateExtraManaTokens()
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         S_DisplayManaPool(EffectController())
         RSN_MarkManaAbilityEnd()
      </RESOLUTION_TIME_ACTION>
      <AI_AVAILABILITY window_step="upkeep" type="window" />
      <AI_AVAILABILITY window_step="main_1" window_turn="my_turn" type="window" />
      <AI_AVAILABILITY window_step="begin_combat" window_turn="their_turn" type="window" />
      <AI_AVAILABILITY window_step="declare_attackers" window_turn="their_turn" type="window" />
      <AI_AVAILABILITY window_step="declare_blockers" type="window" />
      <AI_AVAILABILITY window_step="main_2" window_turn="my_turn" type="window" />
      <AI_AVAILABILITY window_step="end_of_turn" type="window" />
      <AI_AVAILABILITY window_step="end_of_turn" window_turn="their_turn" type="window" />
      <AI_AVAILABILITY type="in_response" response_source="1" response_target="1" />
      <AI_AVAILABILITY type="in_response" response_source="1" />
      <AI_AVAILABILITY type="in_response" response_target="1" />
   </ACTIVATED_ABILITY>
   <STATIC_ABILITY resource_id="1">
      <CONTINUOUS_ACTION layer="0">
         RSN_ClearCanProduceMana()
         if EffectSource():CountCounters( MTG():GetCountersType("Charge") ) &gt; 0 then
            local IsColored = 0
            if EffectSource():GetColour():Test( COLOUR_WHITE ) == true then
               RSN_MarkCanProduceMana( "{W}" )
               IsColored = 1
            end
            if EffectSource():GetColour():Test( COLOUR_BLUE ) == true then
               RSN_MarkCanProduceMana( "{U}" )
               IsColored = 1
            end
            if EffectSource():GetColour():Test( COLOUR_BLACK ) == true then
               RSN_MarkCanProduceMana( "{B}" )
               IsColored = 1
            end
            if EffectSource():GetColour():Test( COLOUR_RED ) == true then
               RSN_MarkCanProduceMana( "{R}" )
               IsColored = 1
            end
            if EffectSource():GetColour():Test( COLOUR_GREEN ) == true then
               RSN_MarkCanProduceMana( "{G}" )
               IsColored = 1
            end
            if IsColored == 0 then
               RSN_MarkCanProduceMana( "{1}" )
            end
         else
            RSN_MarkCanProduceMana( "" )
         end
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <TRIGGERED_ABILITY replacement_effect="1" resource_id="2">
      <TRIGGER value="BEGINNING_OF_STEP" pre_trigger="1" />
      <RESOLUTION_TIME_ACTION>
         RSN_ClearProducedMana()
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_HAND">
      <TRIGGER value="BEGINNING_OF_STEP">
         return ((MTG():GetStep() == STEP_UPKEEP) and (MTG():GetTurnNumber() == 0))
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
         RSN_Characteristics_CreateManagers()
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_LIBRARY">
      <TRIGGER value="BEGINNING_OF_STEP">
         return ((MTG():GetStep() == STEP_UPKEEP) and (MTG():GetTurnNumber() == 0))
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
         RSN_Characteristics_CreateManagers()
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <TOKEN_REGISTRATION reservation="1" type="RSN_TOKEN_MANA_W" />
   <TOKEN_REGISTRATION reservation="1" type="RSN_TOKEN_MANA_U" />
   <TOKEN_REGISTRATION reservation="1" type="RSN_TOKEN_MANA_B" />
   <TOKEN_REGISTRATION reservation="1" type="RSN_TOKEN_MANA_R" />
   <TOKEN_REGISTRATION reservation="1" type="RSN_TOKEN_MANA_G" />
   <TOKEN_REGISTRATION reservation="1" type="RSN_TOKEN_MANA_C" />
   <HELP title="MORE_INFO_TITLE_SUNBURST" body="MORE_INFO_BODY_SUNBURST" zone="ZONE_ANY" />
</CARD_V2>
Fleetfoot | Open
Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
   <FILENAME text="FLEETFOOT_90090011" />
   <CARDNAME text="FLEETFOOT" />
   <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Fleetfoot]]></LOCALISED_TEXT>
   </TITLE>
   <MULTIVERSEID value="90090011" />
   <ARTID value="90090011" />
   <ARTIST name="James Ryman" />
   <CASTING_COST cost="{R}" />
   <FLAVOURTEXT>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[He tries to rush the new members. They mostly just want to run away from him...]]></LOCALISED_TEXT>
   </FLAVOURTEXT>
   <TYPE metaname="Creature" />
   <SUB_TYPE metaname="Ogre" />
   <EXPANSION value="RTR" />
   <RARITY metaname="C" />
   <POWER value="1" />
   <TOUGHNESS value="1" />
   <STATIC_ABILITY active_zone="ZONE_ANY">
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Legion: Haste]]></LOCALISED_TEXT>
      <CONTINUOUS_ACTION layer="6">
         RSN_Characteristics_Set( EffectSource(), X_CHARACTERISTIC_LEGION, 1 )
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <STATIC_ABILITY>
      <FILTER filter_id="0">
         local filter = ClearFilter()
         filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
         filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
      </FILTER>
      <CONTINUOUS_ACTION layer="6" filter_id="0">
         if FilteredCard() ~= nil and RSN_Characteristics_Get( FilteredCard(), X_CHARACTERISTIC_LEGION ) then
            FilteredCard():GetCurrentCharacteristics():Bool_Set( CHARACTERISTIC_HASTE, 1 )
         end
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_HAND">
      <TRIGGER value="BEGINNING_OF_STEP">
         return ((MTG():GetStep() == STEP_UPKEEP) and (MTG():GetTurnNumber() == 0))
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
         RSN_Characteristics_CreateManagers()
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_LIBRARY">
      <TRIGGER value="BEGINNING_OF_STEP">
         return ((MTG():GetStep() == STEP_UPKEEP) and (MTG():GetTurnNumber() == 0))
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
         RSN_Characteristics_CreateManagers()
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <HELP title="MORE_INFO_BADGE_TITLE_14" body="MORE_INFO_BADGE_BODY_14" zone="ZONE_ANY" />
   <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>
Garlith | Open
Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
   <FILENAME text="GARLITH_90090014" />
   <CARDNAME text="GARLITH" />
   <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Garlith]]></LOCALISED_TEXT>
   </TITLE>
   <MULTIVERSEID value="90090014" />
   <ARTID value="90090014" />
   <ARTIST name="James Ryman" />
   <CASTING_COST cost="{G}" />
   <FLAVOURTEXT>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA["You could learn something from that"
         -Legion Commander while a Garlith ransacked the encamptent]]></LOCALISED_TEXT>
   </FLAVOURTEXT>
   <TYPE metaname="Creature" />
   <SUB_TYPE metaname="Beast" />
   <EXPANSION value="RTR" />
   <RARITY metaname="C" />
   <POWER value="1" />
   <TOUGHNESS value="1" />
   <STATIC_ABILITY active_zone="ZONE_ANY">
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Legion: Trample]]></LOCALISED_TEXT>
      <CONTINUOUS_ACTION layer="6">
         RSN_Characteristics_Set( EffectSource(), X_CHARACTERISTIC_LEGION, 1 )
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <STATIC_ABILITY>
      <FILTER filter_id="0">
         local filter = ClearFilter()
         filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
         filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
      </FILTER>
      <CONTINUOUS_ACTION layer="6" filter_id="0">
         if FilteredCard() ~= nil and RSN_Characteristics_Get( FilteredCard(), X_CHARACTERISTIC_LEGION ) then
            FilteredCard():GetCurrentCharacteristics():Bool_Set( CHARACTERISTIC_TRAMPLE, 1 )
         end
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_HAND">
      <TRIGGER value="BEGINNING_OF_STEP">
         return ((MTG():GetStep() == STEP_UPKEEP) and (MTG():GetTurnNumber() == 0))
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
         RSN_Characteristics_CreateManagers()
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_LIBRARY">
      <TRIGGER value="BEGINNING_OF_STEP">
         return ((MTG():GetStep() == STEP_UPKEEP) and (MTG():GetTurnNumber() == 0))
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
         RSN_Characteristics_CreateManagers()
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <HELP title="MORE_INFO_BADGE_TITLE_1" body="MORE_INFO_BADGE_BODY_1" zone="ZONE_ANY" />
   <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>
League's Assassin | Open
Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
   <FILENAME text="LEAGUES_ASSASSIN_90090013" />
   <CARDNAME text="LEAGUES_ASSASSIN" />
   <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[League's Assassin]]></LOCALISED_TEXT>
   </TITLE>
   <MULTIVERSEID value="90090013" />
   <ARTID value="90090013" />
   <ARTIST name="James Ryman" />
   <CASTING_COST cost="{B}" />
   <FLAVOURTEXT>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[A proffesional tutor. His specialty: making your hits count.]]></LOCALISED_TEXT>
   </FLAVOURTEXT>
   <TYPE metaname="Creature" />
   <SUB_TYPE metaname="Human" />
   <SUB_TYPE metaname="Assassin" />
   <EXPANSION value="RTR" />
   <RARITY metaname="C" />
   <POWER value="1" />
   <TOUGHNESS value="1" />
   <STATIC_ABILITY active_zone="ZONE_ANY">
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Legion: Deathtouch]]></LOCALISED_TEXT>
      <CONTINUOUS_ACTION layer="6">
         RSN_Characteristics_Set( EffectSource(), X_CHARACTERISTIC_LEGION, 1 )
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <STATIC_ABILITY>
      <FILTER filter_id="0">
         local filter = ClearFilter()
         filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
         filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
      </FILTER>
      <CONTINUOUS_ACTION layer="6" filter_id="0">
         if FilteredCard() ~= nil and RSN_Characteristics_Get( FilteredCard(), X_CHARACTERISTIC_LEGION ) then
            FilteredCard():GetCurrentCharacteristics():Bool_Set( CHARACTERISTIC_DEATHTOUCH, 1 )
         end
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_HAND">
      <TRIGGER value="BEGINNING_OF_STEP">
         return ((MTG():GetStep() == STEP_UPKEEP) and (MTG():GetTurnNumber() == 0))
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
         RSN_Characteristics_CreateManagers()
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_LIBRARY">
      <TRIGGER value="BEGINNING_OF_STEP">
         return ((MTG():GetStep() == STEP_UPKEEP) and (MTG():GetTurnNumber() == 0))
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
         RSN_Characteristics_CreateManagers()
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <HELP title="MORE_INFO_BADGE_TITLE_3" body="MORE_INFO_BADGE_BODY_3" zone="ZONE_ANY" />
   <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>
League's Healer | Open
Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
   <FILENAME text="LEAGUES_HEALER_90090010" />
   <CARDNAME text="LEAGUES_HEALER" />
   <TITLE>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[League's Healer]]></LOCALISED_TEXT>
   </TITLE>
   <MULTIVERSEID value="90090010" />
   <ARTID value="90090010" />
   <ARTIST name="James Ryman" />
   <CASTING_COST cost="{W}" />
   <FLAVOURTEXT>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[She doesn't just heal the League's wounded, she teaches them to the art.]]></LOCALISED_TEXT>
   </FLAVOURTEXT>
   <TYPE metaname="Creature" />
   <SUB_TYPE metaname="Cleric" />
   <EXPANSION value="RTR" />
   <RARITY metaname="C" />
   <POWER value="1" />
   <TOUGHNESS value="1" />
   <STATIC_ABILITY active_zone="ZONE_ANY">
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Legion: Lifelink]]></LOCALISED_TEXT>
      <CONTINUOUS_ACTION layer="6">
         RSN_Characteristics_Set( EffectSource(), X_CHARACTERISTIC_LEGION, 1 )
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <STATIC_ABILITY>
      <FILTER filter_id="0">
         local filter = ClearFilter()
         filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
         filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
      </FILTER>
      <CONTINUOUS_ACTION layer="6" filter_id="0">
         if FilteredCard() ~= nil and RSN_Characteristics_Get( FilteredCard(), X_CHARACTERISTIC_LEGION ) then
            FilteredCard():GetCurrentCharacteristics():Bool_Set( CHARACTERISTIC_LIFELINK, 1 )
         end
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_HAND">
      <TRIGGER value="BEGINNING_OF_STEP">
         return ((MTG():GetStep() == STEP_UPKEEP) and (MTG():GetTurnNumber() == 0))
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
         RSN_Characteristics_CreateManagers()
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_LIBRARY">
      <TRIGGER value="BEGINNING_OF_STEP">
         return ((MTG():GetStep() == STEP_UPKEEP) and (MTG():GetTurnNumber() == 0))
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
         RSN_Characteristics_CreateManagers()
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <HELP title="MORE_INFO_BADGE_TITLE_4" body="MORE_INFO_BADGE_BODY_4" zone="ZONE_ANY" />
   <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>
Windcrafter Drake | Open
Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
   <FILENAME text="WINDCRAFTER_DRAKE_90090012" />
   <CARDNAME text="WINDCRAFTER_DRAKE" />
   <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Windcrafter Drake]]></LOCALISED_TEXT>
   </TITLE>
   <MULTIVERSEID value="90090012" />
   <ARTID value="90090012" />
   <ARTIST name="James Ryman" />
   <CASTING_COST cost="{U}" />
   <FLAVOURTEXT>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Older than most drakes, he's learned to subtly manipulate the winds for flight. And not just for him.]]></LOCALISED_TEXT>
   </FLAVOURTEXT>
   <TYPE metaname="Creature" />
   <SUB_TYPE metaname="Drake" />
   <EXPANSION value="RTR" />
   <RARITY metaname="C" />
   <POWER value="1" />
   <TOUGHNESS value="1" />
   <STATIC_ABILITY active_zone="ZONE_ANY">
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Legion: Flying]]></LOCALISED_TEXT>
      <CONTINUOUS_ACTION layer="6">
         RSN_Characteristics_Set( EffectSource(), X_CHARACTERISTIC_LEGION, 1 )
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <STATIC_ABILITY>
      <FILTER filter_id="0">
         local filter = ClearFilter()
         filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
         filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
      </FILTER>
      <CONTINUOUS_ACTION layer="6" filter_id="0">
         if FilteredCard() ~= nil and RSN_Characteristics_Get( FilteredCard(), X_CHARACTERISTIC_LEGION ) then
            FilteredCard():GetCurrentCharacteristics():Bool_Set( CHARACTERISTIC_FLYING, 1 )
         end
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_HAND">
      <TRIGGER value="BEGINNING_OF_STEP">
         return ((MTG():GetStep() == STEP_UPKEEP) and (MTG():GetTurnNumber() == 0))
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
         RSN_Characteristics_CreateManagers()
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_LIBRARY">
      <TRIGGER value="BEGINNING_OF_STEP">
         return ((MTG():GetStep() == STEP_UPKEEP) and (MTG():GetTurnNumber() == 0))
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
         RSN_Characteristics_CreateManagers()
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <HELP title="MORE_INFO_BADGE_TITLE_10" body="MORE_INFO_BADGE_BODY_10" zone="ZONE_ANY" />
   <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>
Note that as far as the ability code goes, the five creatures are all identical except for which ability they grant. So if you look at Fleetfoot, you've looked at all the rest (barring mistakes).
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2888
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 119 times
Been thanked: 439 times

Re: Need help fixing a custom card

Postby RiiakShiNal » 16 Mar 2014, 18:11

Xander9009 wrote:That was the problem. So, thank you for pointing out a much simpler way to do it.
I see you and thefiremind figured out that problem, though I will look at using it in a FILTER block and see if there is a problem there that can be fixed. Granted doing loops in a filter probably isn't something we should be doing, but it is a valid test case since theoretically we should be able to.

Xander9009 wrote:Now for the final problem I've been having, and possibly the hardest to solve. My game keeps crashing when I play one of the cards. Why might that be tough to fix? It's not a reliably encountered issue. I might play all the cards I have with the code and not have any problem, and then have the game crash when I try again the next game. The most reliable thing I've found about them is that it's only crashed on the creatures with the custom characteristics. (There's an artifact that hasn't yet crashed the game, and the other cards, custom or vanilla, in the same deck haven't yet crashed it.) It seems like it happens most often with the third card with the custom characteristics (I'm sick of typing that out, how about CChar?). It's tough to test for since I don't know for sure if something has fixed it or if I'm just getting lucky.

I've been encountering the crashing for quite some time, but I didn't initially realize it was only happening when playing the CChar cards. Either of you happen to know what might cause intermittent crashing or have an idea where I might look where others have had the same problems, or is this possibly directly related to either the CCHars or a mistake I made while preparing them?

If you don't know anything off-hand, don't worry about it. I'll try testing with a specific focus on this to see if I can narrow it down a bit and post up any progress.
This is probably because I forgot to tell you to put a TOKEN_REGISTRATION block in for the manager token on each card using the custom characteristics (it has been a while since I last used/looked at them). #-o
Code: Select all
   <TOKEN_REGISTRATION reservation="1" type="RSN_TOKEN_CHARACTERISTIC_MANAGER" />
Hopefully I won't forget it next time. [-o<

Xander9009 wrote:EDIT: I don't expect you guys to read through all of this, but I'm going to go ahead and post the code of all 6 cards that are using this code so far. That way if you know something specific that might cause it, you can glance through for that in particular.

Note that as far as the ability code goes, the five creatures are all identical except for which ability they grant. So if you look at Fleetfoot, you've looked at all the rest (barring mistakes).
  • Book of Shards - confirmed missing the above TOKEN_REGISTRATION.
  • Fleetfoot - confirmed missing the above TOKEN_REGISTRATION.
  • Garlith - confirmed missing the above TOKEN_REGISTRATION.
  • League's Assassin - confirmed missing the above TOKEN_REGISTRATION.
  • League's Healer - confirmed missing the above TOKEN_REGISTRATION.
  • Windcrafter Drake - confirmed missing the above TOKEN_REGISTRATION.

Note that I only skimmed through the code looking to see if the TOKEN_REGISTRATION was there as that is the highly likely suspect.
Problems with base game cards: DotP 2014 Core Fixes
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
RiiakShiNal
Programmer
 
Posts: 2126
Joined: 16 May 2011, 21:37
Has thanked: 73 times
Been thanked: 472 times

Next

Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 6 guests


Who is online

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

Users browsing this forum: No registered users and 6 guests

Login Form