Code for Fast agressive mobs, and a iq flag so mobs always hit the one with the lowest hp.

From: Lars Juul (larsjuul@POST2.TELE.DK)
Date: 08/23/97


Code for two new mob flags - if someone can use it :)

Lars Juul

-- 
Software is like sex; it's better when it's free. - Linus Torvalds


MOB_IQ_FIGHT
------------

Add the MOB_IQ_FIGHT flag in struch.h and constants.c -
in fight.c in perform_violence add a vict and tch var and
insert the following after the call for MOB_SPEC:

    if (MOB_FLAGGED(ch, MOB_IQ_FIGHT)) {  /* LJ IQ fight */
      vict = NULL;
      for (tch = world[ch->in_room].people; tch; tch = tch->next_in_room)
        if (FIGHTING(tch) == ch && !IS_NPC(tch))
          if (vict == NULL || GET_HIT(tch) < GET_HIT(vict))
            vict = tch;

      if (vict != NULL && FIGHTING(ch) != vict) {
        stop_fighting(ch);
        hit(ch, vict, TYPE_UNDEFINED);
      }
    }


MOB_FAST_AGGR
-------------

Add the MOB_FAST_AGGR flag in struch.h and constants.c -
in act.movement.c change do_move to:

ACMD(do_move)
{
  register struct char_data *vict, *tmob;
  int found;

  /*
   * This is basically a mapping of cmd numbers to perform_move indices.
   * It cannot be done in perform_move because perform_move is called
   * by other functions which do not require the remapping.
   */
  perform_move(ch, cmd - 1, 0);

  /* LJ Fast Aggressive */
  for (tmob = world[ch->in_room].people; tmob; tmob = tmob->next_in_room)
  {
    if (!IS_NPC(tmob) || !MOB_FLAGGED(tmob, MOB_FAST_AGGR))
      continue;

    found = FALSE;
    for (vict = world[tmob->in_room].people; vict && !found; vict =
vict->next_in_room)
        {
          if (IS_NPC(vict) || !CAN_SEE(tmob, vict) || PRF_FLAGGED(vict,
PRF_NOHASSLE))
            continue;
          if (MOB_FLAGGED(tmob, MOB_WIMPY) && AWAKE(vict))
            continue;

          if (MOB_FLAGGED(tmob, MOB_AGGRESSIVE) ||
           (MOB_FLAGGED(tmob, MOB_AGGR_EVIL) && IS_EVIL(vict)) ||
           (MOB_FLAGGED(tmob, MOB_AGGR_NEUTRAL) && IS_NEUTRAL(vict)) ||
           (MOB_FLAGGED(tmob, MOB_AGGR_GOOD) && IS_GOOD(vict))) {
            hit(tmob, vict, TYPE_UNDEFINED);
            found = TRUE;
          }
    }
  }

}


     +------------------------------------------------------------+
     | 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/08/00 PST