tag:blogger.com,1999:blog-889604442512373664.post7477821595613138240..comments2023-10-31T08:28:52.391-07:00Comments on Computer Programming and Magic: The Gathering: Mana Flare and cards that change the rulesForgehttp://www.blogger.com/profile/15838286606081721333noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-889604442512373664.post-54452067435282868362009-02-16T00:07:00.000-08:002009-02-16T00:07:00.000-08:00It's actually a triggered mana ability, meaning it...It's actually a triggered mana ability, meaning it doesn't use the stack. Incantus (the program) can't yet do this, but that's mainly just because we haven't implemented it yet.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-889604442512373664.post-32404242202569461912009-02-14T01:04:00.000-08:002009-02-14T01:04:00.000-08:00note: mana flare does not exactly what you just sh...note: mana flare does not exactly what you just showed: you doubled the mana, but mana flare just adds one mana the land could produce. say you have an Azorius Chancery (T: Add WU to your mana pool.). you could either get WWU or WUU, not WWUU.<BR/><BR/>also, mana flare does not change the ammount the land produced. it adds extra mana to your mana pool. it's a triggered, not a static, rules-changing ability.<BR/>this is important when many of these effects happen.<BR/><BR/>say there are several effects:<BR/>"Whenever a land is tapped for mana, it produces an additional G."<BR/>"Whenever a land is tapped for mana, add R to your mana pool."<BR/>"Whenever a land would produce mana, it produces twice as much of each type of mana instead."<BR/><BR/>okay, the effects are pretty complicated, but what I want to say: When you tap a plains, you should get WWRGG, WWRRGG or WWRG. in the case of mana flare, you should try a triggered ability if possible.Silly Freakhttps://www.blogger.com/profile/09963238585847993157noreply@blogger.comtag:blogger.com,1999:blog-889604442512373664.post-42764026585304180972009-02-13T17:20:00.000-08:002009-02-13T17:20:00.000-08:00rising fruition - when I read that article, it rem...rising fruition - when I read that article, it reminded me a lot of what I implemented in Incantus. So it does seem to help manage the complexity.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-889604442512373664.post-51587430376632824272009-02-13T12:26:00.000-08:002009-02-13T12:26:00.000-08:00What you say about Python is absolutely true. Inca...What you say about Python is absolutely true. Incantus uses stacked functions for all of its zany rules-modifying effects (even basic ones, like "This creature can't block" are handled with stacked functions). This allows the core rules code to be pretty simple, while the cards can modify just about any part of the rules they want (I say just about any part because, as I discovered when I wanted to do Brothers Yamazaki and Mirror Gallery, small functions are easier to replace/override than big functions).<BR/><BR/>Our two basic "stacked function" functions are replace() and override(). Replacements are, obviously, for replacement effects, such as damage prevention and cards like Boon Reflection. Overrides are actually a lot more simple (replacement effects are <I>hard</I>), and not even explicitly named in the Magic comprehensive rules. Whenever you see an effect like "This creature can't block," or "Players can't gain life," or "You may play land cards from your graveyard," these are all implemented (in Incantus) with overrides. Overrides act similar to replacements (they replace an existing function with their own code), but instead of having the player affected by them choose from a list, they all apply all of the time. In order to prevent us from going insane, they have a variety of combiners they can use... logical_and, which takes the result of each function and ANDs them together to see what the function actually returns; logical_or, which I suppose you can guess for yourself; do_all, which executes each function and ignores what they want to return; and most_recent, which is for when the last effect played decides what occurs (I can't think of an example of most_recent, actually. I don't think I've ever used it). There is a fifth type of override, called a global_override, which is sort of like most_recent, except it takes priority over the four "normal" overrides... this is usually for a game-wide change instead of an object-specific change (I.E. "Players can't play lands", or "Players can't gain life" as opposed to "This creature can't block").<BR/><BR/>Now, this is how you <I>use</I> stacked functions... how they actually work is well beyond my level of programming skill. Incantus coded them well before I started working on the project, and they're one of the most important and innovative aspects of the system. I occasionally look at the code, but usually only when I want to feel awed and/or inadequate, because I really can't wrap my brain around exactly how they work (I could probably do it... with a handful of graph paper to make charts on).Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-889604442512373664.post-28564886109153538522009-02-13T07:18:00.000-08:002009-02-13T07:18:00.000-08:00As a side note, I love software patterns but I fin...As a side note, I love software patterns but I find it hard to fully understand them. When do I apply it? How to I use it? What does the code look like in Java?<BR/><BR/>I still consider myself an amateur programmer and I keep reviewing the "book of four" as well as other patterns that I see on the web.Forgehttps://www.blogger.com/profile/15838286606081721333noreply@blogger.comtag:blogger.com,1999:blog-889604442512373664.post-70270894156757893832009-02-13T07:13:00.000-08:002009-02-13T07:13:00.000-08:00Thanks for the info, I'll check it out. There is ...Thanks for the info, I'll check it out. There is an old programmer saying, "Anything can be solved by adding another layer of indirection" and most of the time that is true. Also thank goodness for software patterns, I haven't gotten a chance to use them all, but the ones I use (Command, State, Observer, Singleton, Factory) are invaluable.<BR/><BR/>And in case someone doesn't know about software patterns, checkout the handy-dandy <A HREF="http://en.wikipedia.org/wiki/Software_pattern" REL="nofollow">wikipedia</A>Forgehttps://www.blogger.com/profile/15838286606081721333noreply@blogger.comtag:blogger.com,1999:blog-889604442512373664.post-31554678548052175092009-02-13T00:26:00.000-08:002009-02-13T00:26:00.000-08:00Ideally, you could set up a trigger that happens w...Ideally, you could set up a trigger that happens when a land is tapped for mana, and execute the ability "make another mana of that type". Sounds easy, unless you're a programmer, in which case you cringe and shudder. Well, I do at least.<BR/><BR/>I'm currently implementing a Universal Design Pattern, a la Steve Yegge: http://steve-yegge.blogspot.com/2008/10/universal-design-pattern.html. Also called Prototype Pattern, among other things. I'm hoping that it will help me solve some of the complexities of programming Magic.rising fruitionhttps://www.blogger.com/profile/15416969205173300778noreply@blogger.com