[NEWBIE] [CODE QUESTION] Saving Throws Formula instead of case statements?

From: Chris Ward (wwc@cyg.net)
Date: 02/14/03


Is there a formula for this, or must I copy and paste this each time for
each new class I add to the mud ?


/*
  * Saving throws for:
  * MCTW
  *   PARA, ROD, PETRI, BREATH, SPELL
  *     Levels 0-40
  *
  * Do not forget to change extern declaration in magic.c if you add to this.
  */

byte saving_throws(int class_num, int type, int level)
{
   switch (class_num) {
   case CLASS_MAGIC_USER:
     switch (type) {
     case SAVING_PARA:   /* Paralyzation */
       switch (level) {
       case  0: return 90;
       case  1: return 70;
       case  2: return 69;
       case  3: return 68;
       case  4: return 67;
       case  5: return 66;
       case  6: return 65;

etc etc ...

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/26/03 PDT