Band-Aid (tm) for #H5091 - old passive attack
Change the wording slightly if the hero simultaneously (in theory) reverts to normal form and splahes acid on his/her attacker. Giving the passive counterattack message first would be better, but several types of counterattacks need to know in advance whether the hero has reverted, producing a chicken-vs-egg seqeuncing situation. I also took out 'register' directives from a bunch of declarations since they'd been pretty much applied blindly rather than in circumstances where someone evaluated the situation and decided that they might matter.
This commit is contained in:
@@ -421,6 +421,11 @@ add database entry for "martial arts"
|
|||||||
starting inventory for rogues specified +9 lock pick, where +/-N is meaningless
|
starting inventory for rogues specified +9 lock pick, where +/-N is meaningless
|
||||||
fix pile mark when picking up all-but-one items while invisible
|
fix pile mark when picking up all-but-one items while invisible
|
||||||
improve config file error reporting
|
improve config file error reporting
|
||||||
|
when polymorphed into something with a passive counterattack, being 'killed'
|
||||||
|
and returning to normal form allows a subset of counterattacks to
|
||||||
|
continue after telling the player than the hero has reverted; change
|
||||||
|
"Mon is splashed by your acid" to "Mon is splashed by acid" in that
|
||||||
|
situation so that the message sequence doesn't look quite so strange
|
||||||
|
|
||||||
|
|
||||||
Fixes to Post-3.6.0 Problems that Were Exposed Via git Repository
|
Fixes to Post-3.6.0 Problems that Were Exposed Via git Repository
|
||||||
|
|||||||
104
src/mhitu.c
104
src/mhitu.c
@@ -1,4 +1,4 @@
|
|||||||
/* 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. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -26,8 +26,8 @@ static int dieroll;
|
|||||||
|
|
||||||
STATIC_OVL void
|
STATIC_OVL void
|
||||||
hitmsg(mtmp, mattk)
|
hitmsg(mtmp, mattk)
|
||||||
register struct monst *mtmp;
|
struct monst *mtmp;
|
||||||
register struct attack *mattk;
|
struct attack *mattk;
|
||||||
{
|
{
|
||||||
int compat;
|
int compat;
|
||||||
const char *pfmt = 0;
|
const char *pfmt = 0;
|
||||||
@@ -139,8 +139,8 @@ u_slow_down()
|
|||||||
/* monster attacked your displaced image */
|
/* monster attacked your displaced image */
|
||||||
STATIC_OVL void
|
STATIC_OVL void
|
||||||
wildmiss(mtmp, mattk)
|
wildmiss(mtmp, mattk)
|
||||||
register struct monst *mtmp;
|
struct monst *mtmp;
|
||||||
register struct attack *mattk;
|
struct attack *mattk;
|
||||||
{
|
{
|
||||||
int compat;
|
int compat;
|
||||||
const char *Monst_name; /* Monnam(mtmp) */
|
const char *Monst_name; /* Monnam(mtmp) */
|
||||||
@@ -225,17 +225,14 @@ boolean message;
|
|||||||
You("get regurgitated!");
|
You("get regurgitated!");
|
||||||
} else {
|
} else {
|
||||||
char blast[40];
|
char blast[40];
|
||||||
register int i;
|
struct attack *attk = attacktype_fordmg(mdat, AT_ENGL, AD_ANY);
|
||||||
|
|
||||||
blast[0] = '\0';
|
blast[0] = '\0';
|
||||||
for (i = 0; i < NATTK; i++)
|
if (!attk) {
|
||||||
if (mdat->mattk[i].aatyp == AT_ENGL)
|
|
||||||
break;
|
|
||||||
if (mdat->mattk[i].aatyp != AT_ENGL) {
|
|
||||||
impossible("Swallower has no engulfing attack?");
|
impossible("Swallower has no engulfing attack?");
|
||||||
} else {
|
} else {
|
||||||
if (is_whirly(mdat)) {
|
if (is_whirly(mdat)) {
|
||||||
switch (mdat->mattk[i].adtyp) {
|
switch (attk->adtyp) {
|
||||||
case AD_ELEC:
|
case AD_ELEC:
|
||||||
Strcpy(blast, " in a shower of sparks");
|
Strcpy(blast, " in a shower of sparks");
|
||||||
break;
|
break;
|
||||||
@@ -243,8 +240,9 @@ boolean message;
|
|||||||
Strcpy(blast, " in a blast of frost");
|
Strcpy(blast, " in a blast of frost");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
Strcpy(blast, " with a squelch");
|
Strcpy(blast, " with a squelch");
|
||||||
|
}
|
||||||
You("get expelled from %s%s!", mon_nam(mtmp), blast);
|
You("get expelled from %s%s!", mon_nam(mtmp), blast);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -907,8 +905,8 @@ hitmu(mtmp, mattk)
|
|||||||
register struct monst *mtmp;
|
register struct monst *mtmp;
|
||||||
register struct attack *mattk;
|
register struct attack *mattk;
|
||||||
{
|
{
|
||||||
register struct permonst *mdat = mtmp->data;
|
struct permonst *mdat = mtmp->data;
|
||||||
register int uncancelled, ptmp;
|
int uncancelled, ptmp;
|
||||||
int dmg, armpro, permdmg;
|
int dmg, armpro, permdmg;
|
||||||
char buf[BUFSZ];
|
char buf[BUFSZ];
|
||||||
struct permonst *olduasmon = youmonst.data;
|
struct permonst *olduasmon = youmonst.data;
|
||||||
@@ -972,6 +970,7 @@ register struct attack *mattk;
|
|||||||
}
|
}
|
||||||
} else { /* hand to hand weapon */
|
} else { /* hand to hand weapon */
|
||||||
struct obj *otmp = mon_currwep;
|
struct obj *otmp = mon_currwep;
|
||||||
|
|
||||||
if (mattk->aatyp == AT_WEAP && otmp) {
|
if (mattk->aatyp == AT_WEAP && otmp) {
|
||||||
int tmp;
|
int tmp;
|
||||||
|
|
||||||
@@ -1177,7 +1176,7 @@ register struct attack *mattk;
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AD_LEGS: {
|
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",
|
const char *sidestr = (side == RIGHT_SIDE) ? "right" : "left",
|
||||||
*Monst_name = Monnam(mtmp), *leg = body_part(LEG);
|
*Monst_name = Monnam(mtmp), *leg = body_part(LEG);
|
||||||
|
|
||||||
@@ -1718,13 +1717,13 @@ gulp_blnd_check()
|
|||||||
/* monster swallows you, or damage if u.uswallow */
|
/* monster swallows you, or damage if u.uswallow */
|
||||||
STATIC_OVL int
|
STATIC_OVL int
|
||||||
gulpmu(mtmp, mattk)
|
gulpmu(mtmp, mattk)
|
||||||
register struct monst *mtmp;
|
struct monst *mtmp;
|
||||||
register struct attack *mattk;
|
struct attack *mattk;
|
||||||
{
|
{
|
||||||
struct trap *t = t_at(u.ux, u.uy);
|
struct trap *t = t_at(u.ux, u.uy);
|
||||||
int tmp = d((int) mattk->damn, (int) mattk->damd);
|
int tmp = d((int) mattk->damn, (int) mattk->damd);
|
||||||
int tim_tmp;
|
int tim_tmp;
|
||||||
register struct obj *otmp2;
|
struct obj *otmp2;
|
||||||
int i;
|
int i;
|
||||||
boolean physical_damage = FALSE;
|
boolean physical_damage = FALSE;
|
||||||
|
|
||||||
@@ -1769,6 +1768,7 @@ register struct attack *mattk;
|
|||||||
i = number_leashed();
|
i = number_leashed();
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
const char *s = (i > 1) ? "leashes" : "leash";
|
const char *s = (i > 1) ? "leashes" : "leash";
|
||||||
|
|
||||||
pline_The("%s %s loose.", s, vtense(s, "snap"));
|
pline_The("%s %s loose.", s, vtense(s, "snap"));
|
||||||
unleash_all();
|
unleash_all();
|
||||||
}
|
}
|
||||||
@@ -1961,8 +1961,8 @@ register struct attack *mattk;
|
|||||||
/* monster explodes in your face */
|
/* monster explodes in your face */
|
||||||
STATIC_OVL int
|
STATIC_OVL int
|
||||||
explmu(mtmp, mattk, ufound)
|
explmu(mtmp, mattk, ufound)
|
||||||
register struct monst *mtmp;
|
struct monst *mtmp;
|
||||||
register struct attack *mattk;
|
struct attack *mattk;
|
||||||
boolean ufound;
|
boolean ufound;
|
||||||
{
|
{
|
||||||
boolean physical_damage = TRUE, kill_agr = TRUE;
|
boolean physical_damage = TRUE, kill_agr = TRUE;
|
||||||
@@ -1976,8 +1976,8 @@ boolean ufound;
|
|||||||
levl[mtmp->mux][mtmp->muy].typ == WATER ? "empty water"
|
levl[mtmp->mux][mtmp->muy].typ == WATER ? "empty water"
|
||||||
: "thin air");
|
: "thin air");
|
||||||
else {
|
else {
|
||||||
register int tmp = d((int) mattk->damn, (int) mattk->damd);
|
int tmp = d((int) mattk->damn, (int) mattk->damd);
|
||||||
register boolean not_affected = defends((int) mattk->adtyp, uwep);
|
boolean not_affected = defends((int) mattk->adtyp, uwep);
|
||||||
|
|
||||||
hitmsg(mtmp, mattk);
|
hitmsg(mtmp, mattk);
|
||||||
|
|
||||||
@@ -2059,8 +2059,8 @@ boolean ufound;
|
|||||||
/* monster gazes at you */
|
/* monster gazes at you */
|
||||||
int
|
int
|
||||||
gazemu(mtmp, mattk)
|
gazemu(mtmp, mattk)
|
||||||
register struct monst *mtmp;
|
struct monst *mtmp;
|
||||||
register struct attack *mattk;
|
struct attack *mattk;
|
||||||
{
|
{
|
||||||
static const char *const reactions[] = {
|
static const char *const reactions[] = {
|
||||||
"confused", /* [0] */
|
"confused", /* [0] */
|
||||||
@@ -2275,8 +2275,8 @@ register struct attack *mattk;
|
|||||||
/* mtmp hits you for n points damage */
|
/* mtmp hits you for n points damage */
|
||||||
void
|
void
|
||||||
mdamageu(mtmp, n)
|
mdamageu(mtmp, n)
|
||||||
register struct monst *mtmp;
|
struct monst *mtmp;
|
||||||
register int n;
|
int n;
|
||||||
{
|
{
|
||||||
context.botl = 1;
|
context.botl = 1;
|
||||||
if (Upolyd) {
|
if (Upolyd) {
|
||||||
@@ -2299,7 +2299,7 @@ could_seduce(magr, mdef, mattk)
|
|||||||
struct monst *magr, *mdef;
|
struct monst *magr, *mdef;
|
||||||
struct attack *mattk;
|
struct attack *mattk;
|
||||||
{
|
{
|
||||||
register struct permonst *pagr;
|
struct permonst *pagr;
|
||||||
boolean agrinvis, defperc;
|
boolean agrinvis, defperc;
|
||||||
xchar genagr, gendef;
|
xchar genagr, gendef;
|
||||||
|
|
||||||
@@ -2340,9 +2340,9 @@ struct attack *mattk;
|
|||||||
/* Returns 1 if monster teleported */
|
/* Returns 1 if monster teleported */
|
||||||
int
|
int
|
||||||
doseduce(mon)
|
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 */
|
boolean fem = (mon->data == &mons[PM_SUCCUBUS]); /* otherwise incubus */
|
||||||
int attr_tot, tried_gloves = 0;
|
int attr_tot, tried_gloves = 0;
|
||||||
char qbuf[QBUFSZ];
|
char qbuf[QBUFSZ];
|
||||||
@@ -2613,7 +2613,7 @@ register struct monst *mon;
|
|||||||
|
|
||||||
STATIC_OVL void
|
STATIC_OVL void
|
||||||
mayberem(obj, str)
|
mayberem(obj, str)
|
||||||
register struct obj *obj;
|
struct obj *obj;
|
||||||
const char *str;
|
const char *str;
|
||||||
{
|
{
|
||||||
char qbuf[QBUFSZ];
|
char qbuf[QBUFSZ];
|
||||||
@@ -2648,34 +2648,50 @@ const char *str;
|
|||||||
remove_worn_item(obj, TRUE);
|
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
|
STATIC_OVL int
|
||||||
passiveum(olduasmon, mtmp, mattk)
|
passiveum(olduasmon, mtmp, mattk)
|
||||||
struct permonst *olduasmon;
|
struct permonst *olduasmon;
|
||||||
register struct monst *mtmp;
|
struct monst *mtmp;
|
||||||
register struct attack *mattk;
|
struct attack *mattk;
|
||||||
{
|
{
|
||||||
int i, tmp;
|
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)
|
if (i >= NATTK)
|
||||||
return 1;
|
return 1;
|
||||||
if (olduasmon->mattk[i].aatyp == AT_NONE
|
if (olduasmon->mattk[i].aatyp == AT_NONE
|
||||||
|| olduasmon->mattk[i].aatyp == AT_BOOM)
|
|| olduasmon->mattk[i].aatyp == AT_BOOM)
|
||||||
break;
|
oldu_mattk = &olduasmon->mattk[i];
|
||||||
}
|
}
|
||||||
if (olduasmon->mattk[i].damn)
|
if (oldu_mattk->damn)
|
||||||
tmp =
|
tmp = d((int) oldu_mattk->damn, (int) oldu_mattk->damd);
|
||||||
d((int) olduasmon->mattk[i].damn, (int) olduasmon->mattk[i].damd);
|
else if (oldu_mattk->damd)
|
||||||
else if (olduasmon->mattk[i].damd)
|
tmp = d((int) olduasmon->mlevel + 1, (int) oldu_mattk->damd);
|
||||||
tmp = d((int) olduasmon->mlevel + 1, (int) olduasmon->mattk[i].damd);
|
|
||||||
else
|
else
|
||||||
tmp = 0;
|
tmp = 0;
|
||||||
|
|
||||||
/* These affect the enemy even if you were "killed" (rehumanized) */
|
/* These affect the enemy even if you were "killed" (rehumanized) */
|
||||||
switch (olduasmon->mattk[i].adtyp) {
|
switch (oldu_mattk->adtyp) {
|
||||||
case AD_ACID:
|
case AD_ACID:
|
||||||
if (!rn2(2)) {
|
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)) {
|
if (resists_acid(mtmp)) {
|
||||||
pline("%s is not affected.", Monnam(mtmp));
|
pline("%s is not affected.", Monnam(mtmp));
|
||||||
tmp = 0;
|
tmp = 0;
|
||||||
@@ -2729,9 +2745,9 @@ register struct attack *mattk;
|
|||||||
|
|
||||||
/* These affect the enemy only if you are still a monster */
|
/* These affect the enemy only if you are still a monster */
|
||||||
if (rn2(3))
|
if (rn2(3))
|
||||||
switch (youmonst.data->mattk[i].adtyp) {
|
switch (oldu_mattk->adtyp) {
|
||||||
case AD_PHYS:
|
case AD_PHYS:
|
||||||
if (youmonst.data->mattk[i].aatyp == AT_BOOM) {
|
if (oldu_mattk->aatyp == AT_BOOM) {
|
||||||
You("explode!");
|
You("explode!");
|
||||||
/* KMH, balance patch -- this is okay with unchanging */
|
/* KMH, balance patch -- this is okay with unchanging */
|
||||||
rehumanize();
|
rehumanize();
|
||||||
@@ -2828,7 +2844,7 @@ assess_dmg:
|
|||||||
struct monst *
|
struct monst *
|
||||||
cloneu()
|
cloneu()
|
||||||
{
|
{
|
||||||
register struct monst *mon;
|
struct monst *mon;
|
||||||
int mndx = monsndx(youmonst.data);
|
int mndx = monsndx(youmonst.data);
|
||||||
|
|
||||||
if (u.mh <= 1)
|
if (u.mh <= 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user