Multi-attack for mobs (fwd)

From: Billy H. Chan (~{3B:FH;~}) (bhchan@csua.berkeley.edu)
Date: 10/27/95


Darn, first mail got lost... anyway, to belabor the point, here's my
solution of the problem Edward(?) was having...
-Billy H. Chan	~{3B:FH;~}		    <bhchan@csua.berkeley.edu> 
 For more, check out http://www.csua.berkeley.edu/~bhchan
 NovaCmdr. 'Suicide Strom' of Clan Wolf | FiestyFly FireMoth Variant
 "If you're going under 100kph, you might as well stand still"


in db.c within interpret_espec I have:
  CASE("Attacks") {
    RANGE(0, 99);
    mob_proto[i].mob_specials.attack_num = num_arg;
  }

(yes, 99 seems high, but I'm using MonsterManual mobs, so I don't think
I'll ever need to go so high)

in structs.h within struct mob_special_data:
   byte attack_num;         /* The number of attacks                   */


and finally, the main enchilada itself, in fight.c within perform violence:

{
  struct char_data *ch;
  extern struct index_data *mob_index;
  unsigned int attacks = 1;

  for (ch = combat_list; ch; ch = next_combat_list) {
    next_combat_list = ch->next_fighting;

    attacks = 1;
    if (IS_NPC(ch))
        attacks = dice(1, MAX(1, ch->mob_specials.attack_num));
    else { /* PC */
        if (number(1, 101) <= GET_SKILL(ch, SKILL_SECOND_ATTACK))
                attacks++;
        if (number(1, 101) <= GET_SKILL(ch, SKILL_THIRD_ATTACK))
                attacks++;
        if ((IS_WARRIOR(ch) && GET_NUM_OF_CLASS(ch) == 1) ||
             IS_SAMURAI(ch) || IS_BARBARIAN(ch) || IS_MONK(ch))
                attacks += MAX(0, (lvD8(ch) - 2));
    }

    while(attacks-- > 0) {
      if (FIGHTING(ch) == NULL || ch->in_room != FIGHTING(ch)->in_room) {
        stop_fighting(ch);
        continue;
      }
      if (IS_NPC(ch)) {
        if (GET_MOB_WAIT(ch) > 0) {
          GET_MOB_WAIT(ch) -= PULSE_VIOLENCE;
          continue;
        }
        GET_MOB_WAIT(ch) = 0;
        if (GET_POS(ch) < POS_FIGHTING) {
          GET_POS(ch) = POS_FIGHTING;
          act("$n scrambles to $s feet!", TRUE, ch, 0, 0, TO_ROOM);
        }
      }
      if (GET_POS(ch) < POS_FIGHTING) {
        send_to_char("You can't fight while sitting!!\r\n", ch);
        continue;
      }
      hit(ch, FIGHTING(ch), TYPE_UNDEFINED);
    }
    if (MOB_FLAGGED(ch, MOB_SPEC) && mob_index[GET_MOB_RNUM(ch)].func != NULL)
      (mob_index[GET_MOB_RNUM(ch)].func) (ch, ch, 0, "");
  }
}



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