Commit Graph

12007 Commits

Author SHA1 Message Date
nhmall
e69808987e support for build with current Lua version 5.4.3
On some platforms this may require:
	make spotless
	make fetch-lua

I did attempt to force a reminder message about the latter to
Makefile.top this time, and hope that works correctly for everyone.
2021-06-02 19:12:47 -04:00
PatR
9e59977c79 fix pull request #521 - valk+warrior alignment
Valkyrie player monster was set to be chaotic even though valk
hero is lawful by default and can also be neutral but not chaotic.
Change it to be lawful.  Warrior quest monsters attending leader
were also chaotic; change to lawful to match revised valk.  If
hero is a neutral valk then both the player monster and warriors
get changed to neutral at start of game (and stay that way even
if hero changes alignment).  The leader defaults to neutral but
gets changed to lawful for lawful valk hero.

Attentdant quest monsters with the healer leader were lawful but
if they gain enough experience they get promoted to healer, so
make them neutral like the latter.

I've added some miscellaneous comments and done a small amount of
reformatting.  Comment about alignment changing in bones applies
to all roles that can be played with different alignments, not
just to valkyries.  It isn't new; I just thought that it ought to
be mentioned somewhere.

Fixes #521
2021-06-01 17:14:50 -07:00
PatR
ffddb3ecf9 append_str(pager.c) again
More for issue #524.

The revised append_str() was still vulnerable to unsigned subtraction
overflowing from small negative value to huge positive one, if caller
ever passed an outbuf buffer which already had more than BUFSZ
characters in it.

Also the semantics were changed.  If there wasn't room for the whole
" or "+string to be appended, it used to add as much as would fit.
The revised version changed that to all-or-nothing.  This changes it
back, although players will probably never know the difference.
2021-05-31 15:28:19 -07:00
PatR
6fb8434ec9 Tribute: Feet of Clay
Add a page citation for passage #1 and change the wording of that
passage to match the book:  the second "does not need" should be
"doesn't even need".

Also make the comments about various added passages (for other
books) be more consistent.
2021-05-31 07:59:12 -07:00
nhmall
174cd59616 potential buffer overflow in append_str
fixes #524
2021-05-31 10:21:44 -04:00
PatR
53888a713c add ^ and " choices to / command
Like /m for nearby monsters and /O for all objects, implement /^
and /" to view a list of nearby traps or all known traps.  Only
lists discovered traps (or mimics immitating traps, or detected
door or chest traps iff still shown as such on map), but lists
map traps even when an object or monster at the same location is
blocking view of them.

For traps on the Water and Air levels that have been mapped, they
will only be listed when within line of sight so that this feature
can't be used to track portal location as it moves around.  However,
when within line of sight it does allow the portal to be recognized
if that has become covered.
2021-05-30 17:31:47 -07:00
PatR
494b374e12 whatis / quick-whatis for '^'
When using '//' or ';' to examine the map and player uses '^' to
move the cursor to the next displayed trap, have cursor go to
locations containing webs, the vibrating square, or other non-'^'
trap when such is the next trap symbol up.  Otherwise looking at
webs is very tedious because '"' is treated as a look-at command
rather than than a target symbol.
2021-05-30 01:31:54 -07:00
PatR
0fda8504bb sp_lev.c reformatting
Mostly reformatting but fixes a bug in mapfrag_free(); would matter
if the same map fragment gets freed a second time.
2021-05-30 01:01:01 -07:00
PatR
72866e2252 special level loading error
For the baalz 'lit=0' fix, I first tried 'lit=false'.  That isn't
supported and triggered an error, but the error reporting passed
a null pointer to sprintf() for a %s argument.  OSX's stdio shows
"null" instead of crashing in that situation; most implementations
wouldn't be so forgiving.

It intends to complain about "false" but that won't work if the
unexpected value doesn't get put into the lua table.  I don't know
how to fix that aspect of this.  This fix just avoids passing a
null pointer to sprintf.  Plus some miscellaneous reformatting.
2021-05-29 13:34:32 -07:00
PatR
7f2620b98c fix pull request #523 - lighting on baalz level
Details for baalz level are different from other levels and that
unintentionally gave it a chance to be lit.  Force it to be unlit.

Fixes #523
2021-05-29 13:33:15 -07:00
PatR
825314c040 tribute update: Maskerade
Accept "novel named Masquerade" when wishing for Maskerade.

Add four new passages, bringing total to 13.
2021-05-26 13:19:36 -07:00
Pasi Kallinen
a71482af71 Check genocided zombies before raising the zombified corpse
Fixes #520
2021-05-26 09:02:38 +03:00
PatR
0cdb91aa50 Unix 'make update'
Revise Makefile.top to remove the obsolete commands which change
the last modified date of save and bones files during 'make update'.
Using file dates to validate save files against nethack hasn't been
useful for many years.

Also, update assorted comments.
2021-05-23 18:14:13 -07:00
Pasi Kallinen
8d2407f1f2 Monsters can gain resistances by eating corpses
This is based on both the EvilHack implementation by
k21971 <keith.simpson1971@gmail.com>, and xNetHack
implementation by copperwater <aosdict@gmail.com>.
2021-05-23 19:03:33 +03:00
Pasi Kallinen
20cbadcf85 Unlock your quest by killing your quest leader
Allow killing your quest leader, just to make games winnable if you
converted before doing the quest.
Boost the quest leaders and give them some equipment. King Arthur
gets Excalibur. Killing quest leader gives really bad luck and
makes your god angry at you, and killing quest guardians gives
smaller penalties.

This is based on both the EvilHack implementation by
k21971 <keith.simpson1971@gmail.com>, and xNetHack
implementation by copperwater <aosdict@gmail.com>.
2021-05-23 11:11:58 +03:00
copperwater
882efdcf58 Pets are more careful about attacking monsters at low health
Another SliceHack feature. However, the math implemented by SliceHack
seemed incorrect, so I tweaked it.

Pets previously attacked monsters of up to one level higher than them as
long as they were above 25% health. Now, they will attack monsters as
follows:
100%: up to level + 2 (pets could not attack this high before)
80%+: up to level + 1
60%+: up to same level
40%+: up to level - 1
25%+: up to level - 2

The case that prevents any attacks below 25% health still exists.
2021-05-22 16:44:58 +03: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
7f8cfb43d2 More hallu colors 2021-05-22 08:56:54 +03:00
Pasi Kallinen
29868036f1 Lua: nhcore script with function callbacks
Adds possible callbacks for "start_new_game", "restore_old_game",
"moveloop_turn", and "game_exit" which when defined, will be called
from core code at the appropriate time.

Adds lua hooks for dump_fmtstr (only if DUMPLOG), dnum_name, u.moves,
u.uhave_amulet, and u.depth.
2021-05-21 21:24:59 +03:00
PatR
0e9bf2e03c config error reporting
Try to handle the convoluted error handling better.  Not very
thoroughly tested...
2021-05-21 08:52:18 -07:00
PatR
164417f01f fix github issue #514 - 'O' segfault
The #version command retrieves the lua version number to include
in its output, but it was leaving the 'in_lua' flag set.  So if a
later 'O' command tried to complain about a bad option value, the
error reporting routine crashed.
2021-05-21 08:40:39 -07:00
PatR
d6cafdc527 fix github issue #515 - grappling hook internals
Grappling hook used to have an undiscovered description of "iron hook"
and when that was removed, the oc_name_known flag was left set as if
for something that could become discovered.  I'm not sure whether that
made any difference anywhere.

Gold piece was in a similar situation, except that it wasn't because
an alternate description had been present and then removed.  That one
definitely didn't make any difference anywhere.

Fixes #515
2021-05-20 18:56:03 -07:00
Pasi Kallinen
5ad45fc696 Make anti-magic fields drain more energy
... and make them actually deal damage based on the energy
it would've drained, if you have Antimagic.
Also prevent them appearing too early in the dungeon.

Allow drain energy attacks (and anti-magic traps) drain more
than your level of energy.

Make eating magical monsters such as wizards and shamans give
the same tiny buzz bonus as eating a newt.
2021-05-20 21:35:23 +03:00
Pasi Kallinen
a1b765936f Boost HP of some golems
Idea from SporkHack by Derek Ray, but values are different.
2021-05-20 19:25:16 +03:00
PatR
2c92049821 tribute: Interesting Times
Add missing italics to several words in passage 1.

Add three new passages, bringing the total to 13.

The third one ended up being fairly long.  I made note of it
intending just the bacon joke but when transcribing I backed up
quite a ways.  The context is fairly unusual for a Discworld story.
2021-05-20 03:04:31 -07: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
11e98efb94 fix pull request #513 - applying books
Applying a novel to flip through its pages described them as having
"ink" rather than "magical ink" but that wasn't a very suitable way
to distinguish them from spellbooks since their ink never fades.

The Book of the Dead's pages "glowed faintly red" even when the
hero couldn't see them.

Fixes #513
2021-05-18 18:31:04 -07:00
PatR
09ec492dd8 fix github issue #511 - no death message when
level-drained below level 1.  No "you die" or equivalent, just
straight to being life-saved or to "do you want your possessions
identifed?".  Change it to issue "Goodbye level 1."  The fact
that it is has been fatal will become obvious.  An issue comment
on github pointed out where the fix was needed.

Fixes #511
2021-05-18 16:26:38 -07:00
PatR
f88508cd25 fix github issue #512 - fuzzer vs #exploremode
When the fuzzer is running, don't allow a randomly generated M-X
keystroke to switch from debug mode to explore mode.

[Unintended side-effect of the combination of two earlier changes:
assigning M-X as default key for #exploremode and allowing someone
in debug mode to voluntarily downgrade to explore mode (which should
never impact normal play and makes some types of testing simpler).]

Fixes #512
2021-05-18 15:41:51 -07:00
Pasi Kallinen
16105ad0d5 Change touch of death from instadeath to maxhp reduction and damage
Touch of death will now do 50 + 8d6 damage, and drain max HP for half
of that. If the drain is equal or greater than your max HP, then it
will kill you instantly.

Change originally from SporkHack by Derek Ray.
2021-05-18 18:58:34 +03:00
Pasi Kallinen
f057ef573c Knights get no metal armor penalty for clerical spells
Originally from SporkHack by Derek Ray.
2021-05-18 17:02:28 +03:00
Pasi Kallinen
2288452278 Monsters can see player resistances
If monsters see you resist something, generally elemental or magical
attack, or if they see you reflect an attack, they learn that and
will adjust their attack accordingly.

Originally from SporkHack, but this version comes via EvilHack with
some minor changes.
2021-05-17 20:01:11 +03:00
PatR
2a10b3003d kill extremely long running games
If move counter ever hits one billion, quit.  Leaving it unlimited
means that it could eventually wrap to a negative value and break
various things.
2021-05-16 16:48:33 -07:00
PatR
716c50635f food prayer tweak
Guard against 16-bit int overflow when augmenting prayer timeout
for long running games.
2021-05-16 16:42:20 -07:00
PatR
bc856e9a55 tweaks to role-specific prediscovered objects
Characters who start out knowing non-magic armor should not know
cornuthaum and dunce cap.  (Which suggests that those probably
ought to be classified as magic.)

Take away knowledge of polearms from barbarians and valkyries.

Add knowledge of all bows/crossbows, arrows/bolts, and spears to
rangers.

Add knowledge of all daggers to rogues.  (Very minor; non-elves
recognize elven daggers and non-orcs recognize orcish daggers.)
2021-05-15 19:13:29 -07:00
PatR
e3d6fa038b fix #K586 - eucalyptus leaf falling on hero's head
[From 14 months ago; I've got an old email for this but can't find
 it in the bug list.]

Some things shouldn't hurt the hero when thrown upward and falling
back on head.  I've been pretty conservative about what won't do
any harm.
2021-05-14 17:13:48 -07:00
PatR
dae25564bc more object->dknown handling
Fix a couple of places that set obj->dknown to 0 to deal with some
special cases where it should be left at 1.  (Other places do that
but deal with potions where hardcoded 0 remains appropriate.)
2021-05-13 09:38:53 -07:00
PatR
b630d5e038 fix issue #509 - shop 'glob' pricing segfault
A recent change made it possible for a glob to have its dknown flag
cleared and that exposed globby_bill_fixup() passing Null shopkeeper
to get_cost(), triggering a crash.

Make the routine that clears dknown/known/bknown/&c also be the
routine used to initialize those flags for a new object so that it
is the place that handles various special cases.  That hides the
shop bug again.

But also fix the shop bug even though it won't be triggered.

Fixes #509
2021-05-12 16:13:40 -07:00
PatR
25b1baed84 fix saddle sanity check code
Fix some bad code for "no saddle" caused by careless editing that
changed (uncomitted)
  char *ns = 0;
  if (foo)
    ns = "foo";
  else if (bar)
    ns = "bar";
by splicing lines together and accidentally ended up with
  char *ns;
  ns = foo ? ns = "foo" : bar ? ns = "bar" : 0;
when
  char *ns;
  ns = foo ? "foo" : bar ? "bar" : 0;
was intended.

I'm a bit surprised that the intermediate form without any
parentheses around 'ns = "bar"' compiles at all.  C99?  I don't
think that it would have if it had been processed as C90 or pre-ANSI.
2021-05-11 15:59:19 -07:00
nhmall
708a169917 three warnings building with gcc 10
---
insight.c: In function ‘status_enlightenment’:
insight.c:937:28: warning: ‘ (’ directive writing 2 bytes into a region of size between 0 and 255 [-Wformat-overflow=]
  937 |         Sprintf(buf, "%s %s (%s)", ustick ? "holding" : "held by",
      |                            ^~
In file included from ../include/config.h:631,
                 from ../include/hack.h:10,
                 from insight.c:15:
../include/global.h:274:24: note: ‘sprintf’ output 5 or more bytes (assuming 260) into a destination of size 256
  274 | #define Sprintf (void) sprintf
insight.c:937:9: note: in expansion of macro ‘Sprintf’
  937 |         Sprintf(buf, "%s %s (%s)", ustick ? "holding" : "held by",
      |         ^~~~~~~
insight.c:918:29: warning: ‘%s’ directive writing up to 255 bytes into a region of size 252 [-Wformat-overflow=]
  918 |         Sprintf(buf, "%s by %s",
      |                             ^~
  919 |                 is_animal(u.ustuck->data) ? "swallowed" : "engulfed",
  920 |                 heldmon);
      |                 ~~~~~~~
In file included from ../include/config.h:631,
                 from ../include/hack.h:10,
                 from insight.c:15:
../include/global.h:274:24: note: ‘sprintf’ output 5 or more bytes (assuming 260) into a destination of size 256
  274 | #define Sprintf (void) sprintf
insight.c:918:9: note: in expansion of macro ‘Sprintf’
  918 |         Sprintf(buf, "%s by %s",
      |         ^~~~~~~

---

zap.c:475:1: warning: old-style function definition [-Wold-style-definition]
  475 | release_hold()
      | ^~~~~~~~~~~~
2021-05-11 09:24:21 -04:00
nhmall
4c98a6f550 Merge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.7 2021-05-10 18:52:07 -04:00
nhmall
d87a910817 pipelines build attempt 2 2021-05-10 18:51:29 -04:00
PatR
b4967c817a more tribute: Soul Music
Add page citations for first two passages and some missing italics
to the first one.  Fix spelling of "fossil" in passage 8.

Add two short, new passages bringing total to 13.
2021-05-10 15:16:21 -07:00
nhmall
751cce7161 try simple fix for pipelines gcc-8 issue 2021-05-10 14:25:53 -04:00
Pasi Kallinen
1e1d580336 Allow webs to be placed without a giant spider on them
Allow creating webs without spiders in the lua level scripts:

des.trap({ type = "web", spider_on_web = 0 });

Based on xNetHack commit by copperwater <aosdict@gmail.com>.

Also changes the Spider nest themed room to generate without
spiders when the level difficulty is 8 or less.
2021-05-10 17:48:51 +03:00
PatR
09b71fcc95 suppress monster health
For the time being at least, take out "uninjured/barely wounded/
slightly wounded/wounded/heavily wounded/nearly dead" description
on monsters examined with ';' or '//' or '/m' and on final tombstone
and logfile entry if hero gets directly killed by a monster.

Maybe it will be revisited later....
2021-05-09 12:54:45 -07:00
Pasi Kallinen
d2b331abf7 Accept "waiting" on special level des.monster() specifications
Allow specifying "waiting" for monsters created via lua level scripts.
This sets the monster strategy to make it wait for the hero
to be in visual range before allowing the monster to move.

Also makes the monster inside the Mausoleum themed room use this feature,
to prevent out of depth liches bothering the player unprovoked.

For example:

des.monster({ class = "D", waiting = 1 });
2021-05-09 12:24:27 +03:00
Pasi Kallinen
967c7e5b0b Fix compile error on Windows
Fixes #508
2021-05-09 11:43:55 +03:00
PatR
646f247608 corpse eating feedback
Avoid the message combination
|You have a very bad case of stomach acid.
|This acid blob corpse tastes okay.
2021-05-09 01:13:32 -07:00
PatR
c866c9022b fix github issue #507 - filename buffer overflow
when compressing or uncompressing a save file.  Defining
VAR_PLAYGROUND forces PREFIXES_IN_USE to be defined, and the latter
causes docompress_file() to be called with save file name containing
a full path instead of just save/xyzzy.Z relative to the playground.
Depending on the value of VAR_PLAYGROUND, that could be too long for
the buffer used to make a copy of the name with ".Z"/".gz"/".bz2"
appended.

Probably only applies to Unix/linux/OSX configurations.

Fixes #507
2021-05-08 18:02:00 -07:00