[Crossfire-wiki] [Crossfire DokuWiki] page added: dev:spells

no-reply_wiki at metalforge.org no-reply_wiki at metalforge.org
Fri Dec 1 09:26:17 CST 2006


A page in your DokuWiki was added or changed. Here are the details:

Date        : 2006/12/01 09:26
User        : ryo
Edit Summary: created from doc/Developers/spells

====== Spells ======

===== Background =====

This document describe all things spell and spell related that developers need to know.  This document outlines the new spell objects and how this all works.

===== Spell objects =====

In the old model, each spell had a specific number associated with it.
Monster spell abilities, while objects, just said to use spell number
X.  Given that everything else in the game is object, this hardcoding
of spells was less than ideal.

In the new system, spells are objects.  The spell object the player knows
has the characteristics of the spell.  As a first pass, the existing
spells are just converted to object form.  As time passes, new spells
can be easily added in this system.  It also simplifies the code - the
spells a player knows are now objects in his inventory.  The spell
a wand casts is the spell in its inventory.  The spell a scroll casts
is the spell in its inventory, and the spell you learn by reading
a spellbook is the spell in its inventory.

This model makes it very easy to make variations of some spells.  Want
to make an extra large fireball?  All this is needed is to take the
large fireball arch, increase a few parameters, and your all set.

The following is the fields in the object structure, and how they
correspond to a spell.  Fields that are not mentioned are not used.

| char *name | Name of the spell (large fireball, icestorm, etc) |
| char *lore | Description of the spell to be put in books, or perhaps even to just let the player see.  In a sense, this puts documentation of the spells within the object, instead of having to maintain seperate files. |
| sint16 casting_time | How long it takes to cast the spell (was time). This is the number of ticks it takes for the player to cast the spell, and is thus not a fixed time. |
| face/anim | If the spells is a generic spell that doesn't have an other_arch pointer, this is the face (or animation to use when the spell is cast. |
| uint8 type | set to SPELL (101) (to denote this is spell object) |
| sint16 resist_* | For protection spells, resistance they provide. |
| uint32 attacktype | Attacktype of the spell. |
| uint32 path_* | spell path information. Note as of this writing, only path_attuned is expected to mean anything.  However, I can envision the user of path_repelled/denied to denote that if the caster is attuned to some path, they have penalties in casting this spell. FIXME it's used now, no? |
| sint32 value | Base value of this spell for scroll, spellbooks, wands, rods. |
| sint16 level | Level of the spell |
| other_arch | archetype this spell uses.  In the case of bolts, this is the bolt that is fired. |
| char *skill | Skill needed to cast this spell. |
| sint32 subtype | Sub classification for this spell.  It sort of relates to the existing spell number, but in a more general form. At first pass, subtypes would fall into protection spells, bolt spells, ball spells, cone spells, stat increase spells.  There are a number of spells which can not be abstracted and are unique in their own right (dimension door, word of recall, polymorph, etc). In these cases, there will be one value for that spell type. |
| invisible | Always set to 1, so that the player can't directly see it in their inventory. |
| no_drop | Always 1, so when a spell object is destroyed, the spell it contains is dropped and not freed. |

Suggested casting time values:
  * 5: Combat spells (cones, bolts, balls, etc - ones you cast when in danger)
  * 10-15: Protection spells, other often cast spells.  Summoning spells would fall into this category, as they are often cast when not in immediate danger.
  * ~25: Detection spells, or other spells done when times are safe. Many ability improvement spells might fall into this category.

These are only suggestions - they more or less match when the spell will be used and usefulness.  An attack spell that takes forever to cast isn't very useful.  There are really two things to keep in mind - when the spell is cast, and how long the spell itself last.  A long lasting spell can have a longer casting time, simply because it isn't cast that often and will last for a while (thus, smart players won't cast it in combat).



More information about the crossfire-wiki mailing list