Merge branch 'NetHack-3.6.2'

This commit is contained in:
nhmall
2018-09-21 16:41:00 -04:00
23 changed files with 908 additions and 46 deletions

View File

@@ -50,7 +50,7 @@ boolean FDECL((*gp_getvalidf), (int, int));
getpos_getvalid = gp_getvalidf;
}
const char *const gloc_descr[NUM_GLOCS][4] = {
static const char *const gloc_descr[NUM_GLOCS][4] = {
{ "any monsters", "monster", "next monster", "monsters" },
{ "any items", "item", "next object", "objects" },
{ "any doors", "door", "next door or doorway", "doors or doorways" },
@@ -60,7 +60,7 @@ const char *const gloc_descr[NUM_GLOCS][4] = {
"anything interesting" }
};
const char *const gloc_filtertxt[NUM_GFILTER] = {
static const char *const gloc_filtertxt[NUM_GFILTER] = {
"",
" in view",
" in this area"
@@ -90,11 +90,11 @@ getpos_help(force, goal)
boolean force;
const char *goal;
{
static const char *const fastmovemode[2] = { "8 units at a time",
"skipping same glyphs" };
char sbuf[BUFSZ];
boolean doing_what_is;
winid tmpwin = create_nhwindow(NHW_MENU);
const char *const fastmovemode[2] = { "8 units at a time",
"skipping same glyphs" };
Sprintf(sbuf,
"Use '%c', '%c', '%c', '%c' to move the cursor to %s.", /* hjkl */
@@ -275,8 +275,8 @@ int glyph;
}
STATIC_OVL int
gloc_filter_floodfill_matcharea(x,y)
int x,y;
gloc_filter_floodfill_matcharea(x, y)
int x, y;
{
int glyph = back_to_glyph(x, y);
@@ -308,7 +308,7 @@ gloc_filter_init()
{
if (iflags.getloc_filter == GFILTER_AREA) {
if (!gloc_filter_map) {
gloc_filter_map = selection_opvar(NULL);
gloc_filter_map = selection_opvar((char *) 0);
}
/* special case: if we're in a doorway, try to figure out which
direction we're moving, and use that side of the doorway */
@@ -321,8 +321,6 @@ gloc_filter_init()
} else {
gloc_filter_floodfill(u.ux, u.uy);
}
}
}
@@ -331,7 +329,7 @@ gloc_filter_done()
{
if (gloc_filter_map) {
opvar_free_x(gloc_filter_map);
gloc_filter_map = NULL;
gloc_filter_map = (struct opvar *) 0;
}
}
@@ -466,7 +464,7 @@ boolean fulldir;
/* explicit direction; 'one step' is implicit */
Sprintf(buf, "%s", directionname(dst));
} else {
const char *dirnames[4][2] = {
static const char *dirnames[4][2] = {
{ "n", "north" },
{ "s", "south" },
{ "w", "west" },
@@ -543,7 +541,8 @@ int cx, cy;
cc.x = cx;
cc.y = cy;
if (do_screen_description(cc, TRUE, sym, tmpbuf, &firstmatch, (struct permonst **)0)) {
if (do_screen_description(cc, TRUE, sym, tmpbuf, &firstmatch,
(struct permonst **) 0)) {
(void) coord_desc(cx, cy, tmpbuf, iflags.getpos_coords);
custompline(SUPPRESS_HISTORY,
"%s%s%s%s%s", firstmatch, *tmpbuf ? " " : "", tmpbuf,
@@ -590,6 +589,7 @@ int gloc;
coord tmpcc;
const char *firstmatch = "unknown";
int sym = 0;
any.a_int = i + 1;
tmpcc.x = garr[i].x;
tmpcc.y = garr[i].y;
@@ -804,11 +804,12 @@ const char *goal;
msg_given = TRUE;
goto nxtc;
} else if (c == Cmd.spkeys[NHKF_GETPOS_LIMITVIEW]) {
const char *const view_filters[NUM_GFILTER] = {
static const char *const view_filters[NUM_GFILTER] = {
"Not limiting targets",
"Limiting targets to in sight",
"Limiting targets to in same area"
};
iflags.getloc_filter = (iflags.getloc_filter + 1) % NUM_GFILTER;
for (i = 0; i < NUM_GLOCS; i++) {
if (garr[i]) {
@@ -845,6 +846,7 @@ const char *goal;
if (iflags.getloc_usemenu) {
coord tmpcrd;
if (getpos_menu(&tmpcrd, gloc)) {
cx = tmpcrd.x;
cy = tmpcrd.y;
@@ -1513,7 +1515,7 @@ namefloorobj()
(cc.x == u.ux && cc.y == u.uy) ? "under you" : "there");
return;
}
/* note well: 'obj' might be as instance of STRANGE_OBJECT if target
/* note well: 'obj' might be an instance of STRANGE_OBJECT if target
is a mimic; passing that to xname (directly or via simpleonames)
would yield "glorkum" so we need to handle it explicitly; it will
always fail the Hallucination test and pass the !callable test,
@@ -2025,9 +2027,9 @@ static NEARDATA const char *const hliquids[] = {
"instant coffee", "tea", "herbal infusion", "liquid rainbow",
"creamy foam", "mulled wine", "bouillon", "nectar", "grog", "flubber",
"ketchup", "slow light", "oil", "vinaigrette", "liquid crystal", "honey",
"caramel sauce", "ink", "aqueous humour", "milk substitute", "fruit juice",
"glowing lava", "gastric acid", "mineral water", "cough syrup", "quicksilver",
"sweet vitriol", "grey goo", "pink slime",
"caramel sauce", "ink", "aqueous humour", "milk substitute",
"fruit juice", "glowing lava", "gastric acid", "mineral water",
"cough syrup", "quicksilver", "sweet vitriol", "grey goo", "pink slime",
};
const char *
@@ -2035,7 +2037,7 @@ hliquid(liquidpref)
const char *liquidpref;
{
return (Hallucination || !liquidpref) ? hliquids[rn2(SIZE(hliquids))]
: liquidpref;
: liquidpref;
}
/* Aliases for road-runner nemesis

View File

@@ -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) {

View File

@@ -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 */

View File

@@ -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 */

View File

@@ -646,6 +646,7 @@ char *s;
}
#define ORC_LEADER 1
static const char *orcfruit[] = {"paddle cactus", "dwarven root"};
void
migrate_orc(mtmp, mflags)
@@ -664,9 +665,12 @@ unsigned long mflags;
* orcs between here and the bottom of the mines.
*/
nlev = max_depth;
/* once in a blue moon, he won't be at the very bottom */
if (!rn2(40))
nlev--;
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)
@@ -677,6 +681,39 @@ 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 ((otyp != STRANGE_OBJECT) &&
(otmp = mksobj(otyp, FALSE, FALSE)) != 0)
add_to_minv(mtmp, otmp);
}
}
void
migr_booty_item(otyp, gang)
int otyp;
@@ -687,8 +724,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);
}
}
}
@@ -713,24 +755,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;
@@ -741,6 +775,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))
@@ -765,14 +808,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;

View File

@@ -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,