Page 1 of 1

Upkeep mana costs

PostPosted: 09 Mar 2013, 22:24
by Thran75
May someone help me? I do like know how implement the mana costs in upkeep and cumulative in cards like Junun Efreet for exemple or stasi
.

Re: Upkeep mana costs

PostPosted: 09 Mar 2013, 22:37
by thefiremind
There are 2 ways: by using conditional mana costs, or by implementing the query manually. Conditional mana costs are asked to be paid before resolution, so I don't like to use them because it's not optimal rule-wise.

This is how I made the ability for Nicol Bolas:
Code: Select all
  <TRIGGERED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[At the beginning of your upkeep, sacrifice Nicol Bolas unless you pay {U}{B}{R}.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[All’inizio del tuo mantenimento, sacrifica Nicol Bolas a meno che non paghi {U}{B}{R}.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Opfere Nicol Bolas zu Beginn deines Versorgungssegments, falls du nicht {U}{B}{R} bezahlst.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Au début de votre entretien, sacrifiez Nicol Bolas à moins que vous ne payiez {U}{B}{R}.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Al comienzo de tu mantenimiento, sacrifica a Nicol Bolas a menos que pagues {U}{B}{R}.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[あなたのアップキープの開始時に、あなたが{U}{B}{R}を支払わないかぎり、ニコル・ボーラスを生け贄に捧げる。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[At the beginning of your upkeep, sacrifice Nicol Bolas unless you pay {U}{B}{R}.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[В начале вашего шага поддержки пожертвуйте Николя Боласа, если вы не заплатите {U}{B}{R}.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[No início de sua manutenção, sacrifique Nicol Bolas, a menos que você pague {U}{B}{R}.]]></LOCALISED_TEXT>
    <TRIGGER value="BEGINNING_OF_STEP" simple_qualifier="controller">
    return ( EffectController():MyTurn() ~= 0 ) and ( MTG():GetStep() == STEP_UPKEEP )
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    local controller = EffectController()
    if controller ~= nil and controller:CanAfford("{U}{B}{R}") == 1 then
       controller:BeginNewMultipleChoice()
       controller:AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_YES" )
       controller:AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_NO" )
       controller:AskMultipleChoiceQuestion( "CONDITIONAL_QUESTION_BODY" )
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local controller = EffectController()
    if controller ~= nil then
       if controller:CanAfford("{U}{B}{R}") == 1 and Object():GetMultipleChoiceResult() == 0 then
          controller:TapLand("{U}{B}{R}")
       elseif EffectSource() ~= nil then
          EffectSource():Sacrifice(controller)
       end
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
Change all the occurrences of "{U}{B}{R}" with the cost you need, and you can reuse this code for any similar card (Junun Efreet included).

Cumulative upkeeps would be a bit more complicated: the latest rulings for cumulative upkeep state that you must add one age counter to the card during each upkeep, and then pay the cost once for each age counter. I never tried to implement it, but I can come up with something if you need it, just write one of the cards with cumulative upkeep you need so I know where to start.

Re: Upkeep mana costs

PostPosted: 10 Mar 2013, 14:00
by RiiakShiNal
Probably the easiest way to handle cumulative upkeep would be to create a function that generates a mana string based on the number of age counters on the object and the base mana cost for a single age counter, store the returned string in a local variable then use that variable in place of the hard coded mana strings then handle it much like thefiremind does regular upkeep above. Though it would only work properly for cumulative upkeeps that do not have multiple options of paying.

For those which you have the option of paying in multiple ways the easiest way would probably be looping the choice/payment until it has been paid X times where X is the number of age counters. Non-optimal, but it would work.

Re: Upkeep mana costs

PostPosted: 10 Mar 2013, 14:09
by thefiremind
RiiakShiNal wrote:For those which you have the option of paying in multiple ways the easiest way would probably be looping the choice/payment until it has been paid X times where X is the number of age counters. Non-optimal, but it would work.
Another solution would be to treat, for example, "Cumulative upkeep {B} or {R}" as "Cumulative upkeep {BR}".

Re: Upkeep mana costs

PostPosted: 11 Mar 2013, 13:35
by RiiakShiNal
thefiremind wrote:Another solution would be to treat, for example, "Cumulative upkeep {B} or {R}" as "Cumulative upkeep {BR}".
That would indeed work for alternate mana cumulative upkeeps, and using Phyrexian mana could even work for something that alternates between mana and 2 life.

Re: Upkeep mana costs

PostPosted: 13 Mar 2013, 16:18
by Thran75
It worked very good now thanks