-/* NetHack 3.6 mhitu.c $NHDT-Date: 1496619132 2017/06/04 23:32:12 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.146 $ */
+/* NetHack 3.6 mhitu.c $NHDT-Date: 1505001092 2017/09/09 23:51:32 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.147 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
STATIC_OVL void
hitmsg(mtmp, mattk)
-register struct monst *mtmp;
-register struct attack *mattk;
+struct monst *mtmp;
+struct attack *mattk;
{
int compat;
const char *pfmt = 0;
/* monster attacked your displaced image */
STATIC_OVL void
wildmiss(mtmp, mattk)
-register struct monst *mtmp;
-register struct attack *mattk;
+struct monst *mtmp;
+struct attack *mattk;
{
int compat;
const char *Monst_name; /* Monnam(mtmp) */
You("get regurgitated!");
} else {
char blast[40];
- register int i;
+ struct attack *attk = attacktype_fordmg(mdat, AT_ENGL, AD_ANY);
blast[0] = '\0';
- for (i = 0; i < NATTK; i++)
- if (mdat->mattk[i].aatyp == AT_ENGL)
- break;
- if (mdat->mattk[i].aatyp != AT_ENGL) {
+ if (!attk) {
impossible("Swallower has no engulfing attack?");
} else {
if (is_whirly(mdat)) {
- switch (mdat->mattk[i].adtyp) {
+ switch (attk->adtyp) {
case AD_ELEC:
Strcpy(blast, " in a shower of sparks");
break;
Strcpy(blast, " in a blast of frost");
break;
}
- } else
+ } else {
Strcpy(blast, " with a squelch");
+ }
You("get expelled from %s%s!", mon_nam(mtmp), blast);
}
}
register struct monst *mtmp;
register struct attack *mattk;
{
- register struct permonst *mdat = mtmp->data;
- register int uncancelled, ptmp;
+ struct permonst *mdat = mtmp->data;
+ int uncancelled, ptmp;
int dmg, armpro, permdmg;
char buf[BUFSZ];
struct permonst *olduasmon = youmonst.data;
}
} else { /* hand to hand weapon */
struct obj *otmp = mon_currwep;
+
if (mattk->aatyp == AT_WEAP && otmp) {
int tmp;
}
break;
case AD_LEGS: {
- register long side = rn2(2) ? RIGHT_SIDE : LEFT_SIDE;
+ long side = rn2(2) ? RIGHT_SIDE : LEFT_SIDE;
const char *sidestr = (side == RIGHT_SIDE) ? "right" : "left",
*Monst_name = Monnam(mtmp), *leg = body_part(LEG);
/* monster swallows you, or damage if u.uswallow */
STATIC_OVL int
gulpmu(mtmp, mattk)
-register struct monst *mtmp;
-register struct attack *mattk;
+struct monst *mtmp;
+struct attack *mattk;
{
struct trap *t = t_at(u.ux, u.uy);
int tmp = d((int) mattk->damn, (int) mattk->damd);
int tim_tmp;
- register struct obj *otmp2;
+ struct obj *otmp2;
int i;
boolean physical_damage = FALSE;
i = number_leashed();
if (i > 0) {
const char *s = (i > 1) ? "leashes" : "leash";
+
pline_The("%s %s loose.", s, vtense(s, "snap"));
unleash_all();
}
/* monster explodes in your face */
STATIC_OVL int
explmu(mtmp, mattk, ufound)
-register struct monst *mtmp;
-register struct attack *mattk;
+struct monst *mtmp;
+struct attack *mattk;
boolean ufound;
{
boolean physical_damage = TRUE, kill_agr = TRUE;
levl[mtmp->mux][mtmp->muy].typ == WATER ? "empty water"
: "thin air");
else {
- register int tmp = d((int) mattk->damn, (int) mattk->damd);
- register boolean not_affected = defends((int) mattk->adtyp, uwep);
+ int tmp = d((int) mattk->damn, (int) mattk->damd);
+ boolean not_affected = defends((int) mattk->adtyp, uwep);
hitmsg(mtmp, mattk);
/* monster gazes at you */
int
gazemu(mtmp, mattk)
-register struct monst *mtmp;
-register struct attack *mattk;
+struct monst *mtmp;
+struct attack *mattk;
{
static const char *const reactions[] = {
"confused", /* [0] */
/* mtmp hits you for n points damage */
void
mdamageu(mtmp, n)
-register struct monst *mtmp;
-register int n;
+struct monst *mtmp;
+int n;
{
context.botl = 1;
if (Upolyd) {
struct monst *magr, *mdef;
struct attack *mattk;
{
- register struct permonst *pagr;
+ struct permonst *pagr;
boolean agrinvis, defperc;
xchar genagr, gendef;
/* Returns 1 if monster teleported */
int
doseduce(mon)
-register struct monst *mon;
+struct monst *mon;
{
- register struct obj *ring, *nring;
+ struct obj *ring, *nring;
boolean fem = (mon->data == &mons[PM_SUCCUBUS]); /* otherwise incubus */
int attr_tot, tried_gloves = 0;
char qbuf[QBUFSZ];
STATIC_OVL void
mayberem(obj, str)
-register struct obj *obj;
+struct obj *obj;
const char *str;
{
char qbuf[QBUFSZ];
remove_worn_item(obj, TRUE);
}
+/* FIXME:
+ * sequencing issue: a monster's attack might cause poly'd hero
+ * to revert to normal form. The messages for passive counterattack
+ * would look better if they came before reverting form, but we need
+ * to know whether hero reverted in order to decide whether passive
+ * damage applies.
+ */
STATIC_OVL int
passiveum(olduasmon, mtmp, mattk)
struct permonst *olduasmon;
-register struct monst *mtmp;
-register struct attack *mattk;
+struct monst *mtmp;
+struct attack *mattk;
{
int i, tmp;
+ struct attack *oldu_mattk = 0;
- for (i = 0;; i++) {
+ /*
+ * mattk == mtmp's attack that hit you;
+ * oldu_mattk == your passive counterattack (even if mtmp's attack
+ * has already caused you to revert to normal form).
+ */
+ for (i = 0; !oldu_mattk; i++) {
if (i >= NATTK)
return 1;
if (olduasmon->mattk[i].aatyp == AT_NONE
|| olduasmon->mattk[i].aatyp == AT_BOOM)
- break;
+ oldu_mattk = &olduasmon->mattk[i];
}
- if (olduasmon->mattk[i].damn)
- tmp =
- d((int) olduasmon->mattk[i].damn, (int) olduasmon->mattk[i].damd);
- else if (olduasmon->mattk[i].damd)
- tmp = d((int) olduasmon->mlevel + 1, (int) olduasmon->mattk[i].damd);
+ if (oldu_mattk->damn)
+ tmp = d((int) oldu_mattk->damn, (int) oldu_mattk->damd);
+ else if (oldu_mattk->damd)
+ tmp = d((int) olduasmon->mlevel + 1, (int) oldu_mattk->damd);
else
tmp = 0;
/* These affect the enemy even if you were "killed" (rehumanized) */
- switch (olduasmon->mattk[i].adtyp) {
+ switch (oldu_mattk->adtyp) {
case AD_ACID:
if (!rn2(2)) {
- pline("%s is splashed by your %s!", Monnam(mtmp), hliquid("acid"));
+ pline("%s is splashed by %s%s!", Monnam(mtmp),
+ /* temporary? hack for sequencing issue: "your acid"
+ looks strange coming immediately after player has
+ been told that hero has reverted to normal form */
+ !Upolyd ? "" : "your ", hliquid("acid"));
if (resists_acid(mtmp)) {
pline("%s is not affected.", Monnam(mtmp));
tmp = 0;
/* These affect the enemy only if you are still a monster */
if (rn2(3))
- switch (youmonst.data->mattk[i].adtyp) {
+ switch (oldu_mattk->adtyp) {
case AD_PHYS:
- if (youmonst.data->mattk[i].aatyp == AT_BOOM) {
+ if (oldu_mattk->aatyp == AT_BOOM) {
You("explode!");
/* KMH, balance patch -- this is okay with unchanging */
rehumanize();
struct monst *
cloneu()
{
- register struct monst *mon;
+ struct monst *mon;
int mndx = monsndx(youmonst.data);
if (u.mh <= 1)