It is currently 19 Apr 2024, 09:23
   
Text Size

General DotP 2014 Coding Questions

Moderator: CCGHQ Admins

Re: General DotP 2014 Coding Questions

Postby Xander9009 » 21 Nov 2014, 23:49

thefiremind wrote:
Xander9009 wrote:Is there a limit to the number of activated abilities a card can have?
I'm sure there is. If I remember correctly, in DotP2013 (or 2012, or both, can't remember) I couldn't even code Windreaver properly because 4 was too much already.
You can merge some of your 10 abilities in a single activated ability with modes if you want, after all we are talking about a test card, you don't need to adhere to anything. :)
That's not really an option :( I've already got modes. So many modes. Although I could still combine them, I just can't do it using more modes.

My card does a lot. 1 or 5 of any color+colorless mana, damages creatures or players, distributes 5 kinds of counters, searches various zones for either lands or cards, plays or mills all lands at once, plays or casts cards for free, counters or copies target spell or permanent, makes player draw or discard cards, gain or lose life, take extra turns, or control combat, destroys, exiles, taps, untaps, or bounces permanents, grants control of permanents to a player, and then the permanent effects also exist as mass effects, affecting all permanents based on controller (yours, target player's, your team's, opponent's). It allows you to force target player to play target permanents or all permanents from their hand or look for a card in their library or graveyard. Most of those abilities allow any number of targets, too, and many are marked as firebreathing so you can increase the counters, damage, or cards drawn, etc. So, it's rather long and complicated, and it's ALL working except I can't have 10 activated abilities :(

(For the record, it also plays itself from your library, can be played from your graveyard or from exile unless you're the AI, exiles itself if you're the AI, and has flash and hexproof. It pretty much covers every situation ever. Not quite, but close.)

So I would guess they upped the limit making it 8 now. I think instead of combining them, I'll just get rid of the mass manipulation and find 2 abilities which can be merged. Thanks.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

Re: General DotP 2014 Coding Questions

Postby NeoAnderson » 22 Nov 2014, 00:22

Xander9009 wrote:
thefiremind wrote:
Xander9009 wrote:Is there a limit to the number of activated abilities a card can have?
I'm sure there is. If I remember correctly, in DotP2013 (or 2012, or both, can't remember) I couldn't even code Windreaver properly because 4 was too much already.
You can merge some of your 10 abilities in a single activated ability with modes if you want, after all we are talking about a test card, you don't need to adhere to anything. :)
That's not really an option :( I've already got modes. So many modes. Although I could still combine them, I just can't do it using more modes.

My card does a lot. 1 or 5 of any color+colorless mana, damages creatures or players, distributes 5 kinds of counters, searches various zones for either lands or cards, plays or mills all lands at once, plays or casts cards for free, counters or copies target spell or permanent, makes player draw or discard cards, gain or lose life, take extra turns, or control combat, destroys, exiles, taps, untaps, or bounces permanents, grants control of permanents to a player, and then the permanent effects also exist as mass effects, affecting all permanents based on controller (yours, target player's, your team's, opponent's). It allows you to force target player to play target permanents or all permanents from their hand or look for a card in their library or graveyard. Most of those abilities allow any number of targets, too, and many are marked as firebreathing so you can increase the counters, damage, or cards drawn, etc. So, it's rather long and complicated, and it's ALL working except I can't have 10 activated abilities :(

(For the record, it also plays itself from your library, can be played from your graveyard or from exile unless you're the AI, exiles itself if you're the AI, and has flash and hexproof. It pretty much covers every situation ever. Not quite, but close.)

So I would guess they upped the limit making it 8 now. I think instead of combining them, I'll just get rid of the mass manipulation and find 2 abilities which can be merged. Thanks.
This is not right, the new limit for the activable abilities is 10. I have 2 testing cards with 10 abilities each one and both of them works.
Just another information also if we grant the abilities the limit is still 10. I simply checked granting 20 abilities to a card, the first 10 are selectable and usable the other ones we can see only the localised text but are not activable.
NeoAnderson
 
Posts: 914
Joined: 10 Sep 2013, 07:49
Has thanked: 18 times
Been thanked: 139 times

Re: General DotP 2014 Coding Questions

Postby Xander9009 » 22 Nov 2014, 01:45

NeoAnderson wrote:This is not right, the new limit for the activable abilities is 10. I have 2 testing cards with 10 abilities each one and both of them works.
Just another information also if we grant the abilities the limit is still 10. I simply checked granting 20 abilities to a card, the first 10 are selectable and usable the other ones we can see only the localised text but are not activable.
Awesome. Then it's just mine. In that case, can either of you (or Riiak, I'm sure you'll see this eventually haha) think of a reason this might be happening? I'll post the code just so it's up, but it's really long. The last two activated abilities both work for the most part, but unless I comment out one before them, then second to last isn't activable, and unless I comment out two of them, the last one isn't activable. Maybe someone can spot what I'm doing wrong. (Remember that comments can't have hyphens such as after each ability block opening tag. If you comment an ability, you need to remove the hyphens. I kept forgetting this.)

Also, FireMind, any idea what I'm doing wrong with the combat control? I ask you because you coded both the only card in the CW that does this and you have it in Leyline of Deity. It gives me the option to choose blockers, but even though enemy creatures are highlighted, I can't select anything. You can find that section of code if you ctrl-f "Combat/control".
Favor of the Gods | Open
Code: Select all
<?xml version="1.0"?>
<CARD_V2 ExportVersion="1">
   <FILENAME text="FAVOR_OF_THE_GODS_CW_9009000" />
   <CARDNAME text="FAVOR_OF_THE_GODS" />
   <TITLE>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Favor of the Gods]]></LOCALISED_TEXT>
   </TITLE>
   <MULTIVERSEID value="9009000" />
   <ARTID value="CW9009000" />
   <ARTIST name="Matt Steward" />
   <CASTING_COST cost="{0}" />
   <TYPE metaname="Artifact" />
   <EXPANSION value="DPI" />
   <RARITY metaname="M" />
   <SPELL_ABILITY> --AI restriction
      <AVAILABILITY>
         return EffectController():IsAI() == false
      </AVAILABILITY>
   </SPELL_ABILITY>
   <STATIC_ABILITY> --Intrinsic abilities
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Hexproof, Flash]]></LOCALISED_TEXT>
      <INTRINSIC characteristic="CHARACTERISTIC_HEXPROOF" />
      <INTRINSIC characteristic="CHARACTERISTIC_FLASH" />
   </STATIC_ABILITY>
   <STATIC_ABILITY> --Grant abilities
      <CONTINUOUS_ACTION layer="0">
         local characteristics = EffectSource():GetCurrentCharacteristics()
         characteristics:GrantAbility(7)
         characteristics:GrantAbility(8)
         characteristics:GrantAbility(9)
         characteristics:GrantAbility(10)
         characteristics:GrantAbility(11)
         characteristics:GrantAbility(12)
         characteristics:GrantAbility(13)
         characteristics:GrantAbility(14)
         characteristics:GrantAbility(15)
         characteristics:GrantAbility(16)
         characteristics:GrantAbility(17)
         characteristics:GrantAbility(18)
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <ACTIVATED_ABILITY forced_skip="1" resource_id="7"> --Single mana
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{0}: Add one mana of any color to your mana pool.]]></LOCALISED_TEXT>
      <COST mana_cost="{0}" type="Mana" />
      <PLAY_TIME_ACTION>
         RSN_MarkManaAbilityStart()
         local oPlayer = EffectController()
         local oCard = EffectSource()
         if (oPlayer ~= nil) then
            oPlayer:BeginNewMultipleChoice()
               oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_C" )
               oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_W" )
               oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_U" )
               oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_B" )
               oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_R" )
               oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_G" )
               oPlayer:AddMultipleChoiceAnswer( "ALL" )
            oPlayer:AskMultipleChoiceQuestion( "MODE_CHOOSE_ONE", oCard )
         end
      </PLAY_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         local nColour = EffectController():GetMultipleChoiceResult()
         if (nColor == COLOUR_COLOURLESS ) then
            RSN_Produce( "{1}", 1 )
         elseif (nColour == COLOUR_BLACK) then
            RSN_Produce( "{B}", 1 )
         elseif (nColour == COLOUR_BLUE) then
            RSN_Produce( "{U}", 1 )
         elseif (nColour == COLOUR_GREEN) then
            RSN_Produce( "{G}", 1 )
         elseif (nColour == COLOUR_RED) then
            RSN_Produce( "{R}", 1 )
         elseif (nColour == COLOUR_WHITE) then
            RSN_Produce( "{W}", 1 )
         else
            RSN_Produce( "{W}{U}{B}{R}{G}", 1 )
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         RSN_EliminateExtraManaTokens()
         S_DisplayManaPool(EffectController())
         RSN_MarkManaAbilityEnd()
      </RESOLUTION_TIME_ACTION>
      <AI_AVAILABILITY window_step="untap" />
   </ACTIVATED_ABILITY>
   <ACTIVATED_ABILITY forced_skip="1" resource_id="10"> --5 mana
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{0}: Add 5 mana of any color to your mana pool.]]></LOCALISED_TEXT>
      <COST mana_cost="{0}" type="Mana" />
      <PLAY_TIME_ACTION>
         RSN_MarkManaAbilityStart()
         local oPlayer = EffectController()
         local oCard = EffectSource()
         if (oPlayer ~= nil) then
            oPlayer:BeginNewMultipleChoice()
               oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_C" )
               oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_W" )
               oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_U" )
               oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_B" )
               oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_R" )
               oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_G" )
               oPlayer:AddMultipleChoiceAnswer( "ALL" )
            oPlayer:AskMultipleChoiceQuestion( "MODE_CHOOSE_ONE", oCard )
         end
      </PLAY_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         local nColour = EffectController():GetMultipleChoiceResult()
         if (nColor == COLOUR_COLOURLESS ) then
            RSN_Produce( "{1}", 5 )
         elseif (nColour == COLOUR_BLACK) then
            RSN_Produce( "{B}", 5 )
         elseif (nColour == COLOUR_BLUE) then
            RSN_Produce( "{U}", 5 )
         elseif (nColour == COLOUR_GREEN) then
            RSN_Produce( "{G}", 5 )
         elseif (nColour == COLOUR_RED) then
            RSN_Produce( "{R}", 5 )
         elseif (nColour == COLOUR_WHITE) then
            RSN_Produce( "{W}", 5 )
         else
            RSN_Produce( "{W}{U}{B}{R}{G}", 5 )
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         RSN_EliminateExtraManaTokens()
         S_DisplayManaPool(EffectController())
         RSN_MarkManaAbilityEnd()
      </RESOLUTION_TIME_ACTION>
      <AI_AVAILABILITY window_step="untap" />
   </ACTIVATED_ABILITY>
   <ACTIVATED_ABILITY forced_skip="1" resource_id="11" firebreathing="1"> --Target creature/planeswalker
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{0}: Target creature or planeswalker gets counters or target creature takes 1 damage.]]></LOCALISED_TEXT>
      <SFX text="TARGET_FIREBALL_PLAY" />
      <COST mana_cost="{0}" type="Mana" />
      <MODE_SELECT tag="MODE_CHOOSE_ONE">
         <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_1_DAMAGE" index="1" />
         <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_1_1_COUNTER" index="2" />
         <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_1_0_COUNTER" index="3" />
         <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_0_1_COUNTER" index="4" />
         <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_MINUS_1_1_COUNTER" index="5" />
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_LOYALTY" index="6" />
      </MODE_SELECT>
      <TARGET tag="CARD_QUERY_CHOOSE_DEAL_1_DAMAGE" definition="1" compartment="1" mode="1" any_number_of="1" />
      <TARGET_DEFINITION id="1">
         local filter = ClearFilter()
         local subfilter = filter:AddSubFilter_Or()
      subfilter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
      if PLW_FilterNameSet ~= nil then
        PLW_FilterNameSet(subfilter, "PLANESWALKERS", true)
      else
        subfilter:Add( FE_TYPE, OP_IS, CARD_TYPE_PLANESWALKER)
      end
      </TARGET_DEFINITION>
      <RESOLUTION_TIME_ACTION mode="1">
         local targetDC = EffectDC():Get_Targets(1)
         if targetDC ~= nil then
            local numTargets = targetDC:Count()
            for i=0,(numTargets-1) do
               local target_creature = targetDC:Get_CardPtr(i)
               if target_creature ~= nil then
                  EffectSourceLKI():DealDamageTo( 1, target_creature)
               end
            end
         end
      </RESOLUTION_TIME_ACTION>
      <TARGET tag="CARD_QUERY_CHOOSE_CREATURE_TO_GET_PLUS1_PLUS1_COUNTER" definition="2" compartment="2" mode="2" any_number_of="1" />
      <TARGET_DEFINITION id="2" mode="2">
         local filter = ClearFilter()
         filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
      </TARGET_DEFINITION>
      <RESOLUTION_TIME_ACTION mode="2">
         local targetDC = EffectDC():Get_Targets(2)
         if targetDC ~= nil then
            local numTargets = targetDC:Count()
            for i=0,(numTargets-1) do
               local target_creature = targetDC:Get_CardPtr(i)
               if target_creature ~= nil then
                  target_creature:AddCounters( MTG():PlusOnePlusOneCounters(), 1)
               end
            end
         end
      </RESOLUTION_TIME_ACTION>
      <TARGET tag="CARD_QUERY_CHOOSE_CREATURE_TO_GET_PLUS1_PLUS0_COUNTER" definition="3" compartment="3" mode="3" any_number_of="1" />
      <TARGET_DEFINITION id="3" mode="3">
         local filter = ClearFilter()
         filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
      </TARGET_DEFINITION>
      <RESOLUTION_TIME_ACTION mode="3">
         local targetDC = EffectDC():Get_Targets(3)
         if targetDC ~= nil then
            local numTargets = targetDC:Count()
            for i=0,(numTargets-1) do
               local target_creature = targetDC:Get_CardPtr(i)
               if target_creature ~= nil then
                  target_creature:AddCounters( MTG():PlusOnePlusZeroCounters(), 1)
               end
            end
         end
      </RESOLUTION_TIME_ACTION>
      <TARGET tag="CARD_QUERY_CHOOSE_CREATURE_TO_GET_PLUS0_PLUS1_COUNTER" definition="4" compartment="4" mode="4" any_number_of="1" />
      <TARGET_DEFINITION id="4" mode="4">
         local filter = ClearFilter()
         filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
      </TARGET_DEFINITION>
      <RESOLUTION_TIME_ACTION mode="4">
         local targetDC = EffectDC():Get_Targets(4)
         if targetDC ~= nil then
            local numTargets = targetDC:Count()
            for i=0,(numTargets-1) do
               local target_creature = targetDC:Get_CardPtr(i)
               if target_creature ~= nil then
                  target_creature:AddCounters( MTG():PlusZeroPlusOneCounters(), 1)
               end
            end
         end
      </RESOLUTION_TIME_ACTION>
      <TARGET tag="CARD_QUERY_CHOOSE_CREATURE_TO_GET_MINUS1_MINUS1_COUNTER" definition="5" compartment="5" mode="5" any_number_of="1" />
      <TARGET_DEFINITION id="5" mode="5">
         local filter = ClearFilter()
         filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
      </TARGET_DEFINITION>
      <RESOLUTION_TIME_ACTION mode="5">
         local targetDC = EffectDC():Get_Targets(5)
         if targetDC ~= nil then
            local numTargets = targetDC:Count()
            for i=0,(numTargets-1) do
               local target_creature = targetDC:Get_CardPtr(i)
               if target_creature ~= nil then
                  target_creature:AddCounters( MTG():MinusOneMinusOneCounters(), 1)
               end
            end
         end
      </RESOLUTION_TIME_ACTION>
    <PLAY_TIME_ACTION mode="6">
      local filter = ClearFilter()
      local controller = EffectController()
      PLW_FilterNameSet(filter, "PLANESWALKERS", true)
      local count = filter:Count()
      if count &gt; 0 then
        controller:SetItemCount(count)
        for i=0,count-1 do
          controller:SetItemPrompt(i, "CARD_QUERY_CHOOSE_PERMANENT_TO_ADD_LOYALTY")
        end
        controller:ChooseItems( EffectDC():Make_Targets(6), QUERY_FLAG_UP_TO )
      else
        controller:ChooseItem( "CARD_QUERY_CHOOSE_PERMANENT_TO_ADD_LOYALTY", EffectDC():Make_Targets(6), QUERY_FLAG_MAY )
      end
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION mode="6">
      local controller = EffectController()
      controller:BeginNewNumericalChoice()
      controller:AddNumericalChoiceAnswer(50)
      controller:AskNumericalChoiceQuestion("CARD_QUERY_CHOOSE_AMOUNT_COUNTERS")
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION mode="6">
      local amount = EffectController():GetNumericalChoiceResult()
      local targetDC = EffectDC():Get_Targets(6)
      if targetDC ~= nil then
        local count = targetDC:Count()
        if count &gt; 0 then
          for i=0,count-1 do
            local card = targetDC:Get_CardPtr(i)
            if card ~= nil then
              card:AddCounters( MTG():GetCountersType("Loyalty"), amount )
            end
          end
        end
      end
    </RESOLUTION_TIME_ACTION>
      <AI_AVAILABILITY window_step="untap" />
   </ACTIVATED_ABILITY>
   <ACTIVATED_ABILITY forced_skip="1" resource_id="12"> --Find cards
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{0}: Search your library or graveyard zone for cards and put them into your hand or put all basic land cards from your library into play or your graveyard.]]></LOCALISED_TEXT>
      <COST mana_cost="{0}" type="Mana" />
      <MODE_SELECT tag="MODE_CHOOSE_ONE">
         <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_LIBRARY" index="1" />
         <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_GRAVEYARD" index="2" />
         <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_LANDS_MILL" index="3" />
         <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_LANDS_PLAY" index="4" />
      </MODE_SELECT>
      <RESOLUTION_TIME_ACTION mode="1">
         local filter = ClearFilter()
         local controller = EffectController()
         filter:SetZone(ZONE_LIBRARY, controller)
         local count = filter:Count()
         if count &gt; 0 then
            controller:SetItemCount(count)
            for i=0,count-1 do
               controller:SetItemPrompt(i, "CARD_QUERY_CHOOSE_A_CARD_TO_PUT_INTO_YOUR_HAND")
            end
            controller:ChooseItems( EffectDC():Make_Targets(1), QUERY_FLAG_UP_TO )
         else
            controller:ChooseItem( "CARD_QUERY_CHOOSE_A_CARD_TO_PUT_INTO_YOUR_HAND", EffectDC():Make_Targets(1), QUERY_FLAG_MAY )
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION mode="1">
         local targetDC = EffectDC():Get_Targets(1)
         if targetDC ~= nil then
            local count = targetDC:Count()
            if count &gt; 0 then
               for i=0,count-1 do
                  local card = targetDC:Get_CardPtr(i)
                  if card ~= nil then
                     card:PutInHand()
                  end
               end
            end
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION mode="2">
         local filter = ClearFilter()
         local controller = EffectController()
         filter:SetZone(ZONE_GRAVEYARD, controller)
         local count = filter:Count()
         if count &gt; 0 then
            controller:SetItemCount(count)
            for i=0,count-1 do
               controller:SetItemPrompt(i, "CARD_QUERY_CHOOSE_A_CARD_TO_PUT_INTO_YOUR_HAND")
            end
            controller:ChooseItems( EffectDC():Make_Targets(2), QUERY_FLAG_UP_TO )
         else
            controller:ChooseItem( "CARD_QUERY_CHOOSE_A_CARD_TO_PUT_INTO_YOUR_HAND", EffectDC():Make_Targets(2), QUERY_FLAG_MAY )
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION mode="2">
         local targetDC = EffectDC():Get_Targets(2)
         if targetDC ~= nil then
            local count = targetDC:Count()
            if count &gt; 0 then
               for i=0,count-1 do
                  local card = targetDC:Get_CardPtr(i)
                  if card ~= nil then
                     card:PutInHand()
                  end
               end
            end
         end
      </RESOLUTION_TIME_ACTION>
      <FILTER filter_id="3">
         local filter = ClearFilter()
         filter:Add( FE_TYPE, OP_IS, CARD_TYPE_LAND )
         filter:Add( FE_SUPERTYPE, OP_IS, SUPERTYPE_BASIC )
         filter:SetZone(ZONE_LIBRARY, EffectController())
      </FILTER>
      <RESOLUTION_TIME_ACTION mode="3" filter_id="3">
         if FilteredCard() ~= nil then
            FilteredCard():PutInGraveyard()
         end
      </RESOLUTION_TIME_ACTION>
      <FILTER filter_id="4">
         local filter = ClearFilter()
         filter:Add( FE_TYPE, OP_IS, CARD_TYPE_LAND )
         filter:Add( FE_SUPERTYPE, OP_IS, SUPERTYPE_BASIC )
         filter:SetZone(ZONE_LIBRARY, EffectController())
      </FILTER>
      <RESOLUTION_TIME_ACTION mode="4" filter_id="4">
         if FilteredCard() ~= nil then
            FilteredCard():PutOntoBattlefield( EffectController() )
         end
      </RESOLUTION_TIME_ACTION>
      <AI_AVAILABILITY window_step="untap" />
   </ACTIVATED_ABILITY>
   <ACTIVATED_ABILITY forced_skip="1" resource_id="13"> --Play/counter/copy spells
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{0}: Play permanent or cast spell for free or counter or copy target spell or permanent.]]></LOCALISED_TEXT>
      <COST mana_cost="{0}" type="Mana" />
      <MODE_SELECT tag="MODE_CHOOSE_ONE">
         <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_PLAY_PERMANENT" index="1" />
         <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_CAST_SPELL" index="2" />
         <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_COUNTER" index="3" />
         <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_COPY_SPELL" index="4" />
         <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_COPY_PERMANENT" index="5" />
      </MODE_SELECT>
      <PLAY_TIME_ACTION mode="1">
         local filter = ClearFilter()
         local controller = EffectController()
         filter:Add( FE_IS_PERMANENT, true )
         filter:SetZone( ZONE_HAND, EffectController() )
         local count = filter:Count()
         if count &gt; 0 then
            controller:SetItemCount(count)
            for i=0,count-1 do
               controller:SetItemPrompt(i, "CARD_QUERY_CHOOSE_PERMANENT_TO_PUT_ONTO_BATTLEFIELD")
            end
            controller:ChooseItems( EffectDC():Make_Targets(1), QUERY_FLAG_UP_TO )
         else
            controller:ChooseItem( "CARD_QUERY_CHOOSE_PERMANENT_TO_PUT_ONTO_BATTLEFIELD", EffectDC():Make_Targets(1), QUERY_FLAG_MAY )
         end
      </PLAY_TIME_ACTION>
      <RESOLUTION_TIME_ACTION mode="1">
         local targetDC = EffectDC():Get_Targets(1)
         if targetDC ~= nil then
            local count = targetDC:Count()
            if count &gt; 0 then
               for i=0,count-1 do
                  local card = targetDC:Get_CardPtr(i)
                  if card ~= nil then
                     card:PutOntoBattlefield( EffectController() )
                  end
               end
            end
         end
      </RESOLUTION_TIME_ACTION>
      <PLAY_TIME_ACTION mode="2">
         local filter = ClearFilter()
         local controller = EffectController()
         filter:Add( FE_IS_PERMANENT, true )
         filter:SetZone( ZONE_HAND, EffectController() )
         local count = filter:Count()
         if count &gt; 0 then
            controller:SetItemCount(count)
            for i=0,count-1 do
               controller:SetItemPrompt(i, "CARD_QUERY_CHOOSE_PERMANENT_TO_PUT_ONTO_BATTLEFIELD")
            end
            controller:ChooseItems( EffectDC():Make_Targets(2), QUERY_FLAG_UP_TO )
         else
            controller:ChooseItem( "CARD_QUERY_CHOOSE_PERMANENT_TO_PUT_ONTO_BATTLEFIELD", EffectDC():Make_Targets(2), QUERY_FLAG_MAY )
         end
      </PLAY_TIME_ACTION>
      <RESOLUTION_TIME_ACTION mode="2">
         local targetDC = EffectDC():Get_Targets(2)
         if targetDC ~= nil then
            local count = targetDC:Count()
            if count &gt; 0 then
               for i=0,count-1 do
                  local card = targetDC:Get_CardPtr(i)
                  if card ~= nil then
                     EffectController():CastSpellForFree( card )
                  end
               end
            end
         end
      </RESOLUTION_TIME_ACTION>
      <TARGET tag="CARD_QUERY_CHOOSE_SPELL_TO_COUNTER" definition="3" compartment="3" mode="3" count="1" />
      <TARGET_DEFINITION id="3">
         local filter = ClearFilter()
         filter:SetZone( ZONE_STACK )
      </TARGET_DEFINITION>
      <RESOLUTION_TIME_ACTION mode="3" >
         local target = EffectDC():Get_Targets(3):Get_CardPtr(0)
         if target ~= nil then
            target:CounterSpell()
         end
      </RESOLUTION_TIME_ACTION>
      <TARGET tag="CARD_QUERY_CHOOSE_SPELL_TO_COPY" definition="4" compartment="4" mode="4" count="1" />
      <TARGET_DEFINITION id="4">
         local filter = ClearFilter()
         filter:SetZone( ZONE_STACK )
      local subfilter = filter:AddSubFilter_Or()
            subfilter:Add (FE_TYPE, OP_IS, CARD_TYPE_INSTANT)
            subfilter:Add (FE_TYPE, OP_IS, CARD_TYPE_SORCERY)
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION mode="4">
      local target = EffectDC():Get_Targets(4):Get_CardPtr(0)
      local effectController = EffectController()
      if target ~= nil then
        local copy = effectController:CopySpell( target )
        effectController:ChooseNewTargets( copy )
      end
    </RESOLUTION_TIME_ACTION>
    <TARGET tag="CARD_QUERY_CHOOSE_PERMANENT_TO_COPY" definition="5" compartment="5" mode="5" any_number_of="1" />
    <TARGET_DEFINITION id="5">
      local filter = ClearFilter()
      filter:Add( FE_IS_PERMANENT, true )
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION mode="5">
      local targetDC = EffectDC():Get_Targets(5)
         if targetDC ~= nil then
            local numTargets = targetDC:Count()
            for i=0,(numTargets-1) do
               local target = targetDC:Get_CardPtr(i)
               if target ~= nil then
            MTG():PutTokenCopiesOntoBattlefield( target, 1, EffectController() )
          end
        end
      end
    </RESOLUTION_TIME_ACTION>
    <AI_AVAILABILITY window_step="untap" />
  </ACTIVATED_ABILITY>
  <ACTIVATED_ABILITY forced_skip="1" resource_id="14" firebreathing="1"> --Target player
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{0}: Target player draws or discards a card, gains or loses 1 life, takes 1 damage, or takes an extra turn.]]></LOCALISED_TEXT>
    <COST mana_cost="{0}" type="Mana" />
    <MODE_SELECT tag="MODE_CHOOSE_ONE">
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_DRAW" index="1" />
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_DISCARD" index="2" />
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_GAIN_LIFE" index="3" />
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_LOSE_LIFE" index="4" />
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_1_DAMAGE" index="5" />
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_EXTRA_TURN" index="6" />
    </MODE_SELECT>
    <TARGET tag="CARD_QUERY_CHOOSE_PLAYER_DRAW_CARD" definition="1" compartment="1" mode="1" count="1" />
    <TARGET_DEFINITION id="1">
      local filter = ClearFilter()
      filter:SetFilterType( FILTER_TYPE_PLAYERS )
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION mode="1">
      local target = EffectDC():Get_Targets(1):Get_PlayerPtr(0)
      if target ~= nil then
        target:DrawCards( 1 )
      end
    </RESOLUTION_TIME_ACTION>
    <TARGET tag="CARD_QUERY_CHOOSE_PLAYER_DISCARD_1" definition="2" compartment="2" mode="2" count="1" />
    <TARGET_DEFINITION id="2">
      local filter = ClearFilter()
      filter:SetFilterType( FILTER_TYPE_PLAYERS )
    </TARGET_DEFINITION>
    <PLAY_TIME_ACTION mode="2">
      local controller = EffectController()
      controller:BeginNewNumericalChoice()
      controller:AddNumericalChoiceAnswer(50)
      controller:AskNumericalChoiceQuestion("CARD_QUERY_CHOOSE_AMOUNT_COUNTERS")
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
      local amount = EffectController():GetNumericalChoiceResult()
      local filter = ClearFilter()
      local target = EffectDC():Get_Targets(2):Get_PlayerPtr(0)
      if target ~= nil then
        filter:SetZone( ZONE_HAND, target)
        target:SetItemCount( amount )
        for i = 0,(amount-1) do
          target:SetItemPrompt (i, "CARD_QUERY_CHOOSE_CARD_TO_DISCARD" )
        end
        target:ChooseItems( EffectDC():Make_Targets(7) )
      end
    </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
      local amount = EffectController():GetNumericalChoiceResult()
      local player = EffectDC():Get_Targets(2):Get_PlayerPtr(0)
      if player ~= nil then
        for i = 0,(amount-1) do
          local target_card = EffectDC():Get_Targets(7):Get_CardPtr(i)
          if target_card ~= nil  then
            target_card:Discard()
          end
        end
      end
    </RESOLUTION_TIME_ACTION>
    <TARGET tag="CARD_QUERY_CHOOSE_PLAYER_GAIN_1" definition="3" compartment="3" mode="3" count="1" />
    <TARGET_DEFINITION id="3">
      local filter = ClearFilter()
      filter:SetFilterType( FILTER_TYPE_PLAYERS )
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION mode="3">
      local target = EffectDC():Get_Targets(3):Get_PlayerPtr(0)
      if target ~= nil then
        target:GainLife(1)
      end
    </RESOLUTION_TIME_ACTION>
    <TARGET tag="CARD_QUERY_CHOOSE_PLAYER_LOSE_1" definition="4" compartment="4" mode="4" count="1" />
    <TARGET_DEFINITION id="4">
      local filter = ClearFilter()
      filter:SetFilterType( FILTER_TYPE_PLAYERS )
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION mode="4">
      local target = EffectDC():Get_Targets(4):Get_PlayerPtr(0)
      if target ~= nil then
        target:LoseLife(1)
      end
    </RESOLUTION_TIME_ACTION>
    <TARGET tag="CARD_QUERY_CHOOSE_PLAYER_LOSE_1" definition="5" compartment="5" mode="5" count="1" />
    <TARGET_DEFINITION id="5">
      local filter = ClearFilter()
      filter:SetFilterType( FILTER_TYPE_PLAYERS )
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION mode="5">
      local target = EffectDC():Get_Targets(5):Get_PlayerPtr(0)
      if target ~= nil then
        EffectSourceLKI():DealDamageTo( 1, target )
      end
    </RESOLUTION_TIME_ACTION>
    <TARGET tag="CARD_QUERY_CHOOSE_PLAYER_EXTRA_TURN" definition="6" compartment="6" mode="6" count="1" />
    <TARGET_DEFINITION id="6">
      local filter = ClearFilter()
      filter:SetFilterType(FILTER_TYPE_PLAYERS)
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION>
      local player = EffectDC():Get_Targets(6):Get_PlayerPtr(0)
      if player ~= nil then
        player:GetTeam():TakeExtraTurn()
      end
    </RESOLUTION_TIME_ACTION>
    <AI_AVAILABILITY window_step="untap" />
  </ACTIVATED_ABILITY>
  <ACTIVATED_ABILITY forced_skip="1" resource_id="15"> Target permanent
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{0}: Target permanent is destroyed, exiled, tapped, untapped, or returned to its owner's hand.]]></LOCALISED_TEXT>
    <COUNTER_REGISTRATION name="Loyalty" proliferate="11" />
    <SFX text="TARGET_BLADE_PLAY" />
    <COST mana_cost="{0}" type="Mana" />
    <MODE_SELECT tag="MODE_CHOOSE_ONE">
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_DESTROY" index="1" />
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_EXILE" index="2" />
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_TAP" index="3" />
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_BOUNCE" index="4" />
    </MODE_SELECT>
    <PLAY_TIME_ACTION mode="1">
      local filter = ClearFilter()
      local controller = EffectController()
      filter:Add( FE_IS_PERMANENT, true )
      local count = filter:Count()
      if count &gt; 0 then
        controller:SetItemCount(count)
        for i=0,count-1 do
          controller:SetItemPrompt(i, "CARD_QUERY_CHOOSE_PERMANENT_TO_DESTROY")
        end
        controller:ChooseItems( EffectDC():Make_Targets(1), QUERY_FLAG_UP_TO )
      else
        controller:ChooseItem( "CARD_QUERY_CHOOSE_PERMANENT_TO_DESTROY", EffectDC():Make_Targets(1), QUERY_FLAG_MAY )
      end
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION mode="1">
      local targetDC = EffectDC():Get_Targets(1)
      if targetDC ~= nil then
        local count = targetDC:Count()
        if count &gt; 0 then
          for i=0,count-1 do
            local card = targetDC:Get_CardPtr(i)
            if card ~= nil then
              card:Destroy()
            end
          end
        end
      end
    </RESOLUTION_TIME_ACTION>
    <PLAY_TIME_ACTION mode="2">
      local filter = ClearFilter()
      local controller = EffectController()
      filter:Add( FE_IS_PERMANENT, true )
      local count = filter:Count()
      if count &gt; 0 then
        controller:SetItemCount(count)
        for i=0,count-1 do
          controller:SetItemPrompt(i, "CARD_QUERY_CHOOSE_PERMANENT_TO_EXILE")
        end
        controller:ChooseItems( EffectDC():Make_Targets(2), QUERY_FLAG_UP_TO )
      else
        controller:ChooseItem( "CARD_QUERY_CHOOSE_PERMANENT_TO_EXILE", EffectDC():Make_Targets(2), QUERY_FLAG_MAY )
      end
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION mode="2">
      local targetDC = EffectDC():Get_Targets(2)
      if targetDC ~= nil then
        local count = targetDC:Count()
        if count &gt; 0 then
          for i=0,count-1 do
            local card = targetDC:Get_CardPtr(i)
            if card ~= nil then
              card:Exile()
            end
          end
        end
      end
    </RESOLUTION_TIME_ACTION>
    <PLAY_TIME_ACTION mode="3">
      local filter = ClearFilter()
      local controller = EffectController()
      filter:Add( FE_IS_PERMANENT, true )
      local count = filter:Count()
      if count &gt; 0 then
        controller:SetItemCount(count)
        for i=0,count-1 do
          controller:SetItemPrompt(i, "CARD_QUERY_CHOOSE_PERMANENT_TO_TAP_OR_UNTAP")
        end
        controller:ChooseItems( EffectDC():Make_Targets(3), QUERY_FLAG_UP_TO )
      else
        controller:ChooseItem( "CARD_QUERY_CHOOSE_PERMANENT_TO_TAP_UNTAP", EffectDC():Make_Targets(3), QUERY_FLAG_MAY )
      end
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION mode="3">
      local targetDC = EffectDC():Get_Targets(3)
      if targetDC ~= nil then
        local count = targetDC:Count()
        if count &gt; 0 then
          for i=0,count-1 do
            local card = targetDC:Get_CardPtr(i)
            if card ~= nil then
              if card:IsTapped() then
                card:Untap()
              else
                card:Tap()
              end
            end
          end
        end
      end
    </RESOLUTION_TIME_ACTION>
    <PLAY_TIME_ACTION mode="4">
      local filter = ClearFilter()
      local controller = EffectController()
      filter:Add( FE_IS_PERMANENT, true )
      local count = filter:Count()
      if count &gt; 0 then
        controller:SetItemCount(count)
        for i=0,count-1 do
          controller:SetItemPrompt(i, "CARD_QUERY_CHOOSE_PERMANENT_TO_BOUNCE")
        end
        controller:ChooseItems( EffectDC():Make_Targets(4), QUERY_FLAG_UP_TO )
      else
        controller:ChooseItem( "CARD_QUERY_CHOOSE_PERMANENT_TO_BOUNCE", EffectDC():Make_Targets(4), QUERY_FLAG_MAY )
      end
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION mode="4">
      local targetDC = EffectDC():Get_Targets(4)
      if targetDC ~= nil then
        local count = targetDC:Count()
        if count &gt; 0 then
          for i=0,count-1 do
            local card = targetDC:Get_CardPtr(i)
            if card ~= nil then
              card:PutInHand()
            end
          end
        end
      end
    </RESOLUTION_TIME_ACTION>
    <AI_AVAILABILITY window_step="untap" />
  </ACTIVATED_ABILITY>
  <ACTIVATED_ABILITY forced_skip="1" resource_id="16"> Targeted card find/permanent play
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{0}: Target player: searches* for cards and puts them into their hand, puts permanents into play, puts all permanents from hand or all lands they own into play.]]></LOCALISED_TEXT>
    <COST mana_cost="{0}" type="Mana" />
    <MODE_SELECT tag="MODE_CHOOSE_ONE">
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_PLAYER_SEARCHES_FOR_CARDS" index="1" />
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_PLAYER_PLAYS_PERMANENTS" index="2" />
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_PLAYER_PLAYS_ALL_PERMANENTS" index="3" />
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_PLAYER_PLAYS_LANDS" index="4" />
    </MODE_SELECT>
    <TARGET tag="CARD_QUERY_CHOOSE_PLAYER" definition="1" compartment="1" count="1" mode="1" />
      <TARGET_DEFINITION id="1">
         local filter = ClearFilter()
         filter:SetFilterType(FILTER_TYPE_PLAYERS)
      </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION mode="1">
      EffectController():BeginNewMultipleChoice()
        EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_MODE_FAVOR_GODS_LIBRARY" )
        EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_MODE_FAVOR_GODS_GRAVEYARD" )
      EffectController():AskMultipleChoiceQuestion( "CARD_QUERY_CHOOSE_ONE" )
    </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         local player = EffectDC():Get_Targets(1):Get_PlayerPtr(0)
         if player ~= nil then
        local controller = EffectController()
        local filter = ClearFilter()
        if ( controller:GetMultipleChoiceResult() == 0 ) then
          filter:SetZone(ZONE_LIBRARY, player)
        else
          filter:SetZone(ZONE_GRAVEYARD, player)
        end
            player:ChooseItem( "CARD_QUERY_CHOOSE_LAND_TO_PUT_ONTO_THE_BATTLEFIELD_TAPPED", EffectDC():Make_Targets(5), QUERY_FLAG_MAY )
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION mode="1">
         local targetDC = EffectDC():Get_Targets(5)
      if targetDC ~= nil then
        local count = targetDC:Count()
        if count &gt; 0 then
          for i=0,count-1 do
            local card = targetDC:Get_CardPtr(i)
            if card ~= nil then
              card:PutInHand()
            end
          end
            end
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION mode="1">
      if ( EffectController():GetMultipleChoiceResult() == 0 ) then
        local player = EffectDC():Get_Targets(1):Get_PlayerPtr(0)
        if player ~= nil then
          player:ShuffleLibrary()
        end
      </RESOLUTION_TIME_ACTION>
    <TARGET tag="CARD_QUERY_CHOOSE_PLAYER" definition="2" compartment="2" count="1" mode="2" />
      <TARGET_DEFINITION id="2">
         local filter = ClearFilter()
         filter:SetFilterType(FILTER_TYPE_PLAYERS)
      </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION mode="2">
      EffectController():BeginNewMultipleChoice()
        EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_MODE_FAVOR_GODS_HAND" )
        EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_MODE_FAVOR_GODS_LIBRARY" )
        EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_MODE_FAVOR_GODS_GRAVEYARD" )
      EffectController():AskMultipleChoiceQuestion( "CARD_QUERY_CHOOSE_ONE" )
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION mode="2">
      local target_player = EffectDC():Get_Targets(2):Get_PlayerPtr(0)
      local controller = EffectController()
      local filter = ClearFilter()
      if ( controller:GetMultipleChoiceResult() == 0 ) then
        filter:SetZone(ZONE_HAND, target_player)
      elseif ( controller:GetMultipleChoiceResult() == 1 ) then
        filter:SetZone(ZONE_LIBRARY, target_player)
      else
        filter:SetZone(ZONE_GRAVEYARD, target_player)
      end
      local count = filter:Count()
      if count &gt; 0 then
        controller:SetItemCount(count)
        for i=0,count-1 do
          controller:SetItemPrompt(i, "CARD_QUERY_CHOOSE_A_CARD_TO_PUT_ONTO_BATTLEFIELD")
        end
        controller:ChooseItems( EffectDC():Make_Targets(6), QUERY_FLAG_UP_TO )
      else
        controller:ChooseItem( "CARD_QUERY_CHOOSE_CARD_TO_PUT_ONTO_BATTLEFIELD", EffectDC():Make_Targets(6), QUERY_FLAG_MAY )
      end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION mode="2">
      local targetDC = EffectDC():Get_Targets(6)
      if targetDC ~= nil then
        local count = targetDC:Count()
        if count &gt; 0 then
          for i=0,count-1 do
            local card = targetDC:Get_CardPtr(i)
            if card ~= nil then
              card:PutOntoBattlefield( card:GetOwner() )
            end
          end
        end
      end
    </RESOLUTION_TIME_ACTION>
    <TARGET tag="CARD_QUERY_CHOOSE_PLAYER" definition="3" compartment="3" count="1" mode="3" />
      <TARGET_DEFINITION id="3">
         local filter = ClearFilter()
         filter:SetFilterType(FILTER_TYPE_PLAYERS)
      </TARGET_DEFINITION>
    <FILTER filter_id="3">
      local filter = ClearFilter()
      filter:SetZone( ZONE_HAND, EffectDC():Get_Targets(3):Get_PlayerPtr(0) )
      local subfilter = filter:AddSubFilter_Or()
      subfilter:Add( FE_TYPE, OP_IS, CARD_TYPE_ARTIFACT )
      subfilter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
      subfilter:Add( FE_TYPE, OP_IS, CARD_TYPE_ENCHANTMENT )
      subfilter:Add( FE_TYPE, OP_IS, CARD_TYPE_LAND )
      subfilter:Add( FE_TYPE, OP_IS, CARD_TYPE_PLANESWALKER )
    </FILTER>
    <RESOLUTION_TIME_ACTION mode="3" filter_id="3">
      if FilteredCard() ~= nil then
        FilteredCard():PutOntoBattlefield( EffectDC():Get_Targets(3):Get_PlayerPtr(0) )
      end
    </RESOLUTION_TIME_ACTION>
    <TARGET tag="CARD_QUERY_CHOOSE_PLAYER" definition="4" compartment="4" count="1" mode="4" />
      <TARGET_DEFINITION id="4">
         local filter = ClearFilter()
         filter:SetFilterType(FILTER_TYPE_PLAYERS)
      </TARGET_DEFINITION>
    <FILTER filter_id="4">
      local filter = ClearFilter()
      filter:SetZone( ZONE_HAND, EffectDC():Get_Targets(4):Get_PlayerPtr(0) )
      filter:Add( FE_TYPE, OP_IS, CARD_TYPE_LAND )
      filter:Add( FE_SUPERTYPE, OP_IS, SUPERTYPE_BASIC )
    </FILTER>
    <FILTER filter_id="5">
      local filter = ClearFilter()
      filter:SetZone( ZONE_LIBRARY, EffectDC():Get_Targets(4):Get_PlayerPtr(0) )
      filter:Add( FE_TYPE, OP_IS, CARD_TYPE_LAND )
      filter:Add( FE_SUPERTYPE, OP_IS, SUPERTYPE_BASIC )
    </FILTER>
    <FILTER filter_id="6">
      local filter = ClearFilter()
      filter:SetZone( ZONE_GRAVEYARD, EffectDC():Get_Targets(4):Get_PlayerPtr(0) )
      filter:Add( FE_TYPE, OP_IS, CARD_TYPE_LAND )
      filter:Add( FE_SUPERTYPE, OP_IS, SUPERTYPE_BASIC )
    </FILTER>
    <RESOLUTION_TIME_ACTION mode="4" filter_id="4">
      if FilteredCard() ~= nil then
        FilteredCard():PutOntoBattlefield( EffectDC():Get_Targets(4):Get_PlayerPtr(0) )
      end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION mode="4" filter_id="5">
      if FilteredCard() ~= nil then
        FilteredCard():PutOntoBattlefield( EffectDC():Get_Targets(4):Get_PlayerPtr(0) )
      end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION mode="4" filter_id="6">
      if FilteredCard() ~= nil then
        FilteredCard():PutOntoBattlefield( EffectDC():Get_Targets(4):Get_PlayerPtr(0) )
      end
    </RESOLUTION_TIME_ACTION>
    <AI_AVAILABILITY window_step="untap" />
  </ACTIVATED_ABILITY>
  <ACTIVATED_ABILITY forced_skip="1" resource_id="17"> --Combat/control
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{0}: Control attackers and blockers, target player gains control of target permanent.]]></LOCALISED_TEXT>
    <COST mana_cost="{0}" type="Mana" />
    <MODE_SELECT tag="MODE_CHOOSE_ONE">
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_CONTROL_COMBAT" index="1" />
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_EXCHANGE_CONTROL" index="2" />
    </MODE_SELECT>
    <CONTINUOUS_ACTION>
         local num_players = MTG():GetNumberOfPlayers()
         for i=0,num_players-1 do
            local player = MTG():GetNthPlayer(i)
            if player ~= nil then
               player:GetCurrentCharacteristics():SetAttackController(EffectController())
               player:GetCurrentCharacteristics():SetBlockController(EffectController())
            end
         end
      </CONTINUOUS_ACTION>
    <TARGET tag="CARD_QUERY_CHOOSE_PLAYER_TO_GAIN_CONTROL" definition="2" compartment="2" mode="2" count="1" />
    <TARGET_DEFINITION id="2">
      local filter = ClearFilter()
      filter:SetFilterType( FILTER_TYPE_PLAYERS )
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION mode="2">
      local controller = EffectController()
      filter:Add( FE_IS_PERMANENT, true )
      local count = filter:Count()
      if count &gt; 0 then
        controller:SetItemCount(count)
        for i=0,count-1 do
          controller:SetItemPrompt(i, "CARD_QUERY_CHOOSE_PERMANENT_TO_CHANGE_CONTROL")
        end
        controller:ChooseItems( EffectDC():Make_Targets(2), QUERY_FLAG_UP_TO )
      else
        controller:ChooseItem( "CARD_QUERY_CHOOSE_PERMANENT_TO_CHANGE_CONTROL", EffectDC():Make_Targets(2), QUERY_FLAG_MAY )
      end
    </RESOLUTION_TIME_ACTION>
    <CONTINUOUS_ACTION layer="2" mode="2">
      local targetDC = EffectDC():Get_Targets(2)
      if targetDC ~= nil then
        local player = targetDC:Get_PlayerPtr(0)
        if player ~= nil then
          local count = targetDC:Count()
          if count &gt; 0 then
            for i=0,count-1 do
              local card = targetDC:Get_CardPtr(i)
              if card ~= nil then
                card:SetController( player )
              end
            end
          end
        end
      end
    </CONTINUOUS_ACTION>
    <DURATION simple_duration="UntilEOT" />
    <AI_AVAILABILITY window_step="untap" />
  </ACTIVATED_ABILITY>
  <ACTIVATED_ABILITY forced_skip="1" resource_id="18"> --Mass manipulation
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{0}: Mass permanent manipulation]]></LOCALISED_TEXT>
    <COST mana_cost="{0}" type="Mana" />
    <RESOLUTION_TIME_ACTION>
      EffectController():BeginNewMultipleChoice()
        EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_MODE_FAVOR_GODS_CHOOSE" )
        EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_MODE_FAVOR_GODS_TEAMS" )
        EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_MODE_FAVOR_GODS_OPPONENTS" )
        EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_MODE_FAVOR_GODS_ALL" )
      EffectController():AskMultipleChoiceQuestion( "CARD_QUERY_CHOOSE_ONE" )
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
      EffectDC():Set_Int(0, EffectController():GetMultipleChoiceResult())
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
      EffectController():BeginNewMultipleChoice()
        EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_DESTROY" )
        EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_EXILE" )
        EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_TAP" )
        EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_BOUNCE" )
      EffectController():AskMultipleChoiceQuestion( "CARD_QUERY_CHOOSE_ONE" )
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
      if ( EffectDC():Get_Int(0) == 0 ) then
        local filter = ClearFilter()
        filter:SetFilterType( FILTER_TYPE_PLAYERS )
        EffectController():ChooseItem("CARD_QUERY_CHOOSE_PLAYER", EffectDC():Make_Targets(0) )
      end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
      local filter = ClearFilter()
      filter:Add( FE_IS_PERMANENT, true )
      if ( EffectDC():Get_Int(0) == 0 ) then
        local target_player = EffectDC():Get_Targets(0):Get_PlayerPtr(0)
        if target_player ~= nil then
          filter:Add( FE_CONTROLLER, OP_IS, target_player )
        end
      elseif ( EffectDC():Get_Int(0) == 1 ) then
        filter:Add( FE_TEAM, OP_IS, EffectController():GetTeam() )
      elseif ( EffectDC():Get_Int(0) == 2 ) then
        filter:Add( FE_TEAM, OP_NOT, EffectController():GetTeam() )
      end
      local Count = filter:EvaluateObjects()
      local Result = EffectController():GetMultipleChoiceResult()
      for i=0,(Count-1) do
        local CurrentObject = filter:GetNthEvaluatedObject(i)
        if CurrentObject ~= nil then
          if ( Result == 0 ) then
            CurrentObject:Destroy()
          elseif ( Result == 1 ) then
            CurrentObject:Exile()
          elseif ( Result == 2 ) then
            if CurrentObject:IsTapped() then
              CurrentObject:Untap()
            else
              CurrentObject:Tap()
            end
          else
            CurrentObject:PutInHand()
          end
        end
      end
    </RESOLUTION_TIME_ACTION>
    <AI_AVAILABILITY window_step="untap" />
  </ACTIVATED_ABILITY>
  <TRIGGERED_ABILITY forced_skip="1" active_zone="ZONE_LIBRARY">
    <TRIGGER value="BEGINNING_OF_STEP">
      return MTG():GetStep() == STEP_UPKEEP
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
      if EffectController():IsAI() then
        EffectSource():Exile()
      elseif EffectSource() ~= nil then
        EffectSource():PutOntoBattlefield( EffectController() )
      end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <UTILITY_ABILITY forced_skip="1" qualifier="Normal_Cast" active_zone="ZONE_GRAVEYARD"> --Play from graveyard
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[You may cast Favor of the Gods from your graveyard.]]></LOCALISED_TEXT>
  </UTILITY_ABILITY>
  <UTILITY_ABILITY forced_skip="1" qualifier="Normal_Cast" active_zone="ZONE_EXILE"> --Play from exile
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[You may cast Favor of the Gods from exile.]]></LOCALISED_TEXT>
    <AVAILABILITY>
      return EffectController():IsAI() == false
    </AVAILABILITY>
  </UTILITY_ABILITY>
  <STATIC_ABILITY resource_id="8"> --Manual mana mark and backup
    <CONTINUOUS_ACTION layer="0">
      RSN_ClearCanProduceMana()
      RSN_MarkCanProduceMana( "{B}{G}{R}{U}{W}{1}" )
    </CONTINUOUS_ACTION>
    <CONTINUOUS_ACTION layer="8">
      local nDefaultColour = COLOUR_GREEN
      local oCard = EffectSource()
      if (oCard ~= nil) then
        local oCharacteristics = oCard:GetCurrentCharacteristics()
        if (((oCharacteristics ~= nil) and (oCharacteristics:Bool_Get( CHARACTERISTIC_CANT_USE_ACTIVATED_ABILITIES ))) or
          (EffectController():GetCurrentCharacteristics():Bool_Get( PLAYER_CHARACTERISTIC_CANT_ACTIVATE_NONMANA_ABILITIES ))) then
          local nColour = RSN_GetLastProducedColour()
          if (nColour ~= COLOUR_COLOURLESS) then
            oCharacteristics:GrantAbility( nColour )
          else
            oCharacteristics:GrantAbility( 6 )
          end
        end
      end
    </CONTINUOUS_ACTION>
  </STATIC_ABILITY>
  <TRIGGERED_ABILITY forced_skip="1" replacement_effect="1" resource_id="9"> --Manual mana clear
    <TRIGGER value="BEGINNING_OF_STEP" pre_trigger="1" />
    <RESOLUTION_TIME_ACTION>
      RSN_ClearProducedMana()
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <MANA_ABILITY resource_id="1"> --Backup white mana
    <COST type="TapSelf" />
    <PRODUCES amount="{W}" />
  </MANA_ABILITY>
  <MANA_ABILITY resource_id="2"> --Backup blue mana
    <COST type="TapSelf" />
    <PRODUCES amount="{U}" />
  </MANA_ABILITY>
  <MANA_ABILITY resource_id="3"> --Backup black mana
    <COST type="TapSelf" />
    <PRODUCES amount="{B}" />
  </MANA_ABILITY>
  <MANA_ABILITY resource_id="4"> --Backup red mana
    <COST type="TapSelf" />
    <PRODUCES amount="{R}" />
  </MANA_ABILITY>
  <MANA_ABILITY resource_id="5"> --Backup green mana
    <COST type="TapSelf" />
    <PRODUCES amount="{G}" />
  </MANA_ABILITY>
  <MANA_ABILITY resource_id="6"> --Backup colorless mana
    <COST type="TapSelf" />
    <PRODUCES amount="{C}" />
  </MANA_ABILITY>
  <TOKEN_REGISTRATION reservation="1" type="RSN_TOKEN_MANA_B" />
  <TOKEN_REGISTRATION reservation="1" type="RSN_TOKEN_MANA_G" />
  <TOKEN_REGISTRATION reservation="1" type="RSN_TOKEN_MANA_R" />
  <TOKEN_REGISTRATION reservation="1" type="RSN_TOKEN_MANA_U" />
  <TOKEN_REGISTRATION reservation="1" type="RSN_TOKEN_MANA_W" />
  <TOKEN_REGISTRATION reservation="1" type="RSN_TOKEN_MANA_C" />
</CARD_V2>
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

Re: General DotP 2014 Coding Questions

Postby NeoAnderson » 22 Nov 2014, 02:35

Xander the code is really long to parse. Anyway maybe you can just try with simple abilities copied multiple times to check how many abilities you are able to activate. Then you can try to reduce the Description texts...but these are just attempts.

About your abilities be informed you missed to close an if into ability "16" resolution block of shuffle action.

About the combat ability Fire already answer sometime ago read this :
http://www.slightlymagic.net/forum/viewtopic.php?f=63&t=11418&p=136776&hilit=SetBlockController#p136776
NeoAnderson
 
Posts: 914
Joined: 10 Sep 2013, 07:49
Has thanked: 18 times
Been thanked: 139 times

Re: General DotP 2014 Coding Questions

Postby Xander9009 » 22 Nov 2014, 02:42

NeoAnderson wrote:Xander the code is really long to parse. Anyway maybe you can just try with simple abilities copied multiple times to check how many abilities you are able to activate. Then you can try to reduce the Description texts...but these are just attempts.

About your abilities be informed you missed to close an if into ability "16" resolution block of shuffle action.

About the combat ability Fire already answer sometime ago read this :
http://www.slightlymagic.net/forum/viewtopic.php?f=63&t=11418&p=136776&hilit=SetBlockController#p136776
Thanks for the link. I'd more or less assumed that since he'd put it in his card, it would work. He tends to be pretty picky about things like that. At least it's not something I did (although it would be preferable if I could fix it).

Also thanks for the if/end mismatch heads up :) I probably wouldn't have noticed it until I validated the card, which may or may not ever happen.

As for parsing the code, yeah, I understand that. I was mostly just hoping someone had an idea for what would cause the issue in general. I'll test it out in a few days. I'm about done for the night, and I'll be swamped this weekend.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

Re: General DotP 2014 Coding Questions

Postby thefiremind » 22 Nov 2014, 09:35

Xander9009 wrote:Also, FireMind, any idea what I'm doing wrong with the combat control? I ask you because you coded both the only card in the CW that does this and you have it in Leyline of Deity. It gives me the option to choose blockers, but even though enemy creatures are highlighted, I can't select anything.
You are doing nothing wrong: choosing blockers for an opponent is bugged in DotP2014, the only thing you can do is select no one. My test card has it because I discovered the bug after I made the card. #-o I kept it in because maybe in some scenarios it could be useful to force the opponent not to block.

I can guess they broke the feature unintentionally, but never realized it because no official card makes use of it.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times

Re: General DotP 2014 Coding Questions

Postby RiiakShiNal » 22 Nov 2014, 14:10

As for the problem with the abilities, it could also be a limit on the number of grantable abilities. To test this try making ability ids 8 & 9 always on (they aren't ACTIVATED_ABILITYs anyway) and remove them from the granting block (where you are granting 12 abilities).
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 496 times

Re: General DotP 2014 Coding Questions

Postby NeoAnderson » 22 Nov 2014, 14:54

RiiakShiNal wrote:As for the problem with the abilities, it could also be a limit on the number of grantable abilities. To test this try making ability ids 8 & 9 always on (they aren't ACTIVATED_ABILITYs anyway) and remove them from the granting block (where you are granting 12 abilities).
Riiak also Intrinsic abilities has the limit of 10. So i think that this limit is including Granted + Intrinsic abilities so also if he turn granted to "Always on" abilities the issue should remain.
NeoAnderson
 
Posts: 914
Joined: 10 Sep 2013, 07:49
Has thanked: 18 times
Been thanked: 139 times

Re: General DotP 2014 Coding Questions

Postby Xander9009 » 22 Nov 2014, 18:17

Alright. Making 8 and 9 inherent didn't work. Removing the utility abilities worked, but that means that should the card be destroyed or exiled, I can't get it back. So, I made two more static abilities active in graveyard and exile, respectively, and they grant the 'can be cast from graveyard' and 'can be cast from exile' abilities. That means there are no more than 10 activated abilities at a time. So, thank you Riiak for suggesting making 8 and 9 inherent, it's what prompted the actual solution.

Also, thank you neo for pointing out the inherent abilities still count. I had actually assumed that was the case, but I never gave those two abilities a second look until you reminded me of it. That explains why I couldn't seem to have 10 and could only manage 8. It was because of those two inherent abilities that I'd forgotten about.

I'm pretty sure it's fully working now with almost every ability I want it to have (the only one I can think of I want to add is "target creature gets 'ability'" for haste, mainly, but I'll probably throw in a few extras).

TL;DR: It works now (and there's less clutter text, even, so double victory). Thank you to all three of you :)

Here's the working code. I've tested all of the abilities, and I've been using it for a long time. Although, obviously, I just now got the last two abilities working, so those might not work flawlessly, yet. I added one last ability to grant either haste, first strike, deathtouch, vigilance, flying, unblockable, or Palace Guard. It'll let you control just about everything you'll usually need to in order to set up just about any situation.
Favor of the Gods | Open
Code: Select all
<?xml version="1.0"?>
<CARD_V2 ExportVersion="1">
   <FILENAME text="FAVOR_OF_THE_GODS_CW_9009000" />
   <CARDNAME text="FAVOR_OF_THE_GODS" />
   <TITLE>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Favor of the Gods]]></LOCALISED_TEXT>
   </TITLE>
   <MULTIVERSEID value="9009000" />
   <ARTID value="CW9009000" />
   <ARTIST name="Matt Steward" />
   <CASTING_COST cost="{0}" />
   <TYPE metaname="Artifact" />
   <EXPANSION value="DPI" />
   <RARITY metaname="M" />
   <SPELL_ABILITY> --AI restriction
      <AVAILABILITY>
         return EffectController():IsAI() == false
      </AVAILABILITY>
   </SPELL_ABILITY>
  <STATIC_ABILITY> --Intrinsic abilities
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Hexproof, Flash]]></LOCALISED_TEXT>
      <INTRINSIC characteristic="CHARACTERISTIC_HEXPROOF" />
      <INTRINSIC characteristic="CHARACTERISTIC_FLASH" />
   </STATIC_ABILITY>
   <STATIC_ABILITY> --Grant abilities
      <CONTINUOUS_ACTION layer="0">
         local characteristics = EffectSource():GetCurrentCharacteristics()
         characteristics:GrantAbility(7)
         characteristics:GrantAbility(8)
         characteristics:GrantAbility(9)
         characteristics:GrantAbility(10)
         characteristics:GrantAbility(11)
         characteristics:GrantAbility(12)
         characteristics:GrantAbility(13)
         characteristics:GrantAbility(14)
         characteristics:GrantAbility(15)
         characteristics:GrantAbility(16)
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <ACTIVATED_ABILITY forced_skip="1" resource_id="7"> --Single mana
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{0}: Add one mana of any color to your mana pool.]]></LOCALISED_TEXT>
      <COST mana_cost="{0}" type="Mana" />
      <PLAY_TIME_ACTION>
         RSN_MarkManaAbilityStart()
         local oPlayer = EffectController()
         local oCard = EffectSource()
         if (oPlayer ~= nil) then
            oPlayer:BeginNewMultipleChoice()
               oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_C" )
               oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_W" )
               oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_U" )
               oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_B" )
               oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_R" )
               oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_G" )
               oPlayer:AddMultipleChoiceAnswer( "ALL" )
            oPlayer:AskMultipleChoiceQuestion( "MODE_CHOOSE_ONE", oCard )
         end
      </PLAY_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         local nColour = EffectController():GetMultipleChoiceResult()
         if (nColor == COLOUR_COLOURLESS ) then
            RSN_Produce( "{1}", 1 )
         elseif (nColour == COLOUR_BLACK) then
            RSN_Produce( "{B}", 1 )
         elseif (nColour == COLOUR_BLUE) then
            RSN_Produce( "{U}", 1 )
         elseif (nColour == COLOUR_GREEN) then
            RSN_Produce( "{G}", 1 )
         elseif (nColour == COLOUR_RED) then
            RSN_Produce( "{R}", 1 )
         elseif (nColour == COLOUR_WHITE) then
            RSN_Produce( "{W}", 1 )
         else
            RSN_Produce( "{W}{U}{B}{R}{G}", 1 )
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         RSN_EliminateExtraManaTokens()
         S_DisplayManaPool(EffectController())
         RSN_MarkManaAbilityEnd()
      </RESOLUTION_TIME_ACTION>
      <AI_AVAILABILITY window_step="untap" />
   </ACTIVATED_ABILITY>
   <ACTIVATED_ABILITY forced_skip="1" resource_id="8"> --5 mana
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{0}: Add 5 mana of any color to your mana pool.]]></LOCALISED_TEXT>
      <COST mana_cost="{0}" type="Mana" />
      <PLAY_TIME_ACTION>
         RSN_MarkManaAbilityStart()
         local oPlayer = EffectController()
         local oCard = EffectSource()
         if (oPlayer ~= nil) then
            oPlayer:BeginNewMultipleChoice()
               oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_C" )
               oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_W" )
               oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_U" )
               oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_B" )
               oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_R" )
               oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_G" )
               oPlayer:AddMultipleChoiceAnswer( "ALL" )
            oPlayer:AskMultipleChoiceQuestion( "MODE_CHOOSE_ONE", oCard )
         end
      </PLAY_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         local nColour = EffectController():GetMultipleChoiceResult()
         if (nColor == COLOUR_COLOURLESS ) then
            RSN_Produce( "{1}", 5 )
         elseif (nColour == COLOUR_BLACK) then
            RSN_Produce( "{B}", 5 )
         elseif (nColour == COLOUR_BLUE) then
            RSN_Produce( "{U}", 5 )
         elseif (nColour == COLOUR_GREEN) then
            RSN_Produce( "{G}", 5 )
         elseif (nColour == COLOUR_RED) then
            RSN_Produce( "{R}", 5 )
         elseif (nColour == COLOUR_WHITE) then
            RSN_Produce( "{W}", 5 )
         else
            RSN_Produce( "{W}{U}{B}{R}{G}", 5 )
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         RSN_EliminateExtraManaTokens()
         S_DisplayManaPool(EffectController())
         RSN_MarkManaAbilityEnd()
      </RESOLUTION_TIME_ACTION>
      <AI_AVAILABILITY window_step="untap" />
   </ACTIVATED_ABILITY>
   <ACTIVATED_ABILITY forced_skip="1" resource_id="9" firebreathing="1"> --Target creature/planeswalker
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{0}: Target creature or planeswalker gets counters or target creature takes 1 damage or gains ability.]]></LOCALISED_TEXT>
      <SFX text="TARGET_FIREBALL_PLAY" />
      <COST mana_cost="{0}" type="Mana" />
      <MODE_SELECT tag="MODE_CHOOSE_ONE">
         <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_1_DAMAGE" index="1" />
         <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_1_1_COUNTER" index="2" />
         <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_1_0_COUNTER" index="3" />
         <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_0_1_COUNTER" index="4" />
         <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_MINUS_1_1_COUNTER" index="5" />
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_LOYALTY" index="6" />
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_ABILITY" index="7" />
      </MODE_SELECT>
      <TARGET tag="CARD_QUERY_CHOOSE_DEAL_1_DAMAGE" definition="1" compartment="1" mode="1" any_number_of="1" />
      <TARGET_DEFINITION id="1">
         local filter = ClearFilter()
         local subfilter = filter:AddSubFilter_Or()
      subfilter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
      if PLW_FilterNameSet ~= nil then
        PLW_FilterNameSet(subfilter, "PLANESWALKERS", true)
      else
        subfilter:Add( FE_TYPE, OP_IS, CARD_TYPE_PLANESWALKER)
      end
      </TARGET_DEFINITION>
      <RESOLUTION_TIME_ACTION mode="1">
         local targetDC = EffectDC():Get_Targets(1)
         if targetDC ~= nil then
            local numTargets = targetDC:Count()
            for i=0,(numTargets-1) do
               local target_creature = targetDC:Get_CardPtr(i)
               if target_creature ~= nil then
                  EffectSourceLKI():DealDamageTo( 1, target_creature)
               end
            end
         end
      </RESOLUTION_TIME_ACTION>
      <TARGET tag="CARD_QUERY_CHOOSE_CREATURE_TO_GET_PLUS1_PLUS1_COUNTER" definition="2" compartment="2" mode="2" any_number_of="1" />
      <TARGET_DEFINITION id="2" mode="2">
         local filter = ClearFilter()
         filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
      </TARGET_DEFINITION>
      <RESOLUTION_TIME_ACTION mode="2">
         local targetDC = EffectDC():Get_Targets(2)
         if targetDC ~= nil then
            local numTargets = targetDC:Count()
            for i=0,(numTargets-1) do
               local target_creature = targetDC:Get_CardPtr(i)
               if target_creature ~= nil then
                  target_creature:AddCounters( MTG():PlusOnePlusOneCounters(), 1)
               end
            end
         end
      </RESOLUTION_TIME_ACTION>
      <TARGET tag="CARD_QUERY_CHOOSE_CREATURE_TO_GET_PLUS1_PLUS0_COUNTER" definition="3" compartment="3" mode="3" any_number_of="1" />
      <TARGET_DEFINITION id="3" mode="3">
         local filter = ClearFilter()
         filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
      </TARGET_DEFINITION>
      <RESOLUTION_TIME_ACTION mode="3">
         local targetDC = EffectDC():Get_Targets(3)
         if targetDC ~= nil then
            local numTargets = targetDC:Count()
            for i=0,(numTargets-1) do
               local target_creature = targetDC:Get_CardPtr(i)
               if target_creature ~= nil then
                  target_creature:AddCounters( MTG():PlusOnePlusZeroCounters(), 1)
               end
            end
         end
      </RESOLUTION_TIME_ACTION>
      <TARGET tag="CARD_QUERY_CHOOSE_CREATURE_TO_GET_PLUS0_PLUS1_COUNTER" definition="4" compartment="4" mode="4" any_number_of="1" />
      <TARGET_DEFINITION id="4" mode="4">
         local filter = ClearFilter()
         filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
      </TARGET_DEFINITION>
      <RESOLUTION_TIME_ACTION mode="4">
         local targetDC = EffectDC():Get_Targets(4)
         if targetDC ~= nil then
            local numTargets = targetDC:Count()
            for i=0,(numTargets-1) do
               local target_creature = targetDC:Get_CardPtr(i)
               if target_creature ~= nil then
                  target_creature:AddCounters( MTG():PlusZeroPlusOneCounters(), 1)
               end
            end
         end
      </RESOLUTION_TIME_ACTION>
      <TARGET tag="CARD_QUERY_CHOOSE_CREATURE_TO_GET_MINUS1_MINUS1_COUNTER" definition="5" compartment="5" mode="5" any_number_of="1" />
      <TARGET_DEFINITION id="5" mode="5">
         local filter = ClearFilter()
         filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
      </TARGET_DEFINITION>
      <RESOLUTION_TIME_ACTION mode="5">
         local targetDC = EffectDC():Get_Targets(5)
         if targetDC ~= nil then
            local numTargets = targetDC:Count()
            for i=0,(numTargets-1) do
               local target_creature = targetDC:Get_CardPtr(i)
               if target_creature ~= nil then
                  target_creature:AddCounters( MTG():MinusOneMinusOneCounters(), 1)
               end
            end
         end
      </RESOLUTION_TIME_ACTION>
    <PLAY_TIME_ACTION mode="6">
      local filter = ClearFilter()
      local controller = EffectController()
      PLW_FilterNameSet(filter, "PLANESWALKERS", true)
      local count = filter:Count()
      if count &gt; 0 then
        controller:SetItemCount(count)
        for i=0,count-1 do
          controller:SetItemPrompt(i, "CARD_QUERY_CHOOSE_PERMANENT_TO_ADD_LOYALTY")
        end
        controller:ChooseItems( EffectDC():Make_Targets(6), QUERY_FLAG_UP_TO )
      else
        controller:ChooseItem( "CARD_QUERY_CHOOSE_PERMANENT_TO_ADD_LOYALTY", EffectDC():Make_Targets(6), QUERY_FLAG_MAY )
      end
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION mode="6">
      local controller = EffectController()
      controller:BeginNewNumericalChoice()
      controller:AddNumericalChoiceAnswer(50)
      controller:AskNumericalChoiceQuestion("CARD_QUERY_CHOOSE_AMOUNT_COUNTERS")
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION mode="6">
      local amount = EffectController():GetNumericalChoiceResult()
      local targetDC = EffectDC():Get_Targets(6)
      if targetDC ~= nil then
        local count = targetDC:Count()
        if count &gt; 0 then
          for i=0,count-1 do
            local card = targetDC:Get_CardPtr(i)
            if card ~= nil then
              card:AddCounters( MTG():GetCountersType("Loyalty"), amount )
            end
          end
        end
      end
    </RESOLUTION_TIME_ACTION>
    <TARGET tag="CARD_QUERY_CHOOSE_CREATURE_TO_GET_ABILITY" definition="7" compartment="7" mode="7" any_number_of="1" />
      <TARGET_DEFINITION id="7" mode="7">
         local filter = ClearFilter()
         filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
      </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION mode="7">
      EffectController():BeginNewMultipleChoice()
        EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_MODE_FAVOR_GODS_HASTE" )
        EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_MODE_FAVOR_GODS_VIGILANCE" )
        EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_MODE_FAVOR_GODS_FIRST_STRIKE" )
        EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_MODE_FAVOR_GODS_DEATHTOUCH" )
        EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_MODE_FAVOR_GODS_FLYING" )
        EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_MODE_FAVOR_GODS_UNBLOCKABLE" )
        EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_MODE_FAVOR_GODS_SUPER_BLOCKER" )
      EffectController():AskMultipleChoiceQuestion( "CARD_QUERY_CHOOSE_ONE" )
    </RESOLUTION_TIME_ACTION>
    <CONTINUOUS_ACTION layer="6" mode="7">
      local choice = EffectController():GetMultipleChoiceResult()
      local targetDC = EffectDC():Get_Targets(7)
      if targetDC ~= nil then
        local count = targetDC:Count()
        if count &gt; 0 then
          for i=0,count-1 do
            local card = targetDC:Get_CardPtr(i)
            if card ~= nil and choice ~= nil then
              if choice == 0 then
                card:GetCurrentCharacteristics():Bool_Set( CHARACTERISTIC_HASTE, 1 )
              elseif choice == 1 then
                card:GetCurrentCharacteristics():Bool_Set(CHARACTERISTIC_VIGILANCE, 1)
              elseif choice == 2 then
                card:GetCurrentCharacteristics():Bool_Set(CHARACTERISTIC_FIRST_STRIKE, 1)
              elseif choice == 3 then
                card:GetCurrentCharacteristics():Bool_Set(CHARACTERISTIC_DEATHTOUCH, 1)
              elseif choice == 4 then
                card:GetCurrentCharacteristics():Bool_Set(CHARACTERISTIC_FLYING, 1)
              elseif choice == 5 then
                card:GetCurrentCharacteristics():Bool_Set(CHARACTERISTIC_UNBLOCKABLE, 1)
              elseif choice == 6 then
                card:GetCurrentCharacteristics():Bool_Set(CHARACTERISTIC_CAN_BLOCK_ANY_NUMBER_OF_CREATURES, 1)
              end
            end
          end
        end
      end
    </CONTINUOUS_ACTION>
    <DURATION simple_duration="UntilEOT" />
      <AI_AVAILABILITY window_step="untap" />
   </ACTIVATED_ABILITY>
   <ACTIVATED_ABILITY forced_skip="1" resource_id="10"> --Find cards
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{0}: Search your library or graveyard zone for cards and put them into your hand or put all basic land cards from your library into play or your graveyard.]]></LOCALISED_TEXT>
      <COST mana_cost="{0}" type="Mana" />
      <MODE_SELECT tag="MODE_CHOOSE_ONE">
         <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_LIBRARY" index="1" />
         <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_GRAVEYARD" index="2" />
         <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_LANDS_MILL" index="3" />
         <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_LANDS_PLAY" index="4" />
      </MODE_SELECT>
      <RESOLUTION_TIME_ACTION mode="1">
         local filter = ClearFilter()
         local controller = EffectController()
         filter:SetZone(ZONE_LIBRARY, controller)
         local count = filter:Count()
         if count &gt; 0 then
            controller:SetItemCount(count)
            for i=0,count-1 do
               controller:SetItemPrompt(i, "CARD_QUERY_CHOOSE_A_CARD_TO_PUT_INTO_YOUR_HAND")
            end
            controller:ChooseItems( EffectDC():Make_Targets(1), QUERY_FLAG_UP_TO )
         else
            controller:ChooseItem( "CARD_QUERY_CHOOSE_A_CARD_TO_PUT_INTO_YOUR_HAND", EffectDC():Make_Targets(1), QUERY_FLAG_MAY )
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION mode="1">
         local targetDC = EffectDC():Get_Targets(1)
         if targetDC ~= nil then
            local count = targetDC:Count()
            if count &gt; 0 then
               for i=0,count-1 do
                  local card = targetDC:Get_CardPtr(i)
                  if card ~= nil then
                     card:PutInHand()
                  end
               end
            end
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION mode="2">
         local filter = ClearFilter()
         local controller = EffectController()
         filter:SetZone(ZONE_GRAVEYARD, controller)
         local count = filter:Count()
         if count &gt; 0 then
            controller:SetItemCount(count)
            for i=0,count-1 do
               controller:SetItemPrompt(i, "CARD_QUERY_CHOOSE_A_CARD_TO_PUT_INTO_YOUR_HAND")
            end
            controller:ChooseItems( EffectDC():Make_Targets(2), QUERY_FLAG_UP_TO )
         else
            controller:ChooseItem( "CARD_QUERY_CHOOSE_A_CARD_TO_PUT_INTO_YOUR_HAND", EffectDC():Make_Targets(2), QUERY_FLAG_MAY )
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION mode="2">
         local targetDC = EffectDC():Get_Targets(2)
         if targetDC ~= nil then
            local count = targetDC:Count()
            if count &gt; 0 then
               for i=0,count-1 do
                  local card = targetDC:Get_CardPtr(i)
                  if card ~= nil then
                     card:PutInHand()
                  end
               end
            end
         end
      </RESOLUTION_TIME_ACTION>
      <FILTER filter_id="3">
         local filter = ClearFilter()
         filter:Add( FE_TYPE, OP_IS, CARD_TYPE_LAND )
         filter:Add( FE_SUPERTYPE, OP_IS, SUPERTYPE_BASIC )
         filter:SetZone(ZONE_LIBRARY, EffectController())
      </FILTER>
      <RESOLUTION_TIME_ACTION mode="3" filter_id="3">
         if FilteredCard() ~= nil then
            FilteredCard():PutInGraveyard()
         end
      </RESOLUTION_TIME_ACTION>
      <FILTER filter_id="4">
         local filter = ClearFilter()
         filter:Add( FE_TYPE, OP_IS, CARD_TYPE_LAND )
         filter:Add( FE_SUPERTYPE, OP_IS, SUPERTYPE_BASIC )
         filter:SetZone(ZONE_LIBRARY, EffectController())
      </FILTER>
      <RESOLUTION_TIME_ACTION mode="4" filter_id="4">
         if FilteredCard() ~= nil then
            FilteredCard():PutOntoBattlefield( EffectController() )
         end
      </RESOLUTION_TIME_ACTION>
      <AI_AVAILABILITY window_step="untap" />
   </ACTIVATED_ABILITY>
   <ACTIVATED_ABILITY forced_skip="1" resource_id="11"> --Play/counter/copy spells
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{0}: Play permanent or cast spell for free or counter or copy target spell or permanent.]]></LOCALISED_TEXT>
      <COST mana_cost="{0}" type="Mana" />
      <MODE_SELECT tag="MODE_CHOOSE_ONE">
         <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_PLAY_PERMANENT" index="1" />
         <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_CAST_SPELL" index="2" />
         <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_COUNTER" index="3" />
         <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_COPY_SPELL" index="4" />
         <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_COPY_PERMANENT" index="5" />
      </MODE_SELECT>
      <PLAY_TIME_ACTION mode="1">
         local filter = ClearFilter()
         local controller = EffectController()
         filter:Add( FE_IS_PERMANENT, true )
         filter:SetZone( ZONE_HAND, EffectController() )
         local count = filter:Count()
         if count &gt; 0 then
            controller:SetItemCount(count)
            for i=0,count-1 do
               controller:SetItemPrompt(i, "CARD_QUERY_CHOOSE_PERMANENT_TO_PUT_ONTO_BATTLEFIELD")
            end
            controller:ChooseItems( EffectDC():Make_Targets(1), QUERY_FLAG_UP_TO )
         else
            controller:ChooseItem( "CARD_QUERY_CHOOSE_PERMANENT_TO_PUT_ONTO_BATTLEFIELD", EffectDC():Make_Targets(1), QUERY_FLAG_MAY )
         end
      </PLAY_TIME_ACTION>
      <RESOLUTION_TIME_ACTION mode="1">
         local targetDC = EffectDC():Get_Targets(1)
         if targetDC ~= nil then
            local count = targetDC:Count()
            if count &gt; 0 then
               for i=0,count-1 do
                  local card = targetDC:Get_CardPtr(i)
                  if card ~= nil then
                     card:PutOntoBattlefield( EffectController() )
                  end
               end
            end
         end
      </RESOLUTION_TIME_ACTION>
      <PLAY_TIME_ACTION mode="2">
         local filter = ClearFilter()
         local controller = EffectController()
         filter:Add( FE_IS_PERMANENT, true )
         filter:SetZone( ZONE_HAND, EffectController() )
         local count = filter:Count()
         if count &gt; 0 then
            controller:SetItemCount(count)
            for i=0,count-1 do
               controller:SetItemPrompt(i, "CARD_QUERY_CHOOSE_PERMANENT_TO_PUT_ONTO_BATTLEFIELD")
            end
            controller:ChooseItems( EffectDC():Make_Targets(2), QUERY_FLAG_UP_TO )
         else
            controller:ChooseItem( "CARD_QUERY_CHOOSE_PERMANENT_TO_PUT_ONTO_BATTLEFIELD", EffectDC():Make_Targets(2), QUERY_FLAG_MAY )
         end
      </PLAY_TIME_ACTION>
      <RESOLUTION_TIME_ACTION mode="2">
         local targetDC = EffectDC():Get_Targets(2)
         if targetDC ~= nil then
            local count = targetDC:Count()
            if count &gt; 0 then
               for i=0,count-1 do
                  local card = targetDC:Get_CardPtr(i)
                  if card ~= nil then
                     EffectController():CastSpellForFree( card )
                  end
               end
            end
         end
      </RESOLUTION_TIME_ACTION>
      <TARGET tag="CARD_QUERY_CHOOSE_SPELL_TO_COUNTER" definition="3" compartment="3" mode="3" count="1" />
      <TARGET_DEFINITION id="3">
         local filter = ClearFilter()
         filter:SetZone( ZONE_STACK )
      </TARGET_DEFINITION>
      <RESOLUTION_TIME_ACTION mode="3" >
         local target = EffectDC():Get_Targets(3):Get_CardPtr(0)
         if target ~= nil then
            target:CounterSpell()
         end
      </RESOLUTION_TIME_ACTION>
      <TARGET tag="CARD_QUERY_CHOOSE_SPELL_TO_COPY" definition="4" compartment="4" mode="4" count="1" />
      <TARGET_DEFINITION id="4">
         local filter = ClearFilter()
         filter:SetZone( ZONE_STACK )
      local subfilter = filter:AddSubFilter_Or()
            subfilter:Add (FE_TYPE, OP_IS, CARD_TYPE_INSTANT)
            subfilter:Add (FE_TYPE, OP_IS, CARD_TYPE_SORCERY)
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION mode="4">
      local target = EffectDC():Get_Targets(4):Get_CardPtr(0)
      local effectController = EffectController()
      if target ~= nil then
        local copy = effectController:CopySpell( target )
        effectController:ChooseNewTargets( copy )
      end
    </RESOLUTION_TIME_ACTION>
    <TARGET tag="CARD_QUERY_CHOOSE_PERMANENT_TO_COPY" definition="5" compartment="5" mode="5" any_number_of="1" />
    <TARGET_DEFINITION id="5">
      local filter = ClearFilter()
      filter:Add( FE_IS_PERMANENT, true )
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION mode="5">
      local targetDC = EffectDC():Get_Targets(5)
         if targetDC ~= nil then
            local numTargets = targetDC:Count()
            for i=0,(numTargets-1) do
               local target = targetDC:Get_CardPtr(i)
               if target ~= nil then
            MTG():PutTokenCopiesOntoBattlefield( target, 1, EffectController() )
          end
        end
      end
    </RESOLUTION_TIME_ACTION>
    <AI_AVAILABILITY window_step="untap" />
  </ACTIVATED_ABILITY>
  <ACTIVATED_ABILITY forced_skip="1" resource_id="12" firebreathing="1"> --Target player
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{0}: Target player draws or discards a card, gains or loses 1 life, takes 1 damage, or takes an extra turn.]]></LOCALISED_TEXT>
    <COST mana_cost="{0}" type="Mana" />
    <MODE_SELECT tag="MODE_CHOOSE_ONE">
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_DRAW" index="1" />
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_DISCARD" index="2" />
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_GAIN_LIFE" index="3" />
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_LOSE_LIFE" index="4" />
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_1_DAMAGE" index="5" />
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_EXTRA_TURN" index="6" />
    </MODE_SELECT>
    <TARGET tag="CARD_QUERY_CHOOSE_PLAYER_DRAW_CARD" definition="1" compartment="1" mode="1" count="1" />
    <TARGET_DEFINITION id="1">
      local filter = ClearFilter()
      filter:SetFilterType( FILTER_TYPE_PLAYERS )
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION mode="1">
      local target = EffectDC():Get_Targets(1):Get_PlayerPtr(0)
      if target ~= nil then
        target:DrawCards( 1 )
      end
    </RESOLUTION_TIME_ACTION>
    <TARGET tag="CARD_QUERY_CHOOSE_PLAYER_DISCARD_1" definition="2" compartment="2" mode="2" count="1" />
    <TARGET_DEFINITION id="2">
      local filter = ClearFilter()
      filter:SetFilterType( FILTER_TYPE_PLAYERS )
    </TARGET_DEFINITION>
    <PLAY_TIME_ACTION mode="2">
      local controller = EffectController()
      controller:BeginNewNumericalChoice()
      controller:AddNumericalChoiceAnswer(50)
      controller:AskNumericalChoiceQuestion("CARD_QUERY_CHOOSE_AMOUNT_COUNTERS")
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
      local amount = EffectController():GetNumericalChoiceResult()
      local filter = ClearFilter()
      local target = EffectDC():Get_Targets(2):Get_PlayerPtr(0)
      if target ~= nil then
        filter:SetZone( ZONE_HAND, target)
        target:SetItemCount( amount )
        for i = 0,(amount-1) do
          target:SetItemPrompt (i, "CARD_QUERY_CHOOSE_CARD_TO_DISCARD" )
        end
        target:ChooseItems( EffectDC():Make_Targets(7) )
      end
    </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
      local amount = EffectController():GetNumericalChoiceResult()
      local player = EffectDC():Get_Targets(2):Get_PlayerPtr(0)
      if player ~= nil then
        for i = 0,(amount-1) do
          local target_card = EffectDC():Get_Targets(7):Get_CardPtr(i)
          if target_card ~= nil  then
            target_card:Discard()
          end
        end
      end
    </RESOLUTION_TIME_ACTION>
    <TARGET tag="CARD_QUERY_CHOOSE_PLAYER_GAIN_1" definition="3" compartment="3" mode="3" count="1" />
    <TARGET_DEFINITION id="3">
      local filter = ClearFilter()
      filter:SetFilterType( FILTER_TYPE_PLAYERS )
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION mode="3">
      local target = EffectDC():Get_Targets(3):Get_PlayerPtr(0)
      if target ~= nil then
        target:GainLife(1)
      end
    </RESOLUTION_TIME_ACTION>
    <TARGET tag="CARD_QUERY_CHOOSE_PLAYER_LOSE_1" definition="4" compartment="4" mode="4" count="1" />
    <TARGET_DEFINITION id="4">
      local filter = ClearFilter()
      filter:SetFilterType( FILTER_TYPE_PLAYERS )
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION mode="4">
      local target = EffectDC():Get_Targets(4):Get_PlayerPtr(0)
      if target ~= nil then
        target:LoseLife(1)
      end
    </RESOLUTION_TIME_ACTION>
    <TARGET tag="CARD_QUERY_CHOOSE_PLAYER_LOSE_1" definition="5" compartment="5" mode="5" count="1" />
    <TARGET_DEFINITION id="5">
      local filter = ClearFilter()
      filter:SetFilterType( FILTER_TYPE_PLAYERS )
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION mode="5">
      local target = EffectDC():Get_Targets(5):Get_PlayerPtr(0)
      if target ~= nil then
        EffectSourceLKI():DealDamageTo( 1, target )
      end
    </RESOLUTION_TIME_ACTION>
    <TARGET tag="CARD_QUERY_CHOOSE_PLAYER_EXTRA_TURN" definition="6" compartment="6" mode="6" count="1" />
    <TARGET_DEFINITION id="6">
      local filter = ClearFilter()
      filter:SetFilterType(FILTER_TYPE_PLAYERS)
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION>
      local player = EffectDC():Get_Targets(6):Get_PlayerPtr(0)
      if player ~= nil then
        player:GetTeam():TakeExtraTurn()
      end
    </RESOLUTION_TIME_ACTION>
    <AI_AVAILABILITY window_step="untap" />
  </ACTIVATED_ABILITY>
  <ACTIVATED_ABILITY forced_skip="1" resource_id="13"> --Target permanent
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{0}: Target permanent is destroyed, exiled, tapped, untapped, or returned to its owner's hand.]]></LOCALISED_TEXT>
    <COUNTER_REGISTRATION name="Loyalty" proliferate="11" />
    <SFX text="TARGET_BLADE_PLAY" />
    <COST mana_cost="{0}" type="Mana" />
    <MODE_SELECT tag="MODE_CHOOSE_ONE">
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_DESTROY" index="1" />
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_EXILE" index="2" />
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_TAP" index="3" />
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_BOUNCE" index="4" />
    </MODE_SELECT>
    <PLAY_TIME_ACTION mode="1">
      local filter = ClearFilter()
      local controller = EffectController()
      filter:Add( FE_IS_PERMANENT, true )
      local count = filter:Count()
      if count &gt; 0 then
        controller:SetItemCount(count)
        for i=0,count-1 do
          controller:SetItemPrompt(i, "CARD_QUERY_CHOOSE_PERMANENT_TO_DESTROY")
        end
        controller:ChooseItems( EffectDC():Make_Targets(1), QUERY_FLAG_UP_TO )
      else
        controller:ChooseItem( "CARD_QUERY_CHOOSE_PERMANENT_TO_DESTROY", EffectDC():Make_Targets(1), QUERY_FLAG_MAY )
      end
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION mode="1">
      local targetDC = EffectDC():Get_Targets(1)
      if targetDC ~= nil then
        local count = targetDC:Count()
        if count &gt; 0 then
          for i=0,count-1 do
            local card = targetDC:Get_CardPtr(i)
            if card ~= nil then
              card:Destroy()
            end
          end
        end
      end
    </RESOLUTION_TIME_ACTION>
    <PLAY_TIME_ACTION mode="2">
      local filter = ClearFilter()
      local controller = EffectController()
      filter:Add( FE_IS_PERMANENT, true )
      local count = filter:Count()
      if count &gt; 0 then
        controller:SetItemCount(count)
        for i=0,count-1 do
          controller:SetItemPrompt(i, "CARD_QUERY_CHOOSE_PERMANENT_TO_EXILE")
        end
        controller:ChooseItems( EffectDC():Make_Targets(2), QUERY_FLAG_UP_TO )
      else
        controller:ChooseItem( "CARD_QUERY_CHOOSE_PERMANENT_TO_EXILE", EffectDC():Make_Targets(2), QUERY_FLAG_MAY )
      end
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION mode="2">
      local targetDC = EffectDC():Get_Targets(2)
      if targetDC ~= nil then
        local count = targetDC:Count()
        if count &gt; 0 then
          for i=0,count-1 do
            local card = targetDC:Get_CardPtr(i)
            if card ~= nil then
              card:Exile()
            end
          end
        end
      end
    </RESOLUTION_TIME_ACTION>
    <PLAY_TIME_ACTION mode="3">
      local filter = ClearFilter()
      local controller = EffectController()
      filter:Add( FE_IS_PERMANENT, true )
      local count = filter:Count()
      if count &gt; 0 then
        controller:SetItemCount(count)
        for i=0,count-1 do
          controller:SetItemPrompt(i, "CARD_QUERY_CHOOSE_PERMANENT_TO_TAP_OR_UNTAP")
        end
        controller:ChooseItems( EffectDC():Make_Targets(3), QUERY_FLAG_UP_TO )
      else
        controller:ChooseItem( "CARD_QUERY_CHOOSE_PERMANENT_TO_TAP_UNTAP", EffectDC():Make_Targets(3), QUERY_FLAG_MAY )
      end
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION mode="3">
      local targetDC = EffectDC():Get_Targets(3)
      if targetDC ~= nil then
        local count = targetDC:Count()
        if count &gt; 0 then
          for i=0,count-1 do
            local card = targetDC:Get_CardPtr(i)
            if card ~= nil then
              if card:IsTapped() then
                card:Untap()
              else
                card:Tap()
              end
            end
          end
        end
      end
    </RESOLUTION_TIME_ACTION>
    <PLAY_TIME_ACTION mode="4">
      local filter = ClearFilter()
      local controller = EffectController()
      filter:Add( FE_IS_PERMANENT, true )
      local count = filter:Count()
      if count &gt; 0 then
        controller:SetItemCount(count)
        for i=0,count-1 do
          controller:SetItemPrompt(i, "CARD_QUERY_CHOOSE_PERMANENT_TO_BOUNCE")
        end
        controller:ChooseItems( EffectDC():Make_Targets(4), QUERY_FLAG_UP_TO )
      else
        controller:ChooseItem( "CARD_QUERY_CHOOSE_PERMANENT_TO_BOUNCE", EffectDC():Make_Targets(4), QUERY_FLAG_MAY )
      end
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION mode="4">
      local targetDC = EffectDC():Get_Targets(4)
      if targetDC ~= nil then
        local count = targetDC:Count()
        if count &gt; 0 then
          for i=0,count-1 do
            local card = targetDC:Get_CardPtr(i)
            if card ~= nil then
              card:PutInHand()
            end
          end
        end
      end
    </RESOLUTION_TIME_ACTION>
    <AI_AVAILABILITY window_step="untap" />
  </ACTIVATED_ABILITY>
  <ACTIVATED_ABILITY forced_skip="1" resource_id="14"> --Targeted card find/permanent play
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{0}: Target player: searches* for cards and puts them into their hand, puts permanents into play, puts all permanents from hand or all lands they own into play.]]></LOCALISED_TEXT>
    <COST mana_cost="{0}" type="Mana" />
    <MODE_SELECT tag="MODE_CHOOSE_ONE">
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_PLAYER_SEARCHES_FOR_CARDS" index="1" />
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_PLAYER_PLAYS_PERMANENTS" index="2" />
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_PLAYER_PLAYS_ALL_PERMANENTS" index="3" />
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_PLAYER_PLAYS_LANDS" index="4" />
    </MODE_SELECT>
    <TARGET tag="CARD_QUERY_CHOOSE_PLAYER" definition="1" compartment="1" count="1" mode="1" />
      <TARGET_DEFINITION id="1">
         local filter = ClearFilter()
         filter:SetFilterType(FILTER_TYPE_PLAYERS)
      </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION mode="1">
      EffectController():BeginNewMultipleChoice()
        EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_MODE_FAVOR_GODS_LIBRARY" )
        EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_MODE_FAVOR_GODS_GRAVEYARD" )
      EffectController():AskMultipleChoiceQuestion( "CARD_QUERY_CHOOSE_ONE" )
    </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         local player = EffectDC():Get_Targets(1):Get_PlayerPtr(0)
         if player ~= nil then
        local controller = EffectController()
        local filter = ClearFilter()
        if ( controller:GetMultipleChoiceResult() == 0 ) then
          filter:SetZone(ZONE_LIBRARY, player)
        else
          filter:SetZone(ZONE_GRAVEYARD, player)
        end
            player:ChooseItem( "CARD_QUERY_CHOOSE_LAND_TO_PUT_ONTO_THE_BATTLEFIELD_TAPPED", EffectDC():Make_Targets(5), QUERY_FLAG_MAY )
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION mode="1">
         local targetDC = EffectDC():Get_Targets(5)
      if targetDC ~= nil then
        local count = targetDC:Count()
        if count &gt; 0 then
          for i=0,count-1 do
            local card = targetDC:Get_CardPtr(i)
            if card ~= nil then
              card:PutInHand()
            end
          end
            end
         end
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION mode="1">
      if ( EffectController():GetMultipleChoiceResult() == 0 ) then
        local player = EffectDC():Get_Targets(1):Get_PlayerPtr(0)
        if player ~= nil then
          player:ShuffleLibrary()
        end
      end
      </RESOLUTION_TIME_ACTION>
    <TARGET tag="CARD_QUERY_CHOOSE_PLAYER" definition="2" compartment="2" count="1" mode="2" />
      <TARGET_DEFINITION id="2">
         local filter = ClearFilter()
         filter:SetFilterType(FILTER_TYPE_PLAYERS)
      </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION mode="2">
      EffectController():BeginNewMultipleChoice()
        EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_MODE_FAVOR_GODS_HAND" )
        EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_MODE_FAVOR_GODS_LIBRARY" )
        EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_MODE_FAVOR_GODS_GRAVEYARD" )
      EffectController():AskMultipleChoiceQuestion( "CARD_QUERY_CHOOSE_ONE" )
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION mode="2">
      local target_player = EffectDC():Get_Targets(2):Get_PlayerPtr(0)
      local controller = EffectController()
      local filter = ClearFilter()
      if ( controller:GetMultipleChoiceResult() == 0 ) then
        filter:SetZone(ZONE_HAND, target_player)
      elseif ( controller:GetMultipleChoiceResult() == 1 ) then
        filter:SetZone(ZONE_LIBRARY, target_player)
      else
        filter:SetZone(ZONE_GRAVEYARD, target_player)
      end
      local count = filter:Count()
      if count &gt; 0 then
        controller:SetItemCount(count)
        for i=0,count-1 do
          controller:SetItemPrompt(i, "CARD_QUERY_CHOOSE_A_CARD_TO_PUT_ONTO_BATTLEFIELD")
        end
        controller:ChooseItems( EffectDC():Make_Targets(6), QUERY_FLAG_UP_TO )
      else
        controller:ChooseItem( "CARD_QUERY_CHOOSE_CARD_TO_PUT_ONTO_BATTLEFIELD", EffectDC():Make_Targets(6), QUERY_FLAG_MAY )
      end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION mode="2">
      local targetDC = EffectDC():Get_Targets(6)
      if targetDC ~= nil then
        local count = targetDC:Count()
        if count &gt; 0 then
          for i=0,count-1 do
            local card = targetDC:Get_CardPtr(i)
            if card ~= nil then
              card:PutOntoBattlefield( card:GetOwner() )
            end
          end
        end
      end
    </RESOLUTION_TIME_ACTION>
    <TARGET tag="CARD_QUERY_CHOOSE_PLAYER" definition="3" compartment="3" count="1" mode="3" />
      <TARGET_DEFINITION id="3">
         local filter = ClearFilter()
         filter:SetFilterType(FILTER_TYPE_PLAYERS)
      </TARGET_DEFINITION>
    <FILTER filter_id="3">
      local filter = ClearFilter()
      filter:SetZone( ZONE_HAND, EffectDC():Get_Targets(3):Get_PlayerPtr(0) )
      local subfilter = filter:AddSubFilter_Or()
      subfilter:Add( FE_TYPE, OP_IS, CARD_TYPE_ARTIFACT )
      subfilter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
      subfilter:Add( FE_TYPE, OP_IS, CARD_TYPE_ENCHANTMENT )
      subfilter:Add( FE_TYPE, OP_IS, CARD_TYPE_LAND )
      subfilter:Add( FE_TYPE, OP_IS, CARD_TYPE_PLANESWALKER )
    </FILTER>
    <RESOLUTION_TIME_ACTION mode="3" filter_id="3">
      if FilteredCard() ~= nil then
        FilteredCard():PutOntoBattlefield( EffectDC():Get_Targets(3):Get_PlayerPtr(0) )
      end
    </RESOLUTION_TIME_ACTION>
    <TARGET tag="CARD_QUERY_CHOOSE_PLAYER" definition="4" compartment="4" count="1" mode="4" />
      <TARGET_DEFINITION id="4">
         local filter = ClearFilter()
         filter:SetFilterType(FILTER_TYPE_PLAYERS)
      </TARGET_DEFINITION>
    <FILTER filter_id="4">
      local filter = ClearFilter()
      filter:SetZone( ZONE_HAND, EffectDC():Get_Targets(4):Get_PlayerPtr(0) )
      filter:Add( FE_TYPE, OP_IS, CARD_TYPE_LAND )
      filter:Add( FE_SUPERTYPE, OP_IS, SUPERTYPE_BASIC )
    </FILTER>
    <FILTER filter_id="5">
      local filter = ClearFilter()
      filter:SetZone( ZONE_LIBRARY, EffectDC():Get_Targets(4):Get_PlayerPtr(0) )
      filter:Add( FE_TYPE, OP_IS, CARD_TYPE_LAND )
      filter:Add( FE_SUPERTYPE, OP_IS, SUPERTYPE_BASIC )
    </FILTER>
    <FILTER filter_id="6">
      local filter = ClearFilter()
      filter:SetZone( ZONE_GRAVEYARD, EffectDC():Get_Targets(4):Get_PlayerPtr(0) )
      filter:Add( FE_TYPE, OP_IS, CARD_TYPE_LAND )
      filter:Add( FE_SUPERTYPE, OP_IS, SUPERTYPE_BASIC )
    </FILTER>
    <RESOLUTION_TIME_ACTION mode="4" filter_id="4">
      if FilteredCard() ~= nil then
        FilteredCard():PutOntoBattlefield( EffectDC():Get_Targets(4):Get_PlayerPtr(0) )
      end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION mode="4" filter_id="5">
      if FilteredCard() ~= nil then
        FilteredCard():PutOntoBattlefield( EffectDC():Get_Targets(4):Get_PlayerPtr(0) )
      end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION mode="4" filter_id="6">
      if FilteredCard() ~= nil then
        FilteredCard():PutOntoBattlefield( EffectDC():Get_Targets(4):Get_PlayerPtr(0) )
      end
    </RESOLUTION_TIME_ACTION>
    <AI_AVAILABILITY window_step="untap" />
  </ACTIVATED_ABILITY>
  <ACTIVATED_ABILITY forced_skip="1" resource_id="15"> --Combat/control
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{0}: Control attackers and blockers, target player gains control of target permanent.]]></LOCALISED_TEXT>
    <COST mana_cost="{0}" type="Mana" />
    <MODE_SELECT tag="MODE_CHOOSE_ONE">
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_CONTROL_COMBAT" index="1" />
      <MODE tag="CARD_QUERY_MODE_FAVOR_GODS_EXCHANGE_CONTROL" index="2" />
    </MODE_SELECT>
    <CONTINUOUS_ACTION mode="1">
         local num_players = MTG():GetNumberOfPlayers()
         for i=0,num_players-1 do
            local player = MTG():GetNthPlayer(i)
            if player ~= nil then
               player:GetCurrentCharacteristics():SetAttackController(EffectController())
               player:GetCurrentCharacteristics():SetBlockController(EffectController())
            end
         end
      </CONTINUOUS_ACTION>
    <DURATION simple_duration="UntilEOT" mode="1" />
    <TARGET tag="CARD_QUERY_CHOOSE_PLAYER_TO_GAIN_CONTROL" definition="2" compartment="2" mode="2" count="1" />
    <TARGET_DEFINITION id="2">
      local filter = ClearFilter()
      filter:SetFilterType( FILTER_TYPE_PLAYERS )
    </TARGET_DEFINITION>
    <TARGET tag="CARD_QUERY_CHOOSE_PERMANENT_TO_PLAYER_GAIN_CONTROL" definition="3" compartment="3" mode="2" any_number_of="1" />
      <TARGET_DEFINITION id="3">
         local filter = ClearFilter()
         filter:Add( FE_IS_PERMANENT, true )
      </TARGET_DEFINITION>
    <CONTINUOUS_ACTION layer="2" mode="2">
      local playertargetDC = EffectDC():Get_Targets(2)
      local targetDC = EffectDC():Get_Targets(3)
      if playertargetDC ~= nil and targetDC ~= nil then
        local player = playertargetDC:Get_PlayerPtr(0)
        if player ~= nil then
          local count = targetDC:Count()
          if count &gt; 0 then
            for i=0,count-1 do
              local card = targetDC:Get_CardPtr(i)
              if card ~= nil then
                card:SetController( player )
              end
            end
          end
        end
      end
    </CONTINUOUS_ACTION>
    <DURATION mode="2">
         local targetDC = EffectDC():Get_Targets(2)
      if targetDC ~= nil then
        local subtargetsDC = EffectDC():Get_Targets(2):Get_Targets(0)
        local player = EffectDC():Get_Targets(2):Get_PlayerPtr(0)
        if player ~= nil and subtargetsDC ~= nil then
          local count = targetDC:Count()
          if count &gt; 0 then
            for i=0,count-1 do
              local card = targetDC:Get_CardPtr(i)
              if card ~= nil then
                return false
              end
            end
          end
        end
      end
      return true
      </DURATION>
    <AI_AVAILABILITY window_step="untap" />
  </ACTIVATED_ABILITY>
  <ACTIVATED_ABILITY forced_skip="1" resource_id="16"> --Mass manipulation
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{0}: Mass permanent manipulation]]></LOCALISED_TEXT>
    <COST mana_cost="{0}" type="Mana" />
    <RESOLUTION_TIME_ACTION>
      EffectController():BeginNewMultipleChoice()
        EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_MODE_FAVOR_GODS_CHOOSE" )
        EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_MODE_FAVOR_GODS_TEAMS" )
        EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_MODE_FAVOR_GODS_OPPONENTS" )
        EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_MODE_FAVOR_GODS_ALL" )
      EffectController():AskMultipleChoiceQuestion( "CARD_QUERY_CHOOSE_ONE" )
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
      EffectDC():Set_Int(0, EffectController():GetMultipleChoiceResult())
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
      EffectController():BeginNewMultipleChoice()
        EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_DESTROY" )
        EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_EXILE" )
        EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_TAP" )
        EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_BOUNCE" )
      EffectController():AskMultipleChoiceQuestion( "CARD_QUERY_CHOOSE_ONE" )
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
      if ( EffectDC():Get_Int(0) == 0 ) then
        local filter = ClearFilter()
        filter:SetFilterType( FILTER_TYPE_PLAYERS )
        EffectController():ChooseItem("CARD_QUERY_CHOOSE_PLAYER", EffectDC():Make_Targets(0) )
      end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
      local filter = ClearFilter()
      filter:Add( FE_IS_PERMANENT, true )
      if ( EffectDC():Get_Int(0) == 0 ) then
        local target_player = EffectDC():Get_Targets(0):Get_PlayerPtr(0)
        if target_player ~= nil then
          filter:Add( FE_CONTROLLER, OP_IS, target_player )
        end
      elseif ( EffectDC():Get_Int(0) == 1 ) then
        filter:Add( FE_TEAM, OP_IS, EffectController():GetTeam() )
      elseif ( EffectDC():Get_Int(0) == 2 ) then
        filter:Add( FE_TEAM, OP_NOT, EffectController():GetTeam() )
      end
      local Count = filter:EvaluateObjects()
      local Result = EffectController():GetMultipleChoiceResult()
      for i=0,(Count-1) do
        local CurrentObject = filter:GetNthEvaluatedObject(i)
        if CurrentObject ~= nil then
          if ( Result == 0 ) then
            CurrentObject:Destroy()
          elseif ( Result == 1 ) then
            CurrentObject:Exile()
          elseif ( Result == 2 ) then
            if CurrentObject:IsTapped() then
              CurrentObject:Untap()
            else
              CurrentObject:Tap()
            end
          else
            CurrentObject:PutInHand()
          end
        end
      end
    </RESOLUTION_TIME_ACTION>
    <AI_AVAILABILITY window_step="untap" />
  </ACTIVATED_ABILITY>
  <STATIC_ABILITY active_zone="ZONE_GRAVEYARD"> --Grant graveyard ability
      <CONTINUOUS_ACTION layer="0">
      EffectSource():GetCurrentCharacteristics():GrantAbility(17)
    </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
  <UTILITY_ABILITY forced_skip="1" qualifier="Normal_Cast" active_zone="ZONE_GRAVEYARD" resource_id="17"> --Play from graveyard
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[You may cast Favor of the Gods from your graveyard.]]></LOCALISED_TEXT>
  </UTILITY_ABILITY>
  <STATIC_ABILITY active_zone="ZONE_EXILE"> --Grant exile ability
      <CONTINUOUS_ACTION layer="0">
      EffectSource():GetCurrentCharacteristics():GrantAbility(18)
    </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
  <UTILITY_ABILITY forced_skip="1" qualifier="Normal_Cast" active_zone="ZONE_EXILE" resource_id="18"> --Play from exile
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[You may cast Favor of the Gods from exile.]]></LOCALISED_TEXT>
    <AVAILABILITY>
      return EffectController():IsAI() == false
    </AVAILABILITY>
  </UTILITY_ABILITY>-->
  <TRIGGERED_ABILITY forced_skip="1" active_zone="ZONE_LIBRARY">
    <TRIGGER value="BEGINNING_OF_STEP">
      return MTG():GetStep() == STEP_UPKEEP
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
      if EffectController():IsAI() then
        EffectSource():Exile()
      elseif EffectSource() ~= nil then
        EffectSource():PutOntoBattlefield( EffectController() )
      end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <STATIC_ABILITY> --Manual mana mark and backup
    <CONTINUOUS_ACTION layer="0">
      RSN_ClearCanProduceMana()
      RSN_MarkCanProduceMana( "{B}{G}{R}{U}{W}{1}" )
    </CONTINUOUS_ACTION>
    <CONTINUOUS_ACTION layer="8">
      local nDefaultColour = COLOUR_GREEN
      local oCard = EffectSource()
      if (oCard ~= nil) then
        local oCharacteristics = oCard:GetCurrentCharacteristics()
        if (((oCharacteristics ~= nil) and (oCharacteristics:Bool_Get( CHARACTERISTIC_CANT_USE_ACTIVATED_ABILITIES ))) or
          (EffectController():GetCurrentCharacteristics():Bool_Get( PLAYER_CHARACTERISTIC_CANT_ACTIVATE_NONMANA_ABILITIES ))) then
          local nColour = RSN_GetLastProducedColour()
          if (nColour ~= COLOUR_COLOURLESS) then
            oCharacteristics:GrantAbility( nColour )
          else
            oCharacteristics:GrantAbility( 6 )
          end
        end
      end
    </CONTINUOUS_ACTION>
  </STATIC_ABILITY>
  <TRIGGERED_ABILITY forced_skip="1" replacement_effect="1"> --Manual mana clear
    <TRIGGER value="BEGINNING_OF_STEP" pre_trigger="1" />
    <RESOLUTION_TIME_ACTION>
      RSN_ClearProducedMana()
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <MANA_ABILITY resource_id="1"> --Backup white mana
    <COST type="TapSelf" />
    <PRODUCES amount="{W}" />
  </MANA_ABILITY>
  <MANA_ABILITY resource_id="2"> --Backup blue mana
    <COST type="TapSelf" />
    <PRODUCES amount="{U}" />
  </MANA_ABILITY>
  <MANA_ABILITY resource_id="3"> --Backup black mana
    <COST type="TapSelf" />
    <PRODUCES amount="{B}" />
  </MANA_ABILITY>
  <MANA_ABILITY resource_id="4"> --Backup red mana
    <COST type="TapSelf" />
    <PRODUCES amount="{R}" />
  </MANA_ABILITY>
  <MANA_ABILITY resource_id="5"> --Backup green mana
    <COST type="TapSelf" />
    <PRODUCES amount="{G}" />
  </MANA_ABILITY>
  <MANA_ABILITY resource_id="6"> --Backup colorless mana
    <COST type="TapSelf" />
    <PRODUCES amount="{C}" />
  </MANA_ABILITY>
  <TOKEN_REGISTRATION reservation="1" type="RSN_TOKEN_MANA_B" />
  <TOKEN_REGISTRATION reservation="1" type="RSN_TOKEN_MANA_G" />
  <TOKEN_REGISTRATION reservation="1" type="RSN_TOKEN_MANA_R" />
  <TOKEN_REGISTRATION reservation="1" type="RSN_TOKEN_MANA_U" />
  <TOKEN_REGISTRATION reservation="1" type="RSN_TOKEN_MANA_W" />
  <TOKEN_REGISTRATION reservation="1" type="RSN_TOKEN_MANA_C" />
</CARD_V2>
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

Re: General DotP 2014 Coding Questions

Postby Xander9009 » 09 Aug 2015, 06:05

I've got a question for renown on cards like Relic Seeker. I need it to fire an RTA to add the counter and run at least one iteration of a CA to mark it as renowned with the fake characteristic before setting up and firing the STATE_BASED_EFFECTS delayed trigger which will simulate the BECAME_RENOWNED trigger. My question is:
Should I put another RTA after the CA which does the trigger,
Should I put the counter-adding RTA after the CA and set up/fire the trigger from there,
Should I set up/fire the trigger from inside the CA after marking it as renowned and use an EffectDC int to make sure it only happens once,
Or should I mark it as renowned (like in the CA) inside the RTA which adds the counter, and then set up/fire the trigger from there?
(The renowned status is an RSN fake characteristic on layer 6.)

Basically, I can see lots of ways it could be done, but I'm not sure if any of them would be a lot better than the others and I'm just not seeing it. I think the one I'm leaning toward is the last one. RTA: Add counter, mark as renowned, set up trigger, fire trigger. CA: Mark as renowned.

There's also another method:
RTA: Add counter. Set up and fire trigger 1.
CA(6): Mark as renowned.
Trigger 1 (replacement effect) - CA(7): If renowned, set up and fire trigger 2. Invalidate this CA.
Trigger 2 (normal) - RTA: Became renowned, so search library.

I feel like that one would probably be the most correct, since it adds the counter and marks it as renowned and it is as soon as it is marked as renowned in the CA that it fires the fake BECAME_RENOWNED trigger.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

Re: General DotP 2014 Coding Questions

Postby RiiakShiNal » 09 Aug 2015, 14:03

The easiest method would to be not to use fake characteristics in this case. Once a card becomes renown it remains so until it leaves play so in this case you could simply set a register in an ObjectDC fire your trigger and key off that ObjectDC register. ObjectDC registers remain set until a card leaves play (unless the ObjectDC is protected then it can survive longer). In this case there really isn't a need to continuously unset and re-set the characteristic as is necessarily for ability characteristics.
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 496 times

Re: General DotP 2014 Coding Questions

Postby Xander9009 » 10 Aug 2015, 16:23

Alright. And what about Valeron Wardens? I can make a CA on the Valeron Wardens which constantly iterates cards you control and waits for a permanent to have the renown register set to 1, and then add the pointer to an ignore chest and and set up and fire the trigger to draw a card (so it has the response time like it should).

Alternatively, I could just have each card fire the state_based_effects trigger when it becomes renowned and use use that trigger on Valeron Wardens and only then check. I think that way would be better. I'm just not 100% certain if firing that trigger manually like that can cause problems I'm unaware of. I've done it before, but it seems like it's being done more and more as more abilities need approximated, and if there is a problem, I'd rather know about it before I add even more cards that do it. Thoughts?
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

Re: General DotP 2014 Coding Questions

Postby RiiakShiNal » 11 Aug 2015, 11:21

You can use whatever triggering mechanism you want to check the ObjectDC register. Personally, I try to avoid state based effect triggers as state based effects get triggered very often and can lead to lag. So I would probably create an extensible triggering system using something like PLANAR_DIE_ROLLED or PHENOMENON_ENCOUNTERED and use a specific register to then determine what the real event is (that way multiple events could fire the same trigger without conflicting).

For example say I set the ObjectDC register 3456 as the "real" event register to 3 to represent "Became Renown" and I set Object register 4567 to 1 as the "Renown" register, then finally fire PHENOMENON_ENCOUNTERED. Any card that is interested in Renown could then catch the PHENOMENON_ENCOUNTERED event check the TriggerObject() to see if it's ObjectDC register 3456 is set to 3 and if so then this is the "Became Renown" event (if it is 4 it could be "Became Monstrous" or "Caused a Library Search", etc...) then I can do any other necessary checks and return true or false depending on whether I want to run the ability or not.
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 496 times

Re: General DotP 2014 Coding Questions

Postby Xander9009 » 11 Aug 2015, 13:51

Thanks. That's a great solution.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

Re: General DotP 2014 Coding Questions

Postby Xander9009 » 07 Sep 2015, 04:02

Any idea why ManifestTarget:PutOntoBattlefield(EffectController()) would successfully put the card onto the battlefield, but not under EffectController()'s control? Any way you can think of to fix that? (I've been staring at and tweaking/rewriting the code for Ghastly Conscription for quite awhile now. It's working as it should except everything enters under my opponent's control.)
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

PreviousNext

Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 21 guests


Who is online

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

Users browsing this forum: No registered users and 21 guests

Login Form