Merge branch 'NetHack-3.6'

This commit is contained in:
nhmall
2019-11-14 19:48:57 -05:00
15 changed files with 2236 additions and 67 deletions
+102 -16
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 mhitm.c $NHDT-Date: 1560161806 2019/06/10 10:16:46 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.116 $ */
/* NetHack 3.6 mhitm.c $NHDT-Date: 1573773926 2019/11/14 23:25:26 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.118 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */
@@ -52,16 +52,35 @@ struct attack *mattk;
{
const char *fmt;
char buf[BUFSZ];
boolean showit = FALSE;
/* unhiding or unmimicking happens even if hero can't see it
because the formerly concealed monster is now in action */
if (M_AP_TYPE(mdef)) {
seemimic(mdef);
showit |= g.vis;
} else if (mdef->mundetected) {
mdef->mundetected = 0;
showit |= g.vis;
}
if (M_AP_TYPE(magr)) {
seemimic(magr);
showit |= g.vis;
} else if (magr->mundetected) {
magr->mundetected = 0;
showit |= g.vis;
}
if (g.vis) {
if (!canspotmon(magr))
map_invisible(magr->mx, magr->my);
else if (showit)
newsym(magr->mx, magr->my);
if (!canspotmon(mdef))
map_invisible(mdef->mx, mdef->my);
if (M_AP_TYPE(mdef))
seemimic(mdef);
if (M_AP_TYPE(magr))
seemimic(magr);
else if (showit)
newsym(mdef->mx, mdef->my);
fmt = (could_seduce(magr, mdef, mattk) && !magr->mcan)
? "%s pretends to be friendly to"
: "%s misses";
@@ -381,9 +400,9 @@ register struct monst *magr, *mdef;
|| mdef->data == &mons[PM_BROWN_PUDDING])
&& (g.otmp && (objects[g.otmp->otyp].oc_material == IRON
|| objects[g.otmp->otyp].oc_material == METAL))
&& mdef->mhp > 1
&& !mdef->mcan) {
&& mdef->mhp > 1 && !mdef->mcan) {
struct monst *mclone;
if ((mclone = clone_mon(mdef, 0, 0)) != 0) {
if (g.vis && canspotmon(mdef)) {
char buf[BUFSZ];
@@ -425,6 +444,13 @@ register struct monst *magr, *mdef;
break;
case AT_ENGL:
if (mdef->data == &mons[PM_SHADE]) { /* no silver teeth... */
if (g.vis)
pline("%s attempt to engulf %s is futile.",
s_suffix(Monnam(magr)), mon_nam(mdef));
strike = 0;
break;
}
if (u.usteed && mdef == u.usteed) {
strike = 0;
break;
@@ -501,23 +527,49 @@ hitmm(magr, mdef, mattk)
register struct monst *magr, *mdef;
struct attack *mattk;
{
boolean weaponhit = ((mattk->aatyp == AT_WEAP
|| (mattk->aatyp == AT_CLAW && g.otmp))),
silverhit = (weaponhit && g.otmp
&& objects[g.otmp->otyp].oc_material == SILVER),
showit = FALSE;
/* unhiding or unmimicking happens even if hero can't see it
because the formerly concealed monster is now in action */
if (M_AP_TYPE(mdef)) {
seemimic(mdef);
showit |= g.vis;
} else if (mdef->mundetected) {
mdef->mundetected = 0;
showit |= g.vis;
}
if (M_AP_TYPE(magr)) {
seemimic(magr);
showit |= g.vis;
} else if (magr->mundetected) {
magr->mundetected = 0;
showit |= g.vis;
}
if (g.vis) {
int compat;
char buf[BUFSZ];
if (!canspotmon(magr))
map_invisible(magr->mx, magr->my);
else if (showit)
newsym(magr->mx, magr->my);
if (!canspotmon(mdef))
map_invisible(mdef->mx, mdef->my);
if (M_AP_TYPE(mdef))
seemimic(mdef);
if (M_AP_TYPE(magr))
seemimic(magr);
else if (showit)
newsym(mdef->mx, mdef->my);
if ((compat = could_seduce(magr, mdef, mattk)) && !magr->mcan) {
Sprintf(buf, "%s %s", Monnam(magr),
mdef->mcansee ? "smiles at" : "talks to");
pline("%s %s %s.", buf, mon_nam(mdef),
compat == 2 ? "engagingly" : "seductively");
} else if (shade_miss(magr, mdef, g.otmp, FALSE, TRUE)) {
return MM_MISS; /* bypass mdamagem() */
} else {
char magr_name[BUFSZ];
@@ -548,6 +600,28 @@ struct attack *mattk;
Sprintf(buf, "%s hits", magr_name);
}
pline("%s %s.", buf, mon_nam_too(mdef, magr));
if (mon_hates_silver(mdef) && silverhit) {
char *mdef_name = mon_nam_too(mdef, magr);
/* note: mon_nam_too returns a modifiable buffer; so
does s_suffix, but it returns a single static buffer
and we might be calling it twice for this message */
Strcpy(magr_name, s_suffix(magr_name));
if (!noncorporeal(mdef->data) && !amorphous(mdef->data)) {
if (mdef != magr) {
mdef_name = s_suffix(mdef_name);
} else {
(void) strsubst(mdef_name, "himself", "his own");
(void) strsubst(mdef_name, "herself", "her own");
(void) strsubst(mdef_name, "itself", "its own");
}
Strcat(mdef_name, " flesh");
}
pline("%s %s sears %s!", magr_name, /*s_suffix(magr_name), */
simpleonames(g.otmp), mdef_name);
}
}
} else
noises(magr, mattk);
@@ -775,11 +849,12 @@ mdamagem(magr, mdef, mattk)
register struct monst *magr, *mdef;
register struct attack *mattk;
{
struct obj *obj;
struct obj *obj, dmgwep;
char buf[BUFSZ];
struct permonst *pa = magr->data, *pd = mdef->data;
int armpro, num, tmp = d((int) mattk->damn, (int) mattk->damd),
res = MM_MISS;
int armpro, num,
tmp = d((int) mattk->damn, (int) mattk->damd),
res = MM_MISS;
boolean cancelled;
if ((touch_petrifies(pd) /* or flesh_petrifies() */
@@ -882,15 +957,26 @@ register struct attack *mattk;
case AD_HEAL:
case AD_PHYS:
physical:
if (mattk->aatyp == AT_KICK && thick_skinned(pd)) {
/* this shade check is necessary in case any attacks which
dish out physical damage bypass hitmm() to get here */
if ((mattk->aatyp == AT_WEAP || mattk->aatyp == AT_CLAW) && g.otmp)
dmgwep = *g.otmp;
else
dmgwep = cg.zeroobj;
if (shade_miss(magr, mdef, &dmgwep, FALSE, TRUE)) {
tmp = 0;
} else if (mattk->aatyp == AT_WEAP) {
} else if (mattk->aatyp == AT_KICK && thick_skinned(pd)) {
tmp = 0;
} else if (mattk->aatyp == AT_WEAP
|| (mattk->aatyp == AT_CLAW && g.otmp)) {
if (g.otmp) {
struct obj *marmg;
if (g.otmp->otyp == CORPSE
&& touch_petrifies(&mons[g.otmp->corpsenm]))
goto do_stone;
tmp += dmgval(g.otmp, mdef);
if ((marmg = which_armor(magr, W_ARMG)) != 0
&& marmg->otyp == GAUNTLETS_OF_POWER)