Unify boulder dropping on player

... and if you're swallowed, make the dropped boulder hit the monster.
(Changes from UnNetHack)
This commit is contained in:
Pasi Kallinen
2015-04-22 20:22:51 +03:00
parent ed164ad324
commit 5a42ce4040
3 changed files with 62 additions and 71 deletions

View File

@@ -1359,41 +1359,8 @@ struct monst *mtmp;
m_useup(mtmp, otmp);
/* Attack the player */
if (distmin(mmx, mmy, u.ux, u.uy) == 1 && !otmp->cursed) {
int dmg;
struct obj *otmp2;
/* Okay, _you_ write this without repeating the code */
otmp2 = mksobj(confused ? ROCK : BOULDER,
FALSE, FALSE);
if (!otmp2) goto xxx_noobj; /* Shouldn't happen */
otmp2->quan = confused ? rn1(5,2) : 1;
otmp2->owt = weight(otmp2);
if (!amorphous(youmonst.data) &&
!Passes_walls &&
!noncorporeal(youmonst.data) &&
!unsolid(youmonst.data)) {
You("are hit by %s!", doname(otmp2));
dmg = dmgval(otmp2, &youmonst) * otmp2->quan;
if (uarmh) {
if(is_metallic(uarmh)) {
pline("Fortunately, you are wearing a hard helmet.");
if (dmg > 2) dmg = 2;
} else if (flags.verbose) {
pline("%s does not protect you.",
Yname2(uarmh));
}
}
} else
dmg = 0;
if (!flooreffects(otmp2, u.ux, u.uy, "fall")) {
place_object(otmp2, u.ux, u.uy);
stackobj(otmp2);
newsym(u.ux, u.uy);
}
if (dmg) losehp(Maybe_Half_Phys(dmg), "scroll of earth",
KILLED_BY_AN);
drop_boulder_on_player(confused, !otmp->cursed, FALSE, TRUE);
}
xxx_noobj:
return (mtmp->mhp <= 0) ? 1 : 2;
}