[Circle] [code] Multi-attacks, would this be worth the proccessor time?

From: Walter Goodwin (jgoodwin@expert.cc.purdue.edu)
Date: 08/01/96


I was brainstorming the other day trying to come up with something
that would allow multi-attacks, but without allowing a char. to take
all of their attacks before the mob (or player ;)  Basically, everyone
would get an attack, then those with second attack would get their sec.
attack, and then those with a third attack would get it after everyone
else.   I came up with some psuedo-code, but I have no idea how much
proccessor time and memory this would take up and so I thought I'd
ask here for some opinions.  Anyway, here's the code.

void perform_violence(void)
{

Declarations, add which_attack

for (which_attack = 1; which_attack < 4; which_attack++){

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

    if (FIGHTING(ch) == NULL || ch->in_room != FIGHTING(ch)->in_room) {
      stop_fighting(ch);
      continue;
    }

 if (which_attack < 2) {

    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;
    }
    } 

/* then I'd insert a check to see if the char makes a succesful attack */

   if (can_attack_this_time(ch, which_attack)) 
    hit(ch, FIGHTING(ch), TYPE_UNDEFINED);

  if (which_attack < 2) {
    if (MOB_FLAGGED(ch, MOB_SPEC) && mob_index[GET_MOB_RNUM(ch)].func != NULL)
      (mob_index[GET_MOB_RNUM(ch)].func) (ch, ch, 0, "");
      }
     }
    }
   }

I'd add a variable somewhere in the char structure to keep track of which
attack was made last.  For instance, if a character didn't make his sec.
attack check, then they wouldn't get a chance at a third.  my main
concern is the time it'll take to go through this function considering
how often its called.  I have no idea how much overhead this will produce.
Would anyone happen to have suggestions on a better system?

Jason Goodwin
jgoodwin@expert.cc.purdue.edu 
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



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