MCPcopy Create free account
hub / github.com/NetHack/NetHack / spell_damage_bonus

Function spell_damage_bonus

src/zap.c:3479–3502  ·  view source on GitHub ↗

augment damage for a spell based on the hero's intelligence (and level) */

Source from the content-addressed store, hash-verified

3477
3478/* augment damage for a spell based on the hero's intelligence (and level) */
3479int
3480spell_damage_bonus(
3481 int dmg) /* base amount to be adjusted by bonus or penalty */
3482{
3483 int intell = ACURR(A_INT);
3484
3485 /* Punish low intelligence before low level else low intelligence
3486 gets punished only when high level */
3487 if (intell <= 9) {
3488 /* -3 penalty, but never reduce combined amount below 1
3489 (if dmg is 0 for some reason, we're careful to leave it there) */
3490 if (dmg > 1)
3491 dmg = (dmg <= 3) ? 1 : dmg - 3;
3492 } else if (intell <= 13 || u.ulevel < 5)
3493 ; /* no bonus or penalty; dmg remains same */
3494 else if (intell <= 18)
3495 dmg += 1;
3496 else if (intell <= 24 || u.ulevel < 14)
3497 dmg += 2;
3498 else
3499 dmg += 3; /* Int 25 */
3500
3501 return dmg;
3502}
3503
3504/*
3505 * Generate the to-hit bonus for a spell. Based on the hero's skill in

Callers 3

bhitmFunction · 0.85
zhitmFunction · 0.85
spelleffectsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected