Merge branch 'NetHack-3.6.2'

This commit is contained in:
nhmall
2018-11-17 08:32:59 -05:00
26 changed files with 929 additions and 567 deletions

View File

@@ -763,8 +763,15 @@ const char *msg;
static struct early_opt earlyopts[] = {
{ARG_DEBUG, "debug", 5, TRUE},
{ARG_VERSION, "version", 4, TRUE},
#ifdef WIN32
{ARG_WINDOWS, "windows", 4, TRUE},
#endif
};
#ifdef WIN32
extern int FDECL(windows_early_options, (const char *));
#endif
/*
* Returns:
* 0 = no match
@@ -834,6 +841,14 @@ enum earlyarg e_arg;
early_version_info(insert_into_pastebuf);
return 2;
}
#ifdef WIN32
case ARG_WINDOWS: {
if (extended_opt) {
extended_opt++;
return windows_early_options(extended_opt);
}
}
#endif
default:
break;
}

View File

@@ -698,6 +698,7 @@ int fld, idx, idx_p;
boolean *valsetlist;
{
static int oldrndencode = 0;
static nhsym oldgoldsym = 0;
int pc, chg, color = NO_COLOR;
unsigned anytype;
boolean updated = FALSE, reset;
@@ -719,10 +720,28 @@ boolean *valsetlist;
* so $:0 has already been encoded and cached by the window
* port. Without this hack, gold's \G sequence won't be
* recognized and ends up being displayed as-is for 'update_all'.
*
* Also, even if context.rndencode hasn't changed and the
* gold amount itself hasn't changed, the glyph portion of the
* encoding may have changed if a new symset was put into
* effect.
*
* \GXXXXNNNN:25
* XXXX = the context.rndencode portion
* NNNN = the glyph portion
* 25 = the gold amount
*
*/
if (context.rndencode != oldrndencode && fld == BL_GOLD) {
chg = 2;
oldrndencode = context.rndencode;
if (fld == BL_GOLD) {
if (context.rndencode != oldrndencode) {
chg = 2;
oldrndencode = context.rndencode;
}
if (oldgoldsym != showsyms[COIN_CLASS + SYM_OFF_O]) {
chg = 2;
oldgoldsym = showsyms[COIN_CLASS + SYM_OFF_O];
}
}
reset = FALSE;

View File

@@ -721,6 +721,7 @@ struct monst *mtmp, *mtarg;
/* Give 1 in 3 chance of safe breathing even if pet is confused or
* if you're on the quest start level */
if (!mtmp->mconf || !rn2(3) || Is_qstart(&u.uz)) {
int mtmp_lev;
aligntyp align1 = A_NONE, align2 = A_NONE; /* For priests, minions */
boolean faith1 = TRUE, faith2 = TRUE;
@@ -774,10 +775,26 @@ struct monst *mtmp, *mtarg;
|| (mtmp->m_lev > 12 && mtarg->m_lev < mtmp->m_lev - 9
&& u.ulevel > 8 && mtarg->m_lev < u.ulevel - 7))
score -= 25;
/* for strength purposes, a vampshifter in weak form (vampire bat,
fog cloud, maybe wolf) will attack as if in vampire form;
otherwise if won't do much and usually wouldn't suffer enough
damage (from counterattacks) to switch back to vampire form;
make it be more aggressive by behaving as if stronger */
mtmp_lev = mtmp->m_lev;
if (is_vampshifter(mtmp) && mtmp->data->mlet != S_VAMPIRE) {
/* is_vampshifter() implies (mtmp->cham >= LOW_PM) */
mtmp_lev = mons[mtmp->cham].mlevel;
/* actual vampire level would range from 1.0*mlvl to 1.5*mlvl */
mtmp_lev += rn2(mtmp_lev / 2 + 1);
/* we don't expect actual level in weak form to exceed
base level of strong form, but handle that if it happens */
if (mtmp->m_lev > mtmp_lev)
mtmp_lev = mtmp->m_lev;
}
/* And pets will hesitate to attack vastly stronger foes.
This penalty will be discarded if master's in trouble. */
if (mtarg->m_lev > mtmp->m_lev + 4L)
score -= (mtarg->m_lev - mtmp->m_lev) * 20L;
if (mtarg->m_lev > mtmp_lev + 4L)
score -= (mtarg->m_lev - mtmp_lev) * 20L;
/* All things being the same, go for the beefiest monster. This
bonus should not be large enough to override the pet's aversion
to attacking much stronger monsters. */

View File

@@ -943,10 +943,11 @@ register struct permonst *ptr;
/* called after completely consuming a corpse */
STATIC_OVL void
cpostfx(pm)
register int pm;
int pm;
{
register int tmp = 0;
int tmp = 0;
int catch_lycanthropy = NON_PM;
boolean check_intrinsics = FALSE;
/* in case `afternmv' didn't get called for previously mimicking
gold, clean up now to avoid `eatmbuf' memory leak */
@@ -958,6 +959,7 @@ register int pm;
/* MRKR: "eye of newt" may give small magical energy boost */
if (rn2(3) || 3 * u.uen <= 2 * u.uenmax) {
int old_uen = u.uen;
u.uen += rnd(3);
if (u.uen > u.uenmax) {
if (!rn2(3))
@@ -989,6 +991,7 @@ register int pm;
u.uhp = u.uhpmax;
make_blinded(0L, !u.ucreamed);
context.botl = 1;
check_intrinsics = TRUE; /* might also convey poison resistance */
break;
case PM_STALKER:
if (!Invis) {
@@ -1090,7 +1093,13 @@ register int pm;
pline("For some reason, that tasted bland.");
}
/*FALLTHRU*/
default: {
default:
check_intrinsics = TRUE;
break;
}
/* possibly convey an intrinsic */
if (check_intrinsics) {
struct permonst *ptr = &mons[pm];
boolean conveys_STR = is_giant(ptr);
int i, count;
@@ -1137,9 +1146,7 @@ register int pm;
gainstr((struct obj *) 0, 0, TRUE);
else if (tmp > 0)
givit(tmp, ptr);
break;
} /* default case */
} /* switch */
} /* check_intrinsics */
if (catch_lycanthropy >= LOW_PM) {
set_ulycn(catch_lycanthropy);

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 rumors.c $NHDT-Date: 1446713640 2015/11/05 08:54:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.27 $ */
/* NetHack 3.6 rumors.c $NHDT-Date: 1542422933 2018/11/17 02:48:53 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.30 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -43,6 +43,7 @@
STATIC_DCL void FDECL(init_rumors, (dlb *));
STATIC_DCL void FDECL(init_oracles, (dlb *));
STATIC_DCL void FDECL(couldnt_open_file, (const char *));
/* rumor size variables are signed so that value -1 can be used as a flag */
static long true_rumor_size = 0L, false_rumor_size;
@@ -155,7 +156,7 @@ boolean exclude_cookie;
else if (!in_mklev) /* avoid exercizing wisdom for graffiti */
exercise(A_WIS, (adjtruth > 0));
} else {
pline("Can't open rumors file!");
couldnt_open_file(RUMORFILE);
true_rumor_size = -1; /* don't try to open it again */
}
/* this is safe either way, so do it always since we can't get the definition
@@ -272,7 +273,7 @@ rumor_check()
display_nhwindow(tmpwin, TRUE);
destroy_nhwindow(tmpwin);
} else {
impossible("Can't open rumors file!");
couldnt_open_file(RUMORFILE);
true_rumor_size = -1; /* don't try to open it again */
}
}
@@ -314,8 +315,10 @@ char *buf;
*endp = 0;
Strcat(buf, xcrypt(line, xbuf));
(void) dlb_fclose(fh);
} else
impossible("Can't open file %s!", fname);
} else {
couldnt_open_file(fname);
}
return buf;
}
@@ -469,7 +472,7 @@ boolean delphi;
destroy_nhwindow(tmpwin);
(void) dlb_fclose(oracles);
} else {
pline("Can't open oracles file!");
couldnt_open_file(ORACLEFILE);
oracle_flg = -1; /* don't try to open it again */
}
}
@@ -547,4 +550,20 @@ struct monst *oracl;
return 1;
}
STATIC_OVL void
couldnt_open_file(filename)
const char *filename;
{
int save_something = program_state.something_worth_saving;
/* most likely the file is missing, so suppress impossible()'s
"saving and restoring might fix this" (unless the fuzzer,
which escalates impossible to panic, is running) */
if (!iflags.debug_fuzzer)
program_state.something_worth_saving = 0;
impossible("Can't open '%s' file.", filename);
program_state.something_worth_saving = save_something;
}
/*rumors.c*/