Skip to content

Commit

Permalink
Being underwater gives you (and monsters) temporary sonic resistance …
Browse files Browse the repository at this point in the history
…while submerged.
  • Loading branch information
elunna committed Oct 2, 2023
1 parent 9b03ec2 commit 4c7d126
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
3 changes: 2 additions & 1 deletion include/mondata.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
#define resists_elec(mon) ((mon_resistancebits(mon) & MR_ELEC) != 0)
#define resists_poison(mon) ((mon_resistancebits(mon) & MR_POISON) != 0)
#define resists_acid(mon) ((mon_resistancebits(mon) & MR_ACID) != 0)
#define resists_sonic(mon) ((mon_resistancebits(mon) & MR_SONIC) != 0)
#define resists_sonic(mon) ((mon_resistancebits(mon) & MR_SONIC) != 0 \
|| mon_underwater(mon))
#define resists_ston(mon) ((mon_resistancebits(mon) & MR_STONE) != 0)
#define resists_psychic(mon) ((mon_resistancebits(mon) & MR_PSYCHIC) != 0)
#define resists_clob(mon) ((mon_resistancebits(mon) & MR_CLOB) != 0)
Expand Down
4 changes: 3 additions & 1 deletion include/youprop.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@

#define HSonic_resistance u.uprops[SONIC_RES].intrinsic
#define ESonic_resistance u.uprops[SONIC_RES].extrinsic
#define Sonic_resistance (HSonic_resistance || ESonic_resistance)
/* Anytime we are underwater we are effectively sonic resistant */
#define WSonic_resistance Underwater
#define Sonic_resistance (HSonic_resistance || ESonic_resistance || WSonic_resistance)

#define HStone_resistance u.uprops[STONE_RES].intrinsic
#define EStone_resistance u.uprops[STONE_RES].extrinsic
Expand Down
8 changes: 6 additions & 2 deletions src/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3364,8 +3364,12 @@ int final;
from_what(AD_ACID));
if (Psychic_resistance)
you_are("psionic resistant", from_what(PSYCHIC_RES));
if (Sonic_resistance)
you_are("sonic resistant", from_what(SONIC_RES));
if (Sonic_resistance) {
if (!WSonic_resistance)
you_are("sonic resistant", from_what(SONIC_RES));
else
you_are("sonic resistant", " (from being underwater)");
}
if (ESonic_resistance)
enl_msg("Your items ", "are", "were", " protected from sonic",
from_what(AD_LOUD));
Expand Down

0 comments on commit 4c7d126

Please sign in to comment.