]> granicus.if.org Git - nethack/commitdiff
broken wand of striking vs door (trunk only)
authornethack.allison <nethack.allison>
Tue, 7 Mar 2006 03:10:58 +0000 (03:10 +0000)
committernethack.allison <nethack.allison>
Tue, 7 Mar 2006 03:10:58 +0000 (03:10 +0000)
<email deleted> wrote:
> * Doors absorb the blast of a broken wand of striking. What's more, the message
> reads "The door absorbs your bolt!" rather than "blast".

passes wand type to explode() as a negative value for the case
where the wand type isn't mapped to an AD_* explosion type.

Then explode() converts it to a positive and passes it to zap_over_floor().

doc/fixes35.0
include/extern.h
src/apply.c
src/explode.c
src/zap.c

index 0ef911b4c413ee17d838d245c41a53b254f4baff..f00462d29e17c401492d53089f9529c2c93165e1 100644 (file)
@@ -126,6 +126,7 @@ avoid giving misleading or redundant feedback when reading scrolls
 custom arrival message for special levels could be delivered too soon
 prevent scroll of charging that has already disappeared from showing in the
        picklist of things to charge
+doors break instead of absorbing the blast of a broken wand of striking
 
 
 Platform- and/or Interface-Specific Fixes
index ed1ebdd5b1ab8118a4d9de28efdf4c296f0ec852..81546a0fb676c6e559f42fbe136d3c432d094814 100644 (file)
@@ -2509,7 +2509,7 @@ E void FDECL(buzz, (int,int,XCHAR_P,XCHAR_P,int,int));
 E void FDECL(melt_ice, (XCHAR_P,XCHAR_P,const char *));
 E void FDECL(start_melt_ice_timeout, (XCHAR_P,XCHAR_P));
 E void FDECL(melt_ice_away, (genericptr_t, long));
-E int FDECL(zap_over_floor, (XCHAR_P,XCHAR_P,int,boolean *));
+E int FDECL(zap_over_floor, (XCHAR_P,XCHAR_P,int,boolean *,SHORT_P));
 E void FDECL(fracture_rock, (struct obj *));
 E boolean FDECL(break_statue, (struct obj *));
 E void FDECL(destroy_item, (int,int));
index 5427a5102718fff29b0d1d2a4fdc4225a1af3494..2db4a03aa6d0151cc7c332395378cca654d7c202 100644 (file)
@@ -2821,7 +2821,7 @@ do_break_wand(obj)
     }
 
     /* magical explosion and its visual effect occur before specific effects */
-    explode(obj->ox, obj->oy, 0, rnd(dmg), WAND_CLASS, EXPL_MAGICAL);
+    explode(obj->ox, obj->oy, -(obj->otyp), rnd(dmg), WAND_CLASS, EXPL_MAGICAL);
 
     /* this makes it hit us last, so that we can see the action first */
     for (i = 0; i <= 8; i++) {
index 5ca0fe3dc73d49d1b9a965941fa80169e99bf6af..771be3944f41d97288334d9bb0d21f6fabd7a0c9 100644 (file)
@@ -29,7 +29,7 @@ static int explosion[3][3] = {
 void
 explode(x, y, type, dam, olet, expltype)
 int x, y;
-int type; /* the same as in zap.c */
+int type; /* the same as in zap.c; passes -(wand typ) for some WAND_CLASS */
 int dam;
 char olet;
 int expltype;
@@ -47,8 +47,14 @@ int expltype;
        boolean shopdamage = FALSE, generic = FALSE, physical_dmg = FALSE,
                do_hallu = FALSE;
        char hallu_buf[BUFSZ];
+       short exploding_wand_typ = 0;
 
-       if (olet == WAND_CLASS)         /* retributive strike */
+       if (olet == WAND_CLASS) {       /* retributive strike */
+               /*  If 'type' < 0 it indicates (wand type * -1) */
+               if (type < 0) {
+                       exploding_wand_typ = (short)(type * -1);
+                       type = 0;
+               }
                switch (Role_switch) {
                        case PM_PRIEST:
                        case PM_MONK:
@@ -59,6 +65,7 @@ int expltype;
                                  break;
                        default:  break;
                }
+       }
 
        if (olet == MON_EXPLODE) {
            str = killer.name;
@@ -241,7 +248,7 @@ int expltype;
                idamres = idamnonres = 0;
                if (type >= 0)
                    (void)zap_over_floor((xchar)(i+x-1), (xchar)(j+y-1),
-                               type, &shopdamage);
+                               type, &shopdamage, exploding_wand_typ);
 
                mtmp = m_at(i+x-1, j+y-1);
 #ifdef STEED
index 3101bf0820471f22a556beca79c53e3ba516b567..ce803bed65d653c623d227eec58e723236b6a248 100644 (file)
--- a/src/zap.c
+++ b/src/zap.c
@@ -3506,7 +3506,7 @@ register int dx,dy;
        bhitpos.x = sx,  bhitpos.y = sy;
        /* Fireballs only damage when they explode */
        if (type != ZT_SPELL(ZT_FIRE))
-           range += zap_over_floor(sx, sy, type, &shopdamage);
+           range += zap_over_floor(sx, sy, type, &shopdamage, 0);
 
        if (mon) {
            if (type == ZT_SPELL(ZT_FIRE)) break;
@@ -3771,10 +3771,11 @@ long timeout;   /* unused */
  * amount by which range is reduced (the latter is just ignored by fireballs)
  */
 int
-zap_over_floor(x, y, type, shopdamage)
+zap_over_floor(x, y, type, shopdamage, exploding_wand_typ)
 xchar x, y;
 int type;
 boolean *shopdamage;
+short exploding_wand_typ;
 {
        struct monst *mon;
        int abstype = abs(type) % 10;
@@ -3917,6 +3918,15 @@ boolean *shopdamage;
                    break;
                default:
                def_case:
+                   if (exploding_wand_typ > 0) {
+                       /* Magical explosion from misc exploding wand */
+                       if (exploding_wand_typ == WAN_STRIKING) {
+                           new_doormask = D_BROKEN;
+                           see_txt = "The door crashes open!";
+                           sense_txt = "feel a burst of cool air.";
+                           break;
+                       }
+                   }
                    if(cansee(x,y)) {
                        pline_The("door absorbs %s %s!",
                              (type < 0) ? "the" : "your",