From 1a847d031482b751a2b310f4b598d9aac9a1a84c Mon Sep 17 00:00:00 2001 From: copperwater Date: Fri, 27 May 2022 21:23:31 -0400 Subject: [PATCH 1/6] Remove pointless lighting statement in Val-strt The whole level was already lit up, so lighting up a smaller area of it does nothing. --- dat/Val-strt.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/dat/Val-strt.lua b/dat/Val-strt.lua index d5ce45f07..906500fcf 100644 --- a/dat/Val-strt.lua +++ b/dat/Val-strt.lua @@ -51,7 +51,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ]]); -- Dungeon Description des.region(selection.area(00,00,75,19), "lit") -des.region(selection.area(27,08,42,12), "lit") -- Portal arrival point des.levregion({ region = {66,17,66,17}, type="branch" }) -- Stairs From 8e19d6628ab152bfbd8f9d5b606e68e196348d12 Mon Sep 17 00:00:00 2001 From: copperwater Date: Fri, 27 May 2022 21:25:18 -0400 Subject: [PATCH 2/6] Use looted rather than doormask when it pertains to a throne They're both just aliases for rm.flags, but "doormask" doesn't mean anything conceptual for a throne. --- src/dokick.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dokick.c b/src/dokick.c index 3c2a0c348..d6afaff42 100644 --- a/src/dokick.c +++ b/src/dokick.c @@ -1096,9 +1096,9 @@ dokick(void) kick_dumb(x, y); return ECMD_TIME; } - if ((Luck < 0 || g.maploc->doormask) && !rn2(3)) { + if ((Luck < 0 || g.maploc->looted) && !rn2(3)) { + g.maploc->looted = 0; /* don't leave loose ends.. */ g.maploc->typ = ROOM; - g.maploc->doormask = 0; /* don't leave loose ends.. */ (void) mkgold((long) rnd(200), x, y); if (Blind) pline("CRASH! You destroy it."); From 9fa57cede75d1ad52cdcd7b68898621e0b874bdd Mon Sep 17 00:00:00 2001 From: copperwater Date: Fri, 27 May 2022 21:26:58 -0400 Subject: [PATCH 3/6] Fix a stray magic number in pick_lock --- src/lock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lock.c b/src/lock.c index d2d934cb2..d41208450 100644 --- a/src/lock.c +++ b/src/lock.c @@ -600,7 +600,7 @@ pick_lock( autounlock ? yname(pick) : ""); c = ynq(qbuf); if (c != 'y') - return 0; + return PICKLOCK_DID_NOTHING; /* note: for !autounlock, 'apply' already did touch check */ if (autounlock && !touch_artifact(pick, &g.youmonst)) From 5529a9af451c076f8aafc7c364c441c5c75475c6 Mon Sep 17 00:00:00 2001 From: copperwater Date: Fri, 27 May 2022 21:35:05 -0400 Subject: [PATCH 4/6] Correction and clarification for "balk" math comment Andrio pointed out at some point that the "below 25% HP: pet will not attack at all" mentioned in this comment was wrong. It will not attack *peaceful monsters* at all, but will still attack hostile monsters. Also, the math behind the balk variable has confused several people, thinking it's off by one and allowing the pet to attack one level higher than stated. This is not the case, since it's the lowest level they *won't* attack. Clarify that. --- src/dogmove.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/dogmove.c b/src/dogmove.c index 6669f4c72..5a5f5f68a 100644 --- a/src/dogmove.c +++ b/src/dogmove.c @@ -1034,7 +1034,12 @@ dog_move(register struct monst *mtmp, * 60% to 80%: up to level * 40% to 60%: up to level - 1 * 25% to 40%: up to level - 2 - * below 25%: prevented from attacking at all by a different case + * below 25%: won't attack peacefuls of any level (different case) + * below 20%: up to level - 3 + * + * note that balk's maximum value is +3, as it is the lowest level + * the pet will balk at attacking rather than the highest level they + * are willing to attack; note the >= used when comparing it. */ int balk = mtmp->m_lev + ((5 * mtmp->mhp) / mtmp->mhpmax) - 2; From 84f4e53fde5c7f1a4636237f61bc4472e7634cf8 Mon Sep 17 00:00:00 2001 From: copperwater Date: Fri, 27 May 2022 21:42:25 -0400 Subject: [PATCH 5/6] Use RANDOM_CLASS instead of magic number 0 for mksobj_at() --- src/makemon.c | 2 +- src/mklev.c | 6 +++--- src/mkmaze.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/makemon.c b/src/makemon.c index dd6e3b439..b1bb5d90b 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -1273,7 +1273,7 @@ makemon( case S_SNAKE: if (g.in_mklev) if (x && y) - (void) mkobj_at(0, x, y, TRUE); + (void) mkobj_at(RANDOM_CLASS, x, y, TRUE); (void) hideunder(mtmp); break; case S_LIGHT: diff --git a/src/mklev.c b/src/mklev.c index 4a7e35e51..c49479def 100644 --- a/src/mklev.c +++ b/src/mklev.c @@ -635,7 +635,7 @@ makeniche(int trap_type) (void) mksobj_at(SCR_TELEPORTATION, xx, yy + dy, TRUE, FALSE); if (!rn2(3)) - (void) mkobj_at(0, xx, yy + dy, TRUE); + (void) mkobj_at(RANDOM_CLASS, xx, yy + dy, TRUE); } } return; @@ -833,14 +833,14 @@ fill_ordinary_room(struct mkroom *croom) skip_nonrogue: if (!rn2(3) && somexyspace(croom, &pos)) { - (void) mkobj_at(0, pos.x, pos.y, TRUE); + (void) mkobj_at(RANDOM_CLASS, pos.x, pos.y, TRUE); trycnt = 0; while (!rn2(5)) { if (++trycnt > 100) { impossible("trycnt overflow4"); break; } - (void) mkobj_at(0, pos.x, pos.y, TRUE); + (void) mkobj_at(RANDOM_CLASS, pos.x, pos.y, TRUE); } } } diff --git a/src/mkmaze.c b/src/mkmaze.c index bec803d3a..ea1ebdae4 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -1101,7 +1101,7 @@ makemaz(const char *s) for (x = rn1(8, 11); x; x--) { mazexy(&mm); - (void) mkobj_at(rn2(2) ? GEM_CLASS : 0, mm.x, mm.y, TRUE); + (void) mkobj_at(rn2(2) ? GEM_CLASS : RANDOM_CLASS, mm.x, mm.y, TRUE); } for (x = rn1(10, 2); x; x--) { mazexy(&mm); From a1258f898ba8567e77b3ad3ba5ecb04d641d4295 Mon Sep 17 00:00:00 2001 From: copperwater Date: Sat, 28 May 2022 10:42:14 -0400 Subject: [PATCH 6/6] Remove unused "mazeflag" parameter from mkfount() This parameter appears to have been in the code for a very long time, but never used, since no version of NetHack I can find had mazes with randomly placed fountains in them. Certainly isn't used now, so this can be reduced to the same call to find_okay_roompos used by similar functions such as mksink. --- src/mklev.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/mklev.c b/src/mklev.c index c49479def..f3eb47b0f 100644 --- a/src/mklev.c +++ b/src/mklev.c @@ -12,7 +12,7 @@ static boolean generate_stairs_room_good(struct mkroom *, int); static struct mkroom *generate_stairs_find_room(void); static void generate_stairs(void); -static void mkfount(int, struct mkroom *); +static void mkfount(struct mkroom *); static boolean find_okay_roompos(struct mkroom *, coord *); static void mksink(struct mkroom *); static void mkaltar(struct mkroom *); @@ -789,7 +789,7 @@ fill_ordinary_room(struct mkroom *croom) if (Is_rogue_level(&u.uz)) goto skip_nonrogue; if (!rn2(10)) - mkfount(0, croom); + mkfount(croom); if (!rn2(60)) mksink(croom); if (!rn2(60)) @@ -1752,19 +1752,12 @@ generate_stairs(void) } static void -mkfount(int mazeflag, struct mkroom *croom) +mkfount(struct mkroom *croom) { coord m; - register int tryct = 0; - do { - if (++tryct > 200) - return; - if (mazeflag) - mazexy(&m); - else if (!somexy(croom, &m)) - return; - } while (occupied(m.x, m.y) || bydoor(m.x, m.y)); + if (!find_okay_roompos(croom, &m)) + return; /* Put a fountain at m.x, m.y */ if (!set_levltyp(m.x, m.y, FOUNTAIN))