Commit Graph

3361 Commits

Author SHA1 Message Date
PatR
eea54fb773 more attribute from-what
A change earlier today resulted in infravision being described by
enlightenment (wizard mode only) as "from current creature form" when
it was actually due to hero's non-human race.  Now it'll be "innately".
2015-12-25 22:25:56 -08:00
PatR
c4a9d6a45c newline handling
In light of the recent 'bad options' feedback issue where \r messed
up message display, try to to make newline handling be more consistent.
I'm sure there are lots of places that still handle \n manually, but
it's a start.
2015-12-25 21:54:01 -08:00
PatR
1c80503938 fix #H4146 - more enlightenment vs drain resistance
Duplicate of another recent report as far as drain resistance from
Excalibur/Stormbringer/Staff of Aesculapius not being shown by
enlightenment goes, but this one mentioned that it also wasn't being
shown for lycanthropy.  Being inflicted by that does confers level-
drain resistance.  were_change() wasn't calling set_uasmon() since
it isn't changing youmonst.data, but set_uasmon() is were intrinsics
conferred by creature form are set up.  So call it when changing
were-form.  Direct access to u.ulycn wasn't calling it either, so add
a new routine to assign the value to that instead doing so directly.
2015-12-25 16:46:02 -08:00
PatR
0d36c443a3 fix #4040:2 - message typo for pet mind flayer
Mentioned in a completely unrelated report (about energy drain for
vortex attack):  the message given if a tame mind flayer is killed by
attempting to eat Medusa's brains had "then is passes" where "then it
passes" was intended.
2015-12-25 15:33:56 -08:00
PatR
192372a9ac "fix" #H4040 - energy vortex power drain
Reporter thought the fact that two different DREN cases had different
chances to inflict energy drain was an inconsistency, but it was
intentional.  Attack for DREN damage has 25% chance to drain energy,
and is never used since no monster has such an attack.  Engulf for
DREN damage has 75% chance to drain energy; energy vortices have this,
and the higher chance to be drained while engulfed was intentional.
So add comments explicitly spelling out the 25% and 75% chances.

During beta testing there was a complaint that the energy drain was
much too severe:  once hero's current energy drops to 0, excess drain
for current attack and future drains come out of max-energy instead.
That's survivable for caster-type characters with really high energy,
but drained low energy characters to 0 max energy very quickly.
I agreed with the complaint but didn't implement a fix until too late
for 3.6.0.  I've since thrown that one out and done this one instead.
Change base drain amount from 4d6 to 2d6, and weaken it more to 1d6
when energy is low or strengthen it to 3d6 when energy is high.  It
almost certainly will need further tuning.
2015-12-25 15:00:28 -08:00
PatR
67826ff67b inappropriately sensing humans and elves
Discovered while testing the from-what enhancements to enlightenment.
Polymorphing into a vampire confers the ability to sense humans and
elves without having telepathy or being triggered by blindness.  That
would be taken away if you polymorphed into something else, but was
being left in effect if polymorph just timed out and hero returned to
normal form.

Same thing occurred for sensing shriekers if you poly'd into a purple
worm and then reverted to normal (something much less likely to get
noticed and not really subject to abuse if it ever did).

Bonus fix:  the code involved was using 0 to mean that Warn_of_mon
from polymorph wasn't in effect, but 0 is also giant ant.  This makes
it use NON_PM for that instead.
2015-12-25 14:24:18 -08:00
PatR
0ed3d8be4c from_what()
Enlightenment/attribute disclosure while in wizard mode shows reasons
for some of the intrinsics.  This adds some more of those:  innately
due to polymorph for lots of things, and innately due to role for
knight's jumping.  (Drain_resistance from equipped item came with the
'resistance from Excalibur' patch.)
2015-12-25 14:15:00 -08:00
PatR
6f595dabcc fix #H4142 - resistance from Excalibur
Enlightenment and end of game disclosure didn't report level-drain
resistance if that was obtained via wielding Excalibur (or Stormbringer
or Staff of Aesculapius).  Drain_resistance wasn't one of the attributes
set for intrinsics/extrinsics when wielding or unwielding weapon or
wearing/unwearing other equipment.  loseexp() checks resists_drli()
which does check for items in use, so level drain would be aborted,
possibly after messages claimed that it was taming place.  I didn't try
to untangle any of that, just changed set_artifact_intrinsic to include
a test for DRAIN_RES.
2015-12-25 14:13:05 -08:00
PatR
9df552543b fix "Patch for dos mode nethackrc file on linux"
Reported directly to devteam (12 Dec), user had a config file originally
from MSDOS or Windows and used it on a linux system.  That works as-is
except when it contained an invalid option line.  Feedback was
"ad option line: "whatever-the-line-was
because of the carriage return character staying in the option buffer
after linefeed was stripped off from CR+LF line end.

He included a patch which replaced this existing fixup after fgets()
if ((p = index(buf, '\n')) != 0) *p = '\0';
with a loop over the whole string changing either '\n' or '\r' to '\0'.
This uses
if ((p = index(buf, '\n')) != 0) {
if (p > buf && *(p - 1) == '\r') --p;
*p = '\0';
}
instead.  Ordinarily I would have just cloned the original line and then
substituted \r for \n in the copy, but the report mentioned "I couldn't
get index to work with carriage return".  I don't know what he tried to
do or why simple index(buf,'\r') might not work as intended on his
platform, so I went with something that will work even if index()
behaves as strangely as the report suggested.

(We already have a couple of index(string,'\r') calls in use, but I'm
not going to change those unless someone complains about a problem.)
2015-12-24 16:00:50 -08:00
Pasi Kallinen
1cddb2f717 Fix bz210, H4114: Castle chest can be trapped 2015-12-24 14:07:35 +02:00
Pasi Kallinen
69e7f4e29b Allow defining symbols with OPTIONS
Some people are confused by the boulder -option, and
SYMBOLS=S_boulder, so allow defining symbols with
OPTION-lines in addition to the SYMBOLS.

So these are the same thing:

  SYMBOLS=S_boulder:0
  OPTIONS=S_boulder:0
2015-12-24 12:33:17 +02:00
Pasi Kallinen
cc7d5c31b4 Allow optional parameter for boolean config options
Some people try to set boolean options in the config file
by giving the option a parameter, so allow that:

OPTIONS=color:true

Allowed parameters are "true", "yes", "false", and "no".
Negating an option and giving it a parameter is an error.
2015-12-24 11:24:13 +02:00
PatR
9114a334c9 fix "killed by a died"
Explosion caused by an unseen gas spore resulted in messages about
"explosion" instead of "gas spore's explosion", which is intended, but
followed that with a death reason of "killed by a died" which isn't.
2015-12-23 16:05:45 -08:00
Pasi Kallinen
91a7d393cd Do not autopickup unpaid items in shops
This is overridden by pickup_thrown and autopickup
exceptions.
2015-12-22 22:36:30 +02:00
Pasi Kallinen
cdde5b76c9 Some shopkeepers are always stingier
This prevents the "drop the item few times, just to see if
the sell price changes"
2015-12-22 21:44:59 +02:00
Pasi Kallinen
715fd7e3d9 Displace a pet rather than stop travel
... and stop travel if you take damage from any source.

Original patch via Acehack by Alex Smith
2015-12-21 19:13:45 +02:00
Pasi Kallinen
4b876b1aec Fix findtravelpath buffer overflow
Test case: Bigroom, full of boulders, with a single
path from travel start to travel end. Boulders (and
doors) are added to the travelstep[xy] arrays multiple
times, and will overflow the arrays.

Original patch via Acehack by Alex Smith
2015-12-21 18:18:40 +02:00
Pasi Kallinen
9a2eb370e7 Make travel consider traps like closed doors
Test case: U-shaped corridor, with a known trap in it.
Before this change, travel would try to move straight at
the target, bumping the wall or walking into a dead-end.
After this, travel will go along the corridor and then stop
right before the trap.

Original patch via AceHack by Alex Smith.
2015-12-21 17:36:14 +02:00
PatR
31486e23cf H4047 revisited - dipping prompts
Shorten the dip-into-fountain, dip-into-pool, and dip-into-potion prompts
when flags.verbose is off.  For non-verbose, use "it" (or "them") instead
of the formatted object name of the item being dipped.

Also, the "What do you want to dip <object> into?? [xyz or ?*]" prompt
for dipping into a potion had an extra question mark.  I must have seen
that umpteen times before it actually registered.

No fixes entry; these are changes to post-3.6.0 changes....
2015-12-20 19:11:36 -08:00
PatR
b66b5ee6c3 fix #H4072 - alchemy bugs
The 3.6.0 feature of dipping only a subset when attempting to dip a large
stack of potions into another potion (other than water) was calculating
the size of the subset poorly.  Dipping 9 non-magic potions would always
dip the whole stack, but attempting to dip 10 would split the stack and
dip 2..9, so manually splitting off 9 in advance let the player always
get maximum yield.  This anomaly didn't extend to dipping magic potions,
where dipping 2 always dipped "all" 2 and attempting to dip 3..N dipped
2..min(N,9) regardless of N.  Also, the decision about whether what you
were dipping was magic was based on the potion being dipped even though
most alchemy formulas yield the same outcome when dipping magic potion
into non-magic or vice versa.

Change the splitting calculation to yield 3..min(N,8) for magic and 7..N
for non-magic, with no extra threshold that can produce anomalies in the
result.  Also, the determination of magic vs non-magic is based on the
outcome rather than either of the inputs--unless the outcome is random,
in which case it will be treated as magic if either of the input potions
is magic.
2015-12-20 17:17:48 -08:00
PatR
40ad82ed77 fix #H4105 - credit cloning
Putting gold into a hero-owned container on a shop's floot gave credit
for the amount of the gold but also set the gold object no_charge, so
it could be taken out without taking away the credit.  Then put back
in and taken out as many times as the player liked, doubling the gold
each time until the shopkeeper was out of cash.

I think the proper fix would be to avoid giving credit instead of not
marking the gold no_charge, but that would require multiple additional
changes so I took the easy way out.

Most of the changes to pickup.c are reformatting that it escaped prior
to release.  The changes to shk.c are cosmetic and not part of the fix.
2015-12-20 01:44:19 -08:00
PatR
0d2a4afd81 fix "spellbook of novel" on discoveries list
Avoid "spellbook of novel" after novel becomes discovered.  Now it will
just be "novel".  Prior to discovery, it might be on the list as "book
called whatever" if the player assigns a type name.

Also, make novel become discovered after reading one instead of only via
object identification.  It already shows up as "novel" in inventory, but
changing its definition to designate it as not-interesting-to-discover
feels disrespectful to the tribute.
2015-12-19 20:07:51 -08:00
PatR
f87fd929e5 have #jump cast "jumping"
Requested during beta testing:  if hero can't jump, have #jump command
attempt to cast the jumping spell.  This is similar to how #unturn and
^T cast spells when used while lacking the innate ability.
2015-12-19 19:39:20 -08:00
PatR
7d6d508eef more tin opener
Reading a non-cursed scroll of enchant weapon has a side-effect of
uncursing a weapon welded to hand(s).  Make it do the same thing for
cursed tin opener, the only non-weapon/non-weptool that welds to hand.
2015-12-19 18:14:39 -08:00
PatR
4b69dde2d7 tin opener fix
Applying a non-wielded tin opener and then declining to pick a tin to
open would wield the opener without having any time elapse.

Reformat the new tin opener code.

Remove a no-longer-used label in doapply() in order to avoid a warning
from gcc.
2015-12-19 17:11:33 -08:00
Pasi Kallinen
43bf9c978d Improve the tin opener 2015-12-19 14:44:39 +02:00
nhmall
a5c63af579 objected to 2015-12-18 20:55:24 -05:00
nhmall
5ee09d66d6 blind pronunciation of scroll formula not a literacy violation
bug bz25, no web id, devteam email received on 1/3/2006 6:15 AM:
> Reading a scroll while blind shouldn't violate illiterate conduct
2015-12-18 19:02:19 -05:00
nhmall
97974e9968 make corpse visible if stethoscope told you about it
Bug bz14, no web id.

Steps to reproduce:
- have a stethoscope handy.
- place an amulet in a doorway and move one square outside the room's door.
- create and lead an invisible stalker to be on top of amulet, with you
  just outside the room beside the door square.
- zap the stalker asleep with a wand of sleep.
- put on a blindfold.
- quaff a potion of object detection.
- amulet shows in the doorway.
- save the game and keep the savefile for ease of returning to this point.

Bug 1 observed (remember that you're blind due to blindfold):
- zap a wand of death at the stalker that you know to be on top of
the amulet, but that the game gives no indication of.
- if the stalker left a corpse, and you apply a stethoscope to the
  doorway, the game tells you that "You determine that that unfortunate
  being is dead" yet no being or corpse is displayed, still just the amulet.

Fix that by calling map_object(corpse, TRUE) in its_dead() under these circumstances.

The circumstances in the original report were also reproduced, specifically:
If a stethoscope finds an unseen monster on a square with an
object-detected object while blind, after killing the monster, the
object isn't remembered.

That remains unfixed because the I (invis monster glyph) aleady overwrote the
detected object glyph, so it is a much tougher situation.
2015-12-18 18:24:13 -05:00
nhmall
ec166df636 handle escape from new wizmode menu appropriately 2015-12-18 16:23:05 -05:00
nhmall
2eddec8287 fix typo in last patch to yelp() 2015-12-18 13:00:35 -05:00
nhmall
7019a7da77 fix H4101: can hear pets while deaf
This is a fix for H4101, bz192.

add non-audio (felt) outcome to yelp()

This also add #wizintrinsic command because testing this was a pain
without a simple, straightforward way to go deaf that didn't time-out
before the situation being tested recurred.
2015-12-18 12:50:25 -05:00
PatR
c097814f3c warning bit
Suppress a couple of 'dead increment' diagnostics from the clang static
analyzer.  The assignments are dead, but keeping the variable up to date
is more valuable (in case someone someday changes the code to use the
affected variable somewhere farther along in that function) than changing
the code to avoid the assignments in order to prevent the diagnostic.

This will only work to suppress the analyzer's diagnostic messages if
either FORCE_ARG_USAGE or GCC_WARN is defined when compiling makemon.c.
2015-12-18 07:18:58 -08:00
PatR
fcc30bee88 more while-helpless
Guard xlogfile entries against naming killer monst ", while".
2015-12-18 07:11:41 -08:00
Pasi Kallinen
164b64b263 Allow color name aliases for menucolors 2015-12-18 16:12:53 +02:00
PatR
4604777c16 suppression of while-helpless for tombstone
Avoid the possibility of a user-supplied name interfering with killer
reason truncation.  A monster named ", while" that killed the hero
would result in "killed by <mon-type> called " being displayed on the
tombstone after stripping while-helpless reason to shorten the text.
2015-12-18 01:59:36 -08:00
PatR
20b2120f3f fix bz 103+#H4095 - high scores ", while helpless"
If a character dies with 'multi' at a non-zero value, the reason for
helplessness is appended to the cause of death.  But that was taking
place in writeentry(), which is used for every score entry while
rewriting 'record' when a new high score is added.  So whenever a new
score with helplessness was added, all existing entries got corrupted
by having the newest game's reason for helplessness tacked on.

Append the helplessness reason while formatting the cause of death
instead of when writing out score and logfile entries.  xlogfile is
handled a little differently in case the cause of death plus reason
for helplessness is too long so truncated for record and logfile.
Full reason is still put into xlogfile.
2015-12-17 19:50:06 -08:00
nhmall
3e597b6882 Fix bug C343-20 wrong level shown at death
Changes to be committed:
	modified:   doc/fixes36.1
	modified:   src/ball.c

I looked up the original bug report that led to bug page C343-20
"When dying immediately on entering a level, the map may show you dying on the previous level."

It was received public report U891:
> When one is being punished and goes down a staircase and dies because the
> ball and chain fell on their head, one gets the message about their death
> while the old level is still being displayed. I wasn't sure whether this
> was a bug or not because on one hand it wouldn't make much sense to
> generate a new level if the character is going to die anyway. However,
> that being said it does make a difference if the character is about to go
> down into a level where one cannot leave bones files, ie medusa or the
> first level of the mines (if i remember correctly). So, if your character
> dies from this does the bones file get left on the level you were on
> (which is still displayed at the time of death) or the level you died as
> soon as you got to (but was never displayed)? Thanks!

Pat had remarked in response: "So this is just a display issue; game play works as intended
(for the program; I imagine you weren't planning to get killed."

A debug trace in wizard mode 3.6.1 beta shows that the relevant code path is this:
NetHack.exe!done(int how) Line 908
NetHack.exe!losehp(int n, const char * knam, char k_format) Line 2678
NetHack.exe!drag_down(...) Line 823
NetHack.exe!goto_level(d_level * newlevel, char at_stairs, char falling, char portal) Line 1316
NetHack.exe!next_level(char at_stairs) Line 1157
NetHack.exe!dodown(...) Line 954
NetHack.exe!rhack(char * cmd) Line 3416
NetHack.exe!moveloop(char resuming) Line 464
NetHack.exe!main(int argc, char * * argv) Line 104

This patch clears the display for the situation in drag_down(),
so the old level is not shown.
2015-12-17 20:27:42 -05:00
PatR
92858c3e3c more menu <space> screwup
Like the just fixed naming for discoveries list, there are several
other add_menu() calls which specify <space> instead of 0 as a useless
selector on separator lines.  These others are all for role selection,
where menus don't get big enough to need next-page.

I don't know what I was thinking at the time, although it must have
seemed like a good idea for some reason....
2015-12-16 18:42:45 -08:00
PatR
d68bb738d2 fix #H4095 - naming discoveries list
The menu for picking an item to name when using the "on discoveries list"
choice for #name or C when that list spanned multiple pages was exiting
for <space> instead of advancing to next page.  Space was being assigned
as the selection letter for class header lines, which made no sense.
2015-12-16 18:16:39 -08:00
nhmall
fa092f5fe9 housekeeping for 3.6.1
Changes to be committed:
	modified:   Files
	modified:   README
	modified:   dat/history
	modified:   doc/Guidebook.mn
	modified:   doc/Guidebook.tex
	modified:   include/global.h
	modified:   include/obj.h
	modified:   include/patchlevel.h
	modified:   src/invent.c
	modified:   src/objnam.c
	modified:   src/shknam.c
	modified:   src/sounds.c
	modified:   src/spell.c
	modified:   sys/winnt/Install.nt
	modified:   sys/winnt/nethack.def
	modified:   win/macosx/NetHackGuidebook.applescript
	modified:   win/macosx/NetHackTerm.applescript
	modified:   win/win32/mswproc.c
2015-12-16 17:52:34 -05:00
Pasi Kallinen
929be769ec Add option to have autodescribe on by default 2015-12-16 21:42:43 +02:00
PatR
af6887796f scrolls written while blind; scrolls of mail
Make a fix suggested during beta testing:  you can read scrolls while
blind if you know the label, and you can write a scroll with a magic
marker while blind, but the result was flagged as description unknown
so you couldn't read the newly written scroll until regaining sight
or obtaining object identification.  So change writing a previously
discovered scroll while blind to set dknown since a successful write
always yields the type of scroll requested.  Getting lucky while
attempting to write an undiscovered scroll--which has to be done by
scroll's type name (for instance "food detection") rather than by its
label ("YUM YUM")--still leaves the description flagged as unknown
since hero hasn't seen the what sort of label the new scroll has.

Along the way I got side-tracked by the possibilty of writing a scroll
of mail.  It's allowed and yielded the same result as finding such a
scroll in bones, or wishing for one:  when read, it was junk mail from
Larn.  Make one written via marker give different feedback since it
comes from creation of a stamped scroll without any stamps available.

Also, suppress an "argument not used" warning for readmail().
2015-12-16 02:23:32 -08:00
PatR
8f96d4b9ef fix bz157, #H4075 - 'realtime' had strange units
A couple of reports asked what weird unit of measure was used for the
'realtime' value in xlogfile.  It was just seconds, but was accumulating
incorrectly whenever game-state got saved for the checkpoint option.
Now it really is seconds, or rather whatever unit you get for the delta
of two time_t values; usually seconds but not guaranteed to be that.
2015-12-15 17:59:42 -08:00
PatR
3ec592e3f1 fix bz60 and bz61 - meta char feedback
60: getpos() doesn't report the offending keystroke accurately when
rejecting M-something as a movement keystroke while moving the cursor;
61: typing M-N as a command keystroke produces
 |Unknown command 'M-
 |                 '.
where the '.' on the second line clobbers the top line of the map.

I can't reproduce the first one without extending the altmeta hack
[a run-time option to treat two char sequence ESC c as M-c] to getpos()
and nh_poskey(), which I've done for testing but am not including here.

I can't reproduce the second as it's described, but M-^J produces
 |Unknown command 'M-
 |'.--More--
and this fixes that, with a general fix that applies to any meta char.

The diffs include some cleanup/groundwork for maybe extending altmeta.
2015-12-15 03:22:39 -08:00
PatR
c843f56897 fix #H4078 - dull spellbook vs sleep resistance
Reading a dull spellbook could make a sleep resistant hero fall asleep.
2015-12-14 13:27:31 -08:00
nhmall
6f6f74e8d2 slightly change quickmimic() sense wording
Changes to be committed:
	modified:   doc/fixes36.1
	modified:   src/dogmove.c

A bug reporter wrote:
> comments:
> "You sense a little dog appear where Poes was!"
>
> seems strange to me, perhaps it should be "appearing", or the hero shouldn't
> notice at all if it's out of sight.
>
> Not sure it was out of sight, anyway, because I saw the d from the shop
> doorway.
>

Change the wording to:
"You sense that a little dog has appeared where Poes was!"
2015-12-13 21:45:08 -05:00
PatR
50065303e1 commit 8a13a4d2044264cf7427ba6a035021949788b5f1
Author: PatR <rankin@nethack.org>
Date:   Sun Dec 13 06:06:58 2015 -0800

    fix #H4066 - bug eating ring of protection

    Intrinsic protection of 0 (usually from having a gremlin steal divine
    protection, but also possible by eating a +0 ring of protection) does
    not contribute to "magic cancellation", the defense attribute that
    makes some special attacks fail.  That's intended.  Negative intrinsic
    protection (not possible from having divine protection, but turns out
    to be possible from eating negatively enchanted/charged rings of
    protection), did contribute.  That wasn't intended, so stop it.
    (Positive intrinsic protection gives a magic cancellation of 1 if worn
    armor doesn't provide any MC.)
2015-12-13 06:15:54 -08:00
PatR
4ad39ba282 fix part of #H4062 - high priest name refusal
High priests used a different message to refuse accepting a user-supplied
    name than regular temple priests because they're flagged as unique.  The
    effect was cosmetic; it didn't reopen the hole that let you recognize
    which high priest was which via the 'C' command on the Astral Plane.

    [I never received the mail for #H4062 but saw it in bugzilla.]
2015-12-12 20:56:46 -08:00
PatR
807afa22b3 fix #H4047 - dipping inconsistency
Dip the scroll labeled LEP GEX VEN ZEA into the fountain?
Your scroll called light fades.

The first prompt deliberately avoided 'called', 'named', and other
attributes to keep it short, but the discrepancy here is blatant, so
increase the verbosity in order to have the reminder that's included
in the prompt be the same as object name in the followup message.

Bonus fix, noticed while testing it:  water_damage() was reporting
the "{blank,unlabeled} scroll fades" even though blank scrolls are
already as faded as they can get.  Likewise for blank spellbook.
2015-12-12 19:41:35 -08:00