[CODE SNIP/CODE IDEA] Thac0 and Saving throws

From: Kaine LaZaro (demond@tolkien.realms.org)
Date: 02/16/99


in class.c change your byte saving_throws and thack0 to these:
byte saving_throws(int class_num, int type, int level)
{

  switch (class_num) {
  case CLASS_MAGIC_USER:
    switch (type) {
    case SAVING_PARA:   /* Paralyzation */
      return 70 - level;
    case SAVING_ROD:    /* Rods */
      return 50 - level;
    case SAVING_PETRI:  /* Petrification */
      return 65 - level;
    case SAVING_BREATH: /* Breath weapons */
      return 75 - level;
    case SAVING_SPELL:  /* Generic spells */
      return 60 - level;
    default:
      log("SYSERR: Invalid saving throw type.");
    }
    break;
  case CLASS_CLERIC:
    switch (type) {
    case SAVING_PARA:   /* Paralyzation */
      return 60 - level;
    case SAVING_ROD:    /* Rods */
      return 70 - level;
    case SAVING_PETRI:  /* Petrification */
      return 65 - level;
    case SAVING_BREATH: /* Breath weapons */
      return 80 - level;
    case SAVING_SPELL:  /* Generic spells */
      return 75 - level;
    default:
      log("SYSERR: Invalid saving throw type.");
    }
    break;
  case CLASS_THIEF:
    switch (type) {
      return 60 - (level/2);
    case SAVING_ROD:    /* Rods */
      return 70 - (level/2);
    case SAVING_PETRI:  /* Petrification */
      return 60 - (level/2);
    case SAVING_BREATH: /* Breath weapons */
      return 80 - (level/2);
    case SAVING_SPELL:  /* Generic spells */
      return 75 - (level/2);
    default:
      log("SYSERR: Invalid saving throw type.");
    }
    break;
  case CLASS_WARRIOR:
    switch (type) {
    case SAVING_PARA:   /* Paralyzation */
      return 70 - (level/3);
    case SAVING_ROD:    /* Rods */
      return 80 - (level/3);
    case SAVING_PETRI:  /* Petrification */
      return 70 - (level/3);
    case SAVING_BREATH: /* Breath weapons */
      return 80 - (level/2);
    case SAVING_SPELL:  /* Generic spells */
      return 75 - (level/3);
    default:
      log("SYSERR: Invalid saving throw type.");
    }
  default:
    log("SYSERR: Invalid class saving throw.");
  }

  /* Should not get here unless something is wrong. */
  return 100;
}

/* THAC0 for classes and levels.  (To Hit Armor Class 0) */
int thaco(int class_num, int level)
{
  int mod;
  swicth(class_num) {
    case CLASS_MAGIC_USER: mod = 5; break;
    case CLASS_WARRIOR: mod = 1; break;
    case CLASS_CLERIC: mod = 3; break;
    case CLASS_THIEF: mod = 2; break;
    default: mod = 5; break;
  }
  return 100 - (mod * level);

  /* Will not get there unless something is wrong. */
  return 100;
}

*note* this is based on a 100 level system, alter to suit your needs. This
will also allow the adding of levels and classes without a large amount of
hassle and will save key strokes, when/if I learn how do do patches I'll
toss this one up on the ftp site.

James

`Up, Down, Over, and Through, Back arround the Jokes on you!'
 -- Magic the Gathering


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



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