fix github pull request #355 - Sokoban cheating

Track sokoban cheating (taking actions that incur a luck penalty).
The pull request only reported the number of times (possibly zero)
that the player broke nethack's sokoban rules when reporting the
"you obtained the Sokoban prize" achievement, which is when the
count is most meaningful, but this implements it as a full-fledged
conduct instead.  This way the #conduct command can be used after
"creative nethacking" to check immediately whether an action has
violated the Sokoban rules so a player willing to put in a bit of
effort can eventually learn which actions have a negative impact.

The new conduct is only shown during games where the character has
entered the Sokoban branch, but once that has happened it gets shown
no matter the location at the time of #conduct or end of game.

Most of this wasn't in the pull request:  expanding the Guidebook to
give more information about sokoban and its conduct.

Bump EDITLEVEL to invalidate to-be-3.7 save files because u.uconduct
has been extended.

Fixes #355
This commit is contained in:
PatR
2020-07-03 02:21:30 -07:00
parent 26dcf68df8
commit 8801ec34eb
7 changed files with 164 additions and 27 deletions

View File

@@ -1898,12 +1898,34 @@ discover it with the `{\tt s}' (search) command. Monsters can fall prey to
traps, too, which can be a very useful defensive strategy.
%.pg
There is a special pre-mapped branch of the dungeon based on the
classic computer game ``{\tt Sokoban}.'' The goal is to push the boulders
into the pits or holes. With careful foresight, it is possible to
complete all of the levels according to the traditional rules of
Sokoban. Some allowances are permitted in case the player gets stuck;
however, they will lower your luck.
There is a special pre-mapped multi-level branch of the dungeon based
on the classic computer game ``{\tt Sokoban},'' a puzzle solving game.
In that game, you operate as a warehouse worker who pushes crates around
obstacles to position them at designated locations.
In NetHack, the goal is to push boulders into pits or holes until those
traps have all been nullified, giving access to whatever is beyond them.
In the Sokoban game, you can only move in the four cardinal compass
directions, and a crate in its final destination blocks further access
to that spot.
In the Sokoban levels of NetHack, you can move diagonally (unless that
would let you pass between two neighboring boulders) but you can only
push boulders in the four cardinal directions, and a boulder which fills
a pit or hole removes both the boulder and the trap so opens up normal
access to that spot.
With careful foresight, it is possible to complete all of the levels
according to the traditional rules of Sokoban.
(Hint: to solve Sokoban puzzles, you often need to move things away from
their eventual destinations in order to open up more room to maneuver.)
Since NetHack does not support an {\it undo\/} capability, some allowances
are permitted in case you get stuck.
For example, you may drop everything in order to be able to squeeze
into the same location as a boulder (and then presumably move past it),
or may destroy a boulder with magic or tools, or may create new boulders
with a scroll of earth.
However, doing such things will lower your luck without any specific
message given about that.
See the Conduct section for information about getting feedback for your
actions in Sokoban.
%.hn 2
\subsection*{Stairs and ladders (`{\tt <}', `{\tt >}')}
@@ -3076,7 +3098,7 @@ difficult challenge, although it is still possible to gain experience
by other means.
%.pg
An illiterate character cannot read or write. This includes reading
An illiterate character does not read or write. This includes reading
a scroll, spellbook, fortune cookie message, or t-shirt; writing a
scroll; or making an engraving of anything other than a single ``X'' (the
traditional signature of an illiterate person). Reading an engraving,
@@ -3086,6 +3108,33 @@ knowledge of spells) in your starting inventory is assumed to be
learned from your teachers prior to the start of the game and isn't
counted.
%.pg
There is a side-branch to the main dungeon called ``Sokoban,'' briefly
described in the earlier section about {\it Traps}.
As mentioned there, the goal is to push boulders into pits and/or holes
to plug those in order to both get the boulders out of your way and be
able to go past the traps.
There are some special ``rules'' that are active when in that branch
of the dungeon.
Some rules can't be bypassed, such as being unable to push a boulder
diagonally.
Others rules can, such as not smashing boulders with magic or tools,
but doing so causes you to receive a luck penalty.
No message about that is given at the time, but it is tracked as a conduct.
The #conduct command and/or end of game disclosure will report whether
you have abided by the special rules of Sokoban, and if not, how many
times you violated them, providing you with a way to discover which
actions incur bad luck so that you can be better informed about whether
or not to avoid repeating those actions in the future.
(Note: the {\it Sokoban\/} conduct will only be displayed if you have
entered the Sokoban branch of the dungeon during the current game.
Once that has happened, it becomes part of disclosed conduct even if
you haven't done anything interesting there.
Ending the game with ``obeyed the Sokoban rules'' conduct is most
meaningful if you also manage to perform
the ``obtained the Sokoban prize'' achievement
(see {\it Achievements\/} below).)
%.pg
There are several other challenges tracked by the game. It is possible
to eliminate one or more species of monsters by genocide; playing without