Finished basic race handling
This commit is contained in:
parent
0ec7dd3b79
commit
a922f0812d
@ -45,6 +45,7 @@ void appear(struct char_data *ch);
|
||||
void reset_zone(zone_rnum zone);
|
||||
void roll_real_abils(struct char_data *ch);
|
||||
int parse_class(char arg);
|
||||
int parse_race(char *arg);
|
||||
void run_autowiz(void);
|
||||
|
||||
/* local functions */
|
||||
@ -2171,6 +2172,7 @@ ACMD(do_show)
|
||||
{ "age", LVL_GRGOD, BOTH, NUMBER },
|
||||
{ "height", LVL_GOD, BOTH, NUMBER },
|
||||
{ "weight", LVL_GOD, BOTH, NUMBER }, /* 50 */
|
||||
{ "race", LVL_GRGOD, PC, MISC },
|
||||
{ "\n", 0, BOTH, MISC }
|
||||
};
|
||||
|
||||
@ -2497,6 +2499,15 @@ int perform_set(struct char_data *ch, struct char_data *vict, int mode,
|
||||
affect_total(vict);
|
||||
break;
|
||||
|
||||
case 51:
|
||||
if ((i == parse_race(val_arg)) == RACE_UNDEFINED)
|
||||
{
|
||||
send_to_char(ch, "That is not a race.\r\n");
|
||||
return (0);
|
||||
}
|
||||
GET_RACE(vict) = i;
|
||||
break;
|
||||
|
||||
default:
|
||||
send_to_char(ch, "Can't set that!\r\n");
|
||||
return (0);
|
||||
|
104
src/class.c
104
src/class.c
@ -189,11 +189,14 @@ struct guild_info_type guild_info[] = {
|
||||
|
||||
byte saving_throws(int class_num, int type, int level)
|
||||
{
|
||||
switch (class_num) {
|
||||
switch (class_num)
|
||||
{
|
||||
case CLASS_MAGIC_USER:
|
||||
switch (type) {
|
||||
switch (type)
|
||||
{
|
||||
case SAVING_PARA: /* Paralyzation */
|
||||
switch (level) {
|
||||
switch (level)
|
||||
{
|
||||
case 0: return 90;
|
||||
case 1: return 70;
|
||||
case 2: return 69;
|
||||
@ -240,7 +243,8 @@ byte saving_throws(int class_num, int type, int level)
|
||||
break;
|
||||
}
|
||||
case SAVING_ROD: /* Rods */
|
||||
switch (level) {
|
||||
switch (level)
|
||||
{
|
||||
case 0: return 90;
|
||||
case 1: return 55;
|
||||
case 2: return 53;
|
||||
@ -287,7 +291,8 @@ byte saving_throws(int class_num, int type, int level)
|
||||
break;
|
||||
}
|
||||
case SAVING_PETRI: /* Petrification */
|
||||
switch (level) {
|
||||
switch (level)
|
||||
{
|
||||
case 0: return 90;
|
||||
case 1: return 65;
|
||||
case 2: return 63;
|
||||
@ -334,7 +339,8 @@ byte saving_throws(int class_num, int type, int level)
|
||||
break;
|
||||
}
|
||||
case SAVING_BREATH: /* Breath weapons */
|
||||
switch (level) {
|
||||
switch (level)
|
||||
{
|
||||
case 0: return 90;
|
||||
case 1: return 75;
|
||||
case 2: return 73;
|
||||
@ -381,7 +387,8 @@ byte saving_throws(int class_num, int type, int level)
|
||||
break;
|
||||
}
|
||||
case SAVING_SPELL: /* Generic spells */
|
||||
switch (level) {
|
||||
switch (level)
|
||||
{
|
||||
case 0: return 90;
|
||||
case 1: return 60;
|
||||
case 2: return 58;
|
||||
@ -433,9 +440,11 @@ byte saving_throws(int class_num, int type, int level)
|
||||
}
|
||||
break;
|
||||
case CLASS_CLERIC:
|
||||
switch (type) {
|
||||
switch (type)
|
||||
{
|
||||
case SAVING_PARA: /* Paralyzation */
|
||||
switch (level) {
|
||||
switch (level)
|
||||
{
|
||||
case 0: return 90;
|
||||
case 1: return 60;
|
||||
case 2: return 59;
|
||||
@ -482,7 +491,8 @@ byte saving_throws(int class_num, int type, int level)
|
||||
break;
|
||||
}
|
||||
case SAVING_ROD: /* Rods */
|
||||
switch (level) {
|
||||
switch (level)
|
||||
{
|
||||
case 0: return 90;
|
||||
case 1: return 70;
|
||||
case 2: return 69;
|
||||
@ -529,7 +539,8 @@ byte saving_throws(int class_num, int type, int level)
|
||||
break;
|
||||
}
|
||||
case SAVING_PETRI: /* Petrification */
|
||||
switch (level) {
|
||||
switch (level)
|
||||
{
|
||||
case 0: return 90;
|
||||
case 1: return 65;
|
||||
case 2: return 64;
|
||||
@ -576,7 +587,8 @@ byte saving_throws(int class_num, int type, int level)
|
||||
break;
|
||||
}
|
||||
case SAVING_BREATH: /* Breath weapons */
|
||||
switch (level) {
|
||||
switch (level)
|
||||
{
|
||||
case 0: return 90;
|
||||
case 1: return 80;
|
||||
case 2: return 79;
|
||||
@ -623,7 +635,8 @@ byte saving_throws(int class_num, int type, int level)
|
||||
break;
|
||||
}
|
||||
case SAVING_SPELL: /* Generic spells */
|
||||
switch (level) {
|
||||
switch (level)
|
||||
{
|
||||
case 0: return 90;
|
||||
case 1: return 75;
|
||||
case 2: return 74;
|
||||
@ -675,9 +688,11 @@ byte saving_throws(int class_num, int type, int level)
|
||||
}
|
||||
break;
|
||||
case CLASS_THIEF:
|
||||
switch (type) {
|
||||
switch (type)
|
||||
{
|
||||
case SAVING_PARA: /* Paralyzation */
|
||||
switch (level) {
|
||||
switch (level)
|
||||
{
|
||||
case 0: return 90;
|
||||
case 1: return 65;
|
||||
case 2: return 64;
|
||||
@ -724,7 +739,8 @@ byte saving_throws(int class_num, int type, int level)
|
||||
break;
|
||||
}
|
||||
case SAVING_ROD: /* Rods */
|
||||
switch (level) {
|
||||
switch (level)
|
||||
{
|
||||
case 0: return 90;
|
||||
case 1: return 70;
|
||||
case 2: return 68;
|
||||
@ -771,7 +787,8 @@ byte saving_throws(int class_num, int type, int level)
|
||||
break;
|
||||
}
|
||||
case SAVING_PETRI: /* Petrification */
|
||||
switch (level) {
|
||||
switch (level)
|
||||
{
|
||||
case 0: return 90;
|
||||
case 1: return 60;
|
||||
case 2: return 59;
|
||||
@ -818,7 +835,8 @@ byte saving_throws(int class_num, int type, int level)
|
||||
break;
|
||||
}
|
||||
case SAVING_BREATH: /* Breath weapons */
|
||||
switch (level) {
|
||||
switch (level)
|
||||
{
|
||||
case 0: return 90;
|
||||
case 1: return 80;
|
||||
case 2: return 79;
|
||||
@ -865,7 +883,8 @@ byte saving_throws(int class_num, int type, int level)
|
||||
break;
|
||||
}
|
||||
case SAVING_SPELL: /* Generic spells */
|
||||
switch (level) {
|
||||
switch (level)
|
||||
{
|
||||
case 0: return 90;
|
||||
case 1: return 75;
|
||||
case 2: return 73;
|
||||
@ -917,9 +936,11 @@ byte saving_throws(int class_num, int type, int level)
|
||||
}
|
||||
break;
|
||||
case CLASS_WARRIOR:
|
||||
switch (type) {
|
||||
switch (type)
|
||||
{
|
||||
case SAVING_PARA: /* Paralyzation */
|
||||
switch (level) {
|
||||
switch (level)
|
||||
{
|
||||
case 0: return 90;
|
||||
case 1: return 70;
|
||||
case 2: return 68;
|
||||
@ -976,7 +997,8 @@ byte saving_throws(int class_num, int type, int level)
|
||||
break;
|
||||
}
|
||||
case SAVING_ROD: /* Rods */
|
||||
switch (level) {
|
||||
switch (level)
|
||||
{
|
||||
case 0: return 90;
|
||||
case 1: return 80;
|
||||
case 2: return 78;
|
||||
@ -1033,7 +1055,8 @@ byte saving_throws(int class_num, int type, int level)
|
||||
break;
|
||||
}
|
||||
case SAVING_PETRI: /* Petrification */
|
||||
switch (level) {
|
||||
switch (level)
|
||||
{
|
||||
case 0: return 90;
|
||||
case 1: return 75;
|
||||
case 2: return 73;
|
||||
@ -1090,7 +1113,8 @@ byte saving_throws(int class_num, int type, int level)
|
||||
break;
|
||||
}
|
||||
case SAVING_BREATH: /* Breath weapons */
|
||||
switch (level) {
|
||||
switch (level)
|
||||
{
|
||||
case 0: return 90;
|
||||
case 1: return 85;
|
||||
case 2: return 83;
|
||||
@ -1147,7 +1171,8 @@ byte saving_throws(int class_num, int type, int level)
|
||||
break;
|
||||
}
|
||||
case SAVING_SPELL: /* Generic spells */
|
||||
switch (level) {
|
||||
switch (level)
|
||||
{
|
||||
case 0: return 90;
|
||||
case 1: return 85;
|
||||
case 2: return 83;
|
||||
@ -1396,15 +1421,18 @@ int thaco(int class_num, int level)
|
||||
*/
|
||||
void roll_real_abils(struct char_data *ch)
|
||||
{
|
||||
int i, j, k, temp;
|
||||
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 (i = 0; i < 6; i++)
|
||||
{
|
||||
for (j = 0; j < 4; j++)
|
||||
rolls[j] = rand_number(1, 6);
|
||||
|
||||
@ -1412,7 +1440,8 @@ void roll_real_abils(struct char_data *ch)
|
||||
MIN(rolls[0], MIN(rolls[1], MIN(rolls[2], rolls[3])));
|
||||
|
||||
for (k = 0; k < 6; k++)
|
||||
if (table[k] < temp) {
|
||||
if (table[k] < temp)
|
||||
{
|
||||
temp ^= table[k];
|
||||
table[k] ^= temp;
|
||||
temp ^= table[k];
|
||||
@ -1421,7 +1450,8 @@ void roll_real_abils(struct char_data *ch)
|
||||
|
||||
ch->real_abils.str_add = 0;
|
||||
|
||||
switch (GET_CLASS(ch)) {
|
||||
switch (GET_CLASS(ch))
|
||||
{
|
||||
case CLASS_MAGIC_USER:
|
||||
ch->real_abils.intel = table[0];
|
||||
ch->real_abils.wis = table[1];
|
||||
@ -1457,6 +1487,20 @@ void roll_real_abils(struct char_data *ch)
|
||||
ch->real_abils.str_add = rand_number(0, 100);
|
||||
break;
|
||||
}
|
||||
|
||||
// TODO: Add race modifiers
|
||||
switch (GET_RACE(ch))
|
||||
{
|
||||
case RACE_HAOON:
|
||||
break;
|
||||
case RACE_UTNIR:
|
||||
break;
|
||||
case RACE_DUARON:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
ch->aff_abils = ch->real_abils;
|
||||
}
|
||||
|
||||
|
@ -238,6 +238,7 @@ const char *connected_types[] = {
|
||||
"Changing PW 3",
|
||||
"Self-Delete 1",
|
||||
"Self-Delete 2",
|
||||
"Select race",
|
||||
"Disconnecting",
|
||||
"\n"
|
||||
};
|
||||
|
2
src/db.c
2
src/db.c
@ -2217,6 +2217,7 @@ void store_to_char(struct char_file_u *st, struct char_data *ch)
|
||||
|
||||
GET_SEX(ch) = st->sex;
|
||||
GET_CLASS(ch) = st->chclass;
|
||||
GET_RACE(ch) = st->race;
|
||||
GET_LEVEL(ch) = st->level;
|
||||
|
||||
ch->player.short_descr = NULL;
|
||||
@ -2335,6 +2336,7 @@ void char_to_store(struct char_data *ch, struct char_file_u *st)
|
||||
st->height = GET_HEIGHT(ch);
|
||||
st->sex = GET_SEX(ch);
|
||||
st->chclass = GET_CLASS(ch);
|
||||
st->race = GET_RACE(ch);
|
||||
st->level = GET_LEVEL(ch);
|
||||
st->abilities = ch->real_abils;
|
||||
st->points = ch->points;
|
||||
|
@ -29,6 +29,7 @@ extern room_rnum r_mortal_start_room;
|
||||
extern room_rnum r_immort_start_room;
|
||||
extern room_rnum r_frozen_start_room;
|
||||
extern const char *class_menu;
|
||||
extern const char *race_menu;
|
||||
extern char *motd;
|
||||
extern char *imotd;
|
||||
extern char *background;
|
||||
@ -46,6 +47,7 @@ void echo_on(struct descriptor_data *d);
|
||||
void echo_off(struct descriptor_data *d);
|
||||
void do_start(struct char_data *ch);
|
||||
int parse_class(char arg);
|
||||
int parse_race(char *arg);
|
||||
int special(struct char_data *ch, int cmd, char *arg);
|
||||
int isbanned(char *hostname);
|
||||
int Valid_Name(char *newname);
|
||||
@ -1511,6 +1513,19 @@ void nanny(struct descriptor_data *d, char *arg)
|
||||
return;
|
||||
}
|
||||
|
||||
write_to_output(d, "%s\r\nRace: ", race_menu);
|
||||
STATE(d) = CON_QRACE;
|
||||
break;
|
||||
case CON_QRACE:
|
||||
load_result = parse_race(arg);
|
||||
if (load_result == RACE_UNDEFINED)
|
||||
{
|
||||
write_to_output(d, "\r\nThat's not a race.\r\nRace: ");
|
||||
return;
|
||||
}
|
||||
else
|
||||
GET_RACE(d->character) = load_result;
|
||||
|
||||
write_to_output(d, "%s\r\nClass: ", class_menu);
|
||||
STATE(d) = CON_QCLASS;
|
||||
break;
|
||||
|
31
src/races.c
31
src/races.c
@ -1,5 +1,7 @@
|
||||
#include "sysdep.h"
|
||||
#include <string.h>
|
||||
|
||||
#include "conf.h"
|
||||
#include "sysdep.h"
|
||||
#include "structs.h"
|
||||
#include "interpreter.h"
|
||||
#include "utils.h"
|
||||
@ -25,25 +27,22 @@ const char *race_menu = "\r\n"
|
||||
"( 3) Duaron\r\n";
|
||||
|
||||
int
|
||||
parse_race(char arg)
|
||||
parse_race(char *arg)
|
||||
{
|
||||
arg = LOWER(arg);
|
||||
|
||||
switch (arg)
|
||||
if (strcmp(arg, "1") == 0)
|
||||
{
|
||||
case '1':
|
||||
return RACE_HAOON;
|
||||
break;
|
||||
case '2':
|
||||
return RACE_UTNIR;
|
||||
break;
|
||||
case '3':
|
||||
return RACE_DUARON;
|
||||
break;
|
||||
default:
|
||||
return RACE_UNDEFINED;
|
||||
break;
|
||||
}
|
||||
else if (strcmp(arg, "2") == 0)
|
||||
{
|
||||
return RACE_UTNIR;
|
||||
}
|
||||
else if (strcmp(arg, "3") == 0)
|
||||
{
|
||||
return RACE_DUARON;
|
||||
}
|
||||
|
||||
return RACE_UNDEFINED;
|
||||
}
|
||||
|
||||
long
|
||||
|
Loading…
Reference in New Issue
Block a user