Mercurial > hg > early-roguelike
changeset 251:e7862a021609
Fix the perpetual haste cheat.
Rogue V3 allowed the player to gain perpetual haste by quaffing a
potion of haste while already hasted. This is supposed to remove the
haste effect and cause temporary paralysis.
Super-Rogue removed haste correctly, but gave confusing messages.
author | John "Elwin" Edwards |
---|---|
date | Sat, 28 Jan 2017 11:45:36 -0500 |
parents | d08f19d529eb |
children | 3d4252fa2ed3 |
files | rogue3/misc.c rogue3/potions.c rogue3/rogue.h srogue/potions.c srogue/pstats.c srogue/rings.c |
diffstat | 6 files changed, 13 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/rogue3/misc.c Wed Jul 20 20:44:41 2016 -0400 +++ b/rogue3/misc.c Sat Jan 28 11:45:36 2017 -0500 @@ -320,20 +320,23 @@ * add a haste to the player */ -void +bool add_haste(int potion) { if (on(player, ISHASTE)) { msg("You faint from exhaustion."); no_command += rnd(8); + player.t_flags &= ~ISHASTE; extinguish(nohaste); + return FALSE; } else { player.t_flags |= ISHASTE; if (potion) fuse(nohaste, 0, rnd(4)+4, AFTER); + return TRUE; } }
--- a/rogue3/potions.c Wed Jul 20 20:44:41 2016 -0400 +++ b/rogue3/potions.c Sat Jan 28 11:45:36 2017 -0500 @@ -158,8 +158,8 @@ p_know[P_XHEAL] = TRUE; sight(); when P_HASTE: - add_haste(TRUE); - msg("You feel yourself moving much faster."); + if (add_haste(TRUE)) + msg("You feel yourself moving much faster."); p_know[P_HASTE] = TRUE; when P_RESTORE: msg("Hey, this tastes great. It make you feel warm all over.");
--- a/rogue3/rogue.h Wed Jul 20 20:44:41 2016 -0400 +++ b/rogue3/rogue.h Sat Jan 28 11:45:36 2017 -0500 @@ -511,7 +511,7 @@ void _free_list(struct linked_list **ptr); char * _new(size_t size); int add_dam(str_t *str); -void add_haste(int potion); +bool add_haste(int potion); void add_pack(struct linked_list *item, int silent); void add_pass(void); void addmsg(char *fmt, ...);
--- a/srogue/potions.c Wed Jul 20 20:44:41 2016 -0400 +++ b/srogue/potions.c Sat Jan 28 11:45:36 2017 -0500 @@ -197,7 +197,6 @@ when P_HASTE: if (!curse) { add_haste(TRUE); - msg("You feel yourself moving much faster."); p_know[P_HASTE] = TRUE; } when P_INVINC:
--- a/srogue/pstats.c Wed Jul 20 20:44:41 2016 -0400 +++ b/srogue/pstats.c Sat Jan 28 11:45:36 2017 -0500 @@ -148,10 +148,14 @@ } else { player.t_flags |= ISHASTE; - if (potion) + if (potion) { fuse(nohaste, TRUE, roll(10,10)); - else + msg("You feel yourself moving much faster."); + } + else { fuse(nohaste, TRUE, roll(40,20)); + msg("You find yourself moving much faster."); + } } }