Page 1 of 1

Programming question

PostPosted: 17 Mar 2013, 09:10
by gopher
Hi people.

First, thank yo so much for the availability and the quality of your programming work, I really enjoy playing dotp modding decks for a couple of months :D, and especially making my decks and cards.

Looking at your code, I've learned how to write some simple cards (I hope to share them someday) like the funny Ovinomancer, Thawing Glaciers or Soratami Rainshaper, but I'm completely stuck with the Offering feature of the Patron of the Moon card as I can't find such a feature implying tests and maths in previously released cards, and as I'm really far from being a real programmer...

How would you code that ?

Thank you very much in advance,

Gopher.

Re: Programming question

PostPosted: 17 Mar 2013, 09:34
by thefiremind
Don't feel discouraged for not being able to code the offering mechanic: there's no way to code it 100% properly. There are probably some ways to get close to it, but I never tried. I guess there would be the same problems as convoke, more or less. With these functions you could retrieve the mana cost of the Moonfolks you control (luckily there are no Moonfolks with hybrid or phyrexian mana, because my functions don't work with them), which is required for sure... what to do next, well, I have to think a bit about it. :wink:

EDIT: Now that I think about it, there's a problem that could be hard to solve: if you have a Sapphire Medallion or similar cards, there's no way to retrieve the current total cost decrease and apply it to the Patron after doing the math about the Moonfolk.

Re: Programming question

PostPosted: 17 Mar 2013, 10:09
by gopher
thefiremind wrote: With these functions you could retrieve the mana cost of the Moonfolks you control [...] which is required for sure... what to do next, well, I have to think a bit about it. :wink:
Thank you very much for a so quick answer :D I'm looking at the code of these functions right now, it's enlightening but there are so many intricated things to do for this Offering mechanism that it seems yet far beyond my limited skills... I'm thinking a lot about it, anyway :D

EDIT : Searching for already written code, I've found Conclave Equenaut for example, in RiiakShiNal Data_DLC_8192 (not offering but convoke). Maybe can it be of a help, but it's the longest and most complicated code I've seen in cards so far...


G.

Re: Programming question

PostPosted: 17 Mar 2013, 19:46
by thefiremind
I opened a topic in Programming Talk with my current solution for the offering mechanic:
viewtopic.php?f=63&t=9803
read about the approximations I did, test the card, and have fun. :D

Re: Programming question

PostPosted: 17 Mar 2013, 20:46
by gopher
thefiremind wrote:I opened a topic in Programming Talk with my current solution for the offering mechanic:
viewtopic.php?f=63&t=9803
read about the approximations I did, test the card, and have fun. :D
That's very nice of you, thanks a lot :). I'm running out of time tonight, I'll test it and read your code more carefully tomorrow. Thanks again and keep on the good work :D

G.

Re: Programming question

PostPosted: 20 Mar 2013, 15:09
by gopher
thefiremind wrote:I opened a topic in Programming Talk with my current solution for the offering mechanic:
viewtopic.php?f=63&t=9803
read about the approximations I did, test the card, and have fun. :D
Hello.

I've taken the time to study your code and test the "Patron of the moon" which works great. I can't say I understand all the details of your code but at least it's a great programming lesson :D I really didn't realized when asking this question that it could be so complex to implement that, I was just hoping some explanations about some tests and maths... Thanks again for all this work.

I'd have another question if I may, about Amulet of Vigor, speaking of Landfall decks. I've just coded the ability regarding the lands, not all permanent types, and it seems that the artifact activates itself anytime I play a land, would there be a cleaner way to code this, especially when the card will test creatures, artifacts and so on ?

Code: Select all
 <TRIGGERED_ABILITY  filter_zone="ZONE_IN_PLAY">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever a permanent enters the battlefield tapped and under your control, untap it.]]></LOCALISED_TEXT>
    <TRIGGER value="ZONECHANGE_END" simple_qualifier="objectyoucontrol" to_zone="ZONE_IN_PLAY" >
<!--      return TriggerObject():ComesIntoPlayTapped() -->
    return TriggerObject():GetCardType():Test( CARD_TYPE_LAND ) ~= 0
    </TRIGGER>

    <TARGET_DEFINITION id="0">
    local filter = Object():GetFilter()
    filter:Clear()
    filter:AddCardType( CARD_TYPE_LAND )
    filter:SetZone( ZONE_IN_PLAY )
    filter:AddExtra( FILTER_EXTRA_LAND_TAPPED )
    filter:SetHint( HINT_ENEMY, EffectController() )
    </TARGET_DEFINITION>
    <TARGET_DETERMINATION>
    return AtLeastOneTargetFromDefinition(0)
    </TARGET_DETERMINATION> 
    <RESOLUTION_TIME_ACTION>
    if TriggerObject() ~= nil then
       TriggerObject():Untap()
    end

    </RESOLUTION_TIME_ACTION>
Finally, Patron of the moon + Meloku + Amulet of Vigor is a little hard to play, but a very effective and funny combination when one has the chance to encounter and play those cards.

Best,

G.