From 3dfea8f553013c251a60e2f99d5fa3f0ef65fec8 Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Mon, 15 Jul 2013 17:30:16 +0200 Subject: Rework paralysis to avoid insta-death Paralysis would mean instant death (even when hit by a lowly floating eye), but this is not really an interesting mechanic. It has been reworked to not be cumulative, such that it isn't a death sentence, but is still very dangerous if the paralyzer is faster than the player. --- src/cmd2.c | 2 +- src/cmd6.c | 13 ++++++------- src/cmd7.c | 8 ++++---- src/dungeon.c | 4 ++-- src/externs.h | 1 + src/melee1.c | 4 ++-- src/melee2.c | 4 ++-- src/monster2.c | 2 +- src/spells1.c | 6 +++--- src/spells2.c | 8 ++++---- src/traps.c | 4 ++-- src/xtra2.c | 35 ++++++++++++++++++++++++++++++++--- 12 files changed, 60 insertions(+), 31 deletions(-) diff --git a/src/cmd2.c b/src/cmd2.c index 9b1a8ed7..20ef50af 100644 --- a/src/cmd2.c +++ b/src/cmd2.c @@ -2339,7 +2339,7 @@ static bool_ do_cmd_bash_aux(int y, int x, int dir) msg_print("You are off-balance."); /* Hack -- Lose balance ala paralysis */ - (void)set_paralyzed(p_ptr->paralyzed + 2 + rand_int(2)); + (void)set_paralyzed(2 + rand_int(2)); } /* Result */ diff --git a/src/cmd6.c b/src/cmd6.c index ab82bc17..bfe364e5 100644 --- a/src/cmd6.c +++ b/src/cmd6.c @@ -285,7 +285,7 @@ static void corpse_effect(object_type *o_ptr, bool_ cutting) { if (!p_ptr->free_act) { - set_paralyzed(p_ptr->paralyzed + dam + idam + 10); + set_paralyzed(dam + idam + 10); } break; @@ -1060,7 +1060,7 @@ void do_cmd_eat_food(void) { if (!p_ptr->free_act) { - if (set_paralyzed(p_ptr->paralyzed + rand_int(10) + 10)) + if (set_paralyzed(rand_int(10) + 10)) { ident = TRUE; } @@ -1779,7 +1779,7 @@ static bool_ quaff_potion(int tval, int sval, int pval, int pval2) msg_print("The potion makes you vomit!"); (void)set_food(PY_FOOD_STARVE - 1); (void)set_poisoned(0); - (void)set_paralyzed(p_ptr->paralyzed + 4); + (void)set_paralyzed(4); ident = TRUE; break; @@ -1846,7 +1846,7 @@ static bool_ quaff_potion(int tval, int sval, int pval, int pval2) { if (!p_ptr->free_act) { - if (set_paralyzed(p_ptr->paralyzed + rand_int(4) + 4)) + if (set_paralyzed(rand_int(4) + 4)) { ident = TRUE; } @@ -5383,8 +5383,7 @@ const char *activation_aux(object_type * o_ptr, bool_ doit, int item) msg_print("You are too weak to control the stone!"); /* Hack -- Bypass free action */ - (void)set_paralyzed(p_ptr->paralyzed + - randint(5 * oops + 1)); + (void)set_paralyzed(randint(5 * oops + 1)); /* Confusing. */ (void)set_confused(p_ptr->confused + @@ -6999,7 +6998,7 @@ const char *activation_aux(object_type * o_ptr, bool_ doit, int item) case ACT_PARALYZE: { if (!doit) return "paralyze"; - set_paralyzed(p_ptr->paralyzed + 20 + randint(10)); + set_paralyzed(20 + randint(10)); /* Timeout is set before return */ diff --git a/src/cmd7.c b/src/cmd7.c index 555e7e17..3d3b1bb2 100644 --- a/src/cmd7.c +++ b/src/cmd7.c @@ -698,7 +698,7 @@ void do_cmd_mindcraft(void) msg_print("You faint from the effort!"); /* Hack -- Bypass free action */ - (void)set_paralyzed(p_ptr->paralyzed + randint(5 * oops + 1)); + (void)set_paralyzed(randint(5 * oops + 1)); /* Damage WIS (possibly permanently) */ if (rand_int(100) < 50) @@ -1107,7 +1107,7 @@ void do_cmd_mimic(void) msg_print("You faint from the effort!"); /* Hack -- Bypass free action */ - (void)set_paralyzed(p_ptr->paralyzed + randint(5 * oops + 1)); + (void)set_paralyzed(randint(5 * oops + 1)); /* Damage WIS (possibly permanently) */ if (rand_int(100) < 50) @@ -5513,7 +5513,7 @@ void do_cmd_necromancer(void) msg_print("You faint from the effort!"); /* Hack -- Bypass free action */ - (void)set_paralyzed(p_ptr->paralyzed + randint(5 * oops + 1)); + (void)set_paralyzed(randint(5 * oops + 1)); /* Damage CON (possibly permanently) */ if (rand_int(100) < 50) @@ -7540,7 +7540,7 @@ void do_cmd_symbiotic(void) msg_print("You faint from the effort!"); /* Hack -- Bypass free action */ - (void)set_paralyzed(p_ptr->paralyzed + randint(5 * oops + 1)); + (void)set_paralyzed(randint(5 * oops + 1)); /* Damage CON (possibly permanently) */ if (rand_int(100) < 50) diff --git a/src/dungeon.c b/src/dungeon.c index fdf11b3b..de1a51fe 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -1802,7 +1802,7 @@ static void process_world(void) disturb(1, 0); /* Hack -- faint (bypass free action) */ - (void)set_paralyzed(p_ptr->paralyzed + 1 + rand_int(5)); + (void)set_paralyzed(1 + rand_int(5)); } } } @@ -2266,7 +2266,7 @@ static void process_world(void) /* Paralysis */ if (p_ptr->paralyzed) { - (void)set_paralyzed(p_ptr->paralyzed - 1); + dec_paralyzed(); } /* Confusion */ diff --git a/src/externs.h b/src/externs.h index a7a0748a..46675de7 100644 --- a/src/externs.h +++ b/src/externs.h @@ -2130,6 +2130,7 @@ extern bool_ set_confused(int v); extern bool_ set_poisoned(int v); extern bool_ set_afraid(int v); extern bool_ set_paralyzed(int v); +extern void dec_paralyzed(); extern bool_ set_image(int v); extern bool_ set_fast(int v, int p); extern bool_ set_light_speed(int v); diff --git a/src/melee1.c b/src/melee1.c index 0940f7b4..157656a9 100644 --- a/src/melee1.c +++ b/src/melee1.c @@ -783,7 +783,7 @@ bool_ carried_make_attack_normal(int r_idx) } else { - if (set_paralyzed(p_ptr->paralyzed + 3 + randint(rlev))) + if (set_paralyzed(3 + randint(rlev))) { obvious = TRUE; } @@ -2418,7 +2418,7 @@ bool_ make_attack_normal(int m_idx, byte divis) } else { - if (set_paralyzed(p_ptr->paralyzed + 3 + randint(rlev))) + if (set_paralyzed(3 + randint(rlev))) { obvious = TRUE; } diff --git a/src/melee2.c b/src/melee2.c index 04575dd2..9dbdda86 100644 --- a/src/melee2.c +++ b/src/melee2.c @@ -3771,7 +3771,7 @@ bool_ make_attack_spell(int m_idx) } if (!p_ptr->free_act) { - (void)set_paralyzed(p_ptr->paralyzed + rand_int(4) + 4); + (void)set_paralyzed(rand_int(4) + 4); } (void)set_slow(p_ptr->slow + rand_int(4) + 4); @@ -4095,7 +4095,7 @@ bool_ make_attack_spell(int m_idx) } else { - (void)set_paralyzed(p_ptr->paralyzed + rand_int(4) + 4); + (void)set_paralyzed(rand_int(4) + 4); } update_smart_learn(m_idx, DRS_FREE); break; diff --git a/src/monster2.c b/src/monster2.c index 65d1c368..5ed4758a 100644 --- a/src/monster2.c +++ b/src/monster2.c @@ -1633,7 +1633,7 @@ void sanity_blast(monster_type * m_ptr, bool_ necro) } if (!p_ptr->free_act) { - (void)set_paralyzed(p_ptr->paralyzed + rand_int(4) + 4); + (void)set_paralyzed(rand_int(4) + 4); } while (rand_int(100) > p_ptr->skill_sav) (void)do_dec_stat(A_INT, STAT_DEC_NORMAL); diff --git a/src/spells1.c b/src/spells1.c index 9981f2be..5aec03bf 100644 --- a/src/spells1.c +++ b/src/spells1.c @@ -5348,7 +5348,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) } default: if (!p_ptr->free_act) - (void)set_paralyzed(p_ptr->paralyzed + randint(dam)); + (void)set_paralyzed(randint(dam)); break; } } @@ -7954,7 +7954,7 @@ static bool_ project_p(int who, int r, int y, int x, int dam, int typ, int a_rad { if (p_ptr->free_act) break; if (fuzzy) msg_print("You fall asleep!"); - set_paralyzed(p_ptr->paralyzed + dam); + set_paralyzed(dam); dam = 0; break; } @@ -8023,7 +8023,7 @@ static bool_ project_p(int who, int r, int y, int x, int dam, int typ, int a_rad case GF_STASIS: { if (fuzzy) msg_print("You are hit by something paralyzing!"); - set_paralyzed(p_ptr->paralyzed + dam); + set_paralyzed(dam); break; } diff --git a/src/spells2.c b/src/spells2.c index cdd3af66..19fb9f8f 100644 --- a/src/spells2.c +++ b/src/spells2.c @@ -7083,9 +7083,9 @@ case 13: case 14: case 15: case 19: case 20: { msg_print("You feel like a statue!"); if (p_ptr->free_act) - set_paralyzed (p_ptr->paralyzed + randint(3)); + set_paralyzed(randint(3)); else - set_paralyzed (p_ptr->paralyzed + randint(13)); + set_paralyzed(randint(13)); stop_ty = TRUE; } if (randint(6) != 1) break; @@ -7175,9 +7175,9 @@ void activate_dg_curse(void) { msg_print("You feel like a statue!"); if (p_ptr->free_act) - set_paralyzed (p_ptr->paralyzed + randint(3)); + set_paralyzed(randint(3)); else - set_paralyzed (p_ptr->paralyzed + randint(13)); + set_paralyzed(randint(13)); stop_dg = TRUE; } if (randint(7) != 1) break; diff --git a/src/traps.c b/src/traps.c index 0006edc7..999f9acc 100644 --- a/src/traps.c +++ b/src/traps.c @@ -617,7 +617,7 @@ bool_ player_activate_trap_type(s16b y, s16b x, object_type *i_ptr, s16b item) if (!p_ptr->free_act) { msg_print("You touch a poisoned part and can't move."); - (void)set_paralyzed(p_ptr->paralyzed + rand_int(10) + 10); + (void)set_paralyzed(rand_int(10) + 10); ident = TRUE; } else @@ -706,7 +706,7 @@ bool_ player_activate_trap_type(s16b y, s16b x, object_type *i_ptr, s16b item) if (!p_ptr->free_act) { - (void)set_paralyzed(p_ptr->paralyzed + rand_int(dun_level) + 6); + (void)set_paralyzed(rand_int(dun_level) + 6); } ident = TRUE; break; diff --git a/src/xtra2.c b/src/xtra2.c index 6f86b5f7..a0d500f2 100644 --- a/src/xtra2.c +++ b/src/xtra2.c @@ -676,11 +676,14 @@ bool_ set_afraid(int v) /* - * Set "p_ptr->paralyzed", notice observable changes + * Mechanics for setting the "paralyzed" field. */ -bool_ set_paralyzed(int v) +static bool_ set_paralyzed_aux(int v) { - bool_ notice = set_simple_field( + bool_ notice; + + /* Normal processing */ + notice = set_simple_field( &p_ptr->paralyzed, v, TERM_WHITE, "You are paralyzed!", TERM_WHITE, "You can move again."); @@ -698,6 +701,32 @@ bool_ set_paralyzed(int v) return notice; } +/* + * Set "p_ptr->paralyzed", notice observable changes + */ +bool_ set_paralyzed(int v) +{ + /* Paralysis effects do not accumulate -- this is to + prevent the uninteresting insta-death effect, but + still leave paralyzers highly dangerous if they're + faster than the player. */ + + if (p_ptr->paralyzed > 0) { + return FALSE; + } + + /* Normal processing */ + return set_paralyzed_aux(v); +} + +/* + * Decrement "p_ptr->paralyzed", notice observable changes + */ +void dec_paralyzed() +{ + set_paralyzed_aux(p_ptr->paralyzed - 1); +} + /* * Set "p_ptr->image", notice observable changes -- cgit v1.2.3