From 5c7c9d10ae7984667b533bb7038616dc81346a0f Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Tue, 12 Jul 2022 20:24:27 +0300 Subject: [PATCH] Rejigger anti-magic traps My changes were too drastic, so reduce the drain and damage so it matches all the other traps. Now the anti-magic trap will always ding your max energy a bit, in addition to the physical damage done if wearing magic resistance. --- doc/fixes3-7-0.txt | 3 +-- src/mklev.c | 1 - src/trap.c | 19 ++++++++++--------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 0b54451d4..0b8e2a9a6 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -533,8 +533,7 @@ 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 +make anti-magic fields always drain max energy eating magical monsters such as wizards or shamans may give a mild buzz make exploding spheres create an actual explosion pets are more careful about attacking monsters at low health diff --git a/src/mklev.c b/src/mklev.c index 1122610d5..0b647ffee 100644 --- a/src/mklev.c +++ b/src/mklev.c @@ -1435,7 +1435,6 @@ mktrap( 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 85ad82b74..ebff33dd7 100644 --- a/src/trap.c +++ b/src/trap.c @@ -2037,17 +2037,13 @@ trapeffect_anti_magic( unsigned int trflags UNUSED) { if (mtmp == &g.youmonst) { - int drain = (u.uen > 1) ? (rnd(u.uen / 2) + 2) : 4; + int drain = d(2, 6); + int halfd = rnd(((drain + 1) / 2)); 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(drain); - } else { + if (Antimagic) { struct obj *otmp; - int dmgval2 = rnd(drain), hp = Upolyd ? u.mh : u.uhp; + int dmgval2 = rnd(4), 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 */ @@ -2074,6 +2070,11 @@ trapeffect_anti_magic( /* opposite of magical explosion */ losehp(dmgval2, "anti-magic implosion", KILLED_BY_AN); } + if (u.uenmax > halfd) { + u.uenmax -= halfd; + drain -= halfd; + } + drain_en(drain); } else { boolean trapkilled = FALSE; boolean in_sight = canseemon(mtmp) || (mtmp == u.usteed); @@ -2084,7 +2085,7 @@ trapeffect_anti_magic( if (!resists_magm(mtmp)) { /* lose spell energy */ if (!mtmp->mcan && (attacktype(mptr, AT_MAGC) || attacktype(mptr, AT_BREA))) { - mtmp->mspec_used += d(2, 2); + mtmp->mspec_used += d(2, 6); if (in_sight) { seetrap(trap); pline("%s seems lethargic.", Monnam(mtmp));