#include <sys/types.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include "merc.h" #include "interp.h" #include "magic.h" #include "class.h" /* * class_default_table[] * * Default skills/Stats and Attributes each class * gains on creation. */ const struct class_default_type class_default_table[] = { {"Wizard", 100, 250, 150, {20, 50, 40, 30, 20, 25}, {10, 60, 50, 30, 10, 40}, "dagger", "magic missile"}, {"Priest", 150, 250, 100, {30, 40, 50, 8, 10, 25}, {10, 50, 10, 40, 10, 60}, "mace", "cure light"}, {"Thief", 150, 100, 250, {40, 30, 20, 50, 20, 25}, {40, 10, 50, 60, 10, 10}, "dagger", "dodge"}, {"Fighter", 250, 100, 150, {50, 20, 20, 30, 40, 25}, {60, 10, 10, 40, 50, 10}, "sword", "enhanced damage"}, }; /* * setup_class() * * Sets up a new player's statistics based on * their defaults for that class. */ void setup_class(CHAR_DATA * ch) { int sn, x; int i = find_class_default(class_table[ch->class].name); if (ch->level != 1) return; ch->hit = class_default_table[i].hp; ch->max_hit = class_default_table[i].hp; ch->pcdata->perm_hit = class_default_table[i].hp; ch->mana = class_default_table[i].mana; ch->max_mana = class_default_table[i].mana; ch->pcdata->perm_mana = class_default_table[i].mana; ch->move = class_default_table[i].move; ch->max_move = class_default_table[i].move; ch->pcdata->perm_move = class_default_table[i].move; /* Clear out previous skills.. too lazy * to clean up nanny.c right now */ for (sn = 0; sn < MAX_SKILL; sn++) ch->pcdata->learned[sn] = 0; /* Give em stock stats */ for (x = 0; x != MAX_STATS; x++) { ch->perm_stat[x] = class_default_table[ch->class].stats[x]; ch->mod_stat[x] = class_default_table[ch->class].stats[x]; } for (x = 0; x <= 6; x++) ch->multis[x] = class_default_table[ch->class].multis[x]; /* Give their basic skills */ for (x = 0; skill_table[x].name != NULL; x++) { if (skill_table[x].skill_level[ch->class] != LEVEL_IMMORTAL) ch->pcdata->learned[x] = 0; } sn = skill_lookup(class_default_table[ch->class].default_weapon); ch->pcdata->learned[sn] = 25; sn = skill_lookup(class_default_table[ch->class].default_skill); ch->pcdata->learned[sn] = 25; return; } /* * find_class_default() * * Returns table number of given name for default class * stuff. */ int find_class_default(const char *name) { int i; for (i = 0; i < MAX_CLASS; i++) { if (class_default_table[i].name == NULL) break; if (LOWER (name[0]) == LOWER (class_default_table[i].name[0]) && !str_prefix (name, class_default_table[i].name)) return i; } return -1; }