At 05:53 AM 8/19/00 -0700, greerga wrote:
>I tried doing something similar once, putting all of the spells into a
>'struct' instead of the 'switch' blocks but ultimately gave up as there are
>too many differences, special cases, and tests to take care of to make it
>practical.
>
I wanted to add over 300 spells to my mud, and it quickly became apparent
that I lack the patience required to do this in stock circle. I don't
remember exactly but I think there are 5-6 changes you have to make to
separate source files in order to add a single spell. In practice, this
means adding large, repetitious blocks of spellos and skill_levels. I
realized that it wouldn't be too difficult to add a plaintext file
containing this information.
My own approach was to expand spell_info_type and base my work from that.
struct spell_info_type {
char *name; /* name of spell */
char *plural; /* plural name of spell */
byte min_position; /* Position for caster */
int mana_min; /* Min amount of mana used by a spell (highest lev) */
int mana_max; /* Max amount of mana used by a spell (lowest lev) */
int mana_change; /* Change in mana used by spell from lev to lev */
int min_level[NUM_CLASSES]; /* must == num_classes in structs.h */
int routines;
byte violent;
int targets; /* See below for use with TAR_XXX */
long type; /* SPL_XXX. Mana-spell/skill/memorize-spell? */
int spell_level; /* Rank of the spell, for wizard spells use 0 for
nonwizards */
byte deleted; /* don't write spell to file */
int sortpos; /* this spell's # in alphabetical order of all
spells */
char *wearoff; /* spell/skill wearoff message */
... and so on... (info about damdice, healdice, affect bits etc. excerpted)
... And then load the spells from a file. I took an ascii approach because
I have ascii pfiles and xapobjs, as well as ascii object and mob world
files.
#1
Name:
armor~
Plural:
armors~
Wearoff:
You feel less protected.~
MinPos: 7
MinMana: 15
MaxMana: 30
ChangeMana: 3
Violent: 0
Routines: b
Targets: b
Types: an
Cleric: 1
Priest: 4
... and so on...
My implementation is not even close to finished; as George Greer wrote, there
are a ton of special cases that need to be implemented. However, even the
minimal version I have now (and the Obuild-based OLC spelleditor that
interfaces with it) has saved me an enormous amount of work.
< 5000H 5000M 1000V > spellstat 2
Name: teleport (#2), Plural: teleports
Violent?: no
Mana cost: 50/75 (-3/level)
Min position: Standing
Routines: mag_teleport
Targets: char_room
Type: Magic Cast
Teleport room: -1 (random)
Wizard: 88
Melissa Jadwinski/meer@meersan.net
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 04/11/01 PDT