fix github issue #275 - artifact life drain
A monster using Stormbringer or Staff of Aesculapius to drain life from another monster would heal the hero instead of the attacker.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.35 $ $NHDT-Date: 1577190687 2019/12/24 12:31:27 $
|
$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.39 $ $NHDT-Date: 1577662238 2019/12/29 23:30:38 $
|
||||||
|
|
||||||
General Fixes and Modified Features
|
General Fixes and Modified Features
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
@@ -24,6 +24,8 @@ worn meat ring shouldn't cause increased hunger; neither should fake Amulet
|
|||||||
worn +0 ring of protection should cause increased hunger if it is the only
|
worn +0 ring of protection should cause increased hunger if it is the only
|
||||||
source of extrinsic Protection
|
source of extrinsic Protection
|
||||||
fix accessing mons[-1] when monster figures out if a tin cures stoning
|
fix accessing mons[-1] when monster figures out if a tin cures stoning
|
||||||
|
monster wielding Stormbringer or healer's Staff against another monster would
|
||||||
|
heal the hero instead of the wielding monster when draining life
|
||||||
|
|
||||||
|
|
||||||
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
|
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.6 artifact.c $NHDT-Date: 1553363416 2019/03/23 17:50:16 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.129 $ */
|
/* NetHack 3.6 artifact.c $NHDT-Date: 1577662239 2019/12/29 23:30:39 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.152 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/*-Copyright (c) Robert Patrick Rankin, 2013. */
|
/*-Copyright (c) Robert Patrick Rankin, 2013. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
@@ -1322,7 +1322,8 @@ int dieroll; /* needed for Magicbane and vorpal blades */
|
|||||||
*dmgptr = 0;
|
*dmgptr = 0;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
if (noncorporeal(g.youmonst.data) || amorphous(g.youmonst.data)) {
|
if (noncorporeal(g.youmonst.data)
|
||||||
|
|| amorphous(g.youmonst.data)) {
|
||||||
pline("%s slices through your %s.", wepdesc,
|
pline("%s slices through your %s.", wepdesc,
|
||||||
body_part(NECK));
|
body_part(NECK));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -1351,6 +1352,7 @@ int dieroll; /* needed for Magicbane and vorpal blades */
|
|||||||
mon_nam(mdef));
|
mon_nam(mdef));
|
||||||
}
|
}
|
||||||
if (mdef->m_lev == 0) {
|
if (mdef->m_lev == 0) {
|
||||||
|
/* losing a level when at 0 is fatal */
|
||||||
*dmgptr = 2 * mdef->mhp + FATAL_DAMAGE_MODIFIER;
|
*dmgptr = 2 * mdef->mhp + FATAL_DAMAGE_MODIFIER;
|
||||||
} else {
|
} else {
|
||||||
int drain = monhp_per_lvl(mdef);
|
int drain = monhp_per_lvl(mdef);
|
||||||
@@ -1359,8 +1361,16 @@ int dieroll; /* needed for Magicbane and vorpal blades */
|
|||||||
mdef->mhpmax -= drain;
|
mdef->mhpmax -= drain;
|
||||||
mdef->m_lev--;
|
mdef->m_lev--;
|
||||||
drain /= 2;
|
drain /= 2;
|
||||||
if (drain)
|
if (drain) {
|
||||||
healup(drain, 0, FALSE, FALSE);
|
/* attacker heals in proportion to amount drained */
|
||||||
|
if (youattack) {
|
||||||
|
healup(drain, 0, FALSE, FALSE);
|
||||||
|
} else {
|
||||||
|
magr->mhp += drain;
|
||||||
|
if (magr->mhp > magr->mhpmax)
|
||||||
|
magr->mhp = magr->mhpmax;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return vis;
|
return vis;
|
||||||
} else { /* youdefend */
|
} else { /* youdefend */
|
||||||
|
|||||||
Reference in New Issue
Block a user