Merge branch 'NetHack-3.6.0'

This commit is contained in:
keni
2016-06-21 10:29:14 -04:00
84 changed files with 3167 additions and 1281 deletions

View File

@@ -291,7 +291,7 @@ register struct monst *magr, *mdef;
{
int i, /* loop counter */
tmp, /* amour class difference */
strike, /* hit this attack */
strike = 0, /* hit this attack */
attk, /* attack attempted this time */
struck = 0, /* hit at least once */
res[NATTK]; /* results of all attacks */
@@ -354,6 +354,15 @@ register struct monst *magr, *mdef;
attk = 1;
switch (mattk->aatyp) {
case AT_WEAP: /* "hand to hand" attacks */
if (distmin(magr->mx, magr->my, mdef->mx, mdef->my) > 1) {
/* D: Do a ranged attack here! */
strike = thrwmm(magr, mdef);
if (DEADMONSTER(mdef))
res[i] = MM_DEF_DIED;
if (DEADMONSTER(magr))
res[i] |= MM_AGR_DIED;
break;
}
if (magr->weapon_check == NEED_WEAPON || !MON_WEP(magr)) {
magr->weapon_check = NEED_HTH_WEAPON;
if (mon_wield_item(magr) != 0)
@@ -377,7 +386,8 @@ register struct monst *magr, *mdef;
case AT_TENT:
/* Nymph that teleported away on first attack? */
if (distmin(magr->mx, magr->my, mdef->mx, mdef->my) > 1)
return MM_MISS;
/* Continue because the monster may have a ranged attack. */
continue;
/* Monsters won't attack cockatrices physically if they
* have a weapon instead. This instinct doesn't work for
* players, or under conflict or confusion.
@@ -426,6 +436,10 @@ register struct monst *magr, *mdef;
break;
case AT_EXPL:
/* D: Prevent explosions from a distance */
if (distmin(magr->mx,magr->my,mdef->mx,mdef->my) > 1)
continue;
res[i] = explmm(magr, mdef, mattk);
if (res[i] == MM_MISS) { /* cancelled--no attack */
strike = 0;
@@ -435,20 +449,49 @@ register struct monst *magr, *mdef;
break;
case AT_ENGL:
if (u.usteed && (mdef == u.usteed)) {
if (u.usteed && mdef == u.usteed) {
strike = 0;
break;
}
/* Engulfing attacks are directed at the hero if
* possible. -dlc
*/
/* D: Prevent engulf from a distance */
if (distmin(magr->mx, magr->my, mdef->mx, mdef->my) > 1)
continue;
/* Engulfing attacks are directed at the hero if possible. -dlc */
if (u.uswallow && magr == u.ustuck)
strike = 0;
else {
if ((strike = (tmp > rnd(20 + i))))
res[i] = gulpmm(magr, mdef, mattk);
else
missmm(magr, mdef, mattk);
else if ((strike = (tmp > rnd(20 + i))) != 0)
res[i] = gulpmm(magr, mdef, mattk);
else
missmm(magr, mdef, mattk);
break;
case AT_BREA:
if (!monnear(magr, mdef->mx, mdef->my)) {
strike = breamm(magr, mattk, mdef);
/* We don't really know if we hit or not; pretend we did. */
if (strike)
res[i] |= MM_HIT;
if (DEADMONSTER(mdef))
res[i] = MM_DEF_DIED;
if (DEADMONSTER(magr))
res[i] |= MM_AGR_DIED;
}
else
strike = 0;
break;
case AT_SPIT:
if (!monnear(magr, mdef->mx, mdef->my)) {
strike = spitmm(magr, mattk, mdef);
/* We don't really know if we hit or not; pretend we did. */
if (strike)
res[i] |= MM_HIT;
if (DEADMONSTER(mdef))
res[i] = MM_DEF_DIED;
if (DEADMONSTER(magr))
res[i] |= MM_AGR_DIED;
}
break;
@@ -458,12 +501,12 @@ register struct monst *magr, *mdef;
break;
}
if (attk && !(res[i] & MM_AGR_DIED))
if (attk && !(res[i] & MM_AGR_DIED)
&& distmin(magr->mx, magr->my, mdef->mx, mdef->my) <= 1)
res[i] = passivemm(magr, mdef, strike, res[i] & MM_DEF_DIED);
if (res[i] & MM_DEF_DIED)
return res[i];
if (res[i] & MM_AGR_DIED)
return res[i];
/* return if aggressor can no longer attack */
@@ -548,9 +591,8 @@ struct attack *mattk;
pline("%s %s...", buf, mon_nam(mdef));
}
if (magr->mcan || !magr->mcansee
|| (magr->minvis && !perceives(mdef->data)) || !mdef->mcansee
|| mdef->msleeping) {
if (magr->mcan || !magr->mcansee || !mdef->mcansee
|| (magr->minvis && !perceives(mdef->data)) || mdef->msleeping) {
if (vis)
pline("but nothing happens.");
return MM_MISS;
@@ -562,8 +604,8 @@ struct attack *mattk;
if (mdef->mcansee) {
if (mon_reflects(magr, (char *) 0)) {
if (canseemon(magr))
(void) mon_reflects(
magr, "The gaze is reflected away by %s %s.");
(void) mon_reflects(magr,
"The gaze is reflected away by %s %s.");
return MM_MISS;
}
if (mdef->minvis && !perceives(magr->data)) {
@@ -676,7 +718,7 @@ register struct attack *mattk;
} else if (status & MM_AGR_DIED) { /* aggressor died */
place_monster(mdef, dx, dy);
newsym(dx, dy);
} else { /* both alive, put them back */
} else { /* both alive, put them back */
if (cansee(dx, dy))
pline("%s is regurgitated!", Monnam(mdef));
@@ -930,11 +972,12 @@ register struct attack *mattk;
}
if (resists_acid(mdef)) {
if (vis)
pline("%s is covered in acid, but it seems harmless.",
pline("%s is covered in %s, but it seems harmless.",
hliquid("acid"),
Monnam(mdef));
tmp = 0;
} else if (vis) {
pline("%s is covered in acid!", Monnam(mdef));
pline("%s is covered in %s!", hliquid("acid"), Monnam(mdef));
pline("It burns %s!", mon_nam(mdef));
}
if (!rn2(30))
@@ -1127,6 +1170,7 @@ register struct attack *mattk;
*/
{
struct obj *gold = findgold(mdef->minvent);
if (!gold)
break;
obj_extract_self(gold);
@@ -1447,7 +1491,8 @@ int mdead;
if (mhit && !rn2(2)) {
Strcpy(buf, Monnam(magr));
if (canseemon(magr))
pline("%s is splashed by %s acid!", buf,
pline("%s is splashed by %s %s!", buf,
hliquid("acid"),
s_suffix(mon_nam(mdef)));
if (resists_acid(magr)) {
if (canseemon(magr))