]> granicus.if.org Git - nethack/log
nethack
5 years agomimic in health food store
PatR [Thu, 16 Apr 2020 08:09:01 +0000 (01:09 -0700)]
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.

5 years agohealth food store
PatR [Thu, 16 Apr 2020 08:00:31 +0000 (01:00 -0700)]
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.

5 years agoNerf unicorn horn
Pasi Kallinen [Wed, 15 Apr 2020 19:40:11 +0000 (22:40 +0300)]
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.

5 years agogetpos help
PatR [Wed, 15 Apr 2020 08:43:47 +0000 (01:43 -0700)]
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.

5 years agoMimic in a health food store could cause a panic
Pasi Kallinen [Wed, 15 Apr 2020 08:02:33 +0000 (11:02 +0300)]
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.

5 years agoAdd vault guards to undisplaceable monsters
Pasi Kallinen [Wed, 15 Apr 2020 05:59:35 +0000 (08:59 +0300)]
Add vault guards to undisplaceable monsters

5 years agoFixes bit
Pasi Kallinen [Wed, 15 Apr 2020 05:49:43 +0000 (08:49 +0300)]
Fixes bit

5 years agoChange logic for immobilized displacement, fixing a bug
copperwater [Mon, 28 May 2018 23:36:23 +0000 (19:36 -0400)]
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.

5 years agoPet displacement improvements
copperwater [Tue, 20 Mar 2018 16:17:38 +0000 (12:17 -0400)]
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.

5 years agoShopkeepers are immune to peaceful displacement as well
copperwater [Mon, 12 Mar 2018 19:57:25 +0000 (15:57 -0400)]
Shopkeepers are immune to peaceful displacement as well

5 years agoFix: rn2(0) when trying to displace peaceful out of trap
copperwater [Mon, 12 Mar 2018 02:20:32 +0000 (22:20 -0400)]
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.

5 years agoMore peaceful monsters that can't be displaced: priests, Oracle
copperwater [Sat, 24 Feb 2018 04:02:29 +0000 (23:02 -0500)]
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.

5 years agoPlayer can now displace peaceful monsters
copperwater [Fri, 8 Dec 2017 04:26:17 +0000 (23:26 -0500)]
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.

5 years agoFix "x" and "a" when choosing map location
Pasi Kallinen [Wed, 15 Apr 2020 04:15:37 +0000 (07:15 +0300)]
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

5 years agoAllow specifying a montype on figurines in lua files
copperwater [Wed, 15 Apr 2020 02:30:20 +0000 (22:30 -0400)]
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.

5 years agounclutter mattacku a bit
PatR [Wed, 15 Apr 2020 01:13:32 +0000 (18:13 -0700)]
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.

5 years agoMake hostile monsters with launcher and ammo keep away
Pasi Kallinen [Tue, 14 Apr 2020 12:19:26 +0000 (15:19 +0300)]
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.

5 years agoDocument the map characters used in lua
Pasi Kallinen [Tue, 14 Apr 2020 08:43:32 +0000 (11:43 +0300)]
Document the map characters used in lua

5 years agorest/search refinement
PatR [Mon, 13 Apr 2020 21:58:12 +0000 (14:58 -0700)]
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.

5 years agofix #K797 - wrong message when stealing as nymph
PatR [Mon, 13 Apr 2020 19:58:54 +0000 (12:58 -0700)]
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.

5 years agoScatter bag of holding contents instead of deleting them
Pasi Kallinen [Mon, 13 Apr 2020 18:49:16 +0000 (21:49 +0300)]
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.

5 years agoAdd test for selection.iterate
Pasi Kallinen [Mon, 13 Apr 2020 17:29:06 +0000 (20:29 +0300)]
Add test for selection.iterate

5 years agoAllow matching any wall map terrain in lua scripts
Pasi Kallinen [Mon, 13 Apr 2020 16:59:03 +0000 (19:59 +0300)]
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()

5 years agoTrapped container creates occasionally an actual gas cloud
Pasi Kallinen [Mon, 13 Apr 2020 10:08:36 +0000 (13:08 +0300)]
Trapped container creates occasionally an actual gas cloud

5 years agoIn-game doc the extended commands accepting 'm' prefix
Pasi Kallinen [Mon, 13 Apr 2020 08:10:40 +0000 (11:10 +0300)]
In-game doc the extended commands accepting 'm' prefix

5 years agoAllow random mimics to mimic more furniture
Pasi Kallinen [Sun, 12 Apr 2020 19:06:42 +0000 (22:06 +0300)]
Allow random mimics to mimic more furniture

In addition to stairs, allow altar, grave, throne, and sink.

5 years agoThis is cron-daily v1-Jan-20-2020. guidebook updated: doc/Guidebook.txt
nhw_cron [Sun, 12 Apr 2020 15:24:08 +0000 (11:24 -0400)]
This is cron-daily v1-Jan-20-2020.  guidebook updated: doc/Guidebook.txt

5 years agoPrevent searching or waiting next to a hostile
Pasi Kallinen [Sun, 12 Apr 2020 14:21:23 +0000 (17:21 +0300)]
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.

5 years agoFix double free
Pasi Kallinen [Sun, 12 Apr 2020 13:55:00 +0000 (16:55 +0300)]
Fix double free

5 years agoRemove incorrect comment
Pasi Kallinen [Sun, 12 Apr 2020 12:45:13 +0000 (15:45 +0300)]
Remove incorrect comment

5 years agoMerge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into...
nhmall [Sat, 11 Apr 2020 21:55:09 +0000 (17:55 -0400)]
Merge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.7

5 years agoprototype for optfn_palette
nhmall [Sat, 11 Apr 2020 21:54:24 +0000 (17:54 -0400)]
prototype for optfn_palette

5 years agorefinement of monster use of undead turning
PatR [Sat, 11 Apr 2020 19:34:32 +0000 (12:34 -0700)]
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.

5 years agocorpse revival nitpicks
PatR [Sat, 11 Apr 2020 19:24:02 +0000 (12:24 -0700)]
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.

5 years agotypo fix in .travis.yml
nhmall [Sat, 11 Apr 2020 14:25:47 +0000 (10:25 -0400)]
typo fix in .travis.yml

5 years agomingw build bit
nhmall [Sat, 11 Apr 2020 14:14:05 +0000 (10:14 -0400)]
mingw build bit

5 years agolet monsters use wand of undead turning
PatR [Sat, 11 Apr 2020 01:39:46 +0000 (18:39 -0700)]
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.

5 years agom_lined_up() type mismatch
PatR [Sat, 11 Apr 2020 01:09:58 +0000 (18:09 -0700)]
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.

5 years agoXcode warning of possible uninitialized variables
nhmall [Fri, 10 Apr 2020 04:29:51 +0000 (00:29 -0400)]
Xcode warning of possible uninitialized variables

5 years agofix gibhub issue #320 and more - 'mention_decor'
PatR [Thu, 9 Apr 2020 01:33:55 +0000 (18:33 -0700)]
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.

5 years agoteleport message sequencing
PatR [Wed, 8 Apr 2020 22:17:02 +0000 (15:17 -0700)]
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.

5 years agonull pointer crash fix
PatR [Wed, 8 Apr 2020 21:53:06 +0000 (14:53 -0700)]
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.

5 years agofix github issue #321 - 'Mine Town' vs 'Minetown'
PatR [Wed, 8 Apr 2020 19:52:20 +0000 (12:52 -0700)]
fix github issue #321 - 'Mine Town' vs 'Minetown'

Change achievement spelling to match T-shirt spelling:  Minetown.

Fixes #321

5 years agoAdd missing prototype
Pasi Kallinen [Wed, 8 Apr 2020 05:21:03 +0000 (08:21 +0300)]
Add missing prototype

5 years agofix #K763 - segfault eating tin of Rider meat
PatR [Tue, 7 Apr 2020 23:55:07 +0000 (16:55 -0700)]
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.

5 years agowater_damage() band-aid
PatR [Tue, 7 Apr 2020 18:54:52 +0000 (11:54 -0700)]
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().

5 years agoExpose scaled mazes to special level lua
Pasi Kallinen [Tue, 7 Apr 2020 16:20:19 +0000 (19:20 +0300)]
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 });

5 years agoadd missing two-weapon feedback
PatR [Tue, 7 Apr 2020 14:40:33 +0000 (07:40 -0700)]
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.

5 years agoFix monster booted into limbo trying to act
Pasi Kallinen [Tue, 7 Apr 2020 14:23:18 +0000 (17:23 +0300)]
Fix monster booted into limbo trying to act

There's a chance that a tactics-using monster (eg. arch-lich)
teleporting next to you on a full level would get booted off
into limbo. After that, if the monster tried using an item
in the same action you'd get panic "relmon: mon not in list"

Fix this particular case by checking monster mstate.
Other cases may lurk in other places that eventually call mnexto.

5 years agotype mismatch in weapon_insight
PatR [Tue, 7 Apr 2020 13:45:53 +0000 (06:45 -0700)]
type mismatch in weapon_insight

can_advance() returns boolean rather than int. Change the affected
local variables to match rather than casting its return value.

5 years ago^X vs two-weapon
PatR [Tue, 7 Apr 2020 13:17:35 +0000 (06:17 -0700)]
^X vs two-weapon

When dual-wielding and both weapons use the same skill, the weapon
feedback by ^X was inadvertently skipping the part where it would
tell the player whether either the weapons' skill or two-weapon
skill or both had already been trained enough to to be advanced.

Most of the diff is change in indentation.

5 years agoX11 - ice on black&white text map
PatR [Mon, 6 Apr 2020 21:15:36 +0000 (14:15 -0700)]
X11 - ice on black&white text map

Add support for black&white ice (3.7.0 feature) similar to already
supported black&white lava:  show in inverse video if it uses the
same character as floor (in the ice case; as water in the lava case).

Inverse for monster detection, black&white lava, and now black&white
ice was being done unconditionally but has been changed so that the
user can disable it by toggling the 'use_inverse' run-time option.

[Bug noticed in the process:  if you move an inverse video cursor
onto inverse video detected monster/lava/ice (when doing farlook, for
instance), the cursor disappears.  I'm not sure how to address that.]

5 years agoX11 map - no more column 0
PatR [Mon, 6 Apr 2020 20:55:48 +0000 (13:55 -0700)]
X11 map - no more column 0

The extra column that the core sometimes uses for bookkeeping and
that was drawn as stone until recently when changed to blank space
(an unintentional left margin) is now gone for both the tiles map
and the text map.  It's still part of the internal data but the map
window width and the map rendering exclude it.

This was too easy.  There are bound to be bugs lurking....

5 years agoX11 map init
PatR [Mon, 6 Apr 2020 19:43:18 +0000 (12:43 -0700)]
X11 map init

Revert the change from impossible() to panic() that I made recently
and add code to allow continuing to succeed.  The raw_print issued
there doesn't seem to go anywhere, but the game switches from tiles
map to text map and runs sanely.

Also, there was a second place that initialized the text map to all
spaces rather than S_unexplored.  Change it to call the routine that
was already fixed for this.

5 years agoConvert math.random percentage computations into percent()
copperwater [Sat, 29 Feb 2020 22:04:26 +0000 (17:04 -0500)]
Convert math.random percentage computations into percent()

5 years agoImplement dice and percent as global lua functions
copperwater [Sat, 29 Feb 2020 02:19:50 +0000 (21:19 -0500)]
Implement dice and percent as global lua functions

Intended to simplify many of the math.random calls currently in use, and
make them more semantic and thus more readable.

The dice function d() takes either a two-argument form which is the same
as in the C source (number of dice, faces per die) or a one-argument
form that rolls a single die.

The percent(N) function returns true N% of the time.

5 years agoAdd selection gradient doc placeholder
Pasi Kallinen [Mon, 6 Apr 2020 16:03:28 +0000 (19:03 +0300)]
Add selection gradient doc placeholder

5 years agoRe-implement gradient selections
copperwater [Sat, 29 Feb 2020 16:06:30 +0000 (11:06 -0500)]
Re-implement gradient selections

Uncomments and makes available selection.gradient in Lua. (The backend C
code for this still existed, it just wasn't used.)

The only valid way to specify a gradient is with a table. I considered
adding non-table versions, but decided that there are too many
independent variables that can be optional. A non-table version, without
named parameters, would be confusing to read, especially since most of
the arguments are ints.

Also adds an impossible in the (possibly unreachable) case that
selection_do_gradient gets called with a bad gradient type.

5 years agoPrint out Lua error message when encountering an error
copperwater [Sun, 1 Mar 2020 20:20:16 +0000 (15:20 -0500)]
Print out Lua error message when encountering an error

Rather than spitting out an error code number that is not particularly
useful. The string contains the line number and the nature of the error,
which is much more useful for debugging or reporting an issue.

5 years agofix segfault fix
PatR [Mon, 6 Apr 2020 15:24:39 +0000 (08:24 -0700)]
fix segfault fix

Previous fix prevented getting skill feedback about bare-handed
combat/martial arts.

5 years agoFix one more prototype warning
Pasi Kallinen [Mon, 6 Apr 2020 15:24:15 +0000 (18:24 +0300)]
Fix one more prototype warning

5 years agoPrevent segfault when not wielding anything
Pasi Kallinen [Mon, 6 Apr 2020 15:09:47 +0000 (18:09 +0300)]
Prevent segfault when not wielding anything

5 years ago^X weapon feedback
PatR [Mon, 6 Apr 2020 13:25:17 +0000 (06:25 -0700)]
^X weapon feedback

Report weapon skill in the ^X status section when dual-wielding,
The effective skill level is the lower of the weapon's skill and
two-weapon skill, separately for primary and secondary.  It's a
much bigger chunk of code than most enlightenment/^X features so
I put it in its own routine.

5 years agodual-wielding tweaks
PatR [Mon, 6 Apr 2020 13:12:25 +0000 (06:12 -0700)]
dual-wielding tweaks

Reject arrows and darts as candidates for wielding two weapons at
once.

Make the check for being able to two-weapon when polymorphed be more
robust.  Instead of just testing whether the monster form's second
atttack is a weapon attack and then assuming that the first one is
too, test the first three to validate that at least two of those are
AT_WEAP.  The existing code works but seemed fragile.

5 years agoAnd some more warning fixes
Pasi Kallinen [Mon, 6 Apr 2020 12:41:26 +0000 (15:41 +0300)]
And some more warning fixes

5 years agoFix even more warnings
Pasi Kallinen [Mon, 6 Apr 2020 08:54:30 +0000 (11:54 +0300)]
Fix even more warnings

5 years agoFix more warnings
Pasi Kallinen [Mon, 6 Apr 2020 07:25:17 +0000 (10:25 +0300)]
Fix more warnings

5 years ago'A' tweak
PatR [Sun, 5 Apr 2020 22:32:00 +0000 (15:32 -0700)]
'A' tweak

Get rid of a couple of unnecessary calls to set_twoweap() to clear
u.twoweap when using 'A' to 'take off' either weapon.  setuwep() and
setuswapwep() don't do that, but they call setworn() which does.

Make the feedback when disarming with 'A' be more specific when you
are two-weaponing at the time either weapon is unwielded.

5 years agowarning fix
PatR [Sun, 5 Apr 2020 21:31:01 +0000 (14:31 -0700)]
warning fix

A couple of the new prototypes used 'char' where 'CHAR_P' is needed.

Also, move them out of middle of long block of command declarations.
I started to reorder the prototypes into the order in which those
functions appear in the file but gave that up pretty quickly.

5 years agoX11 vs S_unexplored
PatR [Sun, 5 Apr 2020 20:37:06 +0000 (13:37 -0700)]
X11 vs S_unexplored

X11 was still initializing a blank map to 'stone' instead of to
'unexplored'.  When the core started forcing 'unexplored' as part
of cls(), you could see the S_stone background show up and then be
overwritten with S_unexplored.

Also, X11 is [still] drawing unused column 0.  That was also 'stone'
but has been changed to 'nothing' so is now blank for both tiles map
and text map (regardless of S_unexplored value).  The extra useless
column doesn't look too bad normally but does if a vertical scroll
bar is added to support a clipped map.

5 years agoFix more warnings
Pasi Kallinen [Sun, 5 Apr 2020 18:53:45 +0000 (21:53 +0300)]
Fix more warnings

5 years agoFix warnings
Pasi Kallinen [Sun, 5 Apr 2020 18:36:33 +0000 (21:36 +0300)]
Fix warnings

Add missing prototypes and rename one shadowed declaration.

5 years agoRefactor mongets to return the object it creates
copperwater [Wed, 18 Sep 2019 15:12:09 +0000 (11:12 -0400)]
Refactor mongets to return the object it creates

The impetus for this was to avoid ugly constructions such as the one
below (none of which currently appear in vanilla NetHack):

mongets(mtmp, LONG_SWORD);
struct obj* sword = m_carrying(mtmp, LONG_SWORD);
if (sword)
  /* do thing to sword */

Most cases where mongets is used discard the returned value (which used
to be the created object's spe); the only places that do use it are the
series of statements that give various human monsters armor and prevent
them from getting too much armor. These statements included hardcoded
constants representing the base AC of the armor, which would have caused
discrepancies if armor's base AC were ever changed.

With mongets now returning a pointer to the created object, it can just
be passed into ARM_BONUS instead, which covers both the base AC and the
enchantment. (It will also cover erosion, if anyone ever decides that
armor should rarely generate as pre-eroded).

The overall algorithm is not changed by this; human monsters should
receive armor with the same probabilities as before.

5 years agoDon't interrupt tin opening if being slimed and tin is chameleon
copperwater [Thu, 31 Jan 2019 01:54:30 +0000 (20:54 -0500)]
Don't interrupt tin opening if being slimed and tin is chameleon

Another SliceHack feature. It's possible for you to eat the chameleon
tin and turn into a fiery monster that burns off the slime in its
natural form, either extremely luckily at random or if you have
polymorph control.

5 years agoBlessed teleport scrolls now give a single controlled teleport
copperwater [Mon, 30 Oct 2017 23:22:44 +0000 (19:22 -0400)]
Blessed teleport scrolls now give a single controlled teleport

This buffs the blessed effect of the teleport scroll by providing the
reader control over their destination even if they lack teleport
control. This seems like it makes the blessed/uncursed distinction
actually meaningful, rather than mostly pointless.

5 years agoPets will not eat shapeshifter corpses except in extreme circumstances
copperwater [Fri, 19 Oct 2018 14:21:25 +0000 (10:21 -0400)]
Pets will not eat shapeshifter corpses except in extreme circumstances

Ported from SpliceHack, and generalized to all shapeshifters (Splice
only implemented it for chameleons). It's very aggravating when your
powerful but hungry pet chows down on a shapeshifter before you can stop
them and then turns into something much more useless, so this aims to
prevent that.

The extreme circumstances under which a pet will eat a shapeshifter are:
  1. The pet is starving, and prefers polymorph to starvation
  2. The pet's tameness is 1

The reasoning behind the second condition is that if you mistreat your
pet almost to the point of untaming it, it might want to take a chance
on turning into something that might get some more respect from you.
Practically, whenever this happens, this will result in the player now
owning a newly polymorphed and *still* nearly feral pet.

5 years agopurple worms
PatR [Sun, 5 Apr 2020 12:57:37 +0000 (05:57 -0700)]
purple worms

Compiler complained about 'ptr' possibly being used unitinialized
in meatcorpse() and in this case it was right.  meatcorpse() was
cloned from meatobj() but the necessary initialization was missing.

Purple worm would devore an entire stack of corpses in one bite.
Split one off and have it eat that instead.

I'm not sure whether attempting to revive a Rider corpse can force
a monster off the level to make room.  If so, meatobj() and
meatcorpse() weren't prepared to handle that, nor was their caller.
It appears that the monster (either g.cube or purple worm) will
only eat as it moves so can't revive a Rider on a completely full
level since it won't be able to move in that situation.  I fixed
the caller to be prepared to handle a result of 3 (no further
action allowed) instead of just dealing with 2 (died), but I didn't
fix either of the meatfoo() routines to return 3 since bumping the
eating monster off the level seems to not be possible.

Don't let purple worms eat lichen corpses, regardless of whether
they'll swallow live ones.

5 years agoMake demon lords hostile if wielding Demonbane as well as Excalibur
copperwater [Tue, 25 Sep 2018 01:03:03 +0000 (21:03 -0400)]
Make demon lords hostile if wielding Demonbane as well as Excalibur

This makes a lot of sense. Why would they hate one artifact sword so
much and not really care about the one that is especially designed to
kill their type personally?

5 years agoScroll of remove curse becomes learned when items' curses are removed
copperwater [Wed, 1 Nov 2017 02:15:44 +0000 (22:15 -0400)]
Scroll of remove curse becomes learned when items' curses are removed

The scroll of remove curse is trivially identified by checking inventory
after reading it to see whether anything became uncursed. This leads to
annoying tactics like remembering which scroll you just read so you can
go call it "remove curse" on the discoveries list.

This simply autoidentifies it when an item that was known to be cursed
has its curse removed.

5 years agoDeliberate level teleporter activation ignores magic resistance
copperwater [Fri, 1 Feb 2019 17:08:54 +0000 (12:08 -0500)]
Deliberate level teleporter activation ignores magic resistance

This is aimed at providing a little quality of life in the form of not
having to divest yourself of your sources of magic resistance before
using a level teleporter. The player is already able to use regular
teleport traps while Antimagic; there's no reason why it should be
different for level teleporters.

This ultimately comes from "Stevie-O's level teleporter jump patch", by
way of SliceHack. I simplified it a bit: deliberately jumping onto the
trap always takes time even if it fails to levelport you (which would
only happen with level teleporters in the End Game, which don't exist).

5 years agoYou may survive food poisoning with a Con/100 chance
copperwater [Sat, 26 Jan 2019 23:32:02 +0000 (18:32 -0500)]
You may survive food poisoning with a Con/100 chance

Another feature from SliceHack. Randomly averting an instadeath might
seem a little too generous, but the only time you get food poisoning is
if you're a new player who hasn't learned about tainted corpses yet or
if you just did something stupid. So, be a little nicer in those
scenarios.

If you survive, your Con silently decreases by 1. Hey, it's better than
dying.

5 years agoPotions of hallucination can give enlightenment
copperwater [Thu, 31 Jan 2019 04:47:05 +0000 (23:47 -0500)]
Potions of hallucination can give enlightenment

This is also from SliceHack, but with the odds of enlightenment toned
down a bit, to 4/9 for a blessed potion and 1/6 for an uncursed potion
(SliceHack had it at 50% blessed, 20% cursed, and strangely, 0%
uncursed). It gives a much-needed use to one of the potions that's
commonly blanked or discarded.

5 years agoConfused scroll of light conjures tame cancelled lights
Pasi Kallinen [Sun, 5 Apr 2020 10:21:54 +0000 (13:21 +0300)]
Confused scroll of light conjures tame cancelled lights

Tame cancelled lights are actually quite interesting and useful: they
are a mobile light source that will follow you around, and because they
are cancelled they won't explode at hostile monsters.

This replaces the existing confused scroll effect of creating an area of
darkness (the cursed scroll of light still produces this effect). If you
are confused *and* the scroll is cursed, it summons black lights instead
of yellow ones.

Original change by copperwater <aosdict@gmail.com>, added with
formatting and some functional changes.

5 years agoPurple worm changes
Pasi Kallinen [Sun, 5 Apr 2020 09:43:54 +0000 (12:43 +0300)]
Purple worm changes

Shriekers only spawn purple worms when they're appropriate difficulty.
Non-tame Purple worms eat corpses off the ground.
Baby purple worms attack shriekers.
Hero polyed into baby purple worm is warned against shriekers.

Original changes by copperwater <aosdict@gmail.com>, added with some
formatting adjustments and consolidation.

5 years agowizard mode wishing for terrain
PatR [Sat, 4 Apr 2020 10:29:40 +0000 (03:29 -0700)]
wizard mode wishing for terrain

Changing terrain type without moving wasn't registering as moving to
different terrain.  A Passes_walls hero who has levitation blocked
while moving through solid rock can wish for furniture.  Levitation
remained blocked unless hero moved off that spot and then back on.

Doesn't affect normal play.  Changing terrain by digging already
deals with similar situation; not sure whether there are any other
situations that might need to handle it.

5 years agoswitch_terrain() logic bug causing status updates
PatR [Sat, 4 Apr 2020 09:41:13 +0000 (02:41 -0700)]
switch_terrain() logic bug causing status updates

When moving onto a different terrain type, the logic for whether to
block or unblock levitation and flying (for the case of moving in
or out of walls and solid stone with Passes_walls while levitating)
was correct but the XOR logic for whether to do a status update
because of such a change was incorrect.  So stepping from room floor
to furniture or to doorway and vice versa or from corridor to doorway
and vice versa was requesting a status update when there was no need
for one.

Some other code must be requesting a status update when it is needed
for this (or possibly even more often than that?) because the status
line does seem to show the current state of Lev and Fly accurately.
Otherwise this should have been noticed when switch_terrain() was
first implemented.

5 years agogroundwork: u.twoweap manipulation
PatR [Fri, 3 Apr 2020 18:42:17 +0000 (11:42 -0700)]
groundwork: u.twoweap manipulation

Toggle u.twoweap on or off in just one place.

5 years agoset_uinwater() bit
PatR [Fri, 3 Apr 2020 18:39:40 +0000 (11:39 -0700)]
set_uinwater() bit

Assignment target is a one bit wide bitfield; callers only pass 0 or 1
but guarantee that value fits so that no compiler has reason to complain.

5 years agoMake hezrous stink
Pasi Kallinen [Fri, 3 Apr 2020 18:05:45 +0000 (21:05 +0300)]
Make hezrous stink

5 years agoFlip poison gas clouds
Pasi Kallinen [Fri, 3 Apr 2020 17:41:46 +0000 (20:41 +0300)]
Flip poison gas clouds

5 years agomention_decor vs Underwater or drowning escape
PatR [Fri, 3 Apr 2020 17:41:30 +0000 (10:41 -0700)]
mention_decor vs Underwater or drowning escape

Avoid redundant
|You are on solid land again.
|You are back on floor.
when walking or teleporting out of water with the mention_decor option on.

5 years agoCheck for levl typ STONE explicitly
Pasi Kallinen [Fri, 3 Apr 2020 10:10:08 +0000 (13:10 +0300)]
Check for levl typ STONE explicitly

... instead of expecting 0 to be STONE (or unused space in this case)

5 years agogroundwork: u.uinwater manipulation
PatR [Fri, 3 Apr 2020 08:04:27 +0000 (01:04 -0700)]
groundwork: u.uinwater manipulation

Toggle u.uinwater on or off in just one place.

5 years agoRemove workarounds for ancient compilers
Pasi Kallinen [Fri, 3 Apr 2020 05:21:08 +0000 (08:21 +0300)]
Remove workarounds for ancient compilers

5 years agowarning fix
PatR [Thu, 2 Apr 2020 19:48:27 +0000 (12:48 -0700)]
warning fix

Fix a warning about mixing || and && without parentheses where
parentheses were present but a closing one was misplaced.

Also, isok() was redundant in 'isok() && is_pool()' because is_pool()
starts off with its own isok() check.

5 years agoUnify checking if monster is ok in poison gas
Pasi Kallinen [Thu, 2 Apr 2020 15:15:13 +0000 (18:15 +0300)]
Unify checking if monster is ok in poison gas

5 years agopartial fix for S_unexplored
PatR [Wed, 1 Apr 2020 22:49:28 +0000 (15:49 -0700)]
partial fix for S_unexplored

I've been sitting on this for a while but have decided that I'm not
likely to make any further progress.

SYMBOLS=S_stone:8,S_unexplored:9
on tty reveals that S_stone works as intended but S_unexplored does
not.  Unexplored was being drawn as spaces, and detected or sensed
monsters moving around unexplored areas left a trail of S_unexplored
characters behind them.  ^R reverted those to spaces.

This is only a partial fix that works when the map is initially drawn
or fully redrawn.  But after tty erases parts of lines (when deleting
a menu that overlaid the map or when clearing a message line that
wrapped onto the top line of the map), unexplored locations show up
as space rather than as S_unexplored.

5 years agorestore 'use_inverse' option
PatR [Wed, 1 Apr 2020 21:58:40 +0000 (14:58 -0700)]
restore 'use_inverse' option

'use_inverse' used to be unconditionally present but conditionally
had default value True for WIN32 and False for others.  The options
changes that moved things to optlist.h made it present for WIN32 and
absent for others.  Put it back, and change the default value to be
unconditionally True.

5 years agomoat vs water
PatR [Wed, 1 Apr 2020 21:22:47 +0000 (14:22 -0700)]
moat vs water

Far-look and getpos's autodescribe feedback described the castle moat
as "water" and Juiblex's swamp similarly.  Describe them as "moat"
and as "swamp" instead.

5 years agoLevel compiler creates correct novel with supplied name
Patric Mueller [Wed, 1 Apr 2020 20:36:30 +0000 (22:36 +0200)]
Level compiler creates correct novel with supplied name

Before this commit, the name of a novel in the level files was ignored for
setting novelidx. But the name was set nevertheless, so you got a named novel
that showed quotes from a different novel.

Now, 'des.object({ id = "novel", name="Raising Steam"});' will work as
expected.