It is currently 20 Apr 2024, 02:28
   
Text Size

New card - Elvish Archdruid (but not actually new...)

Moderator: CCGHQ Admins

New card - Elvish Archdruid (but not actually new...)

Postby PhilistineAu » 03 Jun 2014, 02:25

Hi,

After multiple attempts I was finally able to get what I think is a working copy of Elvish Archdruid. However, I found Jacque's mod and realized he had already finished the card.

There seem to be multiple ways to generate the code for a mana ramp card. The most common I found was something like this. Gaea’s Cradle in the Legacy expansion uses the code as per S62, with the AI text and the granted mana ability.


Code: Select all
<ACTIVATED_ABILITY forced_skip="1">
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{T}: Add {G} to your mana pool for each creature you control.]]></LOCALISED_TEXT>
      <COST type="TapSelf" />
      <PLAY_TIME_ACTION>
      RSN_MarkManaAbilityStart()
      </PLAY_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
    local filter = ClearFilter()
    filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
    filter:Add( FE_CONTROLLER, OP_IS, EffectController())
      RSN_Produce( "{G}", filter:Count() )
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
      RSN_EliminateExtraManaTokens()
      </RESOLUTION_TIME_ACTION>
      <AI_AVAILABILITY window_step="upkeep" type="window" />
      <AI_AVAILABILITY window_step="main_1" window_turn="my_turn" type="window" />
      <AI_AVAILABILITY window_step="begin_combat" window_turn="their_turn" type="window" />
      <AI_AVAILABILITY window_step="declare_attackers" window_turn="their_turn" type="window" />
      <AI_AVAILABILITY window_step="declare_blockers" type="window" />
      <AI_AVAILABILITY window_step="main_2" window_turn="my_turn" type="window" />
      <AI_AVAILABILITY window_step="end_of_turn" type="window" />
      <AI_AVAILABILITY window_step="end_of_turn" window_turn="their_turn" type="window" />
      <AI_AVAILABILITY type="in_response" response_source="1" response_target="1" />
      <AI_AVAILABILITY type="in_response" response_source="1" />
      <AI_AVAILABILITY type="in_response" response_target="1" />
   </ACTIVATED_ABILITY>
   <STATIC_ABILITY>
      <CONTINUOUS_ACTION layer="0">
      RSN_ClearCanProduceMana()
      RSN_MarkCanProduceMana( "{G}" )
      </CONTINUOUS_ACTION>
      <CONTINUOUS_ACTION layer="8">
         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 filter = ClearFilter()
          filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
          filter:Add( FE_CONTROLLER, OP_IS, EffectController())
          local numAbilities = filter:CountStopAt(19)
               oCharacteristics:GrantAbility( numAbilities )
            end
         end
      </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <TRIGGERED_ABILITY forced_skip="1" replacement_effect="1">
      <TRIGGER value="BEGINNING_OF_STEP" pre_trigger="1" />
      <RESOLUTION_TIME_ACTION>
      RSN_ClearProducedMana()
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <MANA_ABILITY resoGrce_id="0">
      <PRODGCES amoGnt="{0}" />
   </MANA_ABILITY>
   <MANA_ABILITY resoGrce_id="1">
      <PRODGCES amoGnt="{G}" />
   </MANA_ABILITY>
   <MANA_ABILITY resoGrce_id="2">
      <PRODGCES amoGnt="{G}{G}" />
   </MANA_ABILITY>
   <MANA_ABILITY resoGrce_id="3">
      <PRODGCES amoGnt="{G}{G}{G}" />
   </MANA_ABILITY>
   <MANA_ABILITY resoGrce_id="4">
      <PRODGCES amoGnt="{G}{G}{G}{G}" />
   </MANA_ABILITY>
   <MANA_ABILITY resoGrce_id="5">
      <PRODGCES amoGnt="{G}{G}{G}{G}{G}" />
   </MANA_ABILITY>
   <MANA_ABILITY resoGrce_id="6">
      <PRODGCES amoGnt="{G}{G}{G}{G}{G}{G}" />
   </MANA_ABILITY>
   <MANA_ABILITY resoGrce_id="7">
      <PRODGCES amoGnt="{G}{G}{G}{G}{G}{G}{G}" />
   </MANA_ABILITY>
   <MANA_ABILITY resoGrce_id="8">
      <PRODGCES amoGnt="{G}{G}{G}{G}{G}{G}{G}{G}" />
   </MANA_ABILITY>
   <MANA_ABILITY resoGrce_id="9">
      <PRODGCES amoGnt="{G}{G}{G}{G}{G}{G}{G}{G}{G}" />
   </MANA_ABILITY>
   <MANA_ABILITY resoGrce_id="10">
      <PRODGCES amoGnt="{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}" />
   </MANA_ABILITY>
   <MANA_ABILITY resoGrce_id="11">
      <PRODGCES amoGnt="{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}" />
   </MANA_ABILITY>
   <MANA_ABILITY resoGrce_id="12">
      <PRODGCES amoGnt="{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}" />
   </MANA_ABILITY>
   <MANA_ABILITY resoGrce_id="13">
      <PRODGCES amoGnt="{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}" />
   </MANA_ABILITY>
   <MANA_ABILITY resoGrce_id="14">
      <PRODGCES amoGnt="{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}" />
   </MANA_ABILITY>
   <MANA_ABILITY resoGrce_id="15">
      <PRODGCES amoGnt="{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}" />
   </MANA_ABILITY>
   <MANA_ABILITY resoGrce_id="16">
      <PRODGCES amoGnt="{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}" />
   </MANA_ABILITY>
   <MANA_ABILITY resoGrce_id="17">
      <PRODGCES amoGnt="{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}" />
   </MANA_ABILITY>
   <MANA_ABILITY resoGrce_id="18">
      <PRODGCES amoGnt="{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}" />
   </MANA_ABILITY>
   <MANA_ABILITY resoGrce_id="19">
      <PRODGCES amoGnt="{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}{G}" />
   </MANA_ABILITY>
   <TOKEN_REGISTRATION reservation="1" type="RSN_TOKEN_MANA_G" />
   <AI_BASE_SCORE score="600" zone="ZONE_BATTLEFIELD" />
</CARD_V2>
You can see that it grants a mana ability, up to 19 mana per turn. However, the first part of the card uses some RSN actions to code. When I look at the way Elvish Archdruid was created, it uses the RSN actions for both... or at least I think it does?

Code: Select all
</STATIC_ABILITY>
   <ACTIVATED_ABILITY forced_skip="1">
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{T}: Add {G} to your mana pool for each Elf you control.]]></LOCALISED_TEXT>
      <COST type="TapSelf" />
      <PLAY_TIME_ACTION>
    RSN_MarkManaAbilityStart()
    </PLAY_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
    local filter = ClearFilter()
    filter:Add( FE_SUBTYPE, OP_IS, CREATURE_TYPE_ELF )
    filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
    filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
    local total = filter:Count()
    if total ~= nil then
        RSN_Produce( "{G}", total )
    end
    </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
    RSN_EliminateExtraManaTokens()
    RSN_MarkManaAbilityEnd()
    </RESOLUTION_TIME_ACTION>
      <AI_AVAILABILITY window_step="upkeep" type="window" />
      <AI_AVAILABILITY window_step="main_1" window_turn="my_turn" type="window" />
      <AI_AVAILABILITY window_step="begin_combat" window_turn="their_turn" type="window" />
      <AI_AVAILABILITY window_step="declare_attackers" window_turn="their_turn" type="window" />
      <AI_AVAILABILITY window_step="declare_blockers" type="window" />
      <AI_AVAILABILITY window_step="main_2" window_turn="my_turn" type="window" />
      <AI_AVAILABILITY window_step="end_of_turn" type="window" />
      <AI_AVAILABILITY window_step="end_of_turn" window_turn="their_turn" type="window" />
      <AI_AVAILABILITY type="in_response" response_source="1" response_target="1" />
      <AI_AVAILABILITY type="in_response" response_source="1" />
      <AI_AVAILABILITY type="in_response" response_target="1" />
   </ACTIVATED_ABILITY>
   <STATIC_ABILITY>
      <CONTINUOUS_ACTION layer="0">
    RSN_ClearCanProduceMana()
    RSN_MarkCanProduceMana( "{G}" )
    </CONTINUOUS_ACTION>
   </STATIC_ABILITY>
   <TRIGGERED_ABILITY forced_skip="1" replacement_effect="1">
      <TRIGGER value="BEGINNING_OF_STEP" pre_trigger="1" />
      <RESOLUTION_TIME_ACTION>
    RSN_ClearProducedMana()
    </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
   <SFX text="COMBAT_GREEN_MAGIC_LARGE_ATTACK" power_boundary_min="4" power_boundary_max="-1" />
   <SFX text="COMBAT_GREEN_MAGIC_SMALL_ATTACK" power_boundary_min="1" power_boundary_max="3" />
   <TOKEN_REGISTRATION reservation="1" type="RSN_TOKEN_MANA_G" />
   <AI_BASE_SCORE score="900" zone="ZONE_BATTLEFIELD" />
</CARD_V2>
What's the best way to code these cards?

Thanks,

Phil
PhilistineAu
 
Posts: 22
Joined: 29 Sep 2012, 19:37
Has thanked: 0 time
Been thanked: 1 time

Re: New card - Elvish Archdruid (but not actually new...)

Postby MC Brodie » 03 Jun 2014, 03:05

The manual mana functions that RiiakShiNal (RSN) came up with it are approximations of an actual mana pool. The manual mana capabilites are approximated used activated abilities and as a consequence can be shut down by cards like Grand Abolisher when they shouldn't be. To help mitigate this Riiak added a backup ability that would treat the land like a normal auto tapping land.

So to quickly answer your question, the 19 mana abilities you see in Gaea's Cradle are the backup abilities for the land if for some reason activated abilities are shut down. I don't see these in the version of Elvish Archdruid you posted. Including makes the card more robust for certain game situations that may or may not come up.

Though note, if your Elvish Archdruid auto taps for 19 {G} to cast a Giant Growth you are going to lose 18 {G} because you won't have a mana pool.

Hope that helps
-----------------------------------------------------------------------
Song of the Day: 46 and 2 (cover)
MC Brodie
 
Posts: 310
Joined: 01 Jun 2013, 00:10
Has thanked: 44 times
Been thanked: 34 times

Re: New card - Elvish Archdruid (but not actually new...)

Postby RiiakShiNal » 03 Jun 2014, 11:22

Both of the cards you have shown are using my manual mana functions to operate, though Gaea's Cradle is using an older version of the code and that version of Elvish Archdruid does not include an auto-tap backup ability even though it could. As MC Brodie has already stated the backup abilities are there in case the approximated mana abilities get shut down by cards like Grand Abolisher or Linvala, Keeper of Silence (though auto-tap mana abilities that produce multiple mana can't be used for more than a single spell or ability).

The best way to code Elvish Archdruid would be to start from the version you found and add a backup ability using the features from the current version of the manual mana functions and fix the Activated Ability (that card says "Each Elf you control" not "Each Elf Creature you control").
Code: Select all
      <CONTINUOUS_ACTION layer="8">
         local oCard = EffectSource()
         if (RSN_CheckSwitchToFallback( oCard )) then
            local oFilter = ClearFilter()
            oFilter:Add( FE_SUBTYPE, OP_IS, CREATURE_TYPE_ELF )
            oFilter:Add( FE_CONTROLLER, OP_IS, EffectController() )
            local nElves = oFilter:CountStopAt(20)
            local oCharacteristics = oCard:GetCurrentCharacteristics()
            oCharacteristics:GrantAbility( nElves )
         end
      </CONTINUOUS_ACTION>
This method is more reliable than the checks for CHARACTERISTIC_CANT_USE_ACTIVATED_ABILITIES and PLAYER_CHARACTERISTIC_CANT_ACTIVATE_NONMANA_ABILITIES in the Gaea's Cradle code you posted as RSN_CheckSwitchToFallback() checks for more situations and handles them better. You would still need the resource MANA_ABILITYs for as many mana as you allow for the backup (since Elvish Archdruid is an Elf you really shouldn't have to worry about the case having 0 elves, but if you choose a max of 10 you will need resources 1-10 if you choose a max of 20 then you need resources 1-20 and so forth).
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: New card - Elvish Archdruid (but not actually new...)

Postby PhilistineAu » 04 Jun 2014, 10:49

Thanks! I really appreciate the detailed responses. It makes it a lot easier to understand what is going on and more importantly, why.

I'll update and post the new code for you guys to take a look at.

When you say approximated mana do you mean it is kept in a separate pool and used only to cast the next spell? Is there some limitation that prevents it being added to the usual pool? My apologies if there is a thread I should be reading more about these on?

I had wondered what all the AI text was about? Does the AI use this card properly if I wanted to include it in a deck to battle against?

Thanks again!

Phil
PhilistineAu
 
Posts: 22
Joined: 29 Sep 2012, 19:37
Has thanked: 0 time
Been thanked: 1 time

Re: New card - Elvish Archdruid (but not actually new...)

Postby RiiakShiNal » 04 Jun 2014, 12:22

PhilistineAu wrote:When you say approximated mana do you mean it is kept in a separate pool and used only to cast the next spell? Is there some limitation that prevents it being added to the usual pool? My apologies if there is a thread I should be reading more about these on?
DotP (up to 2014) does not have a mana pool (at all). DotP manages mana by using the auto-tap MANA_ABILITYs when it needs mana to cast a spell or pay for an ability, this approach simplifies mana usage and prevents tapping sources unnecessarily, however, it also has some severe limitations. The auto-tap method can't be used to split up mana for multiple casts or activations, it can't be tapped for mana then untapped (through an ability) and tapped for mana again for a single spell/ability, and it doesn't give the player true control over what to tap. To combat these severe limitations we approximate a mana pool using invisible single use mana tokens (with each token representing a single mana, each token has a basic auto-tapping MANA_ABILITY on it to provide the actual mana). However, we can only create these tokens from a non-mana ability (such as a TRIGGERED_ABILITY or ACTIVATED_ABILITY) which means that many cards that use our approximations would trigger something like Burning-Tree Shaman (which is why I came up with an implementation of Burning-Tree Shaman that is compatible with my manual mana functions). The manual-tap method does solve many of the limitations of auto-tap mana, such as multi-tapping (tap, untap, tap again), allows for easier to code dual- and multi-lands, allows the player to properly choose what sources to tap, allows using mana from a single source to cast multiple spells/activate multiple abilities, and allows for special cards like Omnath, Locus of Mana, Mana Flare, Reflecting Pool, Exotic Orchard, and Shizuko, Caller of Autumn.

For more information about the pros and cons of manual mana check out my wiki page for it.

PhilistineAu wrote:I had wondered what all the AI text was about? Does the AI use this card properly if I wanted to include it in a deck to battle against?
The AI_AVAILABILITY tags are to limit how often the AI considers using the fake mana abilities. Without all those tags the AI would consider using the fake mana all the time which would result in slowing the game down even more. Unfortunately, the AI still doesn't properly understand how to use manual-tapping mana and will often not use it at all or will use it incorrectly (such as tapping it for mana and then not using the mana).
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times


Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 30 guests


Who is online

In total there are 30 users online :: 0 registered, 0 hidden and 30 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 30 guests

Login Form