drain energy attack (trunk only)

During some recent newsgroup discussion, <Someone> posted an entry from
his personal bug list:  energy draining damage from ordinary attacks is
implemented even though there are no monsters with that capability and it
was not implemented for engulf attacks even though energy vortices have
the capability.  This implements energy drain engulf attacks against the
hero and also both modes of energy drain attacks for monsters and poly'd
hero against spellcasting monsters.  Since monsters don't have energy,
they lose access to their special abilities (their spells, that is) for a
few turns, same as a post-3.4.3 change done for anti-magic traps.
This commit is contained in:
nethack.rankin
2007-12-20 23:02:47 +00:00
parent 67d5fb1481
commit d0a7d15023
7 changed files with 48 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)mhitm.c 3.5 2007/04/02 */
/* SCCS Id: @(#)mhitm.c 3.5 2007/12/19 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1121,6 +1121,11 @@ mdamagem(magr, mdef, mattk)
}
tmp = 0;
break;
case AD_DREN:
if (!cancelled && !rn2(4))
xdrainenergym(mdef, vis && mattk->aatyp != AT_ENGL);
tmp = 0;
break;
case AD_DRST:
case AD_DRDX:
case AD_DRCO:
@@ -1449,6 +1454,19 @@ int mdead;
return (mdead | mhit);
}
/* hero or monster has successfully hit target mon with drain energy attack */
void
xdrainenergym(mon, givemsg)
struct monst *mon;
boolean givemsg;
{
if (mon->mspec_used < 20 && /* limit draining */
(attacktype(mon->data, AT_MAGC) || attacktype(mon->data, AT_BREA))) {
mon->mspec_used += d(2, 2);
if (givemsg) pline("%s seems lethargic.", Monnam(mon));
}
}
/* "aggressive defense"; what type of armor prevents specified attack
from touching its target? */
long