From: nethack.rankin Date: Tue, 15 Mar 2011 02:25:28 +0000 (+0000) Subject: high level monster spell casting (trunk only) X-Git-Tag: MOVE2GIT~228 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fa94c173af386c74bdbc438e2162410eaf149fa9;p=nethack high level monster spell casting (trunk only) Mage-spell casters higher than level 23 and cleric-spell casters higher than level 13 became less and less likely to cast interesting spells as level went higher, more and more likely to cast the default psi-bolt or open wounds. [Level 21 caster had 4.75% chance to cast touch of death; level 22, 9%; level 23, 13% chance; then level 24, 12.5%; level 25, 12%; level 30, 10%; level 50 (demon lords/princes), only 6%.] This oddity in spell selection meant that the Wizard of Yendor gradually became less likely to use "double trouble" to clone himself as he got killed off more times and his next incarnation arrived at higher level. This fix makes high level casters who pick too-high spell usually retry until they get a valid one instead of just reverting to the default. Still slightly biased towards psi-bolt and open wounds, since they're effective even though a bit boring. --- diff --git a/doc/fixes35.0 b/doc/fixes35.0 index f28312985..f1095ecde 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -348,6 +348,8 @@ enhance life-saving by preventing subsequent poison from being fatal upon don't create mail daemons when populating special levels with random demons teleport control and polymorph control are ineffective while hero is stunned don't report "fried to a crisp" for disintegration from divine wrath +spellcasting monsters' spell selection became less likely to choose harder + spells as their level got higher (including Wizard's "double trouble") Platform- and/or Interface-Specific Fixes diff --git a/src/mcastu.c b/src/mcastu.c index 1f049120c..dc02b28a9 100644 --- a/src/mcastu.c +++ b/src/mcastu.c @@ -1,5 +1,4 @@ /* NetHack 3.5 mcastu.c $Date$ $Revision$ */ -/* SCCS Id: @(#)mcastu.c 3.5 2005/03/19 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -76,7 +75,14 @@ STATIC_OVL int choose_magic_spell(spellval) int spellval; { + /* for 3.4.3 and earlier, val greater than 22 selected the default spell */ + while (spellval > 24 && rn2(25)) spellval = rn2(spellval); + switch (spellval) { + case 24: + case 23: + if (Antimagic || Hallucination) return MGC_PSI_BOLT; + /* else FALL THROUGH */ case 22: case 21: case 20: @@ -121,7 +127,14 @@ STATIC_OVL int choose_clerical_spell(spellnum) int spellnum; { + /* for 3.4.3 and earlier, num greater than 13 selected the default spell */ + while (spellnum > 15 && rn2(16)) spellnum = rn2(spellnum); + switch (spellnum) { + case 15: + case 14: + if (rn2(3)) return CLC_OPEN_WOUNDS; + /* else FALL THROUGH */ case 13: return CLC_GEYSER; case 12: