Magic and effects
Now we're getting to the fun stuff!
All spells can be divided into two categories: Instant and Persistent.
Instant spells are simple, they are just like actions. A fireball
spell is instant, for example. You simply create a FireballSpell
and queue it off. When the spell is executed it does all the checks
and mumbo jumbo and all that, and then fires off a fireball (no pun intended).
Subtracts HP (or whatever) from the target. Then that's it - the
spell is gone.
Persistent spells are a bit more complex. Take for instance a
WerewolfSpell. The poor target will turn into a werewolf every
evening for a week. Any spell that sticks around even after it has
been cast is considered to be persistent. A persistent spell is added
to the action queue as usual, but when executed it creates a new object
- an Effect.
An effect is a subclass of Physical and is therefore part of the container
hierarchy. That means it has a physical location in the world, even
though it may be invisible. So when the WerewolfSpell has been cast
on Joe, a WerewolfEffect will be created and added as a child to Joe (which
means it will receive all events that Joe receives). The WerewolfEffect
will sit there silently, watching the clock until evening comes along.
Then it will unplug Joe's normal soul and plug in a WerewolfSoul instead,
and perhaps change some physical attributes of Joe as well. The player
controlling Joe will be very surprised as he notices his character running
around snarling and eating live horses...
In the morning the WerewolfEffect will restore Joe's original attributes
and give him back his normal soul. But it will still be there, waiting
for next evening... he he he. Joe better go find an exorcist or something
Another example could be an AntiOrcEffect that prevents orcs from entering
a room. This Effect becomes a child of the Area itself, or perhaps
a Place (if it has a limited radius). It will watch what is happening
and if an orc comes in or too near it will turned it into a parrot...
Not all effects are magical. Activities often result in effects being
generated for the duration of the activity. Like if someone starts
singing a patriotic song a RaiseBattleMoraleEffect might be created for
the duration of the song, affecting all creatures of the same nation within
So what's the difference between Effects and Activities?
Other than that, they are quite similar.
A Physical can only be involved in one Activity, but can have many Effects.
A Physical always knows what Activity it is involved in - but Effects can
Activities do not have a geographic location (since they aren't subclasses
of Physical). Effects move around with their host.
Special cases - affecting multiple targets
What about an effect that involves more than one target? Like a TwinCurseEffect
which is cast on two targets and will damage the two targets whenever they
move further than 3 squars from each other. Let's say it's cast on
Joe and Fred. Where does the TwinCurseEffect reside - in Joe or Fred?
Well in this case there will probably be two instances of TwinCurseEffect,
one for Joe and one for Fred. The TwinCurseEffect will also have
references to each other, to keep track of their locations. Another
way is to make just one TwinCurseEffect and put it in Joe, and make this
TwinCurseEffect keep track of Fred explicitely. The difference here
is that even the best exorcist in the world couldn't help Fred get rid
of the curse - because he doesn't "have it" (in fact there isn't even a
pointer from Fred to the curse), Joe does.
Of course that could be cool, in cases. Fred is affected by an
"indirect" effect, an effect which resides somewhere else but is affecting
him all the same... *shiver*