Commit Graph

10070 Commits

Author SHA1 Message Date
PatR
dba6c20e2d loading Lua scripts
When loading a Lua script, modify it with a comment containing the
file name (or DLB module name) so that error reporting doesn't just
show the first 60 bytes of the script.  Also, don't assume that it's
possible to load an entire script in one fread().  Unfortunately
that got way out of hand and the result isn't pretty.  But something
of the sort is necessary.  (Reading the script into one string first
and then applying modifications while copying it into a second one
would probably be a lot cleaner than mixing the two operations.)

If a script starts with a comment or a blank line, the insertion of
the file name comment won't disturb the line number reported in an
error message.  But if the script starts out with code on its first
line, error reports will be off by one for the line number.  Showing
the file name is more useful than keeping that number accurate.
2020-01-24 13:26:01 -08:00
PatR
b2fa6292db Lua error reporting buffer overflow
nhl_error() was clobbering the stack.  I assume that the 'source'
field in the Lua debugging structure is normally a file name, but
nethack loads an entire Lua script into one long string because it
usually comes out of the DLB container, and 'source' contained the
full string.  That would overflow the local buffer in nhl_error()
if nethack encountered a Lua problem and tried to report it. (In
my case, the problem was in a level description file modification.)

[Not something under user control unless user can modify dat/*.lua
and put the result into $HACKDIR/nhdat.]
2020-01-24 12:52:35 -08:00
PatR
424750867a wizard mode un-polymorph
When already polymorphed, polymorphing into 'human' (or character's
species) to revert to normal when at low level has the infuriating
tendency to yield "your new form isn't healthy enough to survive".
Allow specifying your own role as a way to rehumanize() instead of
going through newman() and level/sex/characteristics randomization
which that performs.
2020-01-21 18:29:23 -08:00
PatR
3e18804371 half poison gas damage from wearing a wet towel
Make wearing a wet towel confer new attribute Half_gas_damage in
addition to the usual blindness.  It reduces damage from being inside
a gas cloud region and from being hit by poison gas breath attack.
It also fully blocks breathing of potion vapors.

Might make the Plane of Fire easier although overcoming its blindness
with telepathy won't reveal elementals.  Definitely has the potential
to make blind-from-birth conduct easier which wasn't the intent and
probably isn't significant.
2020-01-21 17:03:54 -08:00
PatR
a13d6c03c9 no more headless eyewear
Noticed while working on something else:  hero kept wearing a towel
after polymorphing into a form without any head.  And when not already
wearing one, could put on a blindfold/towel/lenses while in a headless
form.
2020-01-21 15:36:33 -08:00
PatR
fa890fc7a2 wielded tin opener
For simplified weapon description (used by ^X and a few other places),
show "tin opener" instead of generic "tool" for that item since there
are cases where it is expected to be wielded.

Also, don't describe a wielded "glob of <foo>" as "food".
2020-01-21 15:11:59 -08:00
PatR
08775c2c78 add some long worm comments
and keep the remove_monster()+place_monster() followed by worm_move()
operations together.  No change in behavior.
2020-01-21 06:20:45 -08:00
nhmall
57e0e30d10 travis-ci bits: try to avoid failure-flagging on transient connectivity issues
Attempt to test whether Lua fetch succeeded (and pdcurses for windows
and msdos as well)

If those prerequisite fetches and untars didn't work, just exit without
marking the travis-ci build as a failure so that the development team
isn't notified about something transient that they don't need to fix
in the code.
2020-01-20 11:10:16 -05:00
nhw_cron
b444698005 This is cron-daily v1-Jan-19-2020. manpages updated: nethack.txt 2020-01-20 08:52:59 -05:00
nhmall
8061291c36 Merge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.7 2020-01-19 23:11:31 -05:00
nhmall
5175c6ab07 doc bit; closes #287
closes #287
2020-01-19 23:09:53 -05:00
Pasi Kallinen
2ba3fa9240 Fix warning on nonexistent quest.lua text
Cavemen don't have goal_alt message - before lua, that one
fell through into goal_next message, but now it tried to
load the "common" message. Add ability to define message fallbacks,
and make goal_next the fallback for goal_alt.

Also prevent issuing quest.lua errors twice.
2020-01-19 14:09:16 +02:00
PatR
3f0b9f26c5 losing via #offer to Moloch
Recently added "you hear an invisible choir chant in Latin ..."  is
jarring.  Unfortunately, something like "in an archaic language" would
make the message too long so just take out "in Latin".

Also a few reformatting bits for pray.c.
2020-01-18 18:47:01 -08:00
PatR
d19cab4d98 implicit_uncursed, mention_walls
Move 'implicit_uncursed' and 'mention_walls' from iflags to flags to
make their current setting persist across save/restore.  Invalidates
existing save files.
2020-01-17 04:03:14 -08:00
PatR
1a89e44e19 fix #K188 - trying to move past edge of level
Trying to move into a wall or solid rock fails and doesn't do anything
(unless the 'mention_walls' option is On) and doesn't use a turn, and
trying to move off the edge of the map window also doesn't do anything
(except for 'mention_walls') but that did use a turn.  Don't.
2020-01-17 02:43:32 -08:00
nhmall
fe4bdae740 closes #282
closes #282
2020-01-14 23:50:06 -05:00
nhw_cron
2f52fd3db3 This is cron-daily v1-Jan-14-2020. files updated: Files 2020-01-14 12:03:09 -05:00
nhw_cron
2e570e03e9 This is cron-daily v1-Jan-14-2020. manpages updated: recover.txt 2020-01-14 12:02:57 -05:00
nhw_cron
0415a5a235 This is cron-daily v1-Jan-14-2020. manpages updated: nethack.txt 2020-01-14 12:02:39 -05:00
nhw_cron
6a768b0cbe This is cron-daily v1-Jan-14-2020. manpages updated: mnh.txt 2020-01-14 12:02:26 -05:00
nhw_cron
32c7279e63 This is cron-daily v1-Jan-14-2020. manpages updated: mn.txt 2020-01-14 12:02:10 -05:00
nhw_cron
f431c72873 This is cron-daily v1-Jan-14-2020. manpages updated: makedefs.txt 2020-01-14 12:01:52 -05:00
nhw_cron
bd254e0853 This is cron-daily v1-Jan-14-2020. manpages updated: dlb.txt 2020-01-14 12:01:30 -05:00
PatR
2b1f8a1b43 fix #K166 - role selection filtering
pick_role() had a 5 year old copy+paste error where a pair of lines
were cloned multiple times but one of the resulting lines didn't get
the intended revision, preventing OPTIONS=align:!chaotic or !neutral
or !lawful from working as intended when letting the game choose role
randomly.  The bad line should have been calling ok_align() but that
routine turned out to have a bug too.

Fixing those lead to other less obvious problems with role selection,
particularly the tty menu version for picking manually.  Roles and/or
races which should have been excluded by partial specification weren't
always kept out.  Also, if any filtering was specified, trying to
disable all filters (via choosing 'reset filtering' and de-selecting
everything in the menu) was a no-op.  Once any filtering was in place
you had to leave at least one role or race or gender or alignment
flagged as not acceptable in order to change any of the filtering.
When that was fixed and it was possible to turn off all filtering,
there was no way to turn it back on because the menu choice to reset
the filters wasn't offered unless there was some filtering in place
(that was intentional but turned out not to be a good idea).

I checked curses and X11; they both offer less versatile selection
capability that don't seem to need the tty-specific fixes.
2020-01-13 12:34:01 -08:00
PatR
c2060f9e8c more giant walking onto boulder feedback
autopick_testobj() needs to bypassed during move-without-pickup as
well as when autopicked is disabled.  I hope this is finally right.
2020-01-13 03:46:51 -08:00
PatR
4b7e9d67d3 rnd_class()
Guard against potential bad arguments:  first index greaer than last.
Return STRANGE_OBJECT instead of hardcoded 0 if it ever fails (which
should be impossible with good arguments).
2020-01-12 22:16:49 -08:00
PatR
2d35668c63 update novel fixes entry 2020-01-12 22:15:37 -08:00
PatR
3409546876 more random novels
Give statues 'real' spellbooks only.

Provide mkobj() a way to accomplish that instead of resorting to
mksobj(rnd_class()).
2020-01-12 22:02:36 -08:00
PatR
caaf1b375a randonly occurring Discworld novels
Give 'novel' a 1 in 1000 chance of being created in place of each
random spellbook (except for hero's initial inventory and NPC
priests' monster inventory and divine reward for prayer--those all
force regular spellbooks; statue contents aren't among the
exceptions--those books can now be novels).  Shop inventory (where
first book or scroll shop created is guaranteed one novel) hasn't
been touched.  If there is any other special spellbook handling
somewhere, I've overlooked it.
2020-01-12 11:00:38 -08:00
PatR
92970bfffc spell maneuver correctly 2020-01-12 09:19:17 -08:00
PatR
07a2c1c813 fix github issue #279 - boulder feedback
Polymophed into a giant and moving onto a boulder's location could
yield "you easily pick it up" (without actually doing so) followed
by "you see a boulder here".  It would happen if autopickup was Off,
or if the 'm' move-without-autopickup prefix was used, while either
boulder was included in pickup_types (including when that is set
for 'all') or hero had thrown that particular boulder and
pickup_thrown was On.  The check for whether auto-pick should try
on an object relied on its caller verifying that autopickup was On.
pickup() does that for
 pickup() -> autopick() -> autopick_testobj()
but moverock() wasn't doing that for
 moverock() -> autopick_testobj()
so the logic controlling moverock's message was subverted.

I first thought that logic itself was incorrect and changed the
message.  This keeps the new message even though it turned out not
to be cause of the problem.

Fixes #279
2020-01-12 05:05:24 -08:00
nhmall
1efc2d8e5e support haggis when pluralizing thus avoiding haggi 2020-01-11 20:04:32 -05:00
Patric Mueller
38fa93df73 Restrict the teleportation notification to actual teleportations
teleds() is used for more than just teleportations, the teleportation message
was also given when mounting a steed.

Trying out a new bit flags method parameter design pattern.
2020-01-11 19:51:54 +01:00
PatR
7c3ae74c27 hallucinatory water and lava terrain
When browsing the map while hallucinating and looking at a pool, a
moat, or 'other' water or at molten lava, report with hallucinatory
liquids rather than the ordinary substance.  Likewise when browsing
self on map or using ^X would report "sinking into lava".
2020-01-11 09:34:01 -08:00
PatR
92994f6d71 data.base lookup fix
Changing data.base lookup to accept leading spaces as an alternative
to the normal leading tab ended up adding an invalid integrity check.
Lines without any leading space or tab were considered to be in error
but empty lines are present so need to be accepted.
2020-01-11 08:45:45 -08:00
PatR
e27b6af856 fix github issue #277 - repeat door open failure
The change to make "ouch! you bump into a door" use up a turn didn't
end running, so when it happened while running useless turns took
place and that message was delivered repeatedly until some other
action interrupted the hero.  It didn't matter whether autoopen is
enabled.

Fixes #277
2020-01-10 13:13:36 -08:00
nhmall
14929f797d silence a warning about use of potentially uninitialized variable 2020-01-10 15:10:47 -05:00
PatR
a4e80fa9b4 more trap feedback
When trapped in lava, change the text from "stuck in the lava" to
"sinking into lava" to describe the situation much more accurately.
Instead of doing that twice, move the u.utraptype feedback into a
separate routine that both enlightenment and self-lookat can use.
2020-01-10 06:53:48 -08:00
PatR
3a6e2a9802 escaping buried iron ball
Noticed while testing the look-at-self feedback for traps.  When
punished and the iron ball gets buried, hero becomes "tethered to a
buried object".  It is possible to simply walk away (like from a pit,
bear trap, web, stuck in floor by solidified lava or sinking into
molten lava) but that requires many tries.  Once the escape happens,
"you finally wrench the ball free" and are supposed to have it
reattached to a replacement chain.  However, buried_ball() wouldn't
look at buried objects if the trap countdown timer was 0 (which is
the case when finally wrenching free).  So hero got a new chain to
drag around but it had no heavy iron ball attached.

I didn't turn on sanity checking but that would have complained about
this.  Normal dragging didn't care but I wouldn't be surprised if
various actions that checked Punished and picked up the ball in order
to put it down again elsewhere would have had possibly serious trouble.
2020-01-10 04:36:28 -08:00
PatR
f6c547f376 randomized trap names
Use trapname() in several more places.  I wasn't systematic about it.

trapname() could generate a random value of 0 and attempt to use
"real trap #0" but 0 is NO_TRAP.  So it ended up with "water" from
the preceding block of entries in defsyms[].  Treat 0 as an extra
chance for the actual trap instead of an hallucinatory one.

Add a couple more hallucinatory traps.  "Roach Motel" is trademarked
but like Spam and Band-Aid, general usage has trampled over it.  I
included "(tm)" anyway.  Also, sometimes generate "<role> trap" or
"<rank> trap" on the fly.  Why should tourists get all the fun?
2020-01-09 18:45:06 -08:00
PatR
3ed51c2718 enhanced look-at-self
^X reports whether you're caught in a trap, but neither looking at
yourself (via '//' or ';' or other getpos autodescribe) nor looking
"here" (via ':') said anything about that.  Make looking at yourself
do so.
2020-01-09 16:59:30 -08:00
PatR
f5d7343677 readobjnam() tidying
Move wizard mode wishing for traps and terrain from readobjnam() to a
separate routine.
2020-01-08 18:01:04 -08:00
PatR
8a3a32834f more wishing for Amulet of Yendor
Make wish for "amulet of yendor" be the same as "real amulet of yendor"
instead of preserving the 3.6.x behavior of having a 50% chance of it
yielding "fake amulet of yendor".

Both the "real" and "fake" prefixes are still accepted, but "real" has
become a no-op:
 !real and fake, real and fake => fake
 real and !fake, !real and !fake => real
so fake vs !fake always decides the result.
2020-01-08 17:21:47 -08:00
Patric Mueller
2965488525 Unpaid globs showed weight info unconditionally outside of wizmode
globwt() didn't check for wizmode, so unpaid globs would be shown with weight
information even for normal player.

Eliminated globwt() completely and consolidated the output of aum in one place
as we don't really care about the ordering of debug info in wizmode.
2020-01-08 11:34:53 +01:00
PatR
df50d4cf17 fix #K112 - fumbling vs autoopen
Report complained that having autoopen not work when fumbling was
inconvenient and mentioned that the "ouch! you bump into a door"
result didn't take any time.  This updates the documentation to
state that autoopen won't work while fumbling (so the inconvenient
behavior persists) but changes movement so that bumping into a door
now takes time.  (Despite "ouch!", it doesn't inflict any damage.)

Also, document the recently added autounlock option.
2020-01-07 17:57:38 -08:00
PatR
a49dcd1e12 tethered aklys description
Recent object formatting changes for wielded weapon put some pline
arguments in the wrong order.
 a - aklys (weapontethered  in hand)
or worse, when dual-wielding
 a - aklys (wieldedtethered  in right hand)
Change back to
 a - aklys (tethered weapon in hand)
or
 a - aklys (tethered weapon in right hand)

I considered (tethered weapon wielded in right hand) for the two-
weapon case, but I think that's too verbose.
2020-01-07 04:40:20 -08:00
PatR
2d0e7e0578 fix #K119 - wishing for Amulet of Yendor
Wizard mode wishing for "Amulet of Yendor" has a 50% chance of
yielding a cheap plastic imitation.  Allow asking for "real Amulet
of Yendor" and "fake Amulet of Yendor" to provide precise control.
Asking for "real Amulet of Yendor" in normal play will be accepted
but then overridden with the fake amulet as usual.

Without the prefix, there's still a 50:50 chance for either amulet.
"real fake amulet of yendor" and "fake real amulet of yendor" both
yield a fake one.

When handling "amulet of yendor", any of "cheap", "plastic",
"imitation", "cheap plastic", "cheap imitation", and "plastic
imitation" are now recognized to mean "cheap plastic imitation".
Unlike prefixes such as "blessed rustproof" vs "rustproof blessed",
these two-word ones (or the three-word whole thing) need to be in
specific order and after the general prefixes.  Also, any of those
force "fake" even if an explicit "real" prefix came before them.
2020-01-07 02:59:25 -08:00
Pasi Kallinen
5e307335c3 Add missing NULLs to lua function reg array 2020-01-07 08:44:36 +02:00
Pasi Kallinen
f83dede8e5 Fixes for degenerate RNG
Assume a degenerate RNG that always returns the same number.
With these fixes, the game starts and is almost playable.
There are still some places that will go into infinite loop, eg.
the mines level generation.
2020-01-06 11:48:19 +02:00
PatR
bfa0f072f7 fix #K125 - autounlock vs touching artifacts
Apply makes a touch_artifact check on the tool being applied, but
autounlock would pick an unlocking tool to use without doing that.
Noticed while fixing that:  autounlock took no time.

Since picking an artifact unlocking tool might now blast the hero,
change the tool selection.  First choice: any key except another
role's quest artifact; second: any lock-pick except another role's
quest artifact; third: any credit card except another role's quest
artifact; fourth, fifth, sixth: other roles' quest artifact key,
lock-pick, or credit card.  The fifth category (artifact lock-picks)
is empty.  Rogues will pick non-cursed Master Key over any other
key (special case for first choice).  Tourists will pick a key or
a lock-pick over their PYEC (first and second choices over third).
2020-01-05 23:54:11 -08:00