Commit Graph
262 Commits
Author SHA1 Message Date
PatR c3e5aaf8ba displacer monster vs long worm
Reported directly to devteam:  monster vs monster location swapping
didn't handle single-segment long worms properly.  Multi-segment
worms are disallowed but a worm with no visible segments (which
actually has 1 segment at the head's location) are allowed and the
segment wasn't being moved with the core monster and could trigger
warnings if sanity checking is enabled.  The next time that the
worm moved, it got itself back in synch.

I couldn't reproduce the warning but mdisplacem() clearly assumed
that a long worm reporting 0 segments didn't have any so wasn't
attempting to handle the hidden one.
2021-10-03 14:15:02 -07:00
copperwater f855fb5e45 Remove g.monstermoves
It's redundant with g.moves, so there is no more need for it.

Way, way back, it looks like g.moves and g.monstermoves can and did
desync, where g.moves would track the amount of moves the player had
gotten (and would therefore increase faster if the player were hasted)
and g.monstermoves would track the amount of monster move cycles, aka
turns. But this has not been the case for a long time, and they both
increment together in the same location in allmain.c. There are no
longer any cases where they will not be the same value.

This is a save-breaking change because it changes struct
instance_globals, but I have not updated the editlevel in this commit.
2021-08-28 16:22:38 -07:00
PatR e3712dbb31 gaze vs hider
From a 7 or 8 year old bug report from a beta tester.  A pyrolisk's
gaze against a mimic didn't unhide that mimic.  Somewhere along the
line that has been fixed, but some apparently redundant code inside
'if (visible)' should be done even when not visible.
2021-07-27 11:58:44 -07:00
PatR f8c20800c7 fix pull request #544 - fire vortex engulf
of hero carrying burning objects shouldn't cause those to be
extinguished.  Ditto when fire vortex or poly'd hero engulfs
monsters.

Fixes #544
2021-07-09 06:51:10 -07:00
Pasi Kallinen 6b60618e0e Exploding spheres cause real explosions
Despite active explosion attacks being called explosions in-game,
they only affected a single target, and were handled differently
from actual explosions. Make them do an actual explosion instead.
This should make spheres more interesting and inspire different
tactics handling them.

Because spheres deal more damage on average and can destroy items
in their explosions, their difficulty has been increased slightly.

Polyselfed hero exploding won't cause elemental damage to their
own gear.

Originally from xNetHack by copperwater <aosdict@gmail.com>.
2021-05-22 13:37:39 +03:00
Pasi Kallinen 2f25556025 Conflict based off of charisma
Higher charisma will make it more likely for monsters to be affected.
Conflict will also now require the monster to see the hero.

Originally from SporkHack by Derek Ray.
2021-05-19 18:35:00 +03:00
PatR 28f112fb17 fix pull request #485 - genetic engineer attacks
Pull request fixed two genetic engineer problems:
1) lack of "you hit <foo>" message when you were poly'd into one;
2) lack of shield effect animation ('sparkle') when a genetic
   engineer hit magic resistant hero.

That opened a can o' worms.
3) hero lacking see invisible, poly'd into genetic engineer, and
   turning target into an invisible stalker got no feedback about
   the target vanishing.

A genetic engineer attacking a monster would polymorph it turn
after turn.
4) put back the teleport capability I removed when bringing it over
   from slash'em;
5) have genetic engineer teleport away after polymorphing someone.

The various mhitm_ad_XXXX() routines used g.vis to have caller
decide visibility, but hmonas() for poly'd hero didn't set that so
some messages--not just attack induced polymorph--were based on
visibility of earlier monster vs monster activity.
6) have hmonas() set up g.vis even though it doesn't use that.

There may have been one or two other minor fixes before I managed
to force the lid back onto the can.

Fixes #485
2021-04-04 20:06:45 -07:00
PatR 328dc5bdfa github issue #475 revisited - Trollsbane
Change Trollsbane versus troll corpse revival:  instead of revival
failing if Trollsbane is wielded at time of revival attempt, mark
the corpse no-revive if killed by Trollsbane (whether by the hero
or a monster).

If a no-revive corpse is within view when time to revive occurs,
give "the troll corpse twitches feebly" even when the hero isn't
responsible.  That used to only apply if the hero zapped the
corpse with undead turning, which would have become inoperative
because now being zapped by undead turning clears the no-revive
flag and revives as normal.  In other words, undead turning magic
overrides killed-by-Trollsbane or non-ice troll having been in an
ice box.
2021-04-02 10:38:57 -07:00
PatR 0479625c94 cancelled zombification
Don't let cancelled zombies or cancelled liches create new zombies.
2021-03-30 17:33:31 -07:00
PatR 8adb4aa219 blinded Archon gaze bit
From yesterday (old #H3841), the alternate message given when a
monster is being hit by a blind Archon's gaze was checking the
wrong monster for blindness.
2021-03-04 18:07:23 -08:00
PatR cd43027a49 fix #H3841 - inconsistent Archon gaze behavior
From six years ago:  hero is "blinded by the Archon's radiance"
even if the attacking Archon has been blinded, but monsters hit
by same thing were protected from it by that blindness.  Make
monsters attacked by Archons be affected similarly to the hero.

Hypothetical case of hero-as-Archon versus monster is ignored
because hero can't polymorph into that shape.
2021-03-03 14:40:19 -08:00
nhmall 7900632b50 Qt c++ function name shadow warnings
We have a struct called mkroom and a function called mkroom()
so c++ complains about the mkroom() function hiding the
initializer for the struct.

Similarly, we have a struct called attack and a function
called attack().

There may be a more elegant way of eliminating those two
warnings, but renaming mkroom() to do_mkroom() and
attack() to do_attack() was straightforward enough.
2021-02-03 10:55:07 -05:00
nhmall 5b1d668c44 enable -Wformat-nonliteral for linux and equivalent for windows compilers
Whitelist all the verified existing triggers:
makedefs.c: In function ‘name_file’
attrib.c: one compiler balks at a ? b : c for fmtstring
cmd.c: In function ‘extcmd_via_menu’
cmd.c: In function ‘wiz_levltyp_legend’
do.c: In function ‘goto_level’
do_name.c: In function ‘coord_desc’
dungeon.c: In function ‘overview_stats’
eat.c:  one compiler balks at a ? b : c for fmtstring
end.c:  one compiler balks at a ? b : c for fmtstring
engrave.c: In function ‘engr_stats’
hack:c one compiler balks at a ? b : c for fmtstring
hacklib.c: one compiler balks at a ? b : c for fmtstring
insight.c: one compiler balks at a ? b : c for fmtstring
invent.c: In function ‘let_to_name’
light.c: In function ‘light_stats’
mhitm.c: In function ‘missmm’
options.c: In function ‘handler_symset’
options.c: In function ‘basic_menu_colors’
options.c: In function ‘optfn_o_autopickup_exceptions’
options.c: In function ‘optfn_o_menu_colors’
options.c: In function ‘optfn_o_message_types’
options.c: In function ‘optfn_o_status_cond’
options.c: In function ‘optfn_o_status_hilites’
options.c: In function ‘doset’
options.c: In function ‘doset_add_menu’
options.c: In function ‘show_menu_controls’
options.c: In function ‘handle_add_list_remove’
pager.c: In function ‘do_supplemental_info’
pager.c: In function ‘dohelp’
region.c: In function ‘region_stats’
rumors.c: sscanf usage
sounds.c: In function ‘domonnoise’
spell.c: In function ‘dospellmenu’
timeout.c: In function ‘timer_stats’
topten.c: In function ‘outentry’, fscanf, sscanf, fprintf usage
windows.c: In function ‘genl_status_update’
zap.c: one compiler balks at a ? b : c for fmtstring
win/curses/cursstat.c: In function ‘curses_status_update’
win/tty/wintty.c: In function ‘tty_status_update’
win/win32/mswproc.c: In function ‘mswin_status_update’
2021-02-02 19:03:12 -05:00
Dean Luick 8ddab09cab Fix set but not used warnings 2021-01-28 21:11:21 -06:00
nhmall f963c5aca7 switch source tree from k&r to c99 2021-01-26 21:06:16 -05:00
nhmall 62f25fd000 clear five warnings for "set but not used" variables
Note: the line numbers referenced in the warning messages below are not in sync
with the NetHack-3.7 branch and should be disregarded

files.c: In function 'get_saved_games':
files.c:1168:9: warning: unused variable 'n' [-Wunused-variable]
 1168 |     int n, j = 0;
      |         ^

mhitm.c: In function 'mdamagem':
mhitm.c:843:13: warning: variable 'cancelled' set but not used [-Wunused-but-set-variable]
  843 |     boolean cancelled;
      |             ^~~~~~~~~

mhitu.c: In function 'hitmu':
mhitu.c:943:9: warning: variable 'uncancelled' set but not used [-Wunused-but-set-variable]
  943 |     int uncancelled;
      |         ^~~~~~~~~~~

mklev.c: In function 'place_branch':
mklev.c:1214:20: warning: variable 'br_room' set but not used [-Wunused-but-set-variable]
 1214 |     struct mkroom *br_room;
      |                    ^~~~~~~

monmove.c: In function 'm_move':
monmove.c:874:43: warning: variable 'doorbuster' set but not used [-Wunused-but-set-variable]
  874 |     boolean can_open = 0, can_unlock = 0, doorbuster = 0;
      |                                           ^~~~~~~~~~
2021-01-25 12:57:47 -05:00
Dean Luick 3ef0f889e6 Fix gcc sprintf warnings
Gcc 9 has become more vocal with sprintf buffer overflow
checking.  Remove these sprintf warnings by changing the
offending calls to a snprintf wrapper that will explicitly
check the result.
2021-01-16 19:44:56 -06:00
Pasi Kallinen 1f6a7a5eef Init the done variable to false 2020-12-04 09:30:22 +02:00
Pasi Kallinen 4fb370ee79 Remove unused variables 2020-12-04 09:30:21 +02:00
Pasi Kallinen b797baba7a Make return values use defines 2020-12-04 09:30:21 +02:00
Pasi Kallinen 3ef3b425ad Unify the ad type switches 2020-12-04 09:30:21 +02:00
Pasi Kallinen 88e333a3a8 Unify ad_ssex 2020-12-04 09:30:21 +02:00
Pasi Kallinen 1696019361 Unify ad_sedu 2020-12-04 09:30:21 +02:00
Pasi Kallinen d679d3a029 Unify ad_dgst 2020-12-04 09:30:20 +02:00
Pasi Kallinen d4625266a7 Remove unused goto label 2020-12-04 09:30:20 +02:00
Pasi Kallinen e777bd9670 Unify ad_legs 2020-12-04 09:30:20 +02:00
Pasi Kallinen 337e7da049 Unify ad_stun 2020-12-04 09:30:19 +02:00
Pasi Kallinen 12ee144936 Unify ad_heal 2020-12-04 09:30:19 +02:00
Pasi Kallinen 4901c8027c Unify ad_were 2020-12-04 09:30:19 +02:00
Pasi Kallinen a6a676f720 Unify ad_ston 2020-12-04 09:30:19 +02:00
Pasi Kallinen 20b6ea602b Unify ad_phys 2020-12-04 09:30:19 +02:00
Pasi Kallinen ac5822fe69 Unify ad_halu 2020-12-04 09:30:19 +02:00
Pasi Kallinen 36bb52466d Unify ad_deth 2020-12-04 09:30:19 +02:00
Pasi Kallinen 618feabd88 Unify ad_poly 2020-12-04 09:30:18 +02:00
Pasi Kallinen fda63d145b Unify ad_conf 2020-12-04 09:30:18 +02:00
Pasi Kallinen 558ec78b3a Unify ad_slow 2020-12-04 09:30:18 +02:00
Pasi Kallinen b80c30bcf1 Unify ad_ench 2020-12-04 09:30:18 +02:00
Pasi Kallinen 96a4d14a36 Unify ad_slim 2020-12-04 09:30:17 +02:00
Pasi Kallinen eb5508ba58 Unify ad_slee 2020-12-04 09:30:17 +02:00
Pasi Kallinen 654220f840 Unify ad_plys 2020-12-04 09:30:17 +02:00
Pasi Kallinen 7914237fbf Unify ad_wrap 2020-12-04 09:30:17 +02:00
Pasi Kallinen bfb8931188 Unify ad_stck 2020-12-04 09:30:17 +02:00
Pasi Kallinen b4ed25da46 Unify ad_drin 2020-12-04 09:30:17 +02:00
Pasi Kallinen 1ca0165bb9 Unify ad_drst 2020-12-04 09:30:16 +02:00
Pasi Kallinen dba9aaf424 Unify ad_curs 2020-12-04 09:30:16 +02:00
Pasi Kallinen d325e2cc60 Unify ad_blnd 2020-12-04 09:30:16 +02:00
Pasi Kallinen 607d1bcd96 Unify ad_tlpt 2020-12-04 09:30:16 +02:00
Pasi Kallinen bfe773812e Unify ad_sgld 2020-12-04 09:30:16 +02:00
Pasi Kallinen b7899ee014 Unify ad_acid 2020-12-04 09:30:15 +02:00
Pasi Kallinen 8a78c49fea Unify ad_elec 2020-12-04 09:30:15 +02:00