spell_damage_bonus (trunk only)

From the newsgroup:  player saw "The spell hits the <monster>?"
where the question mark punctuation reflected negative damage occurring.
Another player diagnosed it as a 2 point force bolt (from 2d12 dice role)
modified by -3 penalty for hero who has Int less than 10.  This changes
spell_damage_bonus() to avoid reducing damage below 1 point.
This commit is contained in:
nethack.rankin
2009-05-27 09:19:11 +00:00
parent 30f33ab92c
commit 2dfe3f45c1
4 changed files with 26 additions and 47 deletions

View File

@@ -320,6 +320,7 @@ prevent temple priests and minions from wearing helms of opposite alignment
pearl rings shouldn't rust pearl rings shouldn't rust
shouldn't be able to read a worn T-shirt when it's covered by a worn suit shouldn't be able to read a worn T-shirt when it's covered by a worn suit
simplify hero placement on Castle level when climbing up stairs from Valley simplify hero placement on Castle level when climbing up stairs from Valley
spell attack by low-Int hero could inflict negative damage
Platform- and/or Interface-Specific Fixes Platform- and/or Interface-Specific Fixes

View File

@@ -1,5 +1,4 @@
/* NetHack 3.5 extern.h $Date$ $Revision$ */ /* NetHack 3.5 extern.h $Date$ $Revision$ */
/* SCCS Id: @(#)extern.h 3.5 2009/01/20 */
/* Copyright (c) Steve Creps, 1988. */ /* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -2664,7 +2663,7 @@ E boolean FDECL(cancel_monst, (struct monst *,struct obj *,
E void NDECL(zapsetup); E void NDECL(zapsetup);
E void NDECL(zapwrapup); E void NDECL(zapwrapup);
E void FDECL(weffects, (struct obj *)); E void FDECL(weffects, (struct obj *));
E int NDECL(spell_damage_bonus); E int FDECL(spell_damage_bonus, (int));
E const char *FDECL(exclam, (int force)); E const char *FDECL(exclam, (int force));
E void FDECL(hit, (const char *,struct monst *,const char *)); E void FDECL(hit, (const char *,struct monst *,const char *));
E void FDECL(miss, (const char *,struct monst *)); E void FDECL(miss, (const char *,struct monst *));

View File

@@ -1,5 +1,4 @@
/* NetHack 3.5 spell.c $Date$ $Revision$ */ /* NetHack 3.5 spell.c $Date$ $Revision$ */
/* SCCS Id: @(#)spell.c 3.5 2007/05/29 */
/* Copyright (c) M. Stephenson 1988 */ /* Copyright (c) M. Stephenson 1988 */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -922,7 +921,7 @@ boolean atme;
} else { } else {
explode(u.dx, u.dy, explode(u.dx, u.dy,
pseudo->otyp - SPE_MAGIC_MISSILE + 10, pseudo->otyp - SPE_MAGIC_MISSILE + 10,
u.ulevel/2 + 1 + spell_damage_bonus(), 0, spell_damage_bonus(u.ulevel / 2 + 1), 0,
(pseudo->otyp == SPE_CONE_OF_COLD) ? (pseudo->otyp == SPE_CONE_OF_COLD) ?
EXPL_FROSTY : EXPL_FIERY); EXPL_FROSTY : EXPL_FIERY);
} }

View File

@@ -1,5 +1,4 @@
/* NetHack 3.5 zap.c $Date$ $Revision$ */ /* NetHack 3.5 zap.c $Date$ $Revision$ */
/* SCCS Id: @(#)zap.c 3.5 2008/10/14 */
/* 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. */
@@ -177,7 +176,7 @@ struct obj *otmp;
dmg = d(2,12); dmg = d(2,12);
if(dbldam) dmg *= 2; if(dbldam) dmg *= 2;
if (otyp == SPE_FORCE_BOLT) if (otyp == SPE_FORCE_BOLT)
dmg += spell_damage_bonus(); dmg = spell_damage_bonus(dmg);
hit(zap_type_text, mtmp, exclam(dmg)); hit(zap_type_text, mtmp, exclam(dmg));
(void) resist(mtmp, otmp->oclass, dmg, TELL); (void) resist(mtmp, otmp->oclass, dmg, TELL);
} else miss(zap_type_text, mtmp); } else miss(zap_type_text, mtmp);
@@ -212,7 +211,7 @@ struct obj *otmp;
dmg = rnd(8); dmg = rnd(8);
if(dbldam) dmg *= 2; if(dbldam) dmg *= 2;
if (otyp == SPE_TURN_UNDEAD) if (otyp == SPE_TURN_UNDEAD)
dmg += spell_damage_bonus(); dmg = spell_damage_bonus(dmg);
context.bypasses = TRUE; /* for make_corpse() */ context.bypasses = TRUE; /* for make_corpse() */
if (!resist(mtmp, otmp->oclass, dmg, NOTELL)) { if (!resist(mtmp, otmp->oclass, dmg, NOTELL)) {
if (mtmp->mhp > 0) monflee(mtmp, 0, FALSE, TRUE); if (mtmp->mhp > 0) monflee(mtmp, 0, FALSE, TRUE);
@@ -382,7 +381,7 @@ struct obj *otmp;
dmg = monhp_per_lvl(mtmp); dmg = monhp_per_lvl(mtmp);
if(dbldam) dmg *= 2; if(dbldam) dmg *= 2;
if (otyp == SPE_DRAIN_LIFE) if (otyp == SPE_DRAIN_LIFE)
dmg += spell_damage_bonus(); dmg = spell_damage_bonus(dmg);
if (resists_drli(mtmp)) if (resists_drli(mtmp))
shieldeff(mtmp->mx, mtmp->my); shieldeff(mtmp->mx, mtmp->my);
else if (!resist(mtmp, otmp->oclass, dmg, NOTELL) && else if (!resist(mtmp, otmp->oclass, dmg, NOTELL) &&
@@ -2773,28 +2772,29 @@ struct obj *obj;
return; return;
} }
/* /* augment damage for a spell dased on the hero's intelligence (and level) */
* Generate the to damage bonus for a spell. Based on the hero's intelligence
*/
int int
spell_damage_bonus() spell_damage_bonus(dmg)
int dmg; /* base amount to be adjusted by bonus or penalty */
{ {
int tmp, intell = ACURR(A_INT); int intell = ACURR(A_INT);
/* Punish low intellegence before low level else low intellegence /* Punish low intellegence before low level else low intellegence
gets punished only when high level */ gets punished only when high level */
if (intell < 10) if (intell <= 9) {
tmp = -3; /* -3 penalty, but never reduce combined amount below 1
else if (u.ulevel < 5) (if dmg is 0 for some reason, we're careful to leave it there) */
tmp = 0; if (dmg > 1) dmg = (dmg <= 3) ? 1 : dmg - 3;
else if (intell < 14) } else if (intell <= 13 || u.ulevel < 5)
tmp = 0; ; /* no bonus or penalty; dmg remains same */
else if (intell <= 18) else if (intell <= 18)
tmp = 1; dmg += 1;
else /* helm of brilliance */ else if (intell <= 24 || u.ulevel < 14)
tmp = 2; dmg += 2;
else
dmg += 3; /* Int 25 */
return tmp; return dmg;
} }
/* /*
@@ -3270,12 +3270,7 @@ struct obj **ootmp; /* to return worn armor for caller to disintegrate */
} }
tmp = d(nd,6); tmp = d(nd,6);
if (spellcaster) if (spellcaster)
tmp += spell_damage_bonus(); tmp = spell_damage_bonus(tmp);
#ifdef WIZ_PATCH_DEBUG
if (spellcaster)
pline("Damage = %d + %d", tmp-spell_damage_bonus(),
spell_damage_bonus());
#endif
break; break;
case ZT_FIRE: case ZT_FIRE:
if (resists_fire(mon)) { if (resists_fire(mon)) {
@@ -3285,12 +3280,7 @@ struct obj **ootmp; /* to return worn armor for caller to disintegrate */
tmp = d(nd,6); tmp = d(nd,6);
if (resists_cold(mon)) tmp += 7; if (resists_cold(mon)) tmp += 7;
if (spellcaster) if (spellcaster)
tmp += spell_damage_bonus(); tmp = spell_damage_bonus(tmp);
#ifdef WIZ_PATCH_DEBUG
if (spellcaster)
pline("Damage = %d + %d",tmp-spell_damage_bonus(),
spell_damage_bonus());
#endif
if (burnarmor(mon)) { if (burnarmor(mon)) {
if (!rn2(3)) (void)destroy_mitem(mon, POTION_CLASS, AD_FIRE); if (!rn2(3)) (void)destroy_mitem(mon, POTION_CLASS, AD_FIRE);
if (!rn2(3)) (void)destroy_mitem(mon, SCROLL_CLASS, AD_FIRE); if (!rn2(3)) (void)destroy_mitem(mon, SCROLL_CLASS, AD_FIRE);
@@ -3305,12 +3295,7 @@ struct obj **ootmp; /* to return worn armor for caller to disintegrate */
tmp = d(nd,6); tmp = d(nd,6);
if (resists_fire(mon)) tmp += d(nd, 3); if (resists_fire(mon)) tmp += d(nd, 3);
if (spellcaster) if (spellcaster)
tmp += spell_damage_bonus(); tmp = spell_damage_bonus(tmp);
#ifdef WIZ_PATCH_DEBUG
if (spellcaster)
pline("Damage = %d + %d", tmp-spell_damage_bonus(),
spell_damage_bonus());
#endif
if (!rn2(3)) (void)destroy_mitem(mon, POTION_CLASS, AD_COLD); if (!rn2(3)) (void)destroy_mitem(mon, POTION_CLASS, AD_COLD);
break; break;
case ZT_SLEEP: case ZT_SLEEP:
@@ -3372,12 +3357,7 @@ struct obj **ootmp; /* to return worn armor for caller to disintegrate */
} else } else
tmp = d(nd,6); tmp = d(nd,6);
if (spellcaster) if (spellcaster)
tmp += spell_damage_bonus(); tmp = spell_damage_bonus(tmp);
#ifdef WIZ_PATCH_DEBUG
if (spellcaster)
pline("Damage = %d + %d", tmp-spell_damage_bonus(),
spell_damage_bonus());
#endif
if (!resists_blnd(mon) && if (!resists_blnd(mon) &&
!(type > 0 && u.uswallow && mon == u.ustuck)) { !(type > 0 && u.uswallow && mon == u.ustuck)) {
register unsigned rnd_tmp = rnd(50); register unsigned rnd_tmp = rnd(50);