From 81d755a9e049270568e97f835dc77500ffad3426 Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 28 Mar 2019 08:40:40 -0700 Subject: [PATCH] fix githib issue #179 - random drawbridge state Fixes #179 The Valkyrie goal level has two drawbridges and one of them was set to have 50:50 chance to be closed (raised). But 'random' for drawbridge open/closed (or lowered/raised) state was always choosing open (lowered). This fixes that and also changes that level to have the old settings (southern open, northern 50:50) for 75% of the time and new settings (both 50:50) for 25% of the time. So there's now a 12.5% chance that both will be closed instead of both always being open (due to the bug with handling random). --- dat/Valkyrie.des | 10 +++++++--- doc/fixes36.2 | 5 ++++- src/sp_lev.c | 7 +++++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/dat/Valkyrie.des b/dat/Valkyrie.des index 21541ab0a..ebae19526 100644 --- a/dat/Valkyrie.des +++ b/dat/Valkyrie.des @@ -1,4 +1,4 @@ -# NetHack 3.6 Valkyrie.des $NHDT-Date: 1432512783 2015/05/25 00:13:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.13 $ +# NetHack 3.6 Valkyrie.des $NHDT-Date: 1553787633 2019/03/28 15:40:33 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.14 $ # Copyright (c) 1989 by Jean-Christophe Collet # Copyright (c) 1991-2 by M. Stephenson # NetHack may be freely redistributed. See license for details. @@ -216,9 +216,13 @@ REGION:(00,00,34,16),lit,"ordinary" STAIR:(45,10),up # Non diggable walls NON_DIGGABLE:(00,00,34,16) -# Drawbridges +# Drawbridges; northern one opens to the south, southern one to the north DRAWBRIDGE:(17,02),south,random -DRAWBRIDGE:(17,14),north,open +IF [75%] { + DRAWBRIDGE:(17,14),north,open +} ELSE { + DRAWBRIDGE:(17,14),north,random +} # Objects OBJECT:('(',"crystal ball"),(17,08),blessed,5,name:"The Orb of Fate" OBJECT:random,random diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 9439ab4d3..66de6f54d 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.285 $ $NHDT-Date: 1553653612 2019/03/27 02:26:52 $ +$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.286 $ $NHDT-Date: 1553787633 2019/03/28 15:40:33 $ This fixes36.2 file is here to capture information about updates in the 3.6.x lineage following the release of 3.6.1 in April 2018. Please note, however, @@ -398,6 +398,9 @@ avoid spurious status refresh when hero gains experience while 'showexp' and 'showscore' options are off using Cleaver to attack a worm tail segment but kill adjacent head first would result in an impossible warning from cutworm +Valkyrie quest was supposed to have a 50:50 chance that northern drawbridge + would be raised, but both were always lowered; chances now are: both + lowered: 3/8, S down+N up: 3/8, N down+S up: 1/8, both raised: 1/8 Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/sp_lev.c b/src/sp_lev.c index ded755317..cd952108c 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 sp_lev.c $NHDT-Date: 1550524566 2019/02/18 21:16:06 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.110 $ */ +/* NetHack 3.6 sp_lev.c $NHDT-Date: 1553787633 2019/03/28 15:40:33 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.111 $ */ /* Copyright (c) 1989 by Jean-Christophe Collet */ /* NetHack may be freely redistributed. See license for details. */ @@ -4711,13 +4711,16 @@ struct sp_coder *coder; { static const char nhFunc[] = "spo_drawbridge"; xchar x, y; + int dopen; struct opvar *dir, *db_open, *dcoord; if (!OV_pop_i(dir) || !OV_pop_i(db_open) || !OV_pop_c(dcoord)) return; get_location_coord(&x, &y, DRY | WET | HOT, coder->croom, OV_i(dcoord)); - if (!create_drawbridge(x, y, OV_i(dir), OV_i(db_open))) + if ((dopen = OV_i(db_open)) == -1) + dopen = !rn2(2); + if (!create_drawbridge(x, y, OV_i(dir), dopen ? TRUE : FALSE)) impossible("Cannot create drawbridge."); SpLev_Map[x][y] = 1;