Skip to content

Add paranoid trap, which prevents accidental triggering of harmful traps#259

Closed
copperwater wants to merge 1 commit intoNetHack:NetHack-3.7from
copperwater:paranoid_trap
Closed

Add paranoid trap, which prevents accidental triggering of harmful traps#259
copperwater wants to merge 1 commit intoNetHack:NetHack-3.7from
copperwater:paranoid_trap

Conversation

@copperwater
Copy link
Copy Markdown
Contributor

Primarily, this ports UnNetHack's paranoid_trap to the vanilla 3.6+
paranoid options system via xNetHack. When this option is enabled, the
player must type out "yes" before moving onto a known trap that apparently
poses a danger to them. When not enabled, the game behaves as it did
before, and there is no warning for moving onto traps.

If the hero is hallucinating, there is no way to determine what the trap
actually is, so they will always be prompted to confirm. If the hero is
stunned or confused or has prefixed their movement command with 'm',
they will not be prompted regardless of the trap type (overriding
the hallucination case).

The bulk of the code in this commit is a new function, immune_to_trap,
which is how the game decides whether a given monster or the hero is
safe from a certain type of trap. This helps avoid interface annoyances
in places like levitating over the holes in the Castle (a levitating
hero can never trigger a hole just by moving onto the space, so they're
"immune" to it). The function has three possible results: obviously
immune, obviously not immune, or immune but only by way of items or
intrinsics the hero might not have identified. Only the first case lets
you move onto that trap type freely. Since the game doesn't track your
knowledge of your own intrinsics, this is imperfect; a player with
innate fire resistance (and no other source of it) will still be
prompted before moving onto a fire trap.

I have not currently implemented logic allowing monsters to freely move
onto traps they have seen and are immune to, though this should
theoretically only require changing a couple lines in monmove.c.

Primarily, this ports UnNetHack's paranoid_trap to the vanilla 3.6+
paranoid options system via xNetHack. When this option is enabled, the
player must type out "yes" before moving onto a trap that apparently
poses a danger to them. When not enabled, the game behaves as it did
before, and there is no warning for moving onto traps.

If the hero is hallucinating, there is no way to determine what the trap
actually is, so they will always be prompted to confirm.  If the hero is
stunned or confused or has prefixed their movement command with 'm',
they will not be prompted regardless of the trap type (overriding
the hallucination case).

The bulk of the code in this commit is a new function, immune_to_trap,
which is how the game decides whether a given monster or the hero is
safe from a certain type of trap. This helps avoid interface annoyances
in places like levitating over the holes in the Castle (a levitating
hero can never trigger a hole just by moving onto the space, so they're
"immune" to it). The function has three possible results: obviously
immune, obviously not immune, or immune but only by way of items or
intrinsics the hero might not have identified. Only the first case lets
you move onto that trap type freely. Since the game doesn't track your
knowledge of your own intrinsics, this is imperfect; a player with
innate fire resistance (and no other source of it) will still be
prompted before moving onto a fire trap.

I have not currently implemented logic allowing monsters to freely move
onto traps they have seen and are immune to, though this should
theoretically only require changing a couple lines in monmove.c.
@Planet-Patrick
Copy link
Copy Markdown

If you're hallucinating, shouldn't you step onto the trap if you think it's harmless?

@nhcopier nhcopier deleted the branch NetHack:NetHack-3.7 January 27, 2022 16:20
@nhcopier nhcopier closed this Jan 27, 2022
@nhmall nhmall reopened this Jan 27, 2022
@copperwater
Copy link
Copy Markdown
Contributor Author

If you're hallucinating, the trap will appear as various hallucinatory traps, some of which are quite dangerous! The hero wouldn't see it as harmless.

@Planet-Patrick
Copy link
Copy Markdown

@copperwater But it WOULD see it as harmless for some traps though right?

@copperwater
Copy link
Copy Markdown
Contributor Author

I think it's reasonable to handwave this as when a hallucinating hero sees any trap, they hallucinate it as something that's dangerous to them. I don't see the point in trying to implement "sometimes when hallucinating you should step onto a trap anyway" since that's less fun.

@nhcopier nhcopier closed this in 1a64ee1 Sep 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants