Commit Graph

6608 Commits

Author SHA1 Message Date
PatR
c2fb384a5d rehumanizing while Unchanging
When hero poly'd into paper golem "burns completely" he is rehumanized
even if he has the Unchanging attribute.  A comment states that that is
intentional, but there was no explanation given to the player.  Report
that "your amulet of unchanging failed" when rehumanization despite
Unchanging happens.  (Don't ask me how or why it fails; I don't know.)
2017-12-14 16:39:21 -08:00
PatR
892f210c1e fix #H6610 - completely burnt paper golem
When a monster killed a paper golem with a fire attack, the player was
told that the golem "burns completely" yet it might still leave some
blank scrolls as 'corpse'.  The fix for that was one-line, but several
other death-by-fire situations which didn't report "burns completely"
were also leaving scrolls:  fireball spell or scroll of fire or other
fire explosions (if any), also wand of fire.  Fire trap and poly'd
hero with fire attack were already suppressing 'corpse'.
2017-12-14 16:22:36 -08:00
PatR
b4540086f8 self-genocide's "you feel dead inside"
It seems to me that the reaction to "you feel dead inside" when you're
polymorphed into an undead creature at the time would be "so what else
is new?".  Vary the "dead" when current form is something which gets
reported as "destroyed" rather than "killed" when killed.  That happens
for things flagged as non-living.  Now undead "feel condemned inside"
and golems "feel empty inside".  Neither of those are ideal but they're
more interesting than "feel dead inside".

After becoming dead inside, give a reminder about that during
enlightenment and if you restore a saved game in that condition.  It
was the latter that set this in motion:  I wanted to confirm that
restoring with u.uhp == -1 didn't give "you aren't healthy enough to
survive restoration" when polymorphed.  (It doesn't; the game resumes
and you'll die if/when you rehumanize.)
2017-12-12 17:53:54 -08:00
nhmall
7eb05aef65 git on windows was misbehaving on doc/window.doc
Changes to be committed:
	modified:   .gitattributes
2017-12-09 10:51:41 -05:00
Alex Smith
045ee2a898 Add an instance flag for being inside parse()
Some windowports that are currently being written by third parties
need more information about the engine than they currently have.
Two specific reported problems: a) needing to know whether a
putstr() call relates to a count (so that it can be placed in a
different part of the user interface from the message area); b)
needing to know whether a request for a character relates to
command input (some hangup handling routines need this so that
they can determine what behaviour is potentially exploitable).
Knowing whether or not you're inside parse() fixes both of them.

This would be cleaner to do by changing the windowport API, but
that'd break existing windowports, which isn't really ideal.
Setting a globalish variable that the windowport can inspect, but
can ignore if it prefers, means that existing windowports will
continue to work fine, but new windowports will have more
information and thus more flexibility in how they handle command
entry.
2017-12-09 14:36:33 +00:00
PatR
20accd4bb7 fix #H6597 - genocide exploit
Self-genocide (own role or race) while polymorphed sets u.uhp to -1
so that you'll be killed during rehumanization.  I found a couple
of places which were testing (u.uhp < 1) without checking polymorph
state, and one of those was where monster movement decides whether or
not to attack.  This bug seems to have been present since start of
the second cvs repository, so has been around for quite a long time
without anybody letting on that they'd noticed.  So it probably isn't
a very effective exploit, although it would certainly make ascending
without wearing armor become much more feasible.

There are bound to be other places which examine u.uhp directly
instead of '(Upolyd ? u.mh : u.uhp)' but I only checked m*.c.
2017-12-09 00:36:19 -08:00
PatR
99f5bbc59e fix #H5590 - pets not shown on dumplog map
When ascending or escaping from the dungeon, adjacent pets are moved
onto the 'mydogs' list so that they can be included in the score and
mentioned as being with hero in the final messages.  But keepdogs()
was caled to do that before the known portion of the map was drawn
in the dumplog file, so adjacent pets were missing.  Defer that until
after the map has been dumped so that pets will still be present.
2017-12-08 23:06:25 -08:00
PatR
3f9522041c fix #6598 - monster briefly rendered as hero
When swapping places with a pet, the hero's coordinates are changed
before some tests which might disallow the swap, and if the pet was
a hidden mimic or was trapped and became untame, the attempt to draw
the revised pet or former pet would actually draw the hero and have
that mistake be visible during the message about not swapping.  That
last bit only occurred when the pet couldn't move diagonally (due to
being a grid bug or to being unable to squeeze through a tight space).
Also, spoteffects for arriving at a new location took place even
though the hero hadn't changed position.
2017-12-08 14:12:35 -08:00
Alex Smith
5e7327cb39 TDTTOE: Discourage generating elf corpses on sleeping gas traps
These are elven /adventurers/, so they get sleep resistance at
experience level 4 (not immediately), and so there's an outside
chance they'll be killed by a sleeping gas trap. This commit
reduces the probability, though.
2017-12-06 18:50:46 +00:00
PatR
d7f26afba8 more #adjust (#H6571)
Make the suggested change that only adjusting something into its own
slot be the way to collect/merge compatible stacks with it, instead
of any #adjust without a split count.  This removes the previous
special case for a count that matches the stack size.  Having to
know the exact count was not a burden on the player, but being able
to move things around without merging with other stacks makes more
sense than the original behavior or the hack to work-around that
behavior.
2017-12-05 03:38:23 -08:00
nhmall
fdf07f932b Update the Files file that tracks what's in the source tree 2017-12-03 09:40:48 -05:00
nhmall
2cfbd682a1 VS community editions are freely downloadable. Maintain only 2 most recent.
Changes to be committed:
	modified:   sys/winnt/Install.nt
	modified:   sys/winnt/Makefile.msc
	modified:   sys/winnt/nhsetup.bat
	deleted:    win/win32/vs2010/NetHack.sln
	deleted:    win/win32/vs2010/NetHackW.vcxproj
	deleted:    win/win32/vs2010/dgncomp.vcxproj
	deleted:    win/win32/vs2010/dgnstuff.vcxproj
	deleted:    win/win32/vs2010/dlb_main.vcxproj
	deleted:    win/win32/vs2010/levcomp.vcxproj
	deleted:    win/win32/vs2010/levstuff.vcxproj
	deleted:    win/win32/vs2010/makedefs.vcxproj
	deleted:    win/win32/vs2010/recover.vcxproj
	deleted:    win/win32/vs2010/tile2bmp.vcxproj
	deleted:    win/win32/vs2010/tilemap.vcxproj
	deleted:    win/win32/vs2010/tiles.vcxproj
	deleted:    win/win32/vs2010/uudecode.vcxproj
	deleted:    win/win32/vs2013/NetHack.sln
	deleted:    win/win32/vs2013/NetHack.vcxproj
	deleted:    win/win32/vs2013/NetHackW.vcxproj
	deleted:    win/win32/vs2013/dgncomp.vcxproj
	deleted:    win/win32/vs2013/dgnstuff.vcxproj
	deleted:    win/win32/vs2013/dlb_main.vcxproj
	deleted:    win/win32/vs2013/levcomp.vcxproj
	deleted:    win/win32/vs2013/levstuff.vcxproj
	deleted:    win/win32/vs2013/makedefs.vcxproj
	deleted:    win/win32/vs2013/nhdefkey.vcxproj
	deleted:    win/win32/vs2013/recover.vcxproj
	deleted:    win/win32/vs2013/tile2bmp.vcxproj
	deleted:    win/win32/vs2013/tilemap.vcxproj
	deleted:    win/win32/vs2013/tiles.vcxproj
	deleted:    win/win32/vs2013/uudecode.vcxproj
2017-12-03 08:42:38 -05:00
PatR
90405235e5 address #H6552 - #adjust behavior
The report stated that '#adjust a c' after '#adjust 1a b' moved all
the original 'a' to 'c' instead of leaving the one in 'b' alone.
That's true, but it is also the intended behavior.  Splitting off
with a count explicitly avoids gathering compatible stacks (but
does merge into the destination if compatible, instead of swapping).
Moving a whole stack gathers compatible ones and puts the whole
merged group into the destination.

But that leaves a gap in functionality:  there's no way to get the
don't-collect-other-stacks without splitting; there ought to be.
So, allow the player to specify full count to move a stack from one
slot to another without collecting compatible stacks (the behavior
when no count is given) or splitting (the behavior when count is
less than full amount).  In the example above, if 'a' started with
5 doodads and had 4 left after splitting one to 'b', '#adjust 4a c'
will move those 4 (all of 'a') to 'c' without merging 'b' into them.
The method is a bit obscure but it's also something which doesn't
come up very often.
2017-11-30 19:15:45 -08:00
PatR
359db05c2b mklev.c tweaks
Fix a compiler complaint about comparing unsigned against signed,
plus a couple of formatting bits.
2017-11-25 23:35:39 -08:00
PatR
1deb8dbcf1 more explosion vs u.ustuck
Fix a FIXME (poly'd hero hit by explosion while holding a monster
which is also hit by that explosion takes double damage even if the
held monster got killed) and an incorrect comment.

Add a FIXME about grabbers (monster or hero) who are outside the
explosion radius but holding someone who is inside.
2017-11-25 17:01:06 -08:00
Pasi Kallinen
a3d713d98b Tiny Guidebook fixes 2017-11-24 11:09:16 +02:00
Alex Smith
58b497c303 Merge from the devteam repository into NetHack-3.6.0
Huh, it's nice to see the devteam active enough that we can actually
create simultaneous changes by chance.
2017-11-24 00:49:44 +00:00
Alex Smith
865e69ebca Some traps on early depths were triggered already
The hero isn't the only adventurer seeking the Amulet. It's clear
from various other events in the game that others have been there
beforehand. As such, we can expect many of the traps on the first
few levels to already have been triggered repeatedly by questing
adventurers.

This commit allows for the creation of adventurer corpses in
early-game traps, together with a small amount of cursed junk
(i.e. a miniature bones pile) and any items created by the trap
itself. On dungeon level 1, this is guaranteed for the vast
majority of harmful traps, in order to avoid near-unavoidable
deaths in the very early game due to not having enough max HP to
survive a trap hit.

Wizard mode testing shows that this case doesn't trigger very
often; maybe once a game on average. (Traps are rare on filler
levels, at least early on, and many types of trap would leave no
evidence, e.g. a teleportation trap won't kill people on its own
square.) As a result, the balance impact from the actual items
here is likely to be minimal (it may help out ranged combat roles
slightly but they could do with the boost). The main change,
therefore, is to reduce the number of unfair very early deaths
(replacing them with fairer "you shouldn't have investigated
what created that corpse!" deaths).
2017-11-24 00:42:42 +00:00
PatR
4dbfb4abeb fix #H6489 - explosion double damage to ustuck
Report asked why u.ustuck takes double explosion damage, and concocting
a reason uncovered several inconsistencies.  Grabber takes double damage
for reaching into hero's spot, but only when that spot is within the
explosion's radius and only if hero isn't engulfed.  Poly'd hero takes
double damage if holding a monster which is hit by the explosion.

There are still multiple bugs here:  if the hero is grabbing a monster
which gets killed by the explosion, the fact that one was held is
forgotten by the time damage is inflicted upon the hero.  Just a messy
detail that I opted not to get bogged down in.  But much messier is
that grabber might be outside the explosion radius reaching into that
to hold grabbee, in which case no damage is inflicted.  Handling that
for out-of-range monster holding exploded hero shouldn't be very tough,
but handling it for out-of-range hero holding exploded monster could be
hard.  Anyway, it's more headache than I intend to tackle.
2017-11-23 16:37:20 -08:00
Alex Smith
59c357de9a Balance fix to level drain and potions of restore ability
Right now, the punishment for being hit more than twice by a level
drainer pre-Quest is disproportionate; grinding back up to level
14 from level 13 takes a long time, and yet isn't particularly
difficult, just slow, and a potion of full healing will only
regain one of the lost levels (as only half the lost levels can
be regained this way).

Meanwhile, potions of restore ability are currently automatically
blanked by almost all spoiled players; they don't do anything that
doesn't have more convenient sources (unicorn horn or the spell),
so they're only useful in the very early game for getting poison
resistance.

This commit aims to fix both problems, by allowing potions of
restore ability to restore lost experience levels, in addition to
lost attribute points; an uncursed potion restores one lost level
(with multiple potions making it possible to hit the cap), a
blessed potion restores all of them. That gives players an
incentive to keep them around rather than blanking them. (Notably,
the spell and tool were not changed the same way; for restoring
levels, you need to use the potion.)
2017-11-19 16:16:00 +00:00
PatR
c9153a22ef impossible fixup
For USE_OLDARGS, the varargs calls in pline.c actually need to pass a
fixed number of arguments (padded with dummies for unused ones) when
using a compiler which checks argument usage for consistency.

pline.c used to be the only core source file which needs VA_PASSx()
handling, but it looks like calls to config_error_add() in files.c now
need it too.  (If there were any calls to panic() in end.c, they would
need it as well, but there aren't.)
2017-11-17 23:38:28 -08:00
PatR
024906300e options processing: ascii_map vs tiled_map
Toggling either ascii_map or tiled_map with the X11 interface switches
the map window from one style to another, but it was only working as
intended when done via the 'O' command.  Setting ascii_map via initial
options only worked if tiled_map was explicitly cleared.  This fixes
that.
2017-11-17 16:05:35 -08:00
Alex Smith
8e1b28a453 Less misleading message when impossible() is called
Telling people to #quit due to something going wrong internally is
probably a bad idea; the game might or might not be corrupted, but
even if it is, most players will want to play on rather than lose
their game entirely.

Instead, advise saving and reloading; this will fix the underlying
cause of many impossible()s (which are normally related to
inconsistent internal structures; the save file format has much
less redundancy, therefore less chance of inconsistency, than the
in-memory format).

Thanks to AmyBSOD for reminding me to do this.
2017-11-16 17:19:19 +00:00
PatR
761180ce36 vomiting while fainting
From a beta-tester running 3.6.0:
|You faint from lack of food.
|You suddenly vomit!

The latter has already been changed to "You vomit" (it's given at the
end of a multiple-message vomiting countdown so wasn't "sudden") but is
still odd if your stomach is so empty that you're subject to fainting.
Give an alternate message in that case:
|Your stomach heaves convulsively!

Vomiting while unconscious (when that's due to something other than
fainting from hunger) should pose a risk of choking to death, but I'm
going to pretend that this hasn't occurred to me....
2017-11-14 15:31:26 -08:00
Pasi Kallinen
18aab1ab12 Make shopkeepers bill hero for burying merchandise 2017-11-14 19:32:31 +02:00
Pasi Kallinen
59d4ac02f7 TTY: Treat carriage return as newline
Before this change, more-prompts and input text -prompts could not
be accepted with carriage return. Now, just like in menus, carriage
return is treated the same as a newline.

To test, use 'stty -icrnl'
2017-11-14 16:14:06 +02:00
PatR
b4b3dedd59 options.c formatting 2017-11-12 17:35:30 -08:00
PatR
2f4fcb837d monst.c comment formatting 2017-11-12 16:06:28 -08:00
Pasi Kallinen
c2f767e1fe Fix a warning 2017-11-06 15:28:13 +02:00
Alex Smith
5a31603680 Intentionally spoil foodpois mechanics when it happens
One of the huge strengths of NetHack is that there's a lot of
mechanical content in it; you can continue learning about the game
more or less continuously, and when you die, it's usually possible
to figure out what you did wrong and avoid that for future games.
There are two parts to this: a) a death should only happen if the
player didn't play perfectly, b) the nature of the problem should
be clear.

FoodPois status meets a) just fine, but not b); food poisoning
mechanics tend (based on my research) to actively give the wrong
impression to new players. (Normally, something along the lines of
"corpses are sometimes randomly dangerous", which is insidious in
the sense that it'll cause players to leave them as a last resort
and thus never discover what they're doing wrong.) The easiest way
to fix this is to explain what the rule is explicitly.
Additionally, this should hopefully go some way towards changing
the incorrect perception many people who haven't played (any/much)
NetHack have that the game is arbitrarily cruel... It's important
to get the "everything happens for a reason" attitude across from
an early stage, by tying it to an event like this that's commonly
seen by new plyers.

Experienced players should not be affected much if at all by this
change, because they hardly ever get food poisoning anyway.

(Note: there are actually two main mechanics related to food
poisoning, one widely applicable, one much more subtle. The message
here is focused mainly on the common case, but doesn't actually
contradict the rare case, and attentive players may be able to
deduce both mechanics from the one message. Most likely, players
will hit the common case, see the message, learn the common case,
and some time later hit the rare case, get the message again, and
read it more carefully this time.)
2017-11-06 01:28:48 +00:00
Pasi Kallinen
81b1461600 Explicitly ignore the return value
Fixes scan-build complaint about dead assignment
2017-11-05 17:11:41 +02:00
Pasi Kallinen
b87db2dd3f Init variables to random 2017-11-05 14:17:22 +02:00
PatR
c59b7bf11b fix #H6391 - artifact #invoke for charging
Latent bug:  if a non-role-specific artifact which could be invoked
for charging existed, it would never work as if blessed because the
test for no-role was wrong.  Caused when 3.3.0 changed the Role_if()
predicate and artilist[] array to use monster index numbers (PM_foo)
instead of role letters; the non-role value changed from '\0' to
NON_PM (-1) but the test for non-role didn't.

No fixes36.1 entry; there aren't any artifacts which were affected.
2017-11-04 16:04:46 -07:00
Pasi Kallinen
647ea55b1a Fix compile of tile2x11
I was too zealous changing fprintf to the Fprintf macro, which
ignores the return value.
2017-11-02 23:41:55 +02:00
Pasi Kallinen
f3814417e9 Use enums for properties 2017-11-02 13:37:53 +02:00
Alex Smith
27e5f025f1 Don't use a plain %s when writing to a buffer
My compiler was understandably concerned about a potential buffer
overflow here. I don't think the string could get long enough to
cause that to happen, but it's hard to be certain. It's much safer
to limit the length of the string so that it fits in the buffer, as
done here, and if there really wasn't a problem the change will
cause no harm at all. (If there was, the string will be truncated
rather than corrupting memory. This code is in showing the
config-file version of a status highlight, something where
truncated text will probably be obvious to the user.)
2017-11-01 15:24:52 +00:00
Alex Smith
e4db58bdf3 It's OK for pets to oscillate near the player
This change was coded by FIQ, who suggested it by email.

The main change here is related to monster anti-oscillation code.
When a monster believes it's stuck in an AI loop, it looks for an
alternative strategy. That applies to pets too. However, if the
pet is currently near the player, we can typically assume that it's
there because it wants to be there, and an oscillation is not
because it's stuck but because it's already in the best possible
place. This commit causes pets to be "allowed" to stay near the
player, rather than running the wrong way down a corridor because
it's the only way to do something different than what they're
currently doing.

If the pet is far from the player, we use the old behaviour unless
the pet is leashed or the player tried to call it with a whistle
or the like, in order to avoid the risk of a genuine AI loop trying
to get back to the player. (Whistling happens rarely enough that it
won't cause AI loops of its own - the player isn't going to whistle
every turn - and it makes flavour sense that a pet might interpret
it as "you're going in the wrong direction!".)
2017-11-01 14:55:40 +00:00
Pasi Kallinen
f2765c573f Document therecmdmenu 2017-11-01 16:13:51 +02:00
Pasi Kallinen
089863088e Locked chests and large boxes contain more items 2017-11-01 15:38:44 +02:00
Pasi Kallinen
f19752fc32 Reduce the amount of gold laying on the floor
There's far too much gold just laying around on the floor.
Didn't previous adventurers grab most of it?

This should incentivize gold detection and digging out vaults,
selling stuff to the shopkeeps, and making it harder to donate
for protection.

Most radical reduction on the first few levels, for dlevel 1,
average amount of gold was 80, is now 10, for dlevel 2, 95->15

Does not change the amount of gold deposited by mineralize,
in the vaults, or contained in chests and large boxes.
2017-11-01 15:23:05 +02:00
Pasi Kallinen
001d9681c2 Make Vlad slightly tougher
Increase speed from 18 to 26, HD from 14 to 28, AC from -3 to -6,
weapon attack from 1d10 to 2d10, bite from 1d10 to 1d12
2017-11-01 00:07:29 +02:00
Pasi Kallinen
c50a93b5e0 Charisma affects the leeway in demon lord bribes 2017-10-31 22:30:07 +02:00
Pasi Kallinen
fe9762d1cc X11: Fix renaming at player selection
Due to the new player selection dialog I did, it was possible
to rename your character - but this didn't rename the lock files
and tried to load a save from the wrong name.

This is a bit of a hack, but seems to work and didn't seem to
cause problems for the tty.
2017-10-31 21:18:24 +02:00
PatR
72978d69fa fix #6284 - empty perm_invent
Report was for tty, but X11 exhibited the same behavior.  With the
perm_invent option enabled, when the permanent inventory window is
displayed, it would be empty if not carrying anything.  For tty, that
meant a naked "(end) " selection prompt.  Put a separator line of "Not
carrying anything" into the menu so that it won't be completely empty.
The selection prompt is still present but it is attached to something.
(The behavior is different from !perm_invent, where you get that same
text via pline without any menu at all.)
2017-10-28 14:12:50 -07:00
nhmall
bba7a6b44c fix Makefile build for Windows after recent changes
New code in nttty.c had a dependency on gdi32.lib. Previously
that was only being linked in for the gui build when using the
Makefile.

Move the reference into the base libraries if both tty and gui
depend on it now.
2017-10-28 09:53:27 -04:00
PatR
25c27cd4cf fix #H6338 - naming mimicked potion
Player tried to #name a potion on the floor and got prompted to call a
stream of fluid (sink feedback) instead of a potion.  A mimic posing
as an object is represented by a partially initialized object when
examining its map location.  #name for floor object uses the same data
as look_at.

obj->fromsink overloads obj->corpsenm which is set to NON_PM (-1) even
when creating a non-init'd object.  'fromsink' was only being forced to
0 when creating an init'd object (unlike leash which has its overload
of corpsenm set properly regardless of caller's request to init).  So
docall() treated a mimicked potion as a sink stream.

The fix is straightforward but has pointed out another bug which is
harder to fix.  Examining a floor object next to you sets that obj's
dknown flag as if you had seen it up close (a new feature in 3.6.0).
But a mimicked item is discarded as soon as it's been looked at, so
looking again from a non-adjacent spot will give different feedback
since the previously set dknown will be unset when replaced by a new
fake object.  So you can use '/' and ';' to recognize mimics without
provoking them into motion.  Best fix:  mimicking an object should use
a fully initialized one which is tracked via monst->mextra, but that
will break save file compatibility.  Possible hack:  change monst->
mappearance into a mask which uses N bits for object type (instead of
full 'int') and one of the other bits to track obj->dknown.  Examining
an adjacent object probably ought to set bknown for priests, so bknown
and blessed/uncursed/cursed would need to be tracked too.
2017-10-28 01:18:25 -07:00
Pasi Kallinen
bf0223fd9f Fix door orientation in des-files
Doors in des-files were always generated vertically.
This wasn't visible unless you had separate symbols for
closed vertical and horizontal doors, or used tiles.
2017-10-26 22:00:50 +03:00
PatR
0bdbfaa580 strbuf cleanup
The expression '*cp-- = cp[-count]' is not valid C.  There's no sequence
point between the two references to 'cp', and the decrement side-effect
could occur before or after cp[-count] is resolved.

The functions were also using ANSI-style argument definitions.  The rest
is just reformatting.

It seems to me that the strbuf structure ought to have an allocation
size field in addition to the current length field.  Otherwise a string
which gets shortened will forget about the extra length available for
later expansion, potentially resulting in unnecessary reallocation.
2017-10-25 19:13:21 -07:00
Pasi Kallinen
279050ba84 Sometimes put rings dropped into sinks in the pipes
aka bury the ring under the sink. Idea from Fredrik Ljungdahl.
2017-10-25 14:21:10 +03:00
Pasi Kallinen
4af8a93cff Status hilites: Fix defining hunger via menu 2017-10-25 12:27:02 +03:00