From a922f0812d95a5b543fe0d92f59e4433bb238112 Mon Sep 17 00:00:00 2001 From: "Gergely Polonkai (W00d5t0ck)" Date: Tue, 6 Mar 2012 13:55:27 +0100 Subject: [PATCH] Finished basic race handling --- src/act.wizard.c | 11 + src/class.c | 2202 +++++++++++++++++++++++---------------------- src/constants.c | 1 + src/db.c | 2 + src/interpreter.c | 15 + src/races.c | 39 +- 6 files changed, 1171 insertions(+), 1099 deletions(-) diff --git a/src/act.wizard.c b/src/act.wizard.c index 07fa04f..1b7ab02 100644 --- a/src/act.wizard.c +++ b/src/act.wizard.c @@ -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); diff --git a/src/class.c b/src/class.c index 2c97693..e7d4511 100644 --- a/src/class.c +++ b/src/class.c @@ -189,1031 +189,1056 @@ struct guild_info_type guild_info[] = { 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; - case 7: return 63; - case 8: return 61; - case 9: return 60; - case 10: return 59; - case 11: return 57; - case 12: return 55; - case 13: return 54; - case 14: return 53; - case 15: return 53; - case 16: return 52; - case 17: return 51; - case 18: return 50; - case 19: return 48; - case 20: return 46; - case 21: return 45; - case 22: return 44; - case 23: return 42; - case 24: return 40; - case 25: return 38; - case 26: return 36; - case 27: return 34; - case 28: return 32; - case 29: return 30; - case 30: return 28; - case 31: return 0; - case 32: return 0; - case 33: return 0; - case 34: return 0; - case 35: return 0; - case 36: return 0; - case 37: return 0; - case 38: return 0; - case 39: return 0; - case 40: return 0; - default: - log("SYSERR: Missing level for mage paralyzation saving throw."); - break; - } - case SAVING_ROD: /* Rods */ - switch (level) { - case 0: return 90; - case 1: return 55; - case 2: return 53; - case 3: return 51; - case 4: return 49; - case 5: return 47; - case 6: return 45; - case 7: return 43; - case 8: return 41; - case 9: return 40; - case 10: return 39; - case 11: return 37; - case 12: return 35; - case 13: return 33; - case 14: return 31; - case 15: return 30; - case 16: return 29; - case 17: return 27; - case 18: return 25; - case 19: return 23; - case 20: return 21; - case 21: return 20; - case 22: return 19; - case 23: return 17; - case 24: return 15; - case 25: return 14; - case 26: return 13; - case 27: return 12; - case 28: return 11; - case 29: return 10; - case 30: return 9; - case 31: return 0; - case 32: return 0; - case 33: return 0; - case 34: return 0; - case 35: return 0; - case 36: return 0; - case 37: return 0; - case 38: return 0; - case 39: return 0; - case 40: return 0; - default: - log("SYSERR: Missing level for mage rod saving throw."); - break; - } - case SAVING_PETRI: /* Petrification */ - switch (level) { - case 0: return 90; - case 1: return 65; - case 2: return 63; - case 3: return 61; - case 4: return 59; - case 5: return 57; - case 6: return 55; - case 7: return 53; - case 8: return 51; - case 9: return 50; - case 10: return 49; - case 11: return 47; - case 12: return 45; - case 13: return 43; - case 14: return 41; - case 15: return 40; - case 16: return 39; - case 17: return 37; - case 18: return 35; - case 19: return 33; - case 20: return 31; - case 21: return 30; - case 22: return 29; - case 23: return 27; - case 24: return 25; - case 25: return 23; - case 26: return 21; - case 27: return 19; - case 28: return 17; - case 29: return 15; - case 30: return 13; - case 31: return 0; - case 32: return 0; - case 33: return 0; - case 34: return 0; - case 35: return 0; - case 36: return 0; - case 37: return 0; - case 38: return 0; - case 39: return 0; - case 40: return 0; - default: - log("SYSERR: Missing level for mage petrification saving throw."); - break; - } - case SAVING_BREATH: /* Breath weapons */ - switch (level) { - case 0: return 90; - case 1: return 75; - case 2: return 73; - case 3: return 71; - case 4: return 69; - case 5: return 67; - case 6: return 65; - case 7: return 63; - case 8: return 61; - case 9: return 60; - case 10: return 59; - case 11: return 57; - case 12: return 55; - case 13: return 53; - case 14: return 51; - case 15: return 50; - case 16: return 49; - case 17: return 47; - case 18: return 45; - case 19: return 43; - case 20: return 41; - case 21: return 40; - case 22: return 39; - case 23: return 37; - case 24: return 35; - case 25: return 33; - case 26: return 31; - case 27: return 29; - case 28: return 27; - case 29: return 25; - case 30: return 23; - case 31: return 0; - case 32: return 0; - case 33: return 0; - case 34: return 0; - case 35: return 0; - case 36: return 0; - case 37: return 0; - case 38: return 0; - case 39: return 0; - case 40: return 0; - default: - log("SYSERR: Missing level for mage breath saving throw."); - break; - } - case SAVING_SPELL: /* Generic spells */ - switch (level) { - case 0: return 90; - case 1: return 60; - case 2: return 58; - case 3: return 56; - case 4: return 54; - case 5: return 52; - case 6: return 50; - case 7: return 48; - case 8: return 46; - case 9: return 45; - case 10: return 44; - case 11: return 42; - case 12: return 40; - case 13: return 38; - case 14: return 36; - case 15: return 35; - case 16: return 34; - case 17: return 32; - case 18: return 30; - case 19: return 28; - case 20: return 26; - case 21: return 25; - case 22: return 24; - case 23: return 22; - case 24: return 20; - case 25: return 18; - case 26: return 16; - case 27: return 14; - case 28: return 12; - case 29: return 10; - case 30: return 8; - case 31: return 0; - case 32: return 0; - case 33: return 0; - case 34: return 0; - case 35: return 0; - case 36: return 0; - case 37: return 0; - case 38: return 0; - case 39: return 0; - case 40: return 0; - default: - log("SYSERR: Missing level for mage spell saving throw."); - break; - } - default: - log("SYSERR: Invalid saving throw type."); - break; - } - break; - case CLASS_CLERIC: - switch (type) { - case SAVING_PARA: /* Paralyzation */ - switch (level) { - case 0: return 90; - case 1: return 60; - case 2: return 59; - case 3: return 48; - case 4: return 46; - case 5: return 45; - case 6: return 43; - case 7: return 40; - case 8: return 37; - case 9: return 35; - case 10: return 34; - case 11: return 33; - case 12: return 31; - case 13: return 30; - case 14: return 29; - case 15: return 27; - case 16: return 26; - case 17: return 25; - case 18: return 24; - case 19: return 23; - case 20: return 22; - case 21: return 21; - case 22: return 20; - case 23: return 18; - case 24: return 15; - case 25: return 14; - case 26: return 12; - case 27: return 10; - case 28: return 9; - case 29: return 8; - case 30: return 7; - case 31: return 0; - case 32: return 0; - case 33: return 0; - case 34: return 0; - case 35: return 0; - case 36: return 0; - case 37: return 0; - case 38: return 0; - case 39: return 0; - case 40: return 0; - default: - log("SYSERR: Missing level for cleric paralyzation saving throw."); - break; - } - case SAVING_ROD: /* Rods */ - switch (level) { - case 0: return 90; - case 1: return 70; - case 2: return 69; - case 3: return 68; - case 4: return 66; - case 5: return 65; - case 6: return 63; - case 7: return 60; - case 8: return 57; - case 9: return 55; - case 10: return 54; - case 11: return 53; - case 12: return 51; - case 13: return 50; - case 14: return 49; - case 15: return 47; - case 16: return 46; - case 17: return 45; - case 18: return 44; - case 19: return 43; - case 20: return 42; - case 21: return 41; - case 22: return 40; - case 23: return 38; - case 24: return 35; - case 25: return 34; - case 26: return 32; - case 27: return 30; - case 28: return 29; - case 29: return 28; - case 30: return 27; - case 31: return 0; - case 32: return 0; - case 33: return 0; - case 34: return 0; - case 35: return 0; - case 36: return 0; - case 37: return 0; - case 38: return 0; - case 39: return 0; - case 40: return 0; - default: - log("SYSERR: Missing level for cleric rod saving throw."); - break; - } - case SAVING_PETRI: /* Petrification */ - switch (level) { - case 0: return 90; - case 1: return 65; - case 2: return 64; - case 3: return 63; - case 4: return 61; - case 5: return 60; - case 6: return 58; - case 7: return 55; - case 8: return 53; - case 9: return 50; - case 10: return 49; - case 11: return 48; - case 12: return 46; - case 13: return 45; - case 14: return 44; - case 15: return 43; - case 16: return 41; - case 17: return 40; - case 18: return 39; - case 19: return 38; - case 20: return 37; - case 21: return 36; - case 22: return 35; - case 23: return 33; - case 24: return 31; - case 25: return 29; - case 26: return 27; - case 27: return 25; - case 28: return 24; - case 29: return 23; - case 30: return 22; - case 31: return 0; - case 32: return 0; - case 33: return 0; - case 34: return 0; - case 35: return 0; - case 36: return 0; - case 37: return 0; - case 38: return 0; - case 39: return 0; - case 40: return 0; - default: - log("SYSERR: Missing level for cleric petrification saving throw."); - break; - } - case SAVING_BREATH: /* Breath weapons */ - switch (level) { - case 0: return 90; - case 1: return 80; - case 2: return 79; - case 3: return 78; - case 4: return 76; - case 5: return 75; - case 6: return 73; - case 7: return 70; - case 8: return 67; - case 9: return 65; - case 10: return 64; - case 11: return 63; - case 12: return 61; - case 13: return 60; - case 14: return 59; - case 15: return 57; - case 16: return 56; - case 17: return 55; - case 18: return 54; - case 19: return 53; - case 20: return 52; - case 21: return 51; - case 22: return 50; - case 23: return 48; - case 24: return 45; - case 25: return 44; - case 26: return 42; - case 27: return 40; - case 28: return 39; - case 29: return 38; - case 30: return 37; - case 31: return 0; - case 32: return 0; - case 33: return 0; - case 34: return 0; - case 35: return 0; - case 36: return 0; - case 37: return 0; - case 38: return 0; - case 39: return 0; - case 40: return 0; - default: - log("SYSERR: Missing level for cleric breath saving throw."); - break; - } - case SAVING_SPELL: /* Generic spells */ - switch (level) { - case 0: return 90; - case 1: return 75; - case 2: return 74; - case 3: return 73; - case 4: return 71; - case 5: return 70; - case 6: return 68; - case 7: return 65; - case 8: return 63; - case 9: return 60; - case 10: return 59; - case 11: return 58; - case 12: return 56; - case 13: return 55; - case 14: return 54; - case 15: return 53; - case 16: return 51; - case 17: return 50; - case 18: return 49; - case 19: return 48; - case 20: return 47; - case 21: return 46; - case 22: return 45; - case 23: return 43; - case 24: return 41; - case 25: return 39; - case 26: return 37; - case 27: return 35; - case 28: return 34; - case 29: return 33; - case 30: return 32; - case 31: return 0; - case 32: return 0; - case 33: return 0; - case 34: return 0; - case 35: return 0; - case 36: return 0; - case 37: return 0; - case 38: return 0; - case 39: return 0; - case 40: return 0; - default: - log("SYSERR: Missing level for cleric spell saving throw."); - break; - } - default: - log("SYSERR: Invalid saving throw type."); - break; - } - break; - case CLASS_THIEF: - switch (type) { - case SAVING_PARA: /* Paralyzation */ - switch (level) { - case 0: return 90; - case 1: return 65; - case 2: return 64; - case 3: return 63; - case 4: return 62; - case 5: return 61; - case 6: return 60; - case 7: return 59; - case 8: return 58; - case 9: return 57; - case 10: return 56; - case 11: return 55; - case 12: return 54; - case 13: return 53; - case 14: return 52; - case 15: return 51; - case 16: return 50; - case 17: return 49; - case 18: return 48; - case 19: return 47; - case 20: return 46; - case 21: return 45; - case 22: return 44; - case 23: return 43; - case 24: return 42; - case 25: return 41; - case 26: return 40; - case 27: return 39; - case 28: return 38; - case 29: return 37; - case 30: return 36; - case 31: return 0; - case 32: return 0; - case 33: return 0; - case 34: return 0; - case 35: return 0; - case 36: return 0; - case 37: return 0; - case 38: return 0; - case 39: return 0; - case 40: return 0; - default: - log("SYSERR: Missing level for thief paralyzation saving throw."); - break; - } - case SAVING_ROD: /* Rods */ - switch (level) { - case 0: return 90; - case 1: return 70; - case 2: return 68; - case 3: return 66; - case 4: return 64; - case 5: return 62; - case 6: return 60; - case 7: return 58; - case 8: return 56; - case 9: return 54; - case 10: return 52; - case 11: return 50; - case 12: return 48; - case 13: return 46; - case 14: return 44; - case 15: return 42; - case 16: return 40; - case 17: return 38; - case 18: return 36; - case 19: return 34; - case 20: return 32; - case 21: return 30; - case 22: return 28; - case 23: return 26; - case 24: return 24; - case 25: return 22; - case 26: return 20; - case 27: return 18; - case 28: return 16; - case 29: return 14; - case 30: return 13; - case 31: return 0; - case 32: return 0; - case 33: return 0; - case 34: return 0; - case 35: return 0; - case 36: return 0; - case 37: return 0; - case 38: return 0; - case 39: return 0; - case 40: return 0; - default: - log("SYSERR: Missing level for thief rod saving throw."); - break; - } - case SAVING_PETRI: /* Petrification */ - switch (level) { - case 0: return 90; - case 1: return 60; - case 2: return 59; - case 3: return 58; - case 4: return 58; - case 5: return 56; - case 6: return 55; - case 7: return 54; - case 8: return 53; - case 9: return 52; - case 10: return 51; - case 11: return 50; - case 12: return 49; - case 13: return 48; - case 14: return 47; - case 15: return 46; - case 16: return 45; - case 17: return 44; - case 18: return 43; - case 19: return 42; - case 20: return 41; - case 21: return 40; - case 22: return 39; - case 23: return 38; - case 24: return 37; - case 25: return 36; - case 26: return 35; - case 27: return 34; - case 28: return 33; - case 29: return 32; - case 30: return 31; - case 31: return 0; - case 32: return 0; - case 33: return 0; - case 34: return 0; - case 35: return 0; - case 36: return 0; - case 37: return 0; - case 38: return 0; - case 39: return 0; - case 40: return 0; - default: - log("SYSERR: Missing level for thief petrification saving throw."); - break; - } - case SAVING_BREATH: /* Breath weapons */ - switch (level) { - case 0: return 90; - case 1: return 80; - case 2: return 79; - case 3: return 78; - case 4: return 77; - case 5: return 76; - case 6: return 75; - case 7: return 74; - case 8: return 73; - case 9: return 72; - case 10: return 71; - case 11: return 70; - case 12: return 69; - case 13: return 68; - case 14: return 67; - case 15: return 66; - case 16: return 65; - case 17: return 64; - case 18: return 63; - case 19: return 62; - case 20: return 61; - case 21: return 60; - case 22: return 59; - case 23: return 58; - case 24: return 57; - case 25: return 56; - case 26: return 55; - case 27: return 54; - case 28: return 53; - case 29: return 52; - case 30: return 51; - case 31: return 0; - case 32: return 0; - case 33: return 0; - case 34: return 0; - case 35: return 0; - case 36: return 0; - case 37: return 0; - case 38: return 0; - case 39: return 0; - case 40: return 0; - default: - log("SYSERR: Missing level for thief breath saving throw."); - break; - } - case SAVING_SPELL: /* Generic spells */ - switch (level) { - case 0: return 90; - case 1: return 75; - case 2: return 73; - case 3: return 71; - case 4: return 69; - case 5: return 67; - case 6: return 65; - case 7: return 63; - case 8: return 61; - case 9: return 59; - case 10: return 57; - case 11: return 55; - case 12: return 53; - case 13: return 51; - case 14: return 49; - case 15: return 47; - case 16: return 45; - case 17: return 43; - case 18: return 41; - case 19: return 39; - case 20: return 37; - case 21: return 35; - case 22: return 33; - case 23: return 31; - case 24: return 29; - case 25: return 27; - case 26: return 25; - case 27: return 23; - case 28: return 21; - case 29: return 19; - case 30: return 17; - case 31: return 0; - case 32: return 0; - case 33: return 0; - case 34: return 0; - case 35: return 0; - case 36: return 0; - case 37: return 0; - case 38: return 0; - case 39: return 0; - case 40: return 0; - default: - log("SYSERR: Missing level for thief spell saving throw."); - break; - } - default: - log("SYSERR: Invalid saving throw type."); - break; - } - break; - case CLASS_WARRIOR: - switch (type) { - case SAVING_PARA: /* Paralyzation */ - switch (level) { - case 0: return 90; - case 1: return 70; - case 2: return 68; - case 3: return 67; - case 4: return 65; - case 5: return 62; - case 6: return 58; - case 7: return 55; - case 8: return 53; - case 9: return 52; - case 10: return 50; - case 11: return 47; - case 12: return 43; - case 13: return 40; - case 14: return 38; - case 15: return 37; - case 16: return 35; - case 17: return 32; - case 18: return 28; - case 19: return 25; - case 20: return 24; - case 21: return 23; - case 22: return 22; - case 23: return 20; - case 24: return 19; - case 25: return 17; - case 26: return 16; - case 27: return 15; - case 28: return 14; - case 29: return 13; - case 30: return 12; - case 31: return 11; - case 32: return 10; - case 33: return 9; - case 34: return 8; - case 35: return 7; - case 36: return 6; - case 37: return 5; - case 38: return 4; - case 39: return 3; - case 40: return 2; - case 41: return 1; /* Some mobiles. */ - case 42: return 0; - case 43: return 0; - case 44: return 0; - case 45: return 0; - case 46: return 0; - case 47: return 0; - case 48: return 0; - case 49: return 0; - case 50: return 0; - default: - log("SYSERR: Missing level for warrior paralyzation saving throw."); - break; - } - case SAVING_ROD: /* Rods */ - switch (level) { - case 0: return 90; - case 1: return 80; - case 2: return 78; - case 3: return 77; - case 4: return 75; - case 5: return 72; - case 6: return 68; - case 7: return 65; - case 8: return 63; - case 9: return 62; - case 10: return 60; - case 11: return 57; - case 12: return 53; - case 13: return 50; - case 14: return 48; - case 15: return 47; - case 16: return 45; - case 17: return 42; - case 18: return 38; - case 19: return 35; - case 20: return 34; - case 21: return 33; - case 22: return 32; - case 23: return 30; - case 24: return 29; - case 25: return 27; - case 26: return 26; - case 27: return 25; - case 28: return 24; - case 29: return 23; - case 30: return 22; - case 31: return 20; - case 32: return 18; - case 33: return 16; - case 34: return 14; - case 35: return 12; - case 36: return 10; - case 37: return 8; - case 38: return 6; - case 39: return 5; - case 40: return 4; - case 41: return 3; - case 42: return 2; - case 43: return 1; - case 44: return 0; - case 45: return 0; - case 46: return 0; - case 47: return 0; - case 48: return 0; - case 49: return 0; - case 50: return 0; - default: - log("SYSERR: Missing level for warrior rod saving throw."); - break; - } - case SAVING_PETRI: /* Petrification */ - switch (level) { - case 0: return 90; - case 1: return 75; - case 2: return 73; - case 3: return 72; - case 4: return 70; - case 5: return 67; - case 6: return 63; - case 7: return 60; - case 8: return 58; - case 9: return 57; - case 10: return 55; - case 11: return 52; - case 12: return 48; - case 13: return 45; - case 14: return 43; - case 15: return 42; - case 16: return 40; - case 17: return 37; - case 18: return 33; - case 19: return 30; - case 20: return 29; - case 21: return 28; - case 22: return 26; - case 23: return 25; - case 24: return 24; - case 25: return 23; - case 26: return 21; - case 27: return 20; - case 28: return 19; - case 29: return 18; - case 30: return 17; - case 31: return 16; - case 32: return 15; - case 33: return 14; - case 34: return 13; - case 35: return 12; - case 36: return 11; - case 37: return 10; - case 38: return 9; - case 39: return 8; - case 40: return 7; - case 41: return 6; - case 42: return 5; - case 43: return 4; - case 44: return 3; - case 45: return 2; - case 46: return 1; - case 47: return 0; - case 48: return 0; - case 49: return 0; - case 50: return 0; - default: - log("SYSERR: Missing level for warrior petrification saving throw."); - break; - } - case SAVING_BREATH: /* Breath weapons */ - switch (level) { - case 0: return 90; - case 1: return 85; - case 2: return 83; - case 3: return 82; - case 4: return 80; - case 5: return 75; - case 6: return 70; - case 7: return 65; - case 8: return 63; - case 9: return 62; - case 10: return 60; - case 11: return 55; - case 12: return 50; - case 13: return 45; - case 14: return 43; - case 15: return 42; - case 16: return 40; - case 17: return 37; - case 18: return 33; - case 19: return 30; - case 20: return 29; - case 21: return 28; - case 22: return 26; - case 23: return 25; - case 24: return 24; - case 25: return 23; - case 26: return 21; - case 27: return 20; - case 28: return 19; - case 29: return 18; - case 30: return 17; - case 31: return 16; - case 32: return 15; - case 33: return 14; - case 34: return 13; - case 35: return 12; - case 36: return 11; - case 37: return 10; - case 38: return 9; - case 39: return 8; - case 40: return 7; - case 41: return 6; - case 42: return 5; - case 43: return 4; - case 44: return 3; - case 45: return 2; - case 46: return 1; - case 47: return 0; - case 48: return 0; - case 49: return 0; - case 50: return 0; - default: - log("SYSERR: Missing level for warrior breath saving throw."); - break; - } - case SAVING_SPELL: /* Generic spells */ - switch (level) { - case 0: return 90; - case 1: return 85; - case 2: return 83; - case 3: return 82; - case 4: return 80; - case 5: return 77; - case 6: return 73; - case 7: return 70; - case 8: return 68; - case 9: return 67; - case 10: return 65; - case 11: return 62; - case 12: return 58; - case 13: return 55; - case 14: return 53; - case 15: return 52; - case 16: return 50; - case 17: return 47; - case 18: return 43; - case 19: return 40; - case 20: return 39; - case 21: return 38; - case 22: return 36; - case 23: return 35; - case 24: return 34; - case 25: return 33; - case 26: return 31; - case 27: return 30; - case 28: return 29; - case 29: return 28; - case 30: return 27; - case 31: return 25; - case 32: return 23; - case 33: return 21; - case 34: return 19; - case 35: return 17; - case 36: return 15; - case 37: return 13; - case 38: return 11; - case 39: return 9; - case 40: return 7; - case 41: return 6; - case 42: return 5; - case 43: return 4; - case 44: return 3; - case 45: return 2; - case 46: return 1; - case 47: return 0; - case 48: return 0; - case 49: return 0; - case 50: return 0; - default: - log("SYSERR: Missing level for warrior spell saving throw."); - break; - } - default: - log("SYSERR: Invalid saving throw type."); - break; - } - default: - log("SYSERR: Invalid class saving throw."); - break; - } + 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; + case 7: return 63; + case 8: return 61; + case 9: return 60; + case 10: return 59; + case 11: return 57; + case 12: return 55; + case 13: return 54; + case 14: return 53; + case 15: return 53; + case 16: return 52; + case 17: return 51; + case 18: return 50; + case 19: return 48; + case 20: return 46; + case 21: return 45; + case 22: return 44; + case 23: return 42; + case 24: return 40; + case 25: return 38; + case 26: return 36; + case 27: return 34; + case 28: return 32; + case 29: return 30; + case 30: return 28; + case 31: return 0; + case 32: return 0; + case 33: return 0; + case 34: return 0; + case 35: return 0; + case 36: return 0; + case 37: return 0; + case 38: return 0; + case 39: return 0; + case 40: return 0; + default: + log("SYSERR: Missing level for mage paralyzation saving throw."); + break; + } + case SAVING_ROD: /* Rods */ + switch (level) + { + case 0: return 90; + case 1: return 55; + case 2: return 53; + case 3: return 51; + case 4: return 49; + case 5: return 47; + case 6: return 45; + case 7: return 43; + case 8: return 41; + case 9: return 40; + case 10: return 39; + case 11: return 37; + case 12: return 35; + case 13: return 33; + case 14: return 31; + case 15: return 30; + case 16: return 29; + case 17: return 27; + case 18: return 25; + case 19: return 23; + case 20: return 21; + case 21: return 20; + case 22: return 19; + case 23: return 17; + case 24: return 15; + case 25: return 14; + case 26: return 13; + case 27: return 12; + case 28: return 11; + case 29: return 10; + case 30: return 9; + case 31: return 0; + case 32: return 0; + case 33: return 0; + case 34: return 0; + case 35: return 0; + case 36: return 0; + case 37: return 0; + case 38: return 0; + case 39: return 0; + case 40: return 0; + default: + log("SYSERR: Missing level for mage rod saving throw."); + break; + } + case SAVING_PETRI: /* Petrification */ + switch (level) + { + case 0: return 90; + case 1: return 65; + case 2: return 63; + case 3: return 61; + case 4: return 59; + case 5: return 57; + case 6: return 55; + case 7: return 53; + case 8: return 51; + case 9: return 50; + case 10: return 49; + case 11: return 47; + case 12: return 45; + case 13: return 43; + case 14: return 41; + case 15: return 40; + case 16: return 39; + case 17: return 37; + case 18: return 35; + case 19: return 33; + case 20: return 31; + case 21: return 30; + case 22: return 29; + case 23: return 27; + case 24: return 25; + case 25: return 23; + case 26: return 21; + case 27: return 19; + case 28: return 17; + case 29: return 15; + case 30: return 13; + case 31: return 0; + case 32: return 0; + case 33: return 0; + case 34: return 0; + case 35: return 0; + case 36: return 0; + case 37: return 0; + case 38: return 0; + case 39: return 0; + case 40: return 0; + default: + log("SYSERR: Missing level for mage petrification saving throw."); + break; + } + case SAVING_BREATH: /* Breath weapons */ + switch (level) + { + case 0: return 90; + case 1: return 75; + case 2: return 73; + case 3: return 71; + case 4: return 69; + case 5: return 67; + case 6: return 65; + case 7: return 63; + case 8: return 61; + case 9: return 60; + case 10: return 59; + case 11: return 57; + case 12: return 55; + case 13: return 53; + case 14: return 51; + case 15: return 50; + case 16: return 49; + case 17: return 47; + case 18: return 45; + case 19: return 43; + case 20: return 41; + case 21: return 40; + case 22: return 39; + case 23: return 37; + case 24: return 35; + case 25: return 33; + case 26: return 31; + case 27: return 29; + case 28: return 27; + case 29: return 25; + case 30: return 23; + case 31: return 0; + case 32: return 0; + case 33: return 0; + case 34: return 0; + case 35: return 0; + case 36: return 0; + case 37: return 0; + case 38: return 0; + case 39: return 0; + case 40: return 0; + default: + log("SYSERR: Missing level for mage breath saving throw."); + break; + } + case SAVING_SPELL: /* Generic spells */ + switch (level) + { + case 0: return 90; + case 1: return 60; + case 2: return 58; + case 3: return 56; + case 4: return 54; + case 5: return 52; + case 6: return 50; + case 7: return 48; + case 8: return 46; + case 9: return 45; + case 10: return 44; + case 11: return 42; + case 12: return 40; + case 13: return 38; + case 14: return 36; + case 15: return 35; + case 16: return 34; + case 17: return 32; + case 18: return 30; + case 19: return 28; + case 20: return 26; + case 21: return 25; + case 22: return 24; + case 23: return 22; + case 24: return 20; + case 25: return 18; + case 26: return 16; + case 27: return 14; + case 28: return 12; + case 29: return 10; + case 30: return 8; + case 31: return 0; + case 32: return 0; + case 33: return 0; + case 34: return 0; + case 35: return 0; + case 36: return 0; + case 37: return 0; + case 38: return 0; + case 39: return 0; + case 40: return 0; + default: + log("SYSERR: Missing level for mage spell saving throw."); + break; + } + default: + log("SYSERR: Invalid saving throw type."); + break; + } + break; + case CLASS_CLERIC: + switch (type) + { + case SAVING_PARA: /* Paralyzation */ + switch (level) + { + case 0: return 90; + case 1: return 60; + case 2: return 59; + case 3: return 48; + case 4: return 46; + case 5: return 45; + case 6: return 43; + case 7: return 40; + case 8: return 37; + case 9: return 35; + case 10: return 34; + case 11: return 33; + case 12: return 31; + case 13: return 30; + case 14: return 29; + case 15: return 27; + case 16: return 26; + case 17: return 25; + case 18: return 24; + case 19: return 23; + case 20: return 22; + case 21: return 21; + case 22: return 20; + case 23: return 18; + case 24: return 15; + case 25: return 14; + case 26: return 12; + case 27: return 10; + case 28: return 9; + case 29: return 8; + case 30: return 7; + case 31: return 0; + case 32: return 0; + case 33: return 0; + case 34: return 0; + case 35: return 0; + case 36: return 0; + case 37: return 0; + case 38: return 0; + case 39: return 0; + case 40: return 0; + default: + log("SYSERR: Missing level for cleric paralyzation saving throw."); + break; + } + case SAVING_ROD: /* Rods */ + switch (level) + { + case 0: return 90; + case 1: return 70; + case 2: return 69; + case 3: return 68; + case 4: return 66; + case 5: return 65; + case 6: return 63; + case 7: return 60; + case 8: return 57; + case 9: return 55; + case 10: return 54; + case 11: return 53; + case 12: return 51; + case 13: return 50; + case 14: return 49; + case 15: return 47; + case 16: return 46; + case 17: return 45; + case 18: return 44; + case 19: return 43; + case 20: return 42; + case 21: return 41; + case 22: return 40; + case 23: return 38; + case 24: return 35; + case 25: return 34; + case 26: return 32; + case 27: return 30; + case 28: return 29; + case 29: return 28; + case 30: return 27; + case 31: return 0; + case 32: return 0; + case 33: return 0; + case 34: return 0; + case 35: return 0; + case 36: return 0; + case 37: return 0; + case 38: return 0; + case 39: return 0; + case 40: return 0; + default: + log("SYSERR: Missing level for cleric rod saving throw."); + break; + } + case SAVING_PETRI: /* Petrification */ + switch (level) + { + case 0: return 90; + case 1: return 65; + case 2: return 64; + case 3: return 63; + case 4: return 61; + case 5: return 60; + case 6: return 58; + case 7: return 55; + case 8: return 53; + case 9: return 50; + case 10: return 49; + case 11: return 48; + case 12: return 46; + case 13: return 45; + case 14: return 44; + case 15: return 43; + case 16: return 41; + case 17: return 40; + case 18: return 39; + case 19: return 38; + case 20: return 37; + case 21: return 36; + case 22: return 35; + case 23: return 33; + case 24: return 31; + case 25: return 29; + case 26: return 27; + case 27: return 25; + case 28: return 24; + case 29: return 23; + case 30: return 22; + case 31: return 0; + case 32: return 0; + case 33: return 0; + case 34: return 0; + case 35: return 0; + case 36: return 0; + case 37: return 0; + case 38: return 0; + case 39: return 0; + case 40: return 0; + default: + log("SYSERR: Missing level for cleric petrification saving throw."); + break; + } + case SAVING_BREATH: /* Breath weapons */ + switch (level) + { + case 0: return 90; + case 1: return 80; + case 2: return 79; + case 3: return 78; + case 4: return 76; + case 5: return 75; + case 6: return 73; + case 7: return 70; + case 8: return 67; + case 9: return 65; + case 10: return 64; + case 11: return 63; + case 12: return 61; + case 13: return 60; + case 14: return 59; + case 15: return 57; + case 16: return 56; + case 17: return 55; + case 18: return 54; + case 19: return 53; + case 20: return 52; + case 21: return 51; + case 22: return 50; + case 23: return 48; + case 24: return 45; + case 25: return 44; + case 26: return 42; + case 27: return 40; + case 28: return 39; + case 29: return 38; + case 30: return 37; + case 31: return 0; + case 32: return 0; + case 33: return 0; + case 34: return 0; + case 35: return 0; + case 36: return 0; + case 37: return 0; + case 38: return 0; + case 39: return 0; + case 40: return 0; + default: + log("SYSERR: Missing level for cleric breath saving throw."); + break; + } + case SAVING_SPELL: /* Generic spells */ + switch (level) + { + case 0: return 90; + case 1: return 75; + case 2: return 74; + case 3: return 73; + case 4: return 71; + case 5: return 70; + case 6: return 68; + case 7: return 65; + case 8: return 63; + case 9: return 60; + case 10: return 59; + case 11: return 58; + case 12: return 56; + case 13: return 55; + case 14: return 54; + case 15: return 53; + case 16: return 51; + case 17: return 50; + case 18: return 49; + case 19: return 48; + case 20: return 47; + case 21: return 46; + case 22: return 45; + case 23: return 43; + case 24: return 41; + case 25: return 39; + case 26: return 37; + case 27: return 35; + case 28: return 34; + case 29: return 33; + case 30: return 32; + case 31: return 0; + case 32: return 0; + case 33: return 0; + case 34: return 0; + case 35: return 0; + case 36: return 0; + case 37: return 0; + case 38: return 0; + case 39: return 0; + case 40: return 0; + default: + log("SYSERR: Missing level for cleric spell saving throw."); + break; + } + default: + log("SYSERR: Invalid saving throw type."); + break; + } + break; + case CLASS_THIEF: + switch (type) + { + case SAVING_PARA: /* Paralyzation */ + switch (level) + { + case 0: return 90; + case 1: return 65; + case 2: return 64; + case 3: return 63; + case 4: return 62; + case 5: return 61; + case 6: return 60; + case 7: return 59; + case 8: return 58; + case 9: return 57; + case 10: return 56; + case 11: return 55; + case 12: return 54; + case 13: return 53; + case 14: return 52; + case 15: return 51; + case 16: return 50; + case 17: return 49; + case 18: return 48; + case 19: return 47; + case 20: return 46; + case 21: return 45; + case 22: return 44; + case 23: return 43; + case 24: return 42; + case 25: return 41; + case 26: return 40; + case 27: return 39; + case 28: return 38; + case 29: return 37; + case 30: return 36; + case 31: return 0; + case 32: return 0; + case 33: return 0; + case 34: return 0; + case 35: return 0; + case 36: return 0; + case 37: return 0; + case 38: return 0; + case 39: return 0; + case 40: return 0; + default: + log("SYSERR: Missing level for thief paralyzation saving throw."); + break; + } + case SAVING_ROD: /* Rods */ + switch (level) + { + case 0: return 90; + case 1: return 70; + case 2: return 68; + case 3: return 66; + case 4: return 64; + case 5: return 62; + case 6: return 60; + case 7: return 58; + case 8: return 56; + case 9: return 54; + case 10: return 52; + case 11: return 50; + case 12: return 48; + case 13: return 46; + case 14: return 44; + case 15: return 42; + case 16: return 40; + case 17: return 38; + case 18: return 36; + case 19: return 34; + case 20: return 32; + case 21: return 30; + case 22: return 28; + case 23: return 26; + case 24: return 24; + case 25: return 22; + case 26: return 20; + case 27: return 18; + case 28: return 16; + case 29: return 14; + case 30: return 13; + case 31: return 0; + case 32: return 0; + case 33: return 0; + case 34: return 0; + case 35: return 0; + case 36: return 0; + case 37: return 0; + case 38: return 0; + case 39: return 0; + case 40: return 0; + default: + log("SYSERR: Missing level for thief rod saving throw."); + break; + } + case SAVING_PETRI: /* Petrification */ + switch (level) + { + case 0: return 90; + case 1: return 60; + case 2: return 59; + case 3: return 58; + case 4: return 58; + case 5: return 56; + case 6: return 55; + case 7: return 54; + case 8: return 53; + case 9: return 52; + case 10: return 51; + case 11: return 50; + case 12: return 49; + case 13: return 48; + case 14: return 47; + case 15: return 46; + case 16: return 45; + case 17: return 44; + case 18: return 43; + case 19: return 42; + case 20: return 41; + case 21: return 40; + case 22: return 39; + case 23: return 38; + case 24: return 37; + case 25: return 36; + case 26: return 35; + case 27: return 34; + case 28: return 33; + case 29: return 32; + case 30: return 31; + case 31: return 0; + case 32: return 0; + case 33: return 0; + case 34: return 0; + case 35: return 0; + case 36: return 0; + case 37: return 0; + case 38: return 0; + case 39: return 0; + case 40: return 0; + default: + log("SYSERR: Missing level for thief petrification saving throw."); + break; + } + case SAVING_BREATH: /* Breath weapons */ + switch (level) + { + case 0: return 90; + case 1: return 80; + case 2: return 79; + case 3: return 78; + case 4: return 77; + case 5: return 76; + case 6: return 75; + case 7: return 74; + case 8: return 73; + case 9: return 72; + case 10: return 71; + case 11: return 70; + case 12: return 69; + case 13: return 68; + case 14: return 67; + case 15: return 66; + case 16: return 65; + case 17: return 64; + case 18: return 63; + case 19: return 62; + case 20: return 61; + case 21: return 60; + case 22: return 59; + case 23: return 58; + case 24: return 57; + case 25: return 56; + case 26: return 55; + case 27: return 54; + case 28: return 53; + case 29: return 52; + case 30: return 51; + case 31: return 0; + case 32: return 0; + case 33: return 0; + case 34: return 0; + case 35: return 0; + case 36: return 0; + case 37: return 0; + case 38: return 0; + case 39: return 0; + case 40: return 0; + default: + log("SYSERR: Missing level for thief breath saving throw."); + break; + } + case SAVING_SPELL: /* Generic spells */ + switch (level) + { + case 0: return 90; + case 1: return 75; + case 2: return 73; + case 3: return 71; + case 4: return 69; + case 5: return 67; + case 6: return 65; + case 7: return 63; + case 8: return 61; + case 9: return 59; + case 10: return 57; + case 11: return 55; + case 12: return 53; + case 13: return 51; + case 14: return 49; + case 15: return 47; + case 16: return 45; + case 17: return 43; + case 18: return 41; + case 19: return 39; + case 20: return 37; + case 21: return 35; + case 22: return 33; + case 23: return 31; + case 24: return 29; + case 25: return 27; + case 26: return 25; + case 27: return 23; + case 28: return 21; + case 29: return 19; + case 30: return 17; + case 31: return 0; + case 32: return 0; + case 33: return 0; + case 34: return 0; + case 35: return 0; + case 36: return 0; + case 37: return 0; + case 38: return 0; + case 39: return 0; + case 40: return 0; + default: + log("SYSERR: Missing level for thief spell saving throw."); + break; + } + default: + log("SYSERR: Invalid saving throw type."); + break; + } + break; + case CLASS_WARRIOR: + switch (type) + { + case SAVING_PARA: /* Paralyzation */ + switch (level) + { + case 0: return 90; + case 1: return 70; + case 2: return 68; + case 3: return 67; + case 4: return 65; + case 5: return 62; + case 6: return 58; + case 7: return 55; + case 8: return 53; + case 9: return 52; + case 10: return 50; + case 11: return 47; + case 12: return 43; + case 13: return 40; + case 14: return 38; + case 15: return 37; + case 16: return 35; + case 17: return 32; + case 18: return 28; + case 19: return 25; + case 20: return 24; + case 21: return 23; + case 22: return 22; + case 23: return 20; + case 24: return 19; + case 25: return 17; + case 26: return 16; + case 27: return 15; + case 28: return 14; + case 29: return 13; + case 30: return 12; + case 31: return 11; + case 32: return 10; + case 33: return 9; + case 34: return 8; + case 35: return 7; + case 36: return 6; + case 37: return 5; + case 38: return 4; + case 39: return 3; + case 40: return 2; + case 41: return 1; /* Some mobiles. */ + case 42: return 0; + case 43: return 0; + case 44: return 0; + case 45: return 0; + case 46: return 0; + case 47: return 0; + case 48: return 0; + case 49: return 0; + case 50: return 0; + default: + log("SYSERR: Missing level for warrior paralyzation saving throw."); + break; + } + case SAVING_ROD: /* Rods */ + switch (level) + { + case 0: return 90; + case 1: return 80; + case 2: return 78; + case 3: return 77; + case 4: return 75; + case 5: return 72; + case 6: return 68; + case 7: return 65; + case 8: return 63; + case 9: return 62; + case 10: return 60; + case 11: return 57; + case 12: return 53; + case 13: return 50; + case 14: return 48; + case 15: return 47; + case 16: return 45; + case 17: return 42; + case 18: return 38; + case 19: return 35; + case 20: return 34; + case 21: return 33; + case 22: return 32; + case 23: return 30; + case 24: return 29; + case 25: return 27; + case 26: return 26; + case 27: return 25; + case 28: return 24; + case 29: return 23; + case 30: return 22; + case 31: return 20; + case 32: return 18; + case 33: return 16; + case 34: return 14; + case 35: return 12; + case 36: return 10; + case 37: return 8; + case 38: return 6; + case 39: return 5; + case 40: return 4; + case 41: return 3; + case 42: return 2; + case 43: return 1; + case 44: return 0; + case 45: return 0; + case 46: return 0; + case 47: return 0; + case 48: return 0; + case 49: return 0; + case 50: return 0; + default: + log("SYSERR: Missing level for warrior rod saving throw."); + break; + } + case SAVING_PETRI: /* Petrification */ + switch (level) + { + case 0: return 90; + case 1: return 75; + case 2: return 73; + case 3: return 72; + case 4: return 70; + case 5: return 67; + case 6: return 63; + case 7: return 60; + case 8: return 58; + case 9: return 57; + case 10: return 55; + case 11: return 52; + case 12: return 48; + case 13: return 45; + case 14: return 43; + case 15: return 42; + case 16: return 40; + case 17: return 37; + case 18: return 33; + case 19: return 30; + case 20: return 29; + case 21: return 28; + case 22: return 26; + case 23: return 25; + case 24: return 24; + case 25: return 23; + case 26: return 21; + case 27: return 20; + case 28: return 19; + case 29: return 18; + case 30: return 17; + case 31: return 16; + case 32: return 15; + case 33: return 14; + case 34: return 13; + case 35: return 12; + case 36: return 11; + case 37: return 10; + case 38: return 9; + case 39: return 8; + case 40: return 7; + case 41: return 6; + case 42: return 5; + case 43: return 4; + case 44: return 3; + case 45: return 2; + case 46: return 1; + case 47: return 0; + case 48: return 0; + case 49: return 0; + case 50: return 0; + default: + log("SYSERR: Missing level for warrior petrification saving throw."); + break; + } + case SAVING_BREATH: /* Breath weapons */ + switch (level) + { + case 0: return 90; + case 1: return 85; + case 2: return 83; + case 3: return 82; + case 4: return 80; + case 5: return 75; + case 6: return 70; + case 7: return 65; + case 8: return 63; + case 9: return 62; + case 10: return 60; + case 11: return 55; + case 12: return 50; + case 13: return 45; + case 14: return 43; + case 15: return 42; + case 16: return 40; + case 17: return 37; + case 18: return 33; + case 19: return 30; + case 20: return 29; + case 21: return 28; + case 22: return 26; + case 23: return 25; + case 24: return 24; + case 25: return 23; + case 26: return 21; + case 27: return 20; + case 28: return 19; + case 29: return 18; + case 30: return 17; + case 31: return 16; + case 32: return 15; + case 33: return 14; + case 34: return 13; + case 35: return 12; + case 36: return 11; + case 37: return 10; + case 38: return 9; + case 39: return 8; + case 40: return 7; + case 41: return 6; + case 42: return 5; + case 43: return 4; + case 44: return 3; + case 45: return 2; + case 46: return 1; + case 47: return 0; + case 48: return 0; + case 49: return 0; + case 50: return 0; + default: + log("SYSERR: Missing level for warrior breath saving throw."); + break; + } + case SAVING_SPELL: /* Generic spells */ + switch (level) + { + case 0: return 90; + case 1: return 85; + case 2: return 83; + case 3: return 82; + case 4: return 80; + case 5: return 77; + case 6: return 73; + case 7: return 70; + case 8: return 68; + case 9: return 67; + case 10: return 65; + case 11: return 62; + case 12: return 58; + case 13: return 55; + case 14: return 53; + case 15: return 52; + case 16: return 50; + case 17: return 47; + case 18: return 43; + case 19: return 40; + case 20: return 39; + case 21: return 38; + case 22: return 36; + case 23: return 35; + case 24: return 34; + case 25: return 33; + case 26: return 31; + case 27: return 30; + case 28: return 29; + case 29: return 28; + case 30: return 27; + case 31: return 25; + case 32: return 23; + case 33: return 21; + case 34: return 19; + case 35: return 17; + case 36: return 15; + case 37: return 13; + case 38: return 11; + case 39: return 9; + case 40: return 7; + case 41: return 6; + case 42: return 5; + case 43: return 4; + case 44: return 3; + case 45: return 2; + case 46: return 1; + case 47: return 0; + case 48: return 0; + case 49: return 0; + case 50: return 0; + default: + log("SYSERR: Missing level for warrior spell saving throw."); + break; + } + default: + log("SYSERR: Invalid saving throw type."); + break; + } + default: + log("SYSERR: Invalid class saving throw."); + break; + } - /* Should not get here unless something is wrong. */ - return 100; + /* Should not get here unless something is wrong. */ + return 100; } /* THAC0 for classes and levels. (To Hit Armor Class 0) */ @@ -1396,68 +1421,87 @@ int thaco(int class_num, int level) */ void roll_real_abils(struct char_data *ch) { - int i, j, k, temp; - ubyte table[6]; - ubyte rolls[4]; + 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++) + 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); - for (j = 0; j < 4; j++) - rolls[j] = rand_number(1, 6); + temp = rolls[0] + rolls[1] + rolls[2] + rolls[3] - + MIN(rolls[0], MIN(rolls[1], MIN(rolls[2], rolls[3]))); - temp = rolls[0] + rolls[1] + rolls[2] + rolls[3] - - MIN(rolls[0], MIN(rolls[1], MIN(rolls[2], rolls[3]))); + for (k = 0; k < 6; k++) + if (table[k] < temp) + { + temp ^= table[k]; + table[k] ^= temp; + temp ^= table[k]; + } + } - for (k = 0; k < 6; k++) - if (table[k] < temp) { - temp ^= table[k]; - table[k] ^= temp; - temp ^= table[k]; - } - } + ch->real_abils.str_add = 0; - ch->real_abils.str_add = 0; + switch (GET_CLASS(ch)) + { + case CLASS_MAGIC_USER: + ch->real_abils.intel = table[0]; + ch->real_abils.wis = table[1]; + ch->real_abils.dex = table[2]; + ch->real_abils.str = table[3]; + ch->real_abils.con = table[4]; + ch->real_abils.cha = table[5]; + break; + case CLASS_CLERIC: + ch->real_abils.wis = table[0]; + ch->real_abils.intel = table[1]; + ch->real_abils.str = table[2]; + ch->real_abils.dex = table[3]; + ch->real_abils.con = table[4]; + ch->real_abils.cha = table[5]; + break; + case CLASS_THIEF: + ch->real_abils.dex = table[0]; + ch->real_abils.str = table[1]; + ch->real_abils.con = table[2]; + ch->real_abils.intel = table[3]; + ch->real_abils.wis = table[4]; + ch->real_abils.cha = table[5]; + break; + case CLASS_WARRIOR: + ch->real_abils.str = table[0]; + ch->real_abils.dex = table[1]; + ch->real_abils.con = table[2]; + ch->real_abils.wis = table[3]; + ch->real_abils.intel = table[4]; + ch->real_abils.cha = table[5]; + if (ch->real_abils.str == 18) + ch->real_abils.str_add = rand_number(0, 100); + break; + } - switch (GET_CLASS(ch)) { - case CLASS_MAGIC_USER: - ch->real_abils.intel = table[0]; - ch->real_abils.wis = table[1]; - ch->real_abils.dex = table[2]; - ch->real_abils.str = table[3]; - ch->real_abils.con = table[4]; - ch->real_abils.cha = table[5]; - break; - case CLASS_CLERIC: - ch->real_abils.wis = table[0]; - ch->real_abils.intel = table[1]; - ch->real_abils.str = table[2]; - ch->real_abils.dex = table[3]; - ch->real_abils.con = table[4]; - ch->real_abils.cha = table[5]; - break; - case CLASS_THIEF: - ch->real_abils.dex = table[0]; - ch->real_abils.str = table[1]; - ch->real_abils.con = table[2]; - ch->real_abils.intel = table[3]; - ch->real_abils.wis = table[4]; - ch->real_abils.cha = table[5]; - break; - case CLASS_WARRIOR: - ch->real_abils.str = table[0]; - ch->real_abils.dex = table[1]; - ch->real_abils.con = table[2]; - ch->real_abils.wis = table[3]; - ch->real_abils.intel = table[4]; - ch->real_abils.cha = table[5]; - if (ch->real_abils.str == 18) - ch->real_abils.str_add = rand_number(0, 100); - break; - } - ch->aff_abils = ch->real_abils; + // 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; } diff --git a/src/constants.c b/src/constants.c index a091687..41b5878 100644 --- a/src/constants.c +++ b/src/constants.c @@ -238,6 +238,7 @@ const char *connected_types[] = { "Changing PW 3", "Self-Delete 1", "Self-Delete 2", + "Select race", "Disconnecting", "\n" }; diff --git a/src/db.c b/src/db.c index a8ab725..d1e0d7d 100644 --- a/src/db.c +++ b/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; diff --git a/src/interpreter.c b/src/interpreter.c index 44814ca..c898d9f 100644 --- a/src/interpreter.c +++ b/src/interpreter.c @@ -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; diff --git a/src/races.c b/src/races.c index c975041..d3a63a4 100644 --- a/src/races.c +++ b/src/races.c @@ -1,5 +1,7 @@ -#include "sysdep.h" +#include + #include "conf.h" +#include "sysdep.h" #include "structs.h" #include "interpreter.h" #include "utils.h" @@ -20,30 +22,27 @@ const char *pc_race_types[] = { const char *race_menu = "\r\n" "Select race:\r\n" -"(1) Haoon\r\n" -"(2) Utnir\r\n" -"(3) Duaron\r\n"; +"( 1) Haoon\r\n" +"( 2) Utnir\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; + return RACE_HAOON; } + else if (strcmp(arg, "2") == 0) + { + return RACE_UTNIR; + } + else if (strcmp(arg, "3") == 0) + { + return RACE_DUARON; + } + + return RACE_UNDEFINED; } long