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
|
||||
fix pile mark when picking up all-but-one items while invisible
|
||||
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
|
||||
|
||||
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. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -26,8 +26,8 @@ static int dieroll;
|
||||
|
||||
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;
|
||||
@@ -139,8 +139,8 @@ u_slow_down()
|
||||
/* 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) */
|
||||
@@ -225,17 +225,14 @@ boolean message;
|
||||
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;
|
||||
@@ -243,8 +240,9 @@ boolean message;
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -907,8 +905,8 @@ hitmu(mtmp, mattk)
|
||||
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;
|
||||
@@ -972,6 +970,7 @@ register struct attack *mattk;
|
||||
}
|
||||
} else { /* hand to hand weapon */
|
||||
struct obj *otmp = mon_currwep;
|
||||
|
||||
if (mattk->aatyp == AT_WEAP && otmp) {
|
||||
int tmp;
|
||||
|
||||
@@ -1177,7 +1176,7 @@ register struct attack *mattk;
|
||||
}
|
||||
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);
|
||||
|
||||
@@ -1718,13 +1717,13 @@ gulp_blnd_check()
|
||||
/* 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;
|
||||
|
||||
@@ -1769,6 +1768,7 @@ register struct attack *mattk;
|
||||
i = number_leashed();
|
||||
if (i > 0) {
|
||||
const char *s = (i > 1) ? "leashes" : "leash";
|
||||
|
||||
pline_The("%s %s loose.", s, vtense(s, "snap"));
|
||||
unleash_all();
|
||||
}
|
||||
@@ -1961,8 +1961,8 @@ register struct attack *mattk;
|
||||
/* 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;
|
||||
@@ -1976,8 +1976,8 @@ boolean ufound;
|
||||
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);
|
||||
|
||||
@@ -2059,8 +2059,8 @@ boolean ufound;
|
||||
/* 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] */
|
||||
@@ -2275,8 +2275,8 @@ register struct attack *mattk;
|
||||
/* 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) {
|
||||
@@ -2299,7 +2299,7 @@ could_seduce(magr, mdef, mattk)
|
||||
struct monst *magr, *mdef;
|
||||
struct attack *mattk;
|
||||
{
|
||||
register struct permonst *pagr;
|
||||
struct permonst *pagr;
|
||||
boolean agrinvis, defperc;
|
||||
xchar genagr, gendef;
|
||||
|
||||
@@ -2340,9 +2340,9 @@ struct attack *mattk;
|
||||
/* 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];
|
||||
@@ -2613,7 +2613,7 @@ register struct monst *mon;
|
||||
|
||||
STATIC_OVL void
|
||||
mayberem(obj, str)
|
||||
register struct obj *obj;
|
||||
struct obj *obj;
|
||||
const char *str;
|
||||
{
|
||||
char qbuf[QBUFSZ];
|
||||
@@ -2648,34 +2648,50 @@ const char *str;
|
||||
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;
|
||||
@@ -2729,9 +2745,9 @@ register struct attack *mattk;
|
||||
|
||||
/* 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();
|
||||
@@ -2828,7 +2844,7 @@ assess_dmg:
|
||||
struct monst *
|
||||
cloneu()
|
||||
{
|
||||
register struct monst *mon;
|
||||
struct monst *mon;
|
||||
int mndx = monsndx(youmonst.data);
|
||||
|
||||
if (u.mh <= 1)
|
||||
|
||||
Reference in New Issue
Block a user