From: nethack.allison <nethack.allison>
Date: Tue, 21 Oct 2003 18:49:57 +0000 (+0000)
Subject: Half_physical_damage 04
X-Git-Tag: MOVE2GIT~1661
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d3316e0436c20bee897cae4b9b403866bc631fc9;p=nethack

Half_physical_damage 04

- [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!"
---

diff --git a/src/apply.c b/src/apply.c
index f7a818ed7..392982a62 100644
--- a/src/apply.c
+++ b/src/apply.c
@@ -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;
diff --git a/src/ball.c b/src/ball.c
index d4eaa6cf3..521d44b7b 100644
--- a/src/ball.c
+++ b/src/ball.c
@@ -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();
diff --git a/src/detect.c b/src/detect.c
index 9f6b56822..1a6cc4890 100644
--- a/src/detect.c
+++ b/src/detect.c
@@ -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);
diff --git a/src/dig.c b/src/dig.c
index 5e2e18229..854313da3 100644
--- 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) {
diff --git a/src/do.c b/src/do.c
index 816065a35..e5bae275e 100644
--- 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;
diff --git a/src/dokick.c b/src/dokick.c
index b9f7e11d3..07d0ebbb3 100644
--- a/src/dokick.c
+++ b/src/dokick.c
@@ -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 */
diff --git a/src/sit.c b/src/sit.c
index bc06faa4a..40f9d57b8 100644
--- 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)) {
diff --git a/src/trap.c b/src/trap.c
index d0a8869e1..2481e5837 100644
--- a/src/trap.c
+++ b/src/trap.c
@@ -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 */