Board index Programs with AI or Rules Enforcement Magic: The Gathering - Duels of the Planeswalkers Programming Talk
Upkeep mana costs
Moderator: CCGHQ Admins
Upkeep mana costs
by Thran75 » 09 Mar 2013, 22:24
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
by thefiremind » 09 Mar 2013, 22:37
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:
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.
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>
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.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-
thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 721 times
Re: Upkeep mana costs
by RiiakShiNal » 10 Mar 2013, 14:00
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.
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.
Just getting started: Xander9009's DotP 2014 Community Wad
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
- RiiakShiNal
- Programmer
- Posts: 2185
- Joined: 16 May 2011, 21:37
- Has thanked: 75 times
- Been thanked: 496 times
Re: Upkeep mana costs
by thefiremind » 10 Mar 2013, 14:09
Another solution would be to treat, for example, "Cumulative upkeep or " as "Cumulative upkeep ".
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-
thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 721 times
Re: Upkeep mana costs
by RiiakShiNal » 11 Mar 2013, 13:35
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.thefiremind wrote:Another solution would be to treat, for example, "Cumulative upkeep or " as "Cumulative upkeep ".
Just getting started: Xander9009's DotP 2014 Community Wad
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
- RiiakShiNal
- Programmer
- Posts: 2185
- Joined: 16 May 2011, 21:37
- Has thanked: 75 times
- Been thanked: 496 times
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 30 guests