Skip to content
webxoss edited this page Nov 23, 2018 · 3 revisions

Effects Handling

Effects handling is a core topic of WIXOSS(and most of other card games), which accounts for over 90% of the game flow.

As written in human readable language, you might think effects an easy deal. But things are not that simple:

  1. Even a simplest constant effect is not simple

    [Const]: The opposing SIGNI's power -1000.

    Could we simply set the power to (origin power - 1000)? What if it comes up with an opposing SIGNI saying "[Const]: In attack phase, this SIGNI's power become 2000."? Where to store the informations for recovering opposing SIGNI's power? How do we trigger recalculation when either this SIGNI or the opposing SIGNI enters or leaves? How do we handle cases like effect lost or effect immunity? How do we abstract all these things into a common model that satisfies other constant effects like changing color or gaining abilities?

  2. Unreasonable constant effect

    [Const]: Draw one card.

    Is this a valid constant effect? Why not? What's the limitation? Or, in general, what a constant effect exactly is?

  3. Infinite loop

    [Const]: As long as the opposing SIGNI's power is less than 10000, this SIGNI's power become 15000.

    What happens when two SIGNIs with above effect and origin power of 5000 appear opposing to each other? How do we handle such infinite loop? Is it possible to avoid or detect potential infinite loops?

  4. Rule breaker

    [Const]: As long as this SIGNI's power is more than 10000, skip your charge phase.

    Should we simply hard code the detecting logic in charge phase(consider cases such the SIGNI lost its effects)? Is it possible to change game rules in a effect without touching the rule codes? How could we handle a rule-breaking effect as a common constant effect?

  5. Effect queue management

    [Const]: When this SIGNI gets banished, draw one card.

    It seems like a different type of effects with the "As long as ...," ones. Is it still a constant effect? When and how do we listen to the banish event?

    As the official rule, if this SIGNI gets banished by another effect saying "[Action]: Banish a SIGNI, then discard a card.", its effect should be resolved after discarding. Further, if multiple effects get triggered during that banishing effect, all triggered effects must be queued, then after discarding, be handled in player-decided order. How do we manage these logics?

  6. Mixed effect

    [Action]: Until turn end, one of your SIGNI gets "[Const]: In your turn, when this SIGNI gets banished, draw one card.".

    Terrible! How should we build up such a mixed effect?

  7. And more...

    There are Spells, Arts, Actions, Constants, OnPlays, Life Bursts... Are they the same? Are they different?

Before starting WEBXOSS project, I'd spent almost a month just thinking and thinking over these head-aching questions. Thank Mayu, I finally found out my answer -- the effect system of WEBXOSS.

(If you are interested, try to build up your own effect system before reading ahead!)

Let's begin with the Types of Effects.