Commit Graph

10615 Commits

Author SHA1 Message Date
PatR
263ee3015f tty: S_unexplored
Screen erasure leaves the map set to spaces.  If S_unexplored is
something other than <space>, tty wasn't drawing with S_unexplored
after a menu or long message line got erased following temporary
overwrite of part of the map.

This seems to work but is not the correct way to do things.
clear_screen(), cl_eos(), and cl_end() should all be taught to
flag the map as needing to be refreshed after they erase part of it.
tty_clear_nhwindow(WIN_BASE) is also lacking since it erases the
message line, full map, and status lines but leaves their internal
windows with stale data about what is shown instead of marking them
blank.
2020-04-17 01:06:37 -07:00
Pasi Kallinen
7c44e06ab1 Dehardcode the monk minetown food shop conversion
Instead of trying to figure out in core whether to change a minetown
food shop to health food shop for monks, just figure it out in the
minetown level creation script.
2020-04-16 21:01:37 +03:00
PatR
10a89a529c mimic in health food store
Make a mimic that picks special VEGETARIAN_CLASS look like food
instead of a random object.  Also, at least a couple of Minetown
variants are classified as mazes so  had a 50% chance of not even
making that choice and look like a statue instead.  Override maze
when 'in_town()' yields True.
2020-04-16 01:09:01 -07:00
PatR
c09733f2e4 health food store
When a food shop gets converted into a health food shop (minetown
when playing as a monk), the shop type and underlying room type
weren't changed to match.
2020-04-16 01:00:31 -07:00
Pasi Kallinen
43d331c4eb Nerf unicorn horn
Unicorn horns are just too good. Nerf it in similar way several
other variants have done: don't let it restore attribute loss.

This makes potion of restore ability more valuable, and the
int loss from the (nerfed) mind flayers matter more.
2020-04-15 22:45:47 +03:00
PatR
a768507ebd getpos help
This started with fixing a warning suggesting parentheses when
mixing || and &&, then started sprawling.  The getpos help for x/X
was misleading.  It said that using x or X would move cursor to the
next unexplored location but it actually moves the cursor to next
explored location that's adjacent to an unexplored one.
2020-04-15 01:43:47 -07:00
Pasi Kallinen
fe8f18c5d7 Mimic in a health food store could cause a panic
Health food stores use a special "vegetarian class" of items,
which mkobj doesn't understand. Just make the mimic use a random
item class in that case.
2020-04-15 11:10:26 +03:00
Pasi Kallinen
02f222bc0c Add vault guards to undisplaceable monsters 2020-04-15 08:59:35 +03:00
Pasi Kallinen
ab4e82d1cf Fixes bit 2020-04-15 08:49:43 +03:00
copperwater
a9eb81e0c7 Change logic for immobilized displacement, fixing a bug
The bug was that you could easily displace peaceful sleeping monsters.
The source of this was that there was no check for sleeping in the
attack() function that checks for immobilization.

As well as adding the sleeping check, this logic is modified so that it
makes more sense: if a monster is immobilized at all (sleeping, frozen,
or mcanmove = 0) it always "doesn't seem to move!" You can't randomly
displace it anyway 1/6 of the time.

Sessile monsters who are otherwise not immobilized don't move 5/6 of the
time, but can be displaced with the other 1/6.
2020-04-15 08:46:47 +03:00
copperwater
6134c6f165 Pet displacement improvements
Pets can no longer be displaced out of a trap, because that was
inconsistent with peaceful monsters refusing to be displaced out of a
trap. The untaming-via-displacement-out-of-trap code is removed.

Pets also now have a better survival instinct: they follow the code for
peaceful displacement into a bad position, and refuse to swap places.
This means it's no longer possible to accidentally kill a pet by
levitating/walking over water and displacing it.
2020-04-15 08:46:47 +03:00
copperwater
92b9db7630 Shopkeepers are immune to peaceful displacement as well 2020-04-15 08:46:47 +03:00
copperwater
5a1bbb4d16 Fix: rn2(0) when trying to displace peaceful out of trap
A side effect of making is_safepet() count peacefuls. Now checks
directly for a trapped, peaceful monster and says "they can't move out
of the trap"; this is inconsistent with pet behavior, and pet behavior
should probably be changed to be in line with it (ie they can't be
displaced out of a trap at all.)

Also refactor the code here a bit: a bunch of different if statements
have the exact same resetting code and steed resetting code in them.
Change this to a boolean flag and put the resetting code in one place
checked by that flag.
2020-04-15 08:46:47 +03:00
copperwater
21351fc13c More peaceful monsters that can't be displaced: priests, Oracle
Shouldn't be able to displace priests since that could theoretically
eventually force them out of their temple, which would probably cause
problems. The Oracle doesn't usually move anyway, but seems like she
should "not want to swap places" in any circumstance.
2020-04-15 08:46:47 +03:00
copperwater
2ee09b9210 Player can now displace peaceful monsters
Changes domove() code to allow displacing peaceful monsters.
Specifically, is_safepet() now returns true if the monster is peaceful.
Peacefuls are slightly pickier than pets about whether they consent to
being displaced: they will not displace if a goodpos() check fails for
the displaced space, or if there is a trap on the displaced space, or if
they are your quest leader. is_safepet should probably be renamed to
something else.

In the process of doing this, some other changes were made: the code now
checks whether the player and monster should be swapping places at all
first (previously it ran some code for displacing pets out of traps
first, which was a little weird if the displacement didn't actually
happen.)

In the original commit for this, I needed to guard the spoteffects()
call made in domove with a clause testing whether the player actually
moved; it was previously possible to fail to displace a monster and then
re-trigger a trap on the space you were still standing on. However, the
devteam has apparently put in an if (u.umoved) clause in the same place
and serving the same purpose.
2020-04-15 08:46:47 +03:00
Pasi Kallinen
7efe7b05df Fix "x" and "a" when choosing map location
Recent(ish) change to split unexplored glyphs from solid wall glyphs
resulted in getloc commands to choose unexplored and interesting
locations not work correctly.

Fixes #323
2020-04-15 07:15:41 +03:00
copperwater
18d19c902b Allow specifying a montype on figurines in lua files
This was already allowed for the other montype-compatible objects like
statues, corpses, eggs and tins. I don't see a reason why figurines
shouldn't be part of this group; perhaps it was an oversight.
2020-04-15 06:47:58 +03:00
PatR
2fbf9573d5 unclutter mattacku a bit
Move demon summoning and were creature summoning out of mattacku()
to a separate routine.  Should be no change in behavior.

Also, redo several comments that came after what they applied to
rather than before, and reorder the file-scope prototypes to be in
the same order as the corresponding functions.
2020-04-14 18:13:32 -07:00
Pasi Kallinen
bddb80f13c Make hostile monsters with launcher and ammo keep away
If a hostile monster is wielding a ranged weapon, and is carrying
appropriate ammo for it, make the monster try to stay away,
outside the melee range.
2020-04-14 15:19:30 +03:00
Pasi Kallinen
ffb9540295 Document the map characters used in lua 2020-04-14 11:46:57 +03:00
PatR
caac70c5ec rest/search refinement
When rest and search refuse to operate because a hostile monster is
adjacent, include a reminder of how to force them to operate.  Every
time if 'cmdassist' is On, or just once until after some subsequent
try actually does something.

This new rest and search behavior probably needs to be optional and
default to the old behavior.  It isn't uncommon to deliberately rest
while adjacent to a hostile monster if also adjacent to a peaceful
one and trying to wait for Stun or Confusion to time out, or maybe
search while next to such a monster hoping to find a secret door to
run away through.  A count prefix won't work and needing an extra
keystroke each time is going to be an annoyance.
2020-04-13 14:58:12 -07:00
PatR
124d39f4c5 fix #K797 - wrong message when stealing as nymph
When polymorphed into a nymph and melee hit steals items from the
target, the same-gender charm message vs opposite-gender seduce
message is being chosen by hero's base gender rather than nymphs
always being female.  The seduce message used dynamic pronouns for
the target monster but the charm message used hardcoded She and her
for female nymph attacking female target.  I'm not sure why hero's
base gender is used so left that alone; this changes charm message
to use dynamic pronouns that correctly match the target monster.
2020-04-13 12:58:54 -07:00
Pasi Kallinen
71754910db Scatter bag of holding contents instead of deleting them
Losing all of your items in one go is really frustrating.
If you blow up your bag of holding, make the contents scatter around
instead of outright deleting them. This will destroy fragile objects.
2020-04-13 21:49:29 +03:00
Pasi Kallinen
28c3478ae6 Add test for selection.iterate 2020-04-13 20:29:06 +03:00
Pasi Kallinen
d78dcdcb9b Allow matching any wall map terrain in lua scripts
When matching a terrain, allow using a "w" placeholder that matches
any solid wall:

For example:
   local s = selection.match([[w.w]]);
would match all floor locations with a wall to the left and right of it.
The walls can be solid stone, horizontal, vertical, etc.

This applies to selection.match(), selection.filter_mapchar(), and
des.replace_terrain()
2020-04-13 20:00:34 +03:00
Pasi Kallinen
9513b73169 Trapped container creates occasionally an actual gas cloud 2020-04-13 13:08:39 +03:00
Pasi Kallinen
6b9c9bb170 In-game doc the extended commands accepting 'm' prefix 2020-04-13 11:10:59 +03:00
Pasi Kallinen
ecc1ceb581 Allow random mimics to mimic more furniture
In addition to stairs, allow altar, grave, throne, and sink.
2020-04-12 22:08:06 +03:00
nhw_cron
37c17ab1f4 This is cron-daily v1-Jan-20-2020. guidebook updated: doc/Guidebook.txt 2020-04-12 13:26:18 -04:00
Pasi Kallinen
ac94c44b0b Prevent searching or waiting next to a hostile
Generally speaking there's no reason to wait or search next to
a hostile monster, so let's just prevent those actions. You can
still do those commands by prefixing them with the 'm' prefix.
2020-04-12 17:32:29 +03:00
Pasi Kallinen
47fb7e5ee5 Fix double free 2020-04-12 16:55:00 +03:00
Pasi Kallinen
6d1df04eda Remove incorrect comment 2020-04-12 15:45:13 +03:00
nhmall
d47792ca64 Merge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.7 2020-04-11 17:55:09 -04:00
nhmall
b0237e6d3f prototype for optfn_palette 2020-04-11 17:54:24 -04:00
PatR
d83f1c178b refinement of monster use of undead turning
Instead of just picking up wands of undead turning when one or more
corpses are in hero's inventory, have monsters also pick those up if
hero has a cockatrice corpse in a carried container.  And instead of
only zapping such wands (as defensive measure) when hero is wielding
a cockatrice corpse, also zap them (as offensive measure) if hero is
carrying any corpse in open inventory.
2020-04-11 12:34:32 -07:00
PatR
1f9e4d2468 corpse revival nitpicks
Testing a forthcoming extension of monsters using wands of undead
turning revealed a couple of pre-existing bugs.  Previously only
noticeable if hero zaps self or breaks a wand of undead turning so
unlikely to have happened much.

"Your <mon> corpse comes alive" was given even if it was revived
as an undead.  Also, it was "your <mon> corpse" instead of "one of
your <mon> corpses" even when one from a stack was involved.  If
done by hero to self that message follows "one of your <mon>
corpses glows iridescently" so the comes alive message was ok but
verbose.  Change that to "it comes alive" or "it reanimates" when
following the glow message.
2020-04-11 12:24:02 -07:00
nhmall
f4a83fc9de typo fix in .travis.yml 2020-04-11 10:25:47 -04:00
nhmall
08852d25be mingw build bit 2020-04-11 10:14:05 -04:00
PatR
dc6b2f5de1 let monsters use wand of undead turning
when hero is wielding a cockatrice corpse.  Wands of undead turning
aren't generated as starting equipment but they will now be picked
up if come across while the hero is carrying any corpse, and used
in preference to any other item when carried and non-empty and hero
is wielding a petrifier's corpse.
2020-04-10 18:39:46 -07:00
PatR
05028b4c3e m_lined_up() type mismatch
m_lined_up() was declared 'boolean' but returned 0, 1, or 2.
The 1 case isn't actually used any more.  I changed it to 'int'
rather than 2 to TRUE; it could just as easily be the other way
'round.
2020-04-10 18:09:58 -07:00
nhmall
db7a3abce4 Xcode warning of possible uninitialized variables 2020-04-10 00:29:51 -04:00
PatR
2e177a7fc4 fix gibhub issue #320 and more - 'mention_decor'
Fixes #320

Avoid giving "you are back on the bottom" nearly every step when
moving around underwater.

Avoid "you are back on floor" followed by "you trip over <object>"
when fumbling in case that fumbling was due to being on ice when
taking the step to floor.  Done for all fumbling rather than just
one-turn fumbling instigated by ice.

When moving from ice or water to ground, show "you are back on floor"
before listing objects at that spot instead of after.

I think there was at least one more thing but have lost track.  At
any rate, 'mention_rate' potentially has a new set of bugs.
2020-04-08 18:33:55 -07:00
PatR
27b1a153d3 teleport message sequencing
"You materialize at another location," was delivered while the
previous location still controlled line of sight.  Very noticeable
if you started from underwater and landed on the surface in an area
which hadn't been mapped yet.
2020-04-08 15:17:02 -07:00
PatR
69b4f0afc0 null pointer crash fix
The fix to try to avoid messages about out-of-view objects taking
erosion damage made water_damage_chain() vulnerable to dereferencing
a null pointer, leading to a crash if you create a pool via wizard
mode wishing.
2020-04-08 14:53:06 -07:00
PatR
6582b90008 fix github issue #321 - 'Mine Town' vs 'Minetown'
Change achievement spelling to match T-shirt spelling:  Minetown.

Fixes #321
2020-04-08 12:52:20 -07:00
Pasi Kallinen
c88fab4056 Add missing prototype 2020-04-08 08:22:24 +03:00
PatR
93e0c0c3e6 fix #K763 - segfault eating tin of Rider meat
Eating a tin of one of the Riders and being life-saved or declining
to die would crash when trying to revive a non-existent corpse.  An
old comment stated that since such tins were impossible it could
assume that it was dealing with a corpse, but wishing for tins of
the Riders is possible in wizard mode.

They can't be passed along to normal mode via bones because they're
changed to empty tins as bones are saved.  So there doesn't seem to
be much point in allowing wizard mode wishing to create them, but
I've left that as is.
2020-04-07 16:55:07 -07:00
PatR
c6b82c0e4f water_damage() band-aid
I got "The chain mail rusts." seemingly out of the blue, then when
moving around the corner of the building on Valk home level I saw a
spot of remembered ice be redrawn as water.  Before that I checked
for any mapped objects (via ';' 'o' 'o' ... so I didn't overlook
anything; there were only a couple of objects shown on the map and
none of them were piles) and didn't see any remembered chail mail or
anything at all on that ice spot, so I'm assuming that it was carried
by a monster.  I may be leaving out some steps in the call chain here:

melt_ice -> minliquid -> mondead -> m_detach -> relobj -> mdrop_obj
  -> flooreffects -> water_damage -> erode_obj

erode_obj() uses bhitpos for visibility check of eroding objects not
carried by the hero or by a monster, with a comment expressing doubt
about doing that.  It wouldn't have yielded the right answer for the
possible call chain here unless it got set by some monster activity.
I had been zapping a wand just before and bhitpos would have been set
to a coordinate I could see at the time, fooling erode_obj()'s check
if the value was stale.

Anyway, this only addresses objects eroded from flooreffects(),
water_damage_chain(), and fire_damage_chain().  There are lots of
other indirect calls to erode_obj().
2020-04-07 11:54:52 -07:00
Pasi Kallinen
665eacf40c Expose scaled mazes to special level lua
Adds a new level init type which directly creates a maze,
optionally setting corridor width and wall thickness,
and removing dead ends.

des.level_init({ style = "maze", corrwid = 3, wallthick = 1, deadends = false });
2020-04-07 19:20:39 +03:00
PatR
f694f3b644 add missing two-weapon feedback
When dual-wielding and you wield a different weapon, two weapon combat
was silently toggled off even when the new weapon was eligible to be
dual-wielded.  If the verbose flag is On, explicitly tell the player
when wielding something toggles off two-weapon mode.  Wielding '-' is
an exception because you already get told that you're empty handed.
2020-04-07 07:40:33 -07:00