From 6870660aba089477a0ff7862e5a9f3ca0544e3f6 Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Mon, 20 Oct 2008 04:07:40 +0000 Subject: [PATCH] more breaking wands (trunk only) If breaking a wand of polymorph uses up any floor objects, give a "you feel shuddering vibrations" message like happens when zapping. --- doc/fixes35.0 | 1 + include/extern.h | 2 ++ src/apply.c | 6 ++++++ src/zap.c | 23 ++++++++++++++++++----- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 542ce3b44..5f79d4452 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -288,6 +288,7 @@ wearing or removing an amulet of restful sleep clobbered permanent sleepiness if attempt to select a co-aligned artifact for first divine gift fails because none is available, choose one from among nonaligned artifacts if breaking a wand of polymorph causes hero to drop items, don't transform them +give "shuddering vibrations" feedback if breaking a poly wand uses up items if polymorph causes a monster to drop items, they won't be used up via shuddering vibrations or as golem creation fodder diff --git a/include/extern.h b/include/extern.h index 3123a0009..190a3308f 100644 --- a/include/extern.h +++ b/include/extern.h @@ -2651,6 +2651,8 @@ E int FDECL(zapyourself, (struct obj *,BOOLEAN_P)); E void FDECL(ubreatheu, (struct attack *)); E boolean FDECL(cancel_monst, (struct monst *,struct obj *, BOOLEAN_P,BOOLEAN_P,BOOLEAN_P)); +E void NDECL(zapsetup); +E void NDECL(zapwrapup); E void FDECL(weffects, (struct obj *)); E int NDECL(spell_damage_bonus); E const char *FDECL(exclam, (int force)); diff --git a/src/apply.c b/src/apply.c index 9036c6ee8..20f735094 100644 --- a/src/apply.c +++ b/src/apply.c @@ -2908,6 +2908,9 @@ do_break_wand(obj) surrounding targets (or underlying objects) got affected yet.] */ explode(obj->ox, obj->oy, -(obj->otyp), rnd(dmg), WAND_CLASS, EXPL_MAGICAL); + /* prepare for potential feedback from polymorph... */ + zapsetup(); + /* this makes it hit us last, so that we can see the action first */ for (i = 0; i <= 8; i++) { bhitpos.x = x = obj->ox + xdir[i]; @@ -2990,6 +2993,9 @@ do_break_wand(obj) } } + /* potentially give post zap/break feedback */ + zapwrapup(); + /* Note: if player fell thru, this call is a no-op. Damage is handled in digactualhole in that case */ if (shop_damage) pay_for_damage("dig into", FALSE); diff --git a/src/zap.c b/src/zap.c index 4fd68681e..013bcb696 100644 --- a/src/zap.c +++ b/src/zap.c @@ -2702,6 +2702,22 @@ struct obj *obj; /* wand or spell */ return disclose; } +/* used by do_break_wand() was well as by weffects() */ +void +zapsetup() +{ + obj_zapped = FALSE; +} + +void +zapwrapup() +{ + /* if do_osshock() set obj_zapped while polying, give a message now */ + if (obj_zapped) + You_feel("shuddering vibrations."); + obj_zapped = FALSE; +} + /* called for various wand and spell effects - M. Stephenson */ void weffects(obj) @@ -2718,8 +2734,7 @@ struct obj *obj; } else #endif if (objects[otyp].oc_dir == IMMEDIATE) { - obj_zapped = FALSE; - + zapsetup(); /* reset obj_zapped */ if (u.uswallow) { (void) bhitm(u.ustuck, obj); /* [how about `bhitpile(u.ustuck->minvent)' effect?] */ @@ -2728,9 +2743,7 @@ struct obj *obj; } else { (void) bhit(u.dx,u.dy, rn1(8,6),ZAPPED_WAND, bhitm,bhito, &obj); } - /* give a clue if obj_zapped */ - if (obj_zapped) - You_feel("shuddering vibrations."); + zapwrapup(); /* give feedback for obj_zapped */ } else if (objects[otyp].oc_dir == NODIR) { zapnodir(obj);