New improved Assassins

From: Doppleganger Software (doppsoft@junctionnet.com)
Date: 02/18/97


Here is the new, improved version:

Doppleganger Software's Hired Assassins for CircleMUD
-----------------------------------------------------

in structs.h
------------

Add a MOB_ASSASSIN & AFF_MARK flags and appropriate entrys in constants.c 
file.

in struct char_special_data add
   struct char_data *assassin;

in struct play_special_data_saved change 2 spare ints to
   int as_rnum;
   int as_room;


in spec_procs.c
---------------
add this entire function somewhere.

#define ASSASSIN_PRICE(as) (GET_LEVEL(as) * 100000)

SPECIAL(assassin)
{
  int as_loc;
  struct char_data *as, *vict;

  as_loc = ch->in_room + 1;

  if (CMD_IS("list")) {
    send_to_char("Available assassins are:\r\n", ch);
    for (as = world[as_loc].people;as;as = as->next_in_room) {
      sprintf(buf, "%8d - %s\r\n", ASSASSIN_PRICE(as), GET_NAME(as));
      send_to_char(buf, ch);
    }
    return 1;
  } else if (CMD_IS("hire")) {
    two_arguments(argument, buf, buf2);
    if(!*buf) {
      send_to_char("Hire who?\r\n", ch);
      return 1;
    }
    if (!(as = get_char_room(buf, as_loc))) {
      send_to_char("There is nobody called that!\r\n", ch);
      return 1;
    }
    if(!IS_NPC(as)) {
      send_to_char("GET THE HELL OUT OF THAT ROOM, NOW !!!\r\n", as);
      sprintf(buf, "%s is in the assassin store room.\r\n", GET_NAME(as));
      mudlog(buf, BRF, LVL_IMMORT, TRUE);
      send_to_char("You can't hire players.\r\n", ch);
      return 1;
    }
    if (!*buf2) {
      send_to_char("Whom do want dead?\r\n", ch);
      return 1;
    }
    if (GET_GOLD(ch) < ASSASSIN_PRICE(as)) {
      send_to_char("You don't have enough gold!\r\n", ch);
      return 1;
    }
    if ((vict = get_player_vis(as, buf2, 0))) {
      GET_GOLD(ch) -= ASSASSIN_PRICE(as);
      as = read_mobile(GET_MOB_RNUM(as), REAL);
      char_to_room(as, ch->in_room);
      SET_BIT(MOB_FLAGS(as), MOB_ASSASSIN);
      SET_BIT(MOB_FLAGS(as), MOB_HUNTER);
      remember(as, vict);
      HUNTING(as) = vict;
      ASSASSIN(vict) = as;
      SET_BIT(AFF_FLAGS(vict), AFF_MARK);
      send_to_char("We cannot contact you if the job succeeds or 
not...security$
      act("$n hires $N for a job.", FALSE, ch, 0, as, TO_ROOM);
      sprintf(buf, "&+R%s hires %s to kill %s.&+w\r\n", GET_NAME(ch),
      GET_NAME(as), GET_NAME(vict));
      mudlog(buf, BRF, LVL_IMMORT, TRUE);
      return 1;
    } else {
      send_to_char("The assassin can't find the mark!\r\n", ch);
      return 1;
    }
  }
  return 0;
}

in act.other.c
--------------

in do_quit after 
    send_to_char("Goodbye, friend.. Come back soon!\r\n", ch);

add
  if (IS_AFFECTED(ch, AFF_MARK) && (ASSASSIN(ch) != NULL)) {
    AS_ROOM(ch) = AS_MOB_ROOM(ch);
    AS_RNUM(ch) = AS_MOB_RNUM(ch);
    extract_char(ASSASSIN(ch));
  }

in db.c
-------
in reset_char add
  ASSASSIN(ch) = NULL;

in fight.c
----------
in damage() after
     if (!IS_NPC(victim)) {
      if (MOB_FLAGGED(ch, MOB_MEMORY))
        forget(ch, victim);
      sprintf(buf2, "%s killed by %s at %s", GET_NAME(victim), 
GET_NAME(ch),
              world[victim->in_room].name);
      mudlog(buf2, BRF, LVL_IMMORT, TRUE);
    }

add
    if ((MOB_FLAGGED(ch, MOB_ASSASSIN)) && (HUNTING(ch) == victim)) {
      extract_char(ch);
      REMOVE_BIT(AFF_FLAGS(victim), AFF_MARK);
    }
    if (MOB_FLAGGED(victim, MOB_ASSASSIN))
      REMOVE_BIT(AFF_FLAGS(HUNTING(victim)), AFF_MARK);


in graph.c
----------
in the function that makes the mob hunt if they have a victim set, change 
the else if to what is shown below.

  } else if (ch->in_room != HUNTING(ch)->in_room) {
    perform_move(ch, dir, 1);
    if (ch->in_room == HUNTING(ch)->in_room) {
      if (!ROOM_FLAGGED(ch->in_room, ROOM_PEACEFUL)) {
        do_say(ch, "You coward!  I will kill you!!", 0, 0);
        act("$n lunges at $N!!", FALSE, ch, 0, (HUNTING(ch)), TO_ROOM);
        hit(ch, HUNTING(ch), TYPE_UNDEFINED);
      } else {
        if (!MOB_FLAGGED(ch, MOB_ASSASSIN))
          act("$n says, 'Coward!  Come out of here and fight me $N!'", 
FALSE, c$
        }
    }
    return;
  }

in handler.c
------------
in extract_char add
  if (IS_NPC(ch)) {
    if (MOB_FLAGGED(ch, MOB_ASSASSIN) && HUNTING(ch))
      REMOVE_BIT(AFF_FLAGS(HUNTING(ch)), AFF_MARK);
  }


in interpreter.c
----------------
before in nanny()
      char_to_room(d->character, load_room);
      affect_total(d->character);
      act("$n has entered the game.", TRUE, d->character, 0, 0, TO_ROOM);

add
    if (IS_AFFECTED(d->character, AFF_MARK)) {
      as = read_mobile(AS_RNUM(d->character), REAL);
      char_to_room(as, AS_ROOM(d->character));
      SET_BIT(MOB_FLAGS(as), MOB_ASSASSIN);
      SET_BIT(MOB_FLAGS(as), MOB_HUNTER);
      remember(as, d->character);
      HUNTING(as) = d->character;
      ASSASSIN(d->character) = as;
    }

in utils.h
----------
add
  #define ASSASSIN(ch)  ((ch)->char_specials.assassin)
  #define AS_ROOM(ch)   ((ch)->player_specials->saved.as_room)
  #define AS_RNUM(ch)   ((ch)->player_specials->saved.as_rnum)
  #define AS_MOB_ROOM(ch)  (ASSASSIN(ch)->in_room)
  #define AS_MOB_RNUM(ch)  (ASSASSIN(ch)->nr)


Also, you will need to add in a SPECIAL(assassin) in the ASSIGNROOM part 
of spec_assign.c and assign a room.  If you haven't already, you will 
need to add in mob hunting into the mobact.c file.  You will also have to 
assign a "hire" in interpreter.c as a do_not_here command.

Usage:  Assign the assassin to any room.  The vnum IMMEDIATELY after that 
room is a room that should have no exits.  It will contain all the mobs 
that can be hired.  For example, if the assassin hiring room is 3001.  
The room 3002 will have no exits and contain all the mobs that can be 
hired.  If you have any problems, please e-mail me and I can probably 
find the problem.
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
|    Or send 'info circle' to majordomo@cspo.queensu.ca     |
+-----------------------------------------------------------+



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