From a18ae517f876da53d82a6b7c31991f9ae66d456d Mon Sep 17 00:00:00 2001 From: nhmall Date: Fri, 21 Sep 2018 11:31:01 -0400 Subject: [PATCH] some orctown follow-up bits, fix Bad fruit #0 and some minor tuning --- dat/data.base | 30 ++++++++++++++++++++ doc/fixes36.2 | 2 +- include/extern.h | 3 +- include/hack.h | 3 +- src/dog.c | 2 +- src/dokick.c | 16 ++++++----- src/makemon.c | 2 +- src/mkmaze.c | 73 +++++++++++++++++++++++++++++++++++++----------- src/objnam.c | 7 +++++ 9 files changed, 109 insertions(+), 29 deletions(-) diff --git a/dat/data.base b/dat/data.base index f10a9e581..ebb781af7 100644 --- a/dat/data.base +++ b/dat/data.base @@ -4089,6 +4089,13 @@ acolyte there may well be wonderful universes above us where reason is utterly unreasonable?" [ The Innocence of Father Brown, by G.K. Chesterton ] +paddle cactus + Opuntia, commonly called prickly pear, is a genus in the cactus + family, Cactaceae. Prickly pears are also known as tuna (fruit), + sabra, nopal (paddle, plural nopales) from the Nahuatl word + nopalli for the pads, or nostle, from the Nahuatl word nochtli + for the fruit; or paddle cactus. + [ Wikipedia, the free encyclopedia ] prisoner Where am I? In the Village. @@ -4355,6 +4362,29 @@ rogue conceal it; and therein am I constant to my profession. [ Autolycus the Rogue, from The Winter's Tale by William Shakespeare ] +root +dwarven root + But when they were cooked these roots proved good to eat, + somewhat like bread; and the outlaws were glad of them, for + they had long lacked bread save when they could steal it. + "Wild Elves know them not; Grey-elves have not found them; + the proud ones from over the Sea are too proud to delve," + said Mim. + + "What is their name?" said Turin. Mim looked at him sidelong. + "They have no name, save in the Dwarf-tongue, which we do not + teach," he said. "And we not teach Men to find them, for Men + are greedy and thriftless, and would not spare till all the + plants had perished; whereas now they pass them by as they go + blundering in the wild. No more will you learn of me; but you + may have enough of my bounty, as long as you speak fair and + do not spy or steal." Then again he laughed in his throat. + + "They are of great worth." he said. "More than gold in the + hungry winter, for they may be hoarded like the nuts of a + squirrel, and already we were building our store from the + first that are ripe." + [ Unfinished Tales, Part 1, by J.R.R. Tolkien ] roshi Roshi is a Japanese word, common in Zen Buddhism, meaning "old" (ro) and "teacher" (shi). Roshi can be used as a term of diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 3014b1d10..ca1054a86 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -140,7 +140,7 @@ tty: turn off an optimization that is the suspected cause of Windows reported partial status lines following level changes tty: ensure that current status fields are always copied to prior status values so that comparisons are correct - +orctown: prevent Bad fruit #0 and some minor tuning Platform- and/or Interface-Specific Fixes ----------------------------------------- diff --git a/include/extern.h b/include/extern.h index ed186e667..7e1fb1270 100644 --- a/include/extern.h +++ b/include/extern.h @@ -521,7 +521,7 @@ E void FDECL(container_impact_dmg, (struct obj *, XCHAR_P, XCHAR_P)); E int NDECL(dokick); E boolean FDECL(ship_object, (struct obj *, XCHAR_P, XCHAR_P, BOOLEAN_P)); E void FDECL(obj_delivery, (BOOLEAN_P)); -E void FDECL(deliver_obj_to_mon, (struct monst *mtmp, unsigned long)); +E void FDECL(deliver_obj_to_mon, (struct monst *mtmp, int, unsigned long)); E schar FDECL(down_gate, (XCHAR_P, XCHAR_P)); E void FDECL(impact_drop, (struct obj *, XCHAR_P, XCHAR_P, XCHAR_P)); @@ -1703,6 +1703,7 @@ E const char *FDECL(helm_simple_name, (struct obj *)); E const char *FDECL(mimic_obj_name, (struct monst *)); E char *FDECL(safe_qbuf, (char *, const char *, const char *, struct obj *, char *(*)(OBJ_P), char *(*)(OBJ_P), const char *)); +E int FDECL(shiny_obj, (CHAR_P)); /* ### options.c ### */ diff --git a/include/hack.h b/include/hack.h index f65d2ddd1..555a08818 100644 --- a/include/hack.h +++ b/include/hack.h @@ -272,8 +272,7 @@ typedef struct sortloot_item Loot; /* flags for deliver_obj_to_mon */ #define DF_NONE 0x00 -#define DF_RANDOM2 0x01 -#define DF_RANDOM3 0x02 +#define DF_RANDOM 0x01 #define DF_ALL 0x04 /* special mhpmax value when loading bones monster to flag as extinct or diff --git a/src/dog.c b/src/dog.c index 46cd832ef..1dc4018b9 100644 --- a/src/dog.c +++ b/src/dog.c @@ -410,7 +410,7 @@ boolean with_you; if ((mtmp->mspare1 & MIGR_LEFTOVERS) != 0L) { /* Pick up the rest of the MIGR_TO_SPECIES objects */ if (migrating_objs) - deliver_obj_to_mon(mtmp, DF_ALL); + deliver_obj_to_mon(mtmp, 0, DF_ALL); } if (xlocale && wander) { diff --git a/src/dokick.c b/src/dokick.c index b2d36de70..4a4ac6b93 100644 --- a/src/dokick.c +++ b/src/dokick.c @@ -1671,20 +1671,22 @@ boolean near_hero; } void -deliver_obj_to_mon(mtmp, deliverflags) +deliver_obj_to_mon(mtmp, cnt, deliverflags) +int cnt; struct monst *mtmp; unsigned long deliverflags; { struct obj *otmp, *otmp2; - int where, cnt = 0, maxobj = 0; + int where, maxobj = 1; - if (deliverflags & DF_RANDOM3) - maxobj = rn2(3) + 1; - else if (deliverflags & DF_RANDOM2) - maxobj = rn2(2) + 1; - else if (deliverflags == DF_NONE) + if ((deliverflags & DF_RANDOM) && cnt > 1) + maxobj = rnd(cnt); + else if (deliverflags & DF_ALL) + maxobj = 0; + else maxobj = 1; + cnt = 0; for (otmp = migrating_objs; otmp; otmp = otmp2) { otmp2 = otmp->nobj; where = (int) (otmp->owornmask & 0x7fffL); /* destination code */ diff --git a/src/makemon.c b/src/makemon.c index 55dc7b49d..ee87d332e 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -1391,7 +1391,7 @@ int mmflags; } if (allow_minvent && migrating_objs) - deliver_obj_to_mon(mtmp, DF_RANDOM2); /* in case there's waiting items */ + deliver_obj_to_mon(mtmp, 1, DF_NONE); /* in case there's waiting items */ if (!in_mklev) newsym(mtmp->mx, mtmp->my); /* make sure the mon shows up */ diff --git a/src/mkmaze.c b/src/mkmaze.c index 8282205f8..4639f04a9 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -632,6 +632,7 @@ char *s; } #define ORC_LEADER 1 +static const char *orcfruit[] = {"paddle cactus", "dwarven root"}; void migrate_orc(mtmp, mflags) @@ -652,7 +653,7 @@ unsigned long mflags; nlev = max_depth; mtmp->mspare1 = MIGR_LEFTOVERS; } else { - nlev = rn2(max_depth - cur_depth) + cur_depth + 1; + nlev = rn2((max_depth - cur_depth) + 1) + cur_depth; if (nlev == cur_depth) nlev++; if (nlev > max_depth) @@ -663,6 +664,38 @@ unsigned long mflags; migrate_to_level(mtmp, ledger_no(&dest), MIGR_RANDOM, (coord *) 0); } +void +shiny_orc_stuff(mtmp) +struct monst *mtmp; +{ + int gemprob, goldprob, otyp; + struct obj *otmp; + boolean is_captain = (mtmp->data == &mons[PM_ORC_CAPTAIN]); + + /* probabilities */ + goldprob = is_captain ? 600 : 300; + gemprob = goldprob / 4; + if (rn2(1000) < goldprob) { + if ((otmp = mksobj(GOLD_PIECE, FALSE, FALSE)) != 0) { + otmp->quan = 1L + rnd(goldprob); + otmp->owt = weight(otmp); + add_to_minv(mtmp, otmp); + } + } + if (rn2(1000) < gemprob) { + if ((otmp = mkobj(GEM_CLASS, FALSE)) != 0) { + if (otmp->otyp == ROCK) + dealloc_obj(otmp); + else + add_to_minv(mtmp, otmp); + } + } + if (is_captain || !rn2(8)) { + otyp = shiny_obj(RING_CLASS); + if ((otmp = mksobj(otyp, FALSE, FALSE)) != 0) + add_to_minv(mtmp, otmp); + } +} void migr_booty_item(otyp, gang) int otyp; @@ -673,8 +706,13 @@ const char *gang; if (otmp && gang) { new_oname(otmp, strlen(gang) + 1); /* removes old name if one is present */ Strcpy(ONAME(otmp), gang); - if (otyp >= TRIPE_RATION && otyp <= TIN) + if (otyp >= TRIPE_RATION && otyp <= TIN) { + if (otyp == SLIME_MOLD) + otmp->spe = fruitadd((char *) orcfruit[rn2(SIZE(orcfruit))], + (struct fruit *) 0); otmp->quan += (long) rn2(3); + otmp->owt = weight(otmp); + } } } @@ -699,24 +737,16 @@ stolen_booty(VOID_ARGS) */ gang = rndorcname(gang_name); - /* create the leader of the orc gang */ - mtmp = makemon(&mons[PM_ORC_CAPTAIN], 0, 0, MM_NONAME); - if (mtmp) { - mtmp = christen_monst(mtmp, upstart(gang)); - mtmp->mpeaceful = 0; - migrate_orc(mtmp, ORC_LEADER); - } - /* create the stuff that the rest of the gang took */ - migr_booty_item(rn2(2) ? LONG_SWORD : SILVER_SABER, gang); - cnt = rn2(3) + 1; + /* create the stuff that the gang took */ + cnt = rnd(4); for (i = 0; i < cnt; ++i) migr_booty_item(rn2(4) ? TALLOW_CANDLE : WAX_CANDLE, gang); - cnt = rn2(2) + 1; + cnt = rnd(3); for (i = 0; i < cnt; ++i) migr_booty_item(SKELETON_KEY, gang); otyp = rn2((GAUNTLETS_OF_DEXTERITY - LEATHER_GLOVES) + 1) + LEATHER_GLOVES; migr_booty_item(otyp, gang); - cnt = rn2(9) + 1; + cnt = rnd(10); for (i = 0; i < cnt; ++i) { /* Food items - but no lembas! (or some other weird things) */ otyp = rn2((TIN - TRIPE_RATION) + 1) + TRIPE_RATION; @@ -727,6 +757,15 @@ stolen_booty(VOID_ARGS) otyp != HUGE_CHUNK_OF_MEAT && otyp != CORPSE) migr_booty_item(otyp, gang); } + migr_booty_item(rn2(2) ? LONG_SWORD : SILVER_SABER, gang); + /* create the leader of the orc gang */ + mtmp = makemon(&mons[PM_ORC_CAPTAIN], 0, 0, MM_NONAME); + if (mtmp) { + mtmp = christen_monst(mtmp, upstart(gang)); + mtmp->mpeaceful = 0; + shiny_orc_stuff(mtmp); + migrate_orc(mtmp, ORC_LEADER); + } /* Make most of the orcs on the level be part of the invading gang */ for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { if (DEADMONSTER(mtmp)) @@ -751,14 +790,16 @@ stolen_booty(VOID_ARGS) * members of the invading gang until they get their spoils assigned * to the inventory; handled during that assignment. */ - cnt = rn2(7) + 5; + cnt = rn2(10) + 5; for (i = 0; i < cnt; ++i) { int mtyp; mtyp = rn2((PM_ORC_SHAMAN - PM_ORC) + 1) + PM_ORC; mtmp = makemon(&mons[mtyp], 0, 0, MM_NONAME); - if (mtmp) + if (mtmp) { + shiny_orc_stuff(mtmp); migrate_orc(mtmp, 0UL); + } } ransacked = 0; diff --git a/src/objnam.c b/src/objnam.c index 6588b7f9a..692291417 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -2753,6 +2753,13 @@ char oclass; return STRANGE_OBJECT; } +int +shiny_obj(oclass) +char oclass; +{ + return (int) rnd_otyp_by_namedesc("shiny", oclass); +} + /* * Return something wished for. Specifying a null pointer for * the user request string results in a random object. Otherwise, -- 2.40.0