From: PatR Date: Wed, 12 Oct 2022 20:47:12 +0000 (-0700) Subject: monk strength X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c2894a422b217d3fb8dd676f03ce2a35a3488e48;p=nethack monk strength Add a stack of 2 tins of spinach near the leader on the monk quest start level and another stack of 2 blessed tins of spinach at a random spot on the monk quest locate level, to compensate for the inability to gain strength from giant corpses if they adhere to vegan or vegetarian conduct. paxed supplied the 'tinplace' magic. 4 tins of spinach aren't nearly enough to get to 18/100, but by uncursing the first pair, if necessary, and waiting until strength is at least 18, they can be eaten to add 4..40 (average 22) points of exceptional strength. (Players choosing either of those conducts for other roles or foodless for any role are on their own as far as boosting Str goes, same as before.) The special level loader needed to be modified to handle tins of spinach. It now accepts "spinach" as a fake monster type for an object of type "tin". Also added support for empty tins since it involved the same code, and use of fake monster type "empty" with object type "egg" to be able to create generic (unhatchable) eggs. (Wishing for "egg" produces those by default but it also accepts explicit "empty egg" by coincidence.) --- diff --git a/dat/Mon-loca.lua b/dat/Mon-loca.lua index 75ea76ec9..598b364eb 100644 --- a/dat/Mon-loca.lua +++ b/dat/Mon-loca.lua @@ -57,6 +57,14 @@ des.object() des.object() des.object() des.object() +-- since vegetarian monks shouldn't eat giant corpses, give a chance for +-- Str boost that isn't throttled by exercise restrictions; +-- make a modest effort (Elbereth only) to prevent xorns from eating the tins +local tinplace = selection.negate():filter_mapchar('.') +local tinloc = tinplace:rndcoord(0) +des.object({ id="tin", coord=tinloc, quantity=2, buc="blessed", + montype="spinach" }) +des.engraving({ coord=tinloc, type="burn", text="Elbereth" }) -- Random traps des.trap() des.trap() diff --git a/dat/Mon-strt.lua b/dat/Mon-strt.lua index 287e19887..ffbfec4e2 100644 --- a/dat/Mon-strt.lua +++ b/dat/Mon-strt.lua @@ -101,3 +101,6 @@ end for i = 1, 4 do des.monster("xorn", spacelocs:rndcoord(1)) end +-- next to leader, so possibly tricky to pick up if not ready for quest yet; +-- there's no protection against a xorn eating these tins; BUC state is random +des.object({ id="tin", coord = {29, 9}, quantity=2, montype="spinach" }) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 6f437f347..bea0aa0bc 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1856,6 +1856,7 @@ rudimentary key rebinding in game options experimental #saveoptions command to allow saving configuration settings mouse buttons can be bound to extended commands hero poly'd into purple worm can gain intrinsics from digesting whole monster +add some tins of spinach to monk's quest (vegan => no Str from giant corpses) Platform- and/or Interface-Specific New Features diff --git a/src/sp_lev.c b/src/sp_lev.c index 73411d4fc..191a50c99 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -3551,12 +3551,22 @@ lspo_object(lua_State *L) || tmpobj.id == CORPSE || tmpobj.id == TIN || tmpobj.id == FIGURINE) { struct permonst *pm = NULL; + boolean nonpmobj = FALSE; int i; char *montype = get_table_str_opt(L, "montype", NULL); if (montype) { - if (strlen(montype) == 1 - && def_char_to_monclass(*montype) != MAXMCLASSES) { + if ((tmpobj.id == TIN && (!strcmpi(montype, "spinach") + /* id="tin",montype="empty" produces an empty tin */ + || !strcmpi(montype, "empty"))) + /* id="egg",montype="empty" produces a generic, unhatchable + egg rather than an "empty egg" */ + || (tmpobj.id == EGG && !strcmpi(montype, "empty"))) { + tmpobj.corpsenm = NON_PM; + tmpobj.spe = !strcmpi(montype, "spinach") ? 1 : 0; + nonpmobj = TRUE; + } else if (strlen(montype) == 1 + && def_char_to_monclass(*montype) != MAXMCLASSES) { pm = mkclass(def_char_to_monclass(*montype), G_NOGEN | G_IGNORE); } else { @@ -3573,7 +3583,7 @@ lspo_object(lua_State *L) free((genericptr_t) montype); if (pm) tmpobj.corpsenm = monsndx(pm); - else + else if (!nonpmobj) nhl_error(L, "Unknown montype"); } if (tmpobj.id == STATUE || tmpobj.id == CORPSE) { @@ -3588,7 +3598,7 @@ lspo_object(lua_State *L) tmpobj.spe = lflags; } else if (tmpobj.id == EGG) { tmpobj.spe = get_table_boolean_opt(L, "laid_by_you", 0) ? 1 : 0; - } else { + } else if (!nonpmobj) { /* tmpobj.spe is already set for nonpmobj */ tmpobj.spe = 0; } }