Fare share of exp in group_gain()

From: Michael Gallagher (m_gally@HOTMAIL.COM)
Date: 01/14/01


I wanted to split exp proper within a group so that players get the right
percent as per their level. A level 30 character contributes more to a group
than a level 20. So lets say the exp for the kill is 200 and the group
consists of two level 30's and two level 20's, the level 20's will get 40exp
each and the level 30's will get 60exp each.

here's the code changes in fight.c:

void perform_group_gain(struct char_data * ch, int base,
        struct char_data * victim)
{
  int share;

+  base *= GET_LEVEL(ch);

  share = MIN(max_exp_gain, MAX(1, base));

  if (share > 1) {
    sprintf(buf2, "You receive your share of experience -- %d points.\r\n",
share);
    send_to_char(buf2, ch);
  } else
    send_to_char("You receive your share of experience -- one measly little
point!\r\n", ch);

  gain_exp(ch, share);
  change_alignment(ch, victim);
}


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

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

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

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

  /* round up to the next highest tot_members */
  tot_gain = (GET_EXP(victim) / 3) + tot_members - 1;

  /* prevent illegal xp creation when killing players */
  if (!IS_NPC(victim))
    tot_gain = MIN(max_exp_loss * 2 / 3, tot_gain);

  if (tot_members >= 1)
    base = MAX(1, tot_gain / tot_members);
  else
    base = 0;

  if (AFF_FLAGGED(k, AFF_GROUP) && k->in_room == ch->in_room)
    perform_group_gain(k, base, victim);

  for (f = k->followers; f; f = f->next)
    if (AFF_FLAGGED(f->follower, AFF_GROUP) && f->follower->in_room ==
ch->in_room)
      perform_group_gain(f->follower, base, victim);
}


Subliminal
Head Coder of Star Trek: First Contact MUD
www.stfmud.com

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/03/01 PST