Re: Spell Targets

From: James Turner (turnerjh@XTN.NET)
Date: 04/23/98


Angus Mezick <angus@EDGIL.CCMAIL.COMPUSERVE.COM> writes:

> that works great for TAR_ROOM_CHAR and TAR_DOOR_CHAR, but what about
> TAR_ROOM_WORLD and TAR_ROOM_MOB.  hmm... i think i have come up something rather
> flexible.  Just pass this struct around filling in the required places, and
> letting the TAR_* take care of which member is valid.  I am really trying to
> avoid manual spells, because I see a lot of these spells coming in.
>
>
> struct spell_target {
>   struct char_data *tch;
>   struct obj_data *tobj;
>   struct room_direction_data *tdir;
>   struct room_data *troom;
>   struct someothertarget_data *tother; /* just an example */
> };
>
> and then we just set the targets we need and use the TAR_* flags to determine
> which flags are needed.

This thread has taken an interesting turn.  In my current project,
I've completely redone the magic system, and it allows for targetting
of spells like this.  What I've done is broken the system up somewhat
and used a spell_interpreter based on the idea of command_interpreter.
Adding spells is a brease, and it is very flexible in other respects.
Actually, I did the code for general skills, and use a
skill_interpreter, but it's the same idea.  The code is fairly tested,
though not completely so.  Basically there is a function,

TARGET_DATA *skillFindTarget(CHAR_DATA *ch, int skillnum, char *targ);

struct target_data {
  CHAR_DATA *ch;
  OBJ_DATA *obj;
  int direction;

  int target;
};

typedef struct target_data TARGET_DATA;

The target entry is a flag of what type of target has been found.  The
function is fairly well tested, though not heavily so.  I'll post it
if anyone is interested, but only parts of it will be of much use,
since it interfaces fairly intimately with my skill code, which has no
stock left in it, either.  The direction is simply an integer
containing NORTH, SOUTH, etc; it doesn't validate that the direction
actually has an exit (allowing for spells perhaps to make limited
doors, or something of the like).

--
James Turner               turnerjh@xtn.net
                           http://www.vuse.vanderbilt.edu/~turnerj1/


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



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