[CF-Devel] patch for spell system

david delbecq tchize at MailAndNews.com
Sun Feb 10 05:09:46 CST 2002

I wrote a big modification on the way spells are used in the code. This is 
only internal change and does 
not affect the gameplay. The chages include:

 *  The spells internals have been separated from the rest of the code and are 
only accessed using 
functions in a file called spell_library.c. There should be no more access to 
the spells[] table or the 
spellarch[] table
 *  The spells are now saved in a list and not in a table. This allow to have, 
for example, spells numbers 
from 0 to 203 then spells from 500 to 504, then 600 to 602 and so on. There 
may be holes in the list. 
This should help creating new spells since you get a set of number, keep them 
even if someone else is 
creating newspells at the same time. This also open the door for people 
wanting to allow players 
creating spells (get a free number and keep it)
 *   All spells have their internals saved in a file called spellbook. This 
file may be tuned by system 
administrator, the same way the old file spell_params did, but in a larger and 
more human readable way. 
At the bottom of this mail, there is some example line from the file
  *  The spells are casted using a callback in the new structure. This allow 
plugins to reference spells in 
the server. However the hooks for referencing a spell from a plugin has not 
been written yet :(
  *   The file spellbook in the shared crossfire dir is created automagically 
by the server if not available. 
This is done using thed old spells[] structure and the old spell_param file.
   *   The new structure also opens the door for a new kind of spell: the 
localised spells. This will be done 
using a command fire_at <deltax><deltay> instead of fire <direction> so we 
could create spells that aim 
a position and not a direction

I plan to cvs the code next week. But since it is a big change, i send a patch 
for the moment.

-- A part of the spellbook file --

spell magic bullet
# Core server Spell N°0
# a level 1 wizard spell
id= 0
level= 1
sp= 1
charges= 99
time= 2.000000
scrolls= 0
scroll_chance= 0
book_chance= 10
range?= 1
defensive?= 0
cleric?= 0
onself?= 0
targeting?= 0
path= 0x0010
archname= bullet
bdam= 10
bdur= 0
ldam= 1
ldur= 0
spl= 6
casting_plugin= SERVER
casting_function= sp_cast_bullet
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.newspell.gz
Type: application/x-gzip
Size: 71419 bytes
Desc: not available
Url : 

More information about the crossfire mailing list