Re: Some stuff about spells..

From: Ground Zero Enterprises (zero@baker.cnw.com)
Date: 06/24/96


On Sun, 23 Jun 1996, ShadowLord wrote:

> On Sat, 22 Jun 1996, Ground Zero Enterprises wrote:
> 
> > Now on to more important things, has anyone stayed with the current 
> > spello() system but made it a bit more flexible?  I recently was creating
> > a spell 'gate' that could only target players so I added target flags 
> > TAR_PLR_WORLD and TAR_PLR_ROOM but I am also planning on adding a flag 
> > TAR_SPEC that would pass to a diffrent function and determine is a target 
> > is valid.  Then for example it would be easier for you to create a spell 
> > that only targets elves or warrios or mobs that have full hit points.  I 
> > als changed the section of spello() that was a TRUE/FALSE check for 
> > violent to an int so it could record bitvectors and renamed it flags.  
> > Since I haven't added many spells it was easy to change all of the TRUEs 
> > to CAST_VIOLENCE and all the FALSEs to CAST_NONE.  I mainly did this 
> > because i wanted to have sort of, levels of violence.  For example 
> > although 'word of recall' wouldn't start a fight but it may not be 
> > allowed in a PEACEFUL room so that characters couldn't be moved to a 
> > room  where they could be stolen from.  I was just curious if anyone had 
> > done something similar and if so what methods they used to go about it.  
> 
> TAR_CHAR, TAR_CHAR_ROOM, and TAR_MANUAL seem to take care of the things
> you added.  If you want only players you can add a little check in the
> actual case statement for the individual spells.  That seems fairly
> flexible to me.
> 
> [snip] 
> 	-dak

The targetting routines currently don't cater to many possible needs that 
could come up though.  First of all there is no TAR_MANUAL in stock bpl11.
The problem is, say you have a spell like telepathy for example.  It is 
supposed to let you 'tell' a player messages and not mobs (ignore the 
fact this spell is useless).  Now it doesn't really fit any of the stock 
mag_x routines so you flag it as mag_manual and create an 
ASPELL(spell_telepathy) for it.  Now if the first check in it says 

if(!IS_NPC(victim))
   send_to_char("This spell may only target players!", ch);
   return;

the spell won't work on mobs but you will still get a message from 
do_cast so it will look like this

Okay.
This spell may only target players!

and you'll still have to sit through a WAIT_STATE(ch, PULSE_VIOLENCE) 
even tho the spell was never cast.  It would be siompler to just add a 
check at the beginning of the checks to see if the spell had a valid target
like

    if (!target && (IS_SET(SINFO.targets, TAR_SPEC))) 

send it to a function that determines if the specific spell target is 
present using a switch statement.  This would also more easily allow a 
spell like 'knock' or something that would target a door in a room and 
try to magically unlock it.

Well that's enough of my ramblings so Ill shut up now.

Chris



This archive was generated by hypermail 2b30 : 12/18/00 PST