From 78f7df9a5178c6c7a492b3bbab0848b79117bcdc Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Tue, 22 Feb 2022 11:32:04 +0200 Subject: [PATCH] Casting a forgotten spell uses some random amount of power ... in addition to the confusion/stunning it does. --- doc/fixes3-7-0.txt | 1 + src/spell.c | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 15bc41d8b..8449db7a1 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -806,6 +806,7 @@ chargeable rings have a chance of getting charged when hit with electricity flint and hard gems break less often when thrown hobbits getting a sling also get some ammo for it elves and rangers get alignment penalty for cutting down trees +casting a forgotten spell uses some random amount of power Fixes to 3.7.0-x Problems that Were Exposed Via git Repository diff --git a/src/spell.c b/src/spell.c index 457405d4c..034794b90 100644 --- a/src/spell.c +++ b/src/spell.c @@ -919,6 +919,12 @@ spelleffects(int spell, boolean atme) return ECMD_OK; /* no time elapses */ } + /* + * Note: dotele() also calculates energy use and checks nutrition + * and strength requirements; it any of these change, update it too. + */ + energy = (spellev(spell) * 5); /* 5 <= energy <= 35 */ + /* * Spell casting no longer affects knowledge of the spell. A * decrement of spell knowledge is done every turn. @@ -927,6 +933,10 @@ spelleffects(int spell, boolean atme) Your("knowledge of this spell is twisted."); pline("It invokes nightmarish images in your mind..."); spell_backfire(spell); + u.uen -= rnd(energy); + if (u.uen < 0) + u.uen = 0; + g.context.botl = 1; return ECMD_TIME; } else if (spellknow(spell) <= KEEN / 200) { /* 100 turns left */ You("strain to recall the spell."); @@ -937,11 +947,6 @@ spelleffects(int spell, boolean atme) } else if (spellknow(spell) <= KEEN / 10) { /* 2000 turns left */ Your("recall of this spell is gradually fading."); } - /* - * Note: dotele() also calculates energy use and checks nutrition - * and strength requirements; it any of these change, update it too. - */ - energy = (spellev(spell) * 5); /* 5 <= energy <= 35 */ if (u.uhunger <= 10 && spellid(spell) != SPE_DETECT_FOOD) { You("are too hungry to cast that spell."); -- 2.50.1