Re: [bpl14] [?] How_Good (Part 1)

From: Stephen Wolfe (siv@CYBERENET.NET)
Date: 09/16/98


ok..this is a multi-part message, since there's a lot of stuff to change,
and a lot that i want to explain :)

> i was wondering is it possible to modify how well an individual skill is
> learned by a certain class or race ie....
> kick (superb)
> bash(good)
> disarm(very good)
> and have those be the max they can practice them?
> so now even if they type practice bash it says learned in that area?
>
> Also had a question about adding race spells
> spell_level(SPELL_CLONE, RACE_ELF, 30);

i did this by getting rid of the prac_params thing (in class.c) and the
min_level int in the spell_info struct (spells.h)..i replaced them with
a struct that looks basically like this:

struct prac_info
{
  int min_level;        /* level can prac               */
  int learned;          /* percent can prac to          */
  bool splskl;          /* is it a spell or skill?      */
  int max;              /* max per prac                 */
  int min;              /* min per prac                 */
};

then change spell_info like so:

struct spell_info_type {
   byte min_position;   /* Position for caster   */
   int mana_min;        /* Min amount of mana used by a spell (highest lev) */
   int mana_max;        /* Max amount of mana used by a spell (lowest lev) */
   int mana_change;     /* Change in mana used by spell from lev to lev */

-  int min_level[NUM_CLASSES];
+  struct prac_info class_params[NUM_CLASSES];
+  struct prac_info race_params[NUM_RACES];
   int routines;
   byte violent;
   int targets;         /* See below for use with TAR_XXX  */
};

so now we have all of that information on a class and race basis..this will
allow us to assign practice amounts, learnedness, levels, etc differently
for different races and classes..of course, this will take quite a bit
more memory since we have to store more data..

so, now you need to change how this information gets assigned..we want to
have everything assigned in init_spells, using the spell_level function
just like it is now..so we have to modify it so that calls will look like
this:

spell_level(SPELL_HEAL, CLASS_CLERIC, 1, 25, 100, SPELL, CLASS, 97);

and the function will look like (it's in spell_parser.c):

void spell_level(int spell, int which, int level, int min, int max,
        bool splskl, bool class_or_race, int learned)
{
  int bad = 0;

  if (spell < 0 || spell > TOP_SPELL_DEFINE) {
    log("SYSERR: attempting assign to illegal spellnum %d/%d", spell, TOP_SPELL_DEFINE);
    return;
  }

  if (class_or_race == CLASS) {
    if (which < 0 || which >= NUM_CLASSES) {
      log("SYSERR: assigning '%s' to illegal class %d/%d.", skill_name(spell),
                which, NUM_CLASSES - 1);
      bad = 1;
    }
  } else if (class_or_race == RACE) {
    if (which < 0 || which >= NUM_RACES) {
      log("SYSERR: assigning '%s' to illegal race %d/%d.", skill_name(spell),
                which, NUM_RACES - 1);
      bad = 1;
    }
  } else {
    log("SYSERR: not assigning '%s' to race OR class.", skill_name(spell);
    bad = 1;
  }

  if (level < 1 || level > LVL_IMPL) {
    log("SYSERR: assigning '%s' to illegal level %d/%d.", skill_name(spell),
                level, LVL_IMPL);
    bad = 1;
  }

  if (min < 0 || min > 100) {
    log("SYSERR: assigning '%s' illegal min %d.", skill_name(spell), min);
    bad = 1;
  }

  if (max < 0 || max > 100) {
    log("SYSERR: assigning '%s' illegal max %d.", skill_name(spell), max);
    bad = 1;
  }

  if (learned < 0 || learned > 100) {
    log("SYSERR: assigning '%s' illegal learned %d.", skill_name(spell),
        learned);
    bad = 1;
  }

  if (splskl != SPELL || splskl != SKILL) {
    log("SYSERR: assigning '%s' illegal splskl %d.", skill_name(spell),
        splskl);
    bad = 1;
  }

  if (!bad) {
    if (class_or_race == CLASS) {
      spell_info[spell].class_params[which].min_level = level;
      spell_info[spell].class_params[which].learned = learned;
      spell_info[spell].class_params[which].min = min;
      spell_info[spell].class_params[which].max = max;
      spell_info[spell].class_params[which].splskl = splskl;
    } else {
      spell_info[spell].race_params[which].min_level = level;
      spell_info[spell].race_params[which].learned = learned;
      spell_info[spell].race_params[which].min = min;
      spell_info[spell].race_params[which].max = max;
      spell_info[spell].race_params[which].splskl = splskl;
    }
  }
}

there will be a second part, finishing up the explaination..

siv


     +------------------------------------------------------------+
     | 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