CODE: BUGFIX: DOH! Bugfix on Assassin: Assassin v.91

From: Chris Grantham (casper@optima.mme.wsu.edu)
Date: 07/18/96


I told you there'd be bugfixes, major blunder on MY part.. don't go flaming
Ryan.. grin.

This is v.9 of the Assassin Code. If you use it please put a reference to
Ryan Biggs and Chris Grantham in your credits file.

*NOTE*: This code is not perfect! There will probably be more releases, but
don't blame us if it's buggy!

This is a code for an assassin that players can hire to kill 
people.  It is based on the Pet shop code.  To use it, drop it in the 
spec_procs.c, and put in a spec_assign.c as well.  Put all the mobs you 
want to be assassins in the room you define and go.  Please, if it works, 
or if any extra coding is needed, PLEASE tell me (Ryan Briggs
[ae744@freenet.toronto.on.ca]). Please give me feedback (either positive 
or negative, I want to know everything)

#define ASSASSIN_LOCATION        *VNUM LOCATION OF ASSASSINS HERE* /* If you
don't set this it ain't my fault, don't come crying to me! */
#define ASSASSIN_PRICE(assassin) (GET_LEVEL(assassin) * 100000)

SPECIAL(assassin)
{
  char buf[MAX_STRING_LENGTH], assassin_name[256];
  int assassin_room;
  struct char_data *assassin, *vict;

  if (CMD_IS("list")) {
    send_to_char("Available assassins are:\r\n", ch);
    for (assassin = world[ASSASSIN_LOCATION].people; assassin;assassin = 
assassin->next_in_room) {
      sprintf(buf, "%8d - %s\r\n", ASSASSIN_PRICE(assassin), 
GET_NAME(assassin));
      send_to_char(buf, ch);
    }
    return (TRUE);
  } else if (CMD_IS("hire")) {

    argument = one_argument(argument, buf);
    argument = one_argument(argument, victim_name);

    if (!(assassin = get_char_room(buf, ASSASSIN_LOCATION))) {
      send_to_char("There is nobody called that!\r\n", ch);
      return (TRUE);
    }
    if (GET_GOLD(ch) < ASSASSIN_PRICE(assassin)) {
      send_to_char("You don't have enough gold!\r\n", ch);
      return (TRUE);
    }

    if (*victim_name) {
      send_to_char("You need to specify a target!\r\n", ch);
      return 0;
    }
    
    if ((vict = get_player_vis(assassin, victim_name, 0))) {
      GET_GOLD(ch) -= ASSASSIN_PRICE(assassin);
      assassin = read_mobile(GET_MOB_RNUM(assassin), REAL);
      char_to_room(assassin, ch->in_room);
      SET_BIT(MOB_FLAGS(assassin), MOB_MEMORY);
      SET_BIT(MOB_FLAGS(assassin), MOB_ASSASSIN);
      remember(assassin, vict);
      HUNTING(assassin) = vict;
      send_to_char("You will be contacted if it succeeds or not.\r\n", ch);
      act("$n hires $N for a job.", FALSE, ch, 0, assassin, TO_ROOM);
      return 1;
    } else {
      send_to_char("The assassin can't find the victim!\r\n", ch);
      return 0;
    }
      
  }
  return 0;
}


add this to damage() before the die(victim) call
    if ((MOB_FLAGGED(ch, MOB_ASSASSIN)) && (HUNTING(ch) == victim)) {
      send_to_char("The assassin has succeeded.\r\n", HIRED_BY(ch));
      extract_char(ch);
    }
    if (MOB_FLAGGED(victim, MOB_ASSASSIN))
      send_to_char("The assassin has failed.\r\n", HIRED_BY(ch));

in structs.h in char_special_data, after *hunting add
    struct char_data *hired_by;

in utils.h add in
  #define HIRED_BY(ch)  ((ch)->char_specials.hired_by)

in interperter.c add in
  { "hire"  , POS_STANDING, do_not_here , 1, 0 },

And, if you want to have several assassin places, with different 
assassins at each place, just ask us...that's the way we are using it in 
ours (you can put better assassins in harder to get to places).


Ryan Biggs
and
Chris Grantham



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