]> granicus.if.org Git - nethack/commitdiff
Half_physical_damage 04
authornethack.allison <nethack.allison>
Tue, 21 Oct 2003 18:49:57 +0000 (18:49 +0000)
committernethack.allison <nethack.allison>
Tue, 21 Oct 2003 18:49:57 +0000 (18:49 +0000)
- [fixed in trunk] iron-ball-pulling yourself out of a bear trap
- [fixed in trunk] Hitting your foot with a bullwhip
- [fixed in trunk] Hooking yourself with a grappling hook
- [fixed in trunk] Being thwacked by an iron ball chained to you
- [fixed in trunk] A crystal ball exploding on being applied
- [fixed in trunk] Hitting yourself with your pick-axe
- [fixed in trunk] Molten lava (entering or being splashed)
- [fixed in trunk] Getting squished in a pit under a boulder
- [fixed in trunk] Kicking something that makes you go "Ouch!"

src/apply.c
src/ball.c
src/detect.c
src/dig.c
src/do.c
src/dokick.c
src/sit.c
src/trap.c

index f7a818ed72925d83aed1fca5f380b018f6eaef0b..392982a62ea8499c9cf533afab073a0cec949df6 100644 (file)
@@ -2183,7 +2183,7 @@ struct obj *obj;
        if (dam <= 0) dam = 1;
        You("hit your %s with your bullwhip.", body_part(FOOT));
        Sprintf(buf, "killed %sself with %s bullwhip", uhim(), uhis());
-       losehp(dam, buf, NO_KILLER_PREFIX);
+       losehp(Maybe_Half_Phys(dam), buf, NO_KILLER_PREFIX);
        context.botl = 1;
        return 1;
 
@@ -2585,7 +2585,7 @@ use_grapple (obj)
        default:        /* Yourself (oops!) */
            if (P_SKILL(typ) <= P_BASIC) {
                You("hook yourself!");
-               losehp(rn1(10,10), "a grappling hook", KILLED_BY);
+               losehp(Maybe_Half_Phys(rn1(10,10)), "a grappling hook", KILLED_BY);
                return (1);
            }
            break;
index d4eaa6cf3c0657fd8f2e0e644f1888dc394b06f0..521d44b7b1cb911d1207fa845ad37b06a819762f 100644 (file)
@@ -38,7 +38,8 @@ ballfall()
                    } else if (flags.verbose)
                        pline("%s does not protect you.", Yname2(uarmh));
                }
-               losehp(dmg, "crunched in the head by an iron ball",
+               losehp(Maybe_Half_Phys(dmg),
+                       "crunched in the head by an iron ball",
                        NO_KILLER_PREFIX);
        }
 }
@@ -677,8 +678,9 @@ xchar x, y;
                    Your("%s %s is severely damaged.",
                                        (side == LEFT_SIDE) ? "left" : "right",
                                        body_part(LEG));
-                   losehp(2, "leg damage from being pulled out of a bear trap",
-                                       KILLED_BY);
+                   losehp(Maybe_Half_Phys(2),
+                               "leg damage from being pulled out of a bear trap",
+                               KILLED_BY);
                }
                break;
              }
@@ -766,20 +768,23 @@ drag_down()
        if (forward) {
                if(rn2(6)) {
                        pline_The("iron ball drags you downstairs!");
-                       losehp(rnd(6), "dragged downstairs by an iron ball",
+                       losehp(Maybe_Half_Phys(rnd(6)),
+                               "dragged downstairs by an iron ball",
                                NO_KILLER_PREFIX);
                        litter();
                }
        } else {
                if(rn2(2)) {
                        pline_The("iron ball smacks into you!");
-                       losehp(rnd(20), "iron ball collision", KILLED_BY_AN);
+                       losehp(Maybe_Half_Phys(rnd(20)),
+                               "iron ball collision", KILLED_BY_AN);
                        exercise(A_STR, FALSE);
                        dragchance -= 2;
                }
                if( (int) dragchance >= rnd(6)) {
                        pline_The("iron ball drags you downstairs!");
-                       losehp(rnd(3), "dragged downstairs by an iron ball",
+                       losehp(Maybe_Half_Phys(rnd(3)),
+                               "dragged downstairs by an iron ball",
                                NO_KILLER_PREFIX);
                        exercise(A_STR, FALSE);
                        litter();
index 9f6b5682239ea96706b5e9e2b1793449161f15be..1a6cc489013a038e5c45390f65fa71cbda50d7b3 100644 (file)
@@ -820,7 +820,8 @@ struct obj *obj;
        case 5 : pline("%s!", Tobjnam(obj, "explode"));
            useup(obj);
            obj = 0;    /* it's gone */
-           losehp(rnd(30), "exploding crystal ball", KILLED_BY_AN);
+           losehp(Maybe_Half_Phys(rnd(30)),
+                       "exploding crystal ball", KILLED_BY_AN);
            break;
        }
        if (obj) consume_obj_charge(obj, TRUE);
index 5e2e182292e00248f679ccc5354bea33a0b320fd..854313da37c4ef09923d5394ba5bb7cf3903300a 100644 (file)
--- a/src/dig.c
+++ b/src/dig.c
@@ -902,7 +902,7 @@ struct obj *obj;
                You("hit yourself with %s.", yname(uwep));
                Sprintf(buf, "%s own %s", uhis(),
                                OBJ_NAME(objects[obj->otyp]));
-               losehp(dam, buf, KILLED_BY);
+               losehp(Maybe_Half_Phys(dam), buf, KILLED_BY);
                context.botl=1;
                return(1);
        } else if(u.dz == 0) {
@@ -1182,13 +1182,15 @@ zap_dig()
        if (u.dz) {
            if (!Is_airlevel(&u.uz) && !Is_waterlevel(&u.uz) && !Underwater) {
                if (u.dz < 0 || On_stairs(u.ux, u.uy)) {
+                   int dmg;
                    if (On_stairs(u.ux, u.uy))
                        pline_The("beam bounces off the %s and hits the %s.",
                              (u.ux == xdnladder || u.ux == xupladder) ?
                              "ladder" : "stairs", ceiling(u.ux, u.uy));
                    You("loosen a rock from the %s.", ceiling(u.ux, u.uy));
                    pline("It falls on your %s!", body_part(HEAD));
-                   losehp(rnd((uarmh && is_metallic(uarmh)) ? 2 : 6),
+                   dmg = rnd((uarmh && is_metallic(uarmh)) ? 2 : 6);
+                   losehp(Maybe_Half_Phys(dmg),
                           "falling rock", KILLED_BY_AN);
                    otmp = mksobj_at(ROCK, u.ux, u.uy, FALSE, FALSE);
                    if (otmp) {
index 816065a357a78abcc2a7c89fd4f615671e3f322f..e5bae275ee76ff3a5226f8aac16eeacf106c6729 100644 (file)
--- a/src/do.c
+++ b/src/do.c
@@ -154,7 +154,8 @@ const char *verb;
                        mtmp->mtrapped = 0;
                    } else {
                        if (!Passes_walls && !throws_rocks(youmonst.data)) {
-                           losehp(rnd(15), "squished under a boulder",
+                           losehp(Maybe_Half_Phys(rnd(15)),
+                                  "squished under a boulder",
                                   NO_KILLER_PREFIX);
                            return FALSE;       /* player remains trapped */
                        } else u.utrap = 0;
index b9f7e11d3b7ccf58de1125106da7d66ee1826341..07d0ebbb3ac35b1f8382ceff7373cbb4fb67006a 100644 (file)
@@ -614,6 +614,7 @@ dokick()
 {
        int x, y;
        int avrg_attrib;
+       int dmg = 0;
        register struct monst *mtmp;
        boolean no_kick = FALSE;
        char buf[BUFSZ];
@@ -1000,7 +1001,8 @@ ouch:
                        maploc = &levl[x][y];
                    }
                    if(!rn2(3)) set_wounded_legs(RIGHT_SIDE, 5 + rnd(5));
-                   losehp(rnd(ACURR(A_CON) > 15 ? 3 : 5), kickstr(buf),
+                   dmg = rnd(ACURR(A_CON) > 15 ? 3 : 5);
+                   losehp(Maybe_Half_Phys(dmg), kickstr(buf),
                        KILLED_BY);
                    if(Is_airlevel(&u.uz) || Levitation)
                        hurtle(-u.dx, -u.dy, rn1(2,4), TRUE); /* assume it's heavy */
index bc06faa4ab4379355d558c3cdf6f8b8e12bb0f09..40f9d57b8469f38e44b0074ae373f6929baa4fcc 100644 (file)
--- a/src/sit.c
+++ b/src/sit.c
@@ -91,7 +91,7 @@ dosit()
                    /* Must have fire resistance or they'd be dead already */
                    You("sit in the lava!");
                    u.utrap += rnd(4);
-                   losehp(d(2,10), "sitting in lava", KILLED_BY);
+                   losehp(Maybe_Half_Phys(d(2,10)), "sitting in lava", KILLED_BY);
                } else if(u.utraptype == TT_INFLOOR || u.utraptype == TT_BURIEDBALL) {
                    You_cant("maneuver to sit!");
                    u.utrap++;
@@ -145,7 +145,7 @@ dosit()
                return 1;
            }
            pline_The("lava burns you!");
-           losehp(d((Fire_resistance ? 2 : 10), 10),
+           losehp(Maybe_Half_Phys(d((Fire_resistance ? 2 : 10), 10)),
                   "sitting on lava", KILLED_BY);
 
        } else if (is_ice(u.ux, u.uy)) {
index d0a8869e1ffa340fb92ed1bef93bb8d00a0b7ce9..2481e5837fe1b3c2df18484a7b383fbb024dfc3f 100644 (file)
@@ -706,7 +706,7 @@ unsigned trflags;
                    stackobj(otmp);
                    newsym(u.ux,u.uy);  /* map the rock */
 
-                   losehp(dmg, "falling rock", KILLED_BY_AN);
+                   losehp(Maybe_Half_Phys(dmg), "falling rock", KILLED_BY_AN);
                    exercise(A_STR, FALSE);
                }
                break;
@@ -906,12 +906,14 @@ glovecheck:               (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst);
                if (!steedintrap(trap, (struct obj *)0)) {
 #endif
                if (ttype == SPIKED_PIT) {
-                   losehp(rnd(10),"fell into a pit of iron spikes",
+                   losehp(Maybe_Half_Phys(rnd(10)),
+                       "fell into a pit of iron spikes",
                        NO_KILLER_PREFIX);
                    if (!rn2(6))
                        poisoned("spikes", A_STR, "fall onto poison spikes", 8);
                } else
-                   losehp(rnd(6),"fell into a pit", NO_KILLER_PREFIX);
+                   losehp(Maybe_Half_Phys(rnd(6)),"fell into a pit",
+                       NO_KILLER_PREFIX);
                if (Punished && !carried(uball)) {
                    unplacebc();
                    ballfall();
@@ -1140,7 +1142,7 @@ glovecheck:               (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst);
                        (void)keep_saddle_with_steedcorpse(steed_mid, fobj, saddle);
 #endif
                newsym(u.ux,u.uy);              /* update trap symbol */
-               losehp(rnd(16), "land mine", KILLED_BY_AN);
+               losehp(Maybe_Half_Phys(rnd(16)), "land mine", KILLED_BY_AN);
                /* fall recursively into the pit... */
                if ((trap = t_at(u.ux, u.uy)) != 0) dotrap(trap, RECURSIVETRAP);
                fill_pit(u.ux, u.uy);
@@ -2412,7 +2414,7 @@ struct obj *box;  /* null for floor trap */
            pline("A cascade of steamy bubbles erupts from %s!",
                    the(box ? xname(box) : surface(u.ux,u.uy)));
            if (Fire_resistance) You("are uninjured.");
-           else losehp(rnd(3), "boiling water", KILLED_BY);
+           else losehp(Maybe_Half_Phys(rnd(3)), "boiling water", KILLED_BY);
            return;
        }
        pline("A %s %s from %s!", tower_of_flame,
@@ -3813,7 +3815,7 @@ register int bodypart;
 
        pline("KABOOM!!  %s was booby-trapped!", The(item));
        wake_nearby();
-       losehp(dmg, "explosion", KILLED_BY_AN);
+       losehp(Maybe_Half_Phys(dmg), "explosion", KILLED_BY_AN);
        exercise(A_STR, FALSE);
        if (bodypart) exercise(A_CON, FALSE);
        make_stunned(HStun + dmg, TRUE);
@@ -3897,7 +3899,7 @@ lava_effects()
            dmg = d(6,6);
            pline_The("lava here burns you!");
            if(dmg < u.uhp) {
-               losehp(dmg, lava_killer, KILLED_BY);
+               losehp(Maybe_Half_Phys(dmg), lava_killer, KILLED_BY);
                goto burn_stuff;
            }
        } else
@@ -3954,7 +3956,7 @@ lava_effects()
        u.utraptype = TT_LAVA;
        You("sink into the lava, but it only burns slightly!");
        if (u.uhp > 1)
-           losehp(1, lava_killer, KILLED_BY);
+           losehp(Half_physical_damage ? rn2(2) : 1, lava_killer, KILLED_BY);
     }
     /* just want to burn boots, not all armor; destroy_item doesn't work on
        armor anyway */