From 5ad45fc696448422b1daeda76d3f8b62361d9392 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Thu, 20 May 2021 20:40:56 +0300 Subject: [PATCH] Make anti-magic fields drain more energy ... and make them actually deal damage based on the energy it would've drained, if you have Antimagic. Also prevent them appearing too early in the dungeon. Allow drain energy attacks (and anti-magic traps) drain more than your level of energy. Make eating magical monsters such as wizards and shamans give the same tiny buzz bonus as eating a newt. --- doc/fixes37.0 | 3 +++ src/eat.c | 42 +++++++++++++++++++++++++----------------- src/mklev.c | 1 + src/trap.c | 8 +++++--- 4 files changed, 34 insertions(+), 20 deletions(-) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index c8ef846a7..85348a78a 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -527,6 +527,9 @@ dying from being level-drained below level 1 killed hero without saying so and jumped straight to "do you want your possessions identified?" conflict will now consider your charisma and requires line of sight boost hit points of some golems +make anti-magic fields drain more energy and prevent them from showing up + too early in the dungeon +eating magical monsters such as wizards or shamans may give a mild buzz Fixes to 3.7.0-x Problems that Were Exposed Via git Repository diff --git a/src/eat.c b/src/eat.c index 573bcd756..2125f9a13 100644 --- a/src/eat.c +++ b/src/eat.c @@ -20,6 +20,7 @@ static void done_eating(boolean); static void cprefx(int); static int intrinsic_possible(int, struct permonst *); static void givit(int, struct permonst *); +static void eye_of_newt_buzz(void); static void cpostfx(int); static void consume_tin(const char *); static void start_tin(struct obj *); @@ -916,6 +917,26 @@ givit(int type, register struct permonst *ptr) DISABLE_WARNING_FORMAT_NONLITERAL +static void +eye_of_newt_buzz(void) +{ + /* MRKR: "eye of newt" may give small magical energy boost */ + if (rn2(3) || 3 * u.uen <= 2 * u.uenmax) { + int old_uen = u.uen; + + u.uen += rnd(3); + if (u.uen > u.uenmax) { + if (!rn2(3)) + u.uenmax++; + u.uen = u.uenmax; + } + if (old_uen != u.uen) { + You_feel("a mild buzz."); + g.context.botl = 1; + } + } +} + /* called after completely consuming a corpse */ static void cpostfx(int pm) @@ -930,23 +951,6 @@ cpostfx(int pm) (void) eatmdone(); switch (pm) { - case PM_NEWT: - /* MRKR: "eye of newt" may give small magical energy boost */ - if (rn2(3) || 3 * u.uen <= 2 * u.uenmax) { - int old_uen = u.uen; - - u.uen += rnd(3); - if (u.uen > u.uenmax) { - if (!rn2(3)) - u.uenmax++; - u.uen = u.uenmax; - } - if (old_uen != u.uen) { - You_feel("a mild buzz."); - g.context.botl = 1; - } - } - break; case PM_WRAITH: pluslvl(FALSE); break; @@ -1100,6 +1104,10 @@ cpostfx(int pm) 0L); } + /* Eating magical monsters can give you some magical energy. */ + if (attacktype(ptr, AT_MAGC) || pm == PM_NEWT) + eye_of_newt_buzz(); + /* Check the monster for all of the intrinsics. If this * monster can give more than one, pick one to try to give * from among all it can give. diff --git a/src/mklev.c b/src/mklev.c index c1c8507a5..ea4597757 100644 --- a/src/mklev.c +++ b/src/mklev.c @@ -1385,6 +1385,7 @@ mktrap(int num, int mktrapflags, struct mkroom *croom, coord *tm) if (lvl < 5) kind = NO_TRAP; break; + case ANTI_MAGIC: case LANDMINE: if (lvl < 6) kind = NO_TRAP; diff --git a/src/trap.c b/src/trap.c index 499c5fb16..a536f0f39 100644 --- a/src/trap.c +++ b/src/trap.c @@ -1974,15 +1974,17 @@ trapeffect_anti_magic( unsigned int trflags UNUSED) { if (mtmp == &g.youmonst) { + int drain = (u.uen > 1) ? (rnd(u.uen / 2) + 2) : 4; + seetrap(trap); /* hero without magic resistance loses spell energy, hero with magic resistance takes damage instead; possibly non-intuitive but useful for play balance */ if (!Antimagic) { - drain_en(rnd(u.ulevel) + 1); + drain_en(drain); } else { struct obj *otmp; - int dmgval2 = rnd(4), hp = Upolyd ? u.mh : u.uhp; + int dmgval2 = rnd(drain), hp = Upolyd ? u.mh : u.uhp; /* Half_XXX_damage has opposite its usual effect (approx) but isn't cumulative if hero has more than one */ @@ -4293,7 +4295,7 @@ drain_en(int n) You_feel("momentarily lethargic."); } else { /* throttle further loss a bit when there's not much left to lose */ - if (n > u.uenmax || n > u.ulevel) + if (n > (u.uen + u.uenmax) / 3) n = rnd(n); You_feel("your magical energy drain away%c", (n > u.uen) ? '!' : '.');