diff --git a/doc/Guidebook.mn b/doc/Guidebook.mn index ad1accbe2..84e8e8a07 100644 --- a/doc/Guidebook.mn +++ b/doc/Guidebook.mn @@ -1,4 +1,4 @@ -.\" $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.385 $ $NHDT-Date: 1593731697 2020/07/02 23:14:57 $ +.\" $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.386 $ $NHDT-Date: 1593768045 2020/07/03 09:20:45 $ .\" .\" This is an excerpt from the 'roff' man page from the 'groff' package. .\" Guidebook.mn currently does *not* fully adhere to these guidelines. @@ -1757,13 +1757,34 @@ discover it with the \(oqs\(cq (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 \(lqSokoban.\(rq -The goal is to push the boulders into the pits or holes. +There is a special pre-mapped multi-level branch of the dungeon based +on the classic computer game \(lqSokoban,\(rq 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. -Some allowances are permitted in case the player gets stuck; -however, they will lower your luck. +(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 \fIundo\fP 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 Stairs and ladders (\(oq<\(cq, \(oq>\(cq) .pg @@ -2845,7 +2866,7 @@ In NetHack, a pacifist refuses to cause the death of any other monster difficult challenge, although it is still possible to gain experience by other means. .pg -An illiterate character cannot read or write. +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 \(lqX\(rq @@ -2858,6 +2879,32 @@ 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 \(lqSokoban,\(rq briefly +described in the earlier section about \fITraps\fP. +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 the way and be +able to go past the traps. +There are some special \(lqrules\(rq 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 \fISokoban\fP 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 \(lqobeyed the Sokoban rules\(rq conduct is most +meaningful if you also manage to perform +the \(lqobtained the Sokoban prize\(rq achievement +(see \fIAchievements\fP 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 diff --git a/doc/Guidebook.tex b/doc/Guidebook.tex index 7483f52d6..64a7246b7 100644 --- a/doc/Guidebook.tex +++ b/doc/Guidebook.tex @@ -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 diff --git a/doc/fixes37.0 b/doc/fixes37.0 index e31e002d4..84d3e4eeb 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.237 $ $NHDT-Date: 1593651682 2020/07/02 01:01:22 $ +$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.239 $ $NHDT-Date: 1593768043 2020/07/03 09:20:43 $ General Fixes and Modified Features ----------------------------------- @@ -385,6 +385,9 @@ boolean options can optionally have the form "name:value" with value taken from among "true", "yes", "on", or "false", "no", "off" record number of wishes and artifact wishes in xlogfile give feedback for '#chat' directed at walls +add 'Sokoban' conduct, tracking the number of times the special Sokoban rules + which incur luck penalties have been violated; don't report it + unless/until Sokoban branch has been entered Platform- and/or Interface-Specific New Features diff --git a/include/patchlevel.h b/include/patchlevel.h index 24b92cf36..b22e99524 100644 --- a/include/patchlevel.h +++ b/include/patchlevel.h @@ -1,4 +1,4 @@ -/* NetHack 3.7 patchlevel.h $NHDT-Date: 1581322658 2020/02/10 08:17:38 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.156 $ */ +/* NetHack 3.7 patchlevel.h $NHDT-Date: 1593768081 2020/07/03 09:21:21 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.165 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -14,7 +14,7 @@ * Incrementing EDITLEVEL can be used to force invalidation of old bones * and save files. */ -#define EDITLEVEL 20 +#define EDITLEVEL 21 #define COPYRIGHT_BANNER_A "NetHack, Copyright 1985-2020" #define COPYRIGHT_BANNER_B \ diff --git a/include/you.h b/include/you.h index 437500d9c..da85c9c21 100644 --- a/include/you.h +++ b/include/you.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 you.h $NHDT-Date: 1586375530 2020/04/08 19:52:10 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.44 $ */ +/* NetHack 3.6 you.h $NHDT-Date: 1593768079 2020/07/03 09:21:19 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.46 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2016. */ /* NetHack may be freely redistributed. See license for details. */ @@ -150,6 +150,7 @@ struct u_conduct { /* number of times... */ long polyselfs; /* transformed yourself */ long wishes; /* used a wish */ long wisharti; /* wished for an artifact */ + long sokocheat; /* violated special 'rules' in Sokoban */ /* genocides already listed at end of game */ }; diff --git a/src/insight.c b/src/insight.c index 6e300241b..41ba4a254 100644 --- a/src/insight.c +++ b/src/insight.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 insight.c $NHDT-Date: 1586375531 2020/04/08 19:52:11 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.14 $ */ +/* NetHack 3.7 insight.c $NHDT-Date: 1593768047 2020/07/03 09:20:47 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.17 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1769,7 +1769,7 @@ show_conduct(final) int final; { char buf[BUFSZ]; - int ngenocided; + int ngenocided, soko_ach; /* Create the conduct window */ g.en_win = create_nhwindow(NHW_MENU); @@ -1866,6 +1866,38 @@ int final; " for any artifacts", ""); } + /* only report Sokoban conduct if the Sokoban branch has been entered; + to find out whether that's the case, it's simpler to check the + recorded achievements than the convoluted dungeon data structure */ + for (soko_ach = 0; u.uachieved[soko_ach]; ++soko_ach) + if (u.uachieved[soko_ach] == ACH_SOKO) /* "entered Sokoban" */ + break; + if (u.uachieved[soko_ach]) { + const char *presentverb = "have violated", *pastverb = "violated"; + + Strcpy(buf, " the special Sokoban rules "); + switch (u.uconduct.sokocheat) { + case 0L: + presentverb = "have not violated"; + pastverb = "did not violate"; + Strcpy(buf, " any of the special Sokoban rules"); + break; + case 1L: + Strcat(buf, "once"); + break; + case 2L: + Strcat(buf, "twice"); + break; + case 3L: + Strcat(buf, "thrice"); + break; + default: + Sprintf(eos(buf), "%ld times", u.uconduct.sokocheat); + break; + } + enl_msg(You_, presentverb, pastverb, buf, ""); + } + show_achievements(final); /* Pop up the window and wait for a key */ diff --git a/src/trap.c b/src/trap.c index b94f2c7cd..72fd27d59 100644 --- a/src/trap.c +++ b/src/trap.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 trap.c $NHDT-Date: 1586382778 2020/04/08 21:52:58 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.358 $ */ +/* NetHack 3.6 trap.c $NHDT-Date: 1593768051 2020/07/03 09:20:51 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.361 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -5456,13 +5456,18 @@ void sokoban_guilt() { if (Sokoban) { + u.uconduct.sokocheat++; change_luck(-1); - /* TODO: issue some feedback so that player can learn that whatever - he/she just did is a naughty thing to do in sokoban and should - probably be avoided in future.... - Caveat: doing this might introduce message sequencing issues, - depending upon feedback during the various actions which trigger - Sokoban luck penalties. */ + /* + * TODO: + * Issue some feedback so that player can learn that whatever + * he/she just did is a naughty thing to do in sokoban and + * should probably be avoided in future.... + * + * Caveat: doing this might introduce message sequencing + * issues, depending upon feedback during the various actions + * which trigger Sokoban luck penalties. + */ } }