Commit Graph

290 Commits

Author SHA1 Message Date
PatR
6cbd2c5d85 warning fixes
Using 'ladder' as a variable conflicts with 'struct flag flags'
because of a macro in rm.h.  Also remove or hide a couple of
unused variables.

The hack.c diff is unrelated; just a reformatting bit that I had
laying around.
2020-11-13 14:11:54 -08:00
PatR
0e713dc4e9 fix #K2617 - metallivores eating iron bars
Monsters with rust attacks (rust monster) and corrosion attacks
(black pudding, gray ooze) can eat or otherwise destroy iron bars
but xorns could only move through the iron bars spot without being
able to eat the metal there.  Change xorn to eat bars instead of
phazing through them.  Lets rock moles eat bars too.

Hero polymorphed into a rust monster would eat bars if trying to
move to their location but couldn't do so if already there (maybe
was in xorn form and now in rust monster form).  Xorns could pass
through them but not eat them.  Allow hero metallivores to eat
bars at the current location via 'e', similar to eating food off
the floor.  Hero as rock mole behaves like rust monster.
2020-10-23 19:43:10 -07:00
PatR
239620ffd7 fix pull request #386 - monster interaction
The previous teleport scroll fix was mislabeled with this pull
request number.  Too late to fix that now; should have been

Closes #307

Now...  Interaction between voluntarily busy hero (resting,
searching, and so on) with approaching monsters to decide whether
to stop had some inconsistencies.

Really closes #386
2020-09-18 15:53:43 -07:00
nhmall
ac9ba38449 file header bump from "NetHack 3.6" to "NetHack 3.7" 2020-08-03 22:07:36 -04:00
nhmall
e440e9569d change is_safepet macro name
Leaving the word "pet" in the macro name, when it applied to non-pets
seemed too contradictory, even for NetHack.
2020-05-03 21:52:41 -04:00
PatR
7817e69c41 two new monsters from slash'em
Adds two monsters originally from slash'em.  I used the slash'em
tiles this time, also its code as a starting point but made various
revisions.  Both the tiles could benefit from some touch-ups.

displacer beast:  blue 'f'.  Attempting a melee hit (ie, trying to
  move to its spot) has a 50:50 chance for it to swap places with you.
  Fairly tough monster to begin with, then half your ordinary attacks
  effectively miss and if you try to face a mob by retreating to a
  corridor or backing into a corner you can end up being drawn back
  into the open.  I added bargethrough capability, and also it won't
  be fooled about hero's location by Displacement.  [It only swaps
  places during combat when contact is initiated by the hero, not
  when attacked by another monster or when attacking.]

genetic engineer:  green 'Q'.  Its attack causes the target to be
  polymorphed unless that target resists.  Hero will almost always
  have magic resistance by the time this monster is encountered, but
  it can make conflict become risky by hitting and polymorphing other
  monsters.  Slash'em flagged it hell-only but I took that flag off;
  I also took away its ability to teleport.  Slash'em polymorphs the
  hero if a genetic engineer corpse is eaten; that's included and I
  introduced that for monsters too.

I added both of these to the list of candidates for monster spell
'summon nasties' and for post-Wizard harassment.

I also gave all the 'f's infravision.  Probably only matters if the
hero polymorphs into a feline.

Displacer beast is originally from AD&D which depicts it as a six-
legged cougar with a pair of tentacles; it has Displacement rather
be able to affect an attacker's location.  I think genetic engineer
is original to slash'em where it expands Q class but seems mainly to
be the base monster for Dr.Frankenstein (a unique monster with a
one-level side-branch lair in slash'em's incarnation of Gehennom).
2020-05-03 14:13:08 -07:00
PatR
b2b8d508dd comment typo 2020-04-27 11:54:52 -07:00
PatR
54cfb86936 fix pull request #340 - untrap steed sanity
When a failed #untrap attempt while mounted caused hero to be moved
onto the trap, it neglected to set the steed's coordinates to match.
If 'sanity_check' was On, that would trigger warnings about steed's
anomalous position.  Eventually a normal move would put steed's
coordinates back in sync with the hero's.

The pull request code set u.usteed->{mx,my} directly.  I've used
u_on_newpos() instead.  I also replaced some direct manipulations of
u.{ux,uy} with u_on_newpos() so that if clipping is in effect it will
be updated.

Fixes #340
2020-04-27 11:48:55 -07:00
PatR
f8e1f38cb0 swapping places with peaceful monster
When swapping with a peaceful monster rather than a pet, say so.
2020-04-22 02:51:45 -07:00
Pasi Kallinen
02f222bc0c Add vault guards to undisplaceable monsters 2020-04-15 08:59:35 +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
e215f09ddb Fix even more warnings 2020-04-06 13:34:07 +03:00
PatR
c8044a202b 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.
2020-04-04 02:41:13 -07:00
PatR
d58e449d6c 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.
2020-04-03 11:39:40 -07:00
PatR
b37b9f25ce 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.
2020-04-03 10:41:30 -07:00
PatR
a2338e92aa groundwork: u.uinwater manipulation
Toggle u.uinwater on or off in just one place.
2020-04-03 01:04:27 -07:00
PatR
40d19525c3 updating 'time' status
Handling botl updates for 'time' was inconsistent.  Set the flag to
do that when moves is incremented (where the update is suppressed if
running) or when running stops short.

losehp() would cancel running/traveling if called when in normal form
but not if called when polymorphed, so theoretically you could take
damage and keep on running.  I don't have a test case to verify that.
2020-03-16 17:32:12 -07:00
PatR
be50da07d9 botl update for trapped/untrapped
Make set_utrap() set context.botl when changing between untrapped and
trapped or vice versa.
2020-02-27 02:26:57 -08:00
PatR
3981e3e6e5 controlling u.ustuck
Setting or clearing u.ustuck now requires that context.botl be set,
so make a new routine to take care of both instead of manipulating
that pointer directly.
2020-02-16 13:04:12 -08:00
PatR
2d150d323b new status conditions
Several conditions result in stale data on the status line when
starting or stopping because things which didn't used to affect it
haven't been setting context.botl to force an update.  This wasn't
systematic; there are bound to be lots more.
2020-02-15 15:41:24 -08:00
PatR
804499d9be add some new, easier achievements
Introduce eight achievements that can be attained by more players.
 Entered Gnomish Mines  - self explanatory
 Entered Mine Town      - the town portion, not just the level
 Entered a shop         - any tended shop on any level
 Entered a temple       - likewise for temple
 Consulted the Oracle   - bought at least one major or minor oracle
 Read a Discworld Novel - read at least one passage
 Entered Sokoban        - like mines
 Entered the Big Room   - not always possible since not always present

The novel and bigroom ones aren't always achieveable since novels are
only guaranteed if a book or scroll shop gets created and bigroom is
only guaranteed in wizard mode.  No one ever claimed that every
possible achievement can be attained in a single game.  (If one for
entering the Fort Ludios level--or perhaps entering the Fort itself--
eventually gets add, that won't be possible in every game either.)

The mine town one probably needs some tweaking.  Two of the town's
seven variants have no town boundary (despite a rectangular area of
pre-defined map) and at present simply arriving on either of those
levels is enough to be credited with the entered-town achievement.

Bump EDITLEVEL because u.uachieved[] has increased in size.  This
time it has been expanded to the maximum that xlogfile's bitmask of
achievements can handle, enough for up to 9 more achievements without
another EDITLEVEL increment.
2020-02-12 14:35:37 -08:00
PatR
d19cab4d98 implicit_uncursed, mention_walls
Move 'implicit_uncursed' and 'mention_walls' from iflags to flags to
make their current setting persist across save/restore.  Invalidates
existing save files.
2020-01-17 04:03:14 -08:00
PatR
1a89e44e19 fix #K188 - trying to move past edge of level
Trying to move into a wall or solid rock fails and doesn't do anything
(unless the 'mention_walls' option is On) and doesn't use a turn, and
trying to move off the edge of the map window also doesn't do anything
(except for 'mention_walls') but that did use a turn.  Don't.
2020-01-17 02:43:32 -08:00
PatR
c2060f9e8c more giant walking onto boulder feedback
autopick_testobj() needs to bypassed during move-without-pickup as
well as when autopicked is disabled.  I hope this is finally right.
2020-01-13 03:46:51 -08:00
PatR
92970bfffc spell maneuver correctly 2020-01-12 09:19:17 -08:00
PatR
07a2c1c813 fix github issue #279 - boulder feedback
Polymophed into a giant and moving onto a boulder's location could
yield "you easily pick it up" (without actually doing so) followed
by "you see a boulder here".  It would happen if autopickup was Off,
or if the 'm' move-without-autopickup prefix was used, while either
boulder was included in pickup_types (including when that is set
for 'all') or hero had thrown that particular boulder and
pickup_thrown was On.  The check for whether auto-pick should try
on an object relied on its caller verifying that autopickup was On.
pickup() does that for
 pickup() -> autopick() -> autopick_testobj()
but moverock() wasn't doing that for
 moverock() -> autopick_testobj()
so the logic controlling moverock's message was subverted.

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

Fixes #279
2020-01-12 05:05:24 -08:00
PatR
e27b6af856 fix github issue #277 - repeat door open failure
The change to make "ouch! you bump into a door" use up a turn didn't
end running, so when it happened while running useless turns took
place and that message was delivered repeatedly until some other
action interrupted the hero.  It didn't matter whether autoopen is
enabled.

Fixes #277
2020-01-10 13:13:36 -08:00
PatR
df50d4cf17 fix #K112 - fumbling vs autoopen
Report complained that having autoopen not work when fumbling was
inconvenient and mentioned that the "ouch! you bump into a door"
result didn't take any time.  This updates the documentation to
state that autoopen won't work while fumbling (so the inconvenient
behavior persists) but changes movement so that bumping into a door
now takes time.  (Despite "ouch!", it doesn't inflict any damage.)

Also, document the recently added autounlock option.
2020-01-07 17:57:38 -08:00
Patric Mueller
2ae7cf02ea Replace "money" in in-game texts with "gold"
When GOLDOBJ was activated unconditionally, several texts started referencing
"money" instead of "gold".

As we don't have the intention to introduce a complex coin system with
different denominations, change it back and also some other places that
reference "money".
2020-01-01 10:59:24 +01:00
copperwater
277dcc05b5 Port the autounlock feature, hallucinatory trap names from UnNetHack
This adds a boolean option, autounlock, defaulting to true. When this is
set to TRUE, messages stating that some door or container is locked are
automatically followed by a prompt asking if you would like to unlock
it, if you are carrying an unlocking tool (key, lock pick, or credit
card).

Architecturally, this extends the pick_lock function to take three
additional arguments (door coordinates or a box on the ground you are
autounlocking).

The code that selects an unlocking tool will always look first for a
skeleton key, then a lock pick, then a credit card. Since curses, rust,
and other attributes don't really have an effect on the viability of the
unlocking device, it didn't seem to warrant making a more complex
function for that.

Add hallucinatory trap names

This adds many funny, realistic, and nonsensical traps to the game, to
be shown when the player is hallucinating.

Architecturally, the biggest change is merging the what_trap macro and
the "defsyms[trap_to_defsym(ttyp)].explanation" pattern into a single
function "trapname", which returns the name of the trap, handling the
hallucination case. There is also a second parameter used for overriding
hallucination in the occasional cases where the actual trap name should
always be returned.

In addition, the what_trap and random_trap macros are now obsolete and
not used anywhere, so they are removed.

reinstate anti-rng abuse bit on hallucination

updates to hallucinatory trap names and fixes37.0 entry
2019-12-19 18:52:23 -05:00
nhmall
98976b3141 Merge branch 'NetHack-3.6' 2019-12-18 07:38:59 -05:00
PatR
8349d95992 ceiling hiders vs '>'
Poly'd hero hiding on the ceiling was told "you can't go down here"
if using '>' at a spot that didn't have down stairs, trap door, hole,
or pit.  Let '>' bring a ceiling hider out of hiding; lurker above
resumes flying, piercer falls to floor or whatever is underneath it.
2019-12-17 19:08:26 -08:00
nhmall
f48ac58561 Merge branch 'NetHack-3.6' 2019-12-13 17:37:46 -05:00
PatR
8a57029503 spelling and typo fixes
Submitted for 3.7.0; all but one also apply to 3.6.3.

I rewrote the curses terminal-too-small message instead of just
fixing the spelling of "minumum".
2019-12-11 12:35:45 -08:00
nhmall
8cd73c8cc9 Merge branch 'NetHack-3.6' 2019-11-29 16:57:23 -05:00
nhmall
fd7d0f5d52 more things considered when you're on the brink 2019-11-29 11:14:55 -05:00
nhmall
a7e3129919 Merge branch 'NetHack-3.6' 2019-11-05 11:02:24 -05:00
nhmall
26121fca9a deafness left "Perhaps that why you cannot move it" message orphaned 2019-11-04 23:08:15 -05:00
nhmall
e5fc5efd21 Merge branch 'NetHack-3.6' 2019-09-17 08:25:45 -04:00
PatR
5589a16d74 github pull request - "You are <a foo>[.]"
Fixes #215

A post-3.6.2 change added a message for life-saving which lack its end
of sentence punctuation.
2019-09-14 18:00:39 -07:00
nhmall
c425c37097 Merge branch 'NetHack-3.6' 2019-08-13 16:32:53 -04:00
PatR
a2a257a512 fix github issue #211 - wrong parentheses
Fixes #211

dopickup() was getting the wrong value from pickup_checks() due
to misplaced closing parenthesis.  But it didn't actually impact
play; picking things up from engulfer's minvent while swallowed
worked even though the special check for that was failing.  The
code which was accidentally being skipped can probably go away but
I haven't gone that far.
2019-08-08 11:25:36 -07:00
nhmall
0d34f43830 remove STATIC_DCL, STATIC_OVL, STATIC_VAR, STATIC_PTR from core 2019-07-14 17:24:58 -04:00
nhmall
77fd719e05 Merge branch 'NetHack-3.6' 2019-07-13 00:38:10 -04:00
nhmall
638d9f9363 if prototype is declared static make function static to match
Today, a compiler was encountered that considered it an error
to have the prototype declared static and the function body
not
2019-07-13 00:17:23 -04:00
nhmall
bfc4445537 Merge branch 'NetHack-3.6' 2019-06-05 08:08:32 -04:00