roll_real_abils()

From: fantasia (fantasia@virtual.zipnet.net)
Date: 07/18/96


REPLY TO: eagle@virtual.zipnet.net

Because so many ppl asked for this here it is my roll_real_abils(). you
will note that i made very little modifications to it, and i threw in
parse_class() for the hell of it to demonstrate how to limit classes to
certain races, you throw in checks in parse_class() to limit classes by
attributes also.

I hope everyone enjoys these.

void roll_real_abils(struct char_data * ch)
{
  int i, j, k, temp;
  ubyte table[6];
  ubyte rolls[4];

  for (i = 0; i < 6; i++)
    table[i] = 0;

  for (i = 0; i < 6; i++) {

    for (j = 0; j < 4; j++)
      rolls[j] = number(1, 6);

    temp = rolls[0] + rolls[1] + rolls[2] + rolls[3] -
      MIN(rolls[0], MIN(rolls[1], MIN(rolls[2], rolls[3])));

    for (k = 0; k < 6; k++)
      if (table[k] < temp) {
	temp ^= table[k];
	table[k] ^= temp;
	temp ^= table[k];
      }
  }

  ch->real_abils.str_add = 0;

  ch->real_abils.str = table[0];
  ch->real_abils.intel = table[1];
  ch->real_abils.dex = table[2];
  ch->real_abils.con = table[3];
  ch->real_abils.wis = table[4];
  ch->real_abils.cha = table[5];

  ch->aff_abils = ch->real_abils;
}

int parse_class(struct char_data * ch, char arg)
{
  arg = LOWER(arg);

  switch (arg) {
  case 'm':
    if (GET_RACE(ch) != RACE_DWARF) {
      return CLASS_MAGIC_USER;
    } else {
      return CLASS_UNDEFINED;
    }
    break;
  case 'c':
    if (GET_RACE(ch) != RACE_DWARF) {
      return CLASS_MAGIC_USER;
    } else {
      return CLASS_UNDEFINED;
    }
    return CLASS_CLERIC;
    break;
  case 'w':
    return CLASS_WARRIOR;
    break;
  case 't':
    return CLASS_THIEF;
    break;
  default:
    return CLASS_UNDEFINED;
    break;
  }
}



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