[crossfire] Spellcasting Swords progress

Nicolas Weeger nicolas.weeger at laposte.net
Sun Jun 5 03:20:58 CDT 2005


>
     
       The other possiblity would be to change the code, so that the sword 
     
     >
     
      itself can act as the caster object.  I'm not sure what changes would 
     
     >
     
      need to be made - perhaps not too many.  The real complication here is 
     
     >
     
      that for weapon improvement, it probably uses some of the same fields as 
     
     >
     
      you'd need to it to be a casting object.  The simple solution this is 
     
     >
     
      that spell casting weapons can't be improved - then you don't have to 
     
     >
     
      worry about that conflicting use of fields.
     
     
I propose an option, but it's a long-time goal as it implies to 
refactor many parts of the code. It's a rough proposal.

The idea is to replace the 'type' field (which stores only one value) 
with a binary value, flags indicating what the item can do.
So you could have 'is_weapon 1', and 'cast_spell 1' at the same time.
Of course arises the issue of the different parameters of the item 
(spell points, and so on). Let's put items in the inventory, with a 
special flag ('is_parameter 1') and the associated specific flag.

Thus you'd have: (* = item, + = parameter)
* sword
  + is_weapon 1
  + casts_spell 1
  * sword caracteristics
   + is_parameter 1
   + is_weapon
   + wc
   + damage
  * spell caracteristics
   + is_parameter 1
   + casts_spell 1
   + sp
   + level

Drawback, there will be many flags (basically one for each item 
type...). Also requires to convert all existing items (argh), and fix 
all maps (argh again). Can probably be done incrementally, ie let 
server convert at load time.
Also it may slow the server, as there's a need to find the item 
parameters often.

Nicolas

    
    


More information about the crossfire mailing list