[CODE] Group_gain function...

From: Christoffer Lundberg (avatar@ORION.BODEN.SE)
Date: 04/06/98


I've seen this question on the list before, but I need to bring it
up again, sorry.

I'm experiencing trouble with my group_gain function. When a char
runs and kills our newbie-mobiles, he/she gain 163 exp. I wanted
the group_gain to be the same as the normal exp function, with the
only difference that group_gain will halve for every additional
member in the group (e.g. the 163 exp from single exp, or group_gain
exp with only char itself in the group, should be 81 if there are
two members, 54 if three members).

The problem is that the group_gain is more than the normal exp function.
That is rather strange, but my coding aint the best.

Here follows my void group_gain:

void group_gain(struct char_data * ch, struct char_data * victim)
{
  int tot_members, base;
  struct char_data *k;
  struct follow_type *f;
  int total_levels;

  if (!(k = ch->master))
    k = ch;

  if (IS_AFFECTED(k, AFF_GROUP) && (k->in_room == ch->in_room))
    tot_members = 1;
  else
    tot_members = 0;

  for (f = k->followers; f; f = f->next)
  if (IS_AFFECTED(f->follower, AFF_GROUP) && f->follower->in_room ==
ch->in_room)
    tot_members++;

 total_levels = GET_LEVEL(k);
 base = MIN(max_exp_gain, GET_EXP(victim) / 3);

 for (f = k->followers; f; f = f->next)
    total_levels += GET_LEVEL(f->follower);

 total_levels >>= tot_members;
 base += ((GET_LEVEL(victim) - total_levels) * 30);

 if (IS_AFFECTED(k, AFF_GROUP))
   perform_group_gain(k, base, victim);

 for (f = k->followers; f; f = f->next)
    perform_group_gain(f->follower, base, victim);
}


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