Merge branch 'NetHack-3.6.2'

This commit is contained in:
nhmall
2018-11-25 15:49:18 -05:00
12 changed files with 202 additions and 98 deletions

View File

@@ -2088,18 +2088,28 @@ char *s;
}
struct monst *
christen_orc(mtmp, gang)
christen_orc(mtmp, gang, other)
struct monst *mtmp;
char *gang;
char *gang, *other;
{
int sz = 0;
char buf[BUFSZ], buf2[BUFSZ], *orcname;
orcname = rndorcname(buf2);
sz = (int) (strlen(gang) + strlen(orcname) + sizeof " of " - sizeof "");
if (gang && orcname && sz < BUFSZ) {
Sprintf(buf, "%s of %s", upstart(orcname), upstart(gang));
mtmp = christen_monst(mtmp, buf);
sz = (int) ((gang ? strlen(gang) : other ? strlen(other) : 0)
+ strlen(orcname) + sizeof " of " - sizeof "");
if (sz < BUFSZ) {
boolean nameit = FALSE;
if (gang && orcname) {
Sprintf(buf, "%s of %s", upstart(orcname), upstart(gang));
nameit = TRUE;
} else if (other && orcname) {
Sprintf(buf, "%s%s", upstart(orcname), other);
nameit = TRUE;
}
if (nameit)
mtmp = christen_monst(mtmp, buf);
}
return mtmp;
}

View File

@@ -1680,7 +1680,8 @@ unsigned long deliverflags;
{
struct obj *otmp, *otmp2;
int where, maxobj = 1;
boolean at_crime_scene = In_mines(&u.uz);
if ((deliverflags & DF_RANDOM) && cnt > 1)
maxobj = rnd(cnt);
else if (deliverflags & DF_ALL)
@@ -1702,8 +1703,12 @@ unsigned long deliverflags;
/* special treatment for orcs and their kind */
if ((otmp->corpsenm & M2_ORC) != 0 && has_oname(otmp)) {
if (!has_mname(mtmp))
mtmp = christen_orc(mtmp, ONAME(otmp));
if (!has_mname(mtmp)) {
if (at_crime_scene || (!at_crime_scene && !rn2(2)))
mtmp = christen_orc(mtmp,
at_crime_scene ? ONAME(otmp) : (char *) 0,
" the Fence"); /* bought the stolen goods */
}
free_oname(otmp);
}
otmp->corpsenm = 0;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 explode.c $NHDT-Date: 1522454717 2018/03/31 00:05:17 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.56 $ */
/* NetHack 3.6 explode.c $NHDT-Date: 1543101719 2018/11/24 23:21:59 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.59 $ */
/* Copyright (C) 1990 by Ken Arromdee */
/* NetHack may be freely redistributed. See license for details. */
@@ -616,6 +616,10 @@ struct obj *obj; /* only scatter this obj */
struct scatter_chain *schain = (struct scatter_chain *) 0;
long total = 0L;
if (individual_object && (obj->ox != sx || obj->oy != sy))
impossible("scattered object <%d,%d> not at scatter site <%d,%d>",
obj->ox, obj->oy, sx, sy);
while ((otmp = (individual_object ? obj : level.objects[sx][sy])) != 0) {
if (otmp->quan > 1L) {
qtmp = otmp->quan - 1L;
@@ -759,7 +763,7 @@ struct obj *obj; /* only scatter this obj */
free((genericptr_t) stmp);
newsym(x, y);
}
newsym(sx, sy);
return total;
}

View File

@@ -799,7 +799,7 @@ stolen_booty(VOID_ARGS)
* member of the main orc horde.
*/
if (mtmp->data != &mons[PM_ORC_CAPTAIN])
mtmp = christen_orc(mtmp, upstart(gang));
mtmp = christen_orc(mtmp, upstart(gang), "");
}
}
/* Lastly, ensure there's several more orcs from the gang along the way.

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 mon.c $NHDT-Date: 1543052701 2018/11/24 09:45:01 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.270 $ */
/* NetHack 3.6 mon.c $NHDT-Date: 1543100460 2018/11/24 23:01:00 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.271 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2827,40 +2827,34 @@ boolean via_attack;
void
wake_nearby()
{
register struct monst *mtmp;
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
if (DEADMONSTER(mtmp))
continue;
if (distu(mtmp->mx, mtmp->my) < u.ulevel * 20) {
mtmp->msleeping = 0;
if (!unique_corpstat(mtmp->data))
mtmp->mstrategy &= ~STRAT_WAITMASK;
if (mtmp->mtame) {
if (!mtmp->isminion)
EDOG(mtmp)->whistletime = moves;
/* Clear mtrack. This is to fix up a pet who is
stuck "fleeing" its master. */
memset(mtmp->mtrack, 0, sizeof(mtmp->mtrack));
}
}
}
wake_nearto(u.ux, u.uy, u.ulevel * 20);
}
/* Wake up monsters near some particular location. */
void
wake_nearto(x, y, distance)
register int x, y, distance;
int x, y, distance;
{
register struct monst *mtmp;
struct monst *mtmp;
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
if (DEADMONSTER(mtmp))
continue;
if (distance == 0 || dist2(mtmp->mx, mtmp->my, x, y) < distance) {
mtmp->msleeping = 0;
if (!unique_corpstat(mtmp->data))
mtmp->mstrategy &= ~STRAT_WAITMASK;
/* sleep for N turns uses mtmp->mfrozen, but so does paralysis
so we leave mfrozen monsters alone */
mtmp->msleeping = 0; /* wake indeterminate sleep */
if (!(mtmp->data->geno & G_UNIQ))
mtmp->mstrategy &= ~STRAT_WAITMASK; /* wake 'meditation' */
if (context.mon_moving)
continue;
if (mtmp->mtame) {
if (!mtmp->isminion)
EDOG(mtmp)->whistletime = moves;
/* Clear mtrack. This is to fix up a pet who is
stuck "fleeing" its master. */
memset(mtmp->mtrack, 0, sizeof mtmp->mtrack);
}
}
}
}

View File

@@ -1340,64 +1340,88 @@ boolean do_mons; /* True => monsters, False => objects */
destroy_nhwindow(win);
}
static const char *suptext1[] = {
"%s is a member of a marauding horde of orcs",
"rumored to have brutally attacked and plundered",
"the ordinarily sheltered town that is located ",
"deep within The Gnomish Mines.",
"",
"The members of that vicious horde proudly and ",
"defiantly acclaim their allegiance to their",
"leader %s in their names.",
(char *) 0,
};
static const char *suptext2[] = {
"%s is a nefarious orc who is known to acquire",
"property from thieves and sell it off for profit",
"or gain. The perpetrator was last seen hanging",
"around the stairs leading to the Gnomish Mines.",
(char *) 0,
};
void
do_supplemental_info(name, pm, without_asking)
char *name;
struct permonst *pm;
boolean without_asking;
{
const char **textp;
winid datawin = WIN_ERR;
char *entrytext = name, *bp;
char *entrytext = name, *bp = (char *) 0, *bp2 = (char *) 0;
char question[QBUFSZ];
boolean yes_to_moreinfo = FALSE;
boolean is_marauder = (name && pm && is_orc(pm));
/*
* Provide some info on some specific things
* meant to support in-game mythology, and not
* available from data.base or other sources.
*/
if (name && pm && is_orc(pm) && (strlen(name) < (BUFSZ - 1))
&& (bp = strstri(name, " of ")) != 0) {
if (is_marauder && (strlen(name) < (BUFSZ - 1))) {
char fullname[BUFSZ];
Strcpy(fullname, name);
if (!without_asking) {
Strcpy(question, "More info about \"");
/* +2 => length of "\"?" */
copynchars(eos(question), entrytext,
(int) (sizeof question - 1 - (strlen(question) + 2)));
Strcat(question, "\"?");
if (yn(question) == 'y')
yes_to_moreinfo = TRUE;
}
if (yes_to_moreinfo) {
int i, subs = 0;
char *gang = bp + 4;
static const char *text[] = {
"%s is a member of a marauding horde of orcs",
"rumored to have brutally attacked and plundered the ordinarily",
"sheltered town that is located deep within The Gnomish Mines.",
"",
"The members of that vicious horde proudly and defiantly acclaim",
"their allegiance to their leader %s in their names.",
};
bp = strstri(name, " of ");
bp2 = strstri(name, " the Fence");
*bp = '\0';
datawin = create_nhwindow(NHW_MENU);
for (i = 0; i < SIZE(text); i++) {
char buf[BUFSZ];
const char *txt;
if (strstri(text[i], "%s") != 0) {
Sprintf(buf, text[i],
subs++ ? gang : fullname);
txt = buf;
} else
txt = text[i];
putstr(datawin, 0, txt);
if (bp || bp2) {
Strcpy(fullname, name);
if (!without_asking) {
Strcpy(question, "More info about \"");
/* +2 => length of "\"?" */
copynchars(eos(question), entrytext,
(int) (sizeof question - 1 - (strlen(question) + 2)));
Strcat(question, "\"?");
if (yn(question) == 'y')
yes_to_moreinfo = TRUE;
}
if (yes_to_moreinfo) {
int i, subs = 0;
char *gang = (char *) 0;
if (bp) {
textp = suptext1;
gang = bp + 4;
*bp = '\0';
} else {
textp = suptext2;
gang = "";
}
datawin = create_nhwindow(NHW_MENU);
for (i = 0; textp[i]; i++) {
char buf[BUFSZ];
const char *txt;
if (strstri(textp[i], "%s") != 0) {
Sprintf(buf, textp[i], subs++ ? gang : fullname);
txt = buf;
} else
txt = textp[i];
putstr(datawin, 0, txt);
}
display_nhwindow(datawin, FALSE);
destroy_nhwindow(datawin), datawin = WIN_ERR;
}
display_nhwindow(datawin, FALSE);
destroy_nhwindow(datawin), datawin = WIN_ERR;
}
}
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 trap.c $NHDT-Date: 1542856572 2018/11/22 03:16:12 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.304 $ */
/* NetHack 3.6 trap.c $NHDT-Date: 1543100476 2018/11/24 23:01:16 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.311 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */
@@ -3164,7 +3164,7 @@ domagictrap()
if (fate < 10) {
/* Most of the time, it creates some monsters. */
register int cnt = rnd(4);
int cnt = rnd(4);
/* blindness effects */
if (!resists_blnd(&youmonst)) {
@@ -3189,6 +3189,9 @@ domagictrap()
}
while (cnt--)
(void) makemon((struct permonst *) 0, u.ux, u.uy, NO_MM_FLAGS);
/* roar: wake monsters in vicinity, after placing trap-created ones */
wake_nearto(u.ux, u.uy, 7 * 7);
/* [flash: should probably also hit nearby gremlins with light] */
} else
switch (fate) {
case 10: