From: nethack.allison Date: Wed, 22 Oct 2003 03:02:11 +0000 (+0000) Subject: Half_physical_damage 06 X-Git-Tag: MOVE2GIT~1659 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8467ab1515a6e302d5d2ff04e7b5cb12e999e05b;p=nethack Half_physical_damage 06 - [fixed in trunk] Alchemical explosion - [fixed in trunk] Artifacts' blasting - [fixed in trunk] Boiling/freezing potions - [fixed in trunk] Chest/door/tin traps - [fixed in trunk] Falling rocks/boulders (trap, digging, scroll of earth) - [fixed in trunk] Mixing water and acid - [fixed in trunk] Thrown potion (acid) This is my last patch on this today. --- diff --git a/src/artifact.c b/src/artifact.c index ee18f5e54..c00cb4396 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -529,7 +529,7 @@ touch_artifact(obj,mon) You("are blasted by %s power!", s_suffix(the(xname(obj)))); dmg = d((Antimagic ? 2 : 4), (self_willed ? 10 : 4)); Sprintf(buf, "touching %s", oart->name); - losehp(dmg, buf, KILLED_BY); + losehp(dmg, buf, KILLED_BY); /* magic damage, not physical */ exercise(A_WIS, FALSE); } diff --git a/src/dig.c b/src/dig.c index 854313da3..1f0df5409 100644 --- a/src/dig.c +++ b/src/dig.c @@ -945,7 +945,8 @@ struct obj *obj; pline("Sparks fly as you whack the %s.%s", sobj_at(STATUE, rx, ry) ? "statue" : "boulder", vibrate ? " The axe-handle vibrates violently!" : ""); - if (vibrate) losehp(2, "axing a hard object", KILLED_BY); + if (vibrate) losehp(Maybe_Half_Phys(2), + "axing a hard object", KILLED_BY); } else You("swing %s through thin air.", diff --git a/src/dothrow.c b/src/dothrow.c index 59378e5e0..c82b2f3b4 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -828,7 +828,7 @@ boolean hitsroof; } } hitfloor(obj); - losehp(dmg, "falling object", KILLED_BY_AN); + losehp(Maybe_Half_Phys(dmg), "falling object", KILLED_BY_AN); } return TRUE; } diff --git a/src/eat.c b/src/eat.c index 314cf92db..347e8b13c 100644 --- a/src/eat.c +++ b/src/eat.c @@ -1260,7 +1260,7 @@ eatcorpse(otmp) /* called when a corpse is selected as food */ } else if (acidic(&mons[mnum]) && !Acid_resistance) { tp++; You("have a very bad case of stomach acid."); /* not body_part() */ - losehp(rnd(15), "acidic corpse", KILLED_BY_AN); + losehp(Maybe_Half_Phys(rnd(15)), "acidic corpse", KILLED_BY_AN); } else if (poisonous(&mons[mnum]) && rn2(5)) { tp++; pline("Ecch - that must have been poisonous!"); diff --git a/src/fountain.c b/src/fountain.c index 7e1587da8..366aa25c6 100644 --- a/src/fountain.c +++ b/src/fountain.c @@ -524,7 +524,8 @@ drinksink() case 2: You("take a sip of scalding hot water."); if (Fire_resistance) pline("It seems quite tasty."); - else losehp(rnd(6), "sipping boiling water", KILLED_BY); + else losehp(Maybe_Half_Phys(rnd(6)), + "sipping boiling water", KILLED_BY); break; case 3: if (mvitals[PM_SEWER_RAT].mvflags & G_GONE) pline_The("sink seems quite dirty."); diff --git a/src/mhitu.c b/src/mhitu.c index 0fc975908..4dba6b387 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -2263,8 +2263,7 @@ register struct monst *mon; You_feel("exhausted."); exercise(A_STR, FALSE); tmp = rn1(10, 6); - if(Half_physical_damage) tmp = (tmp+1) / 2; - losehp(tmp, "exhaustion", KILLED_BY); + losehp(Maybe_Half_Phys(tmp), "exhaustion", KILLED_BY); break; } } diff --git a/src/mon.c b/src/mon.c index 960d98f94..21894887e 100644 --- a/src/mon.c +++ b/src/mon.c @@ -1485,8 +1485,7 @@ boolean was_swallowed; /* digestion */ body_part(STOMACH)); Sprintf(killer.name, "%s explosion", s_suffix(mdat->mname)); - if (Half_physical_damage) tmp = (tmp+1) / 2; - losehp(tmp, killer.name, KILLED_BY_AN); + losehp(Maybe_Half_Phys(tmp), killer.name, KILLED_BY_AN); } else { if (!Deaf) You_hear("an explosion."); magr->mhp -= tmp; @@ -2013,8 +2012,7 @@ int typ, fatal; pline("You%s!", poiseff[typ]); } else { i = thrown_weapon ? rnd(6) : rn1(10,6); - if(Half_physical_damage) i = (i+1) / 2; - losehp(i, pname, kprefix); + losehp(Maybe_Half_Phys(i), pname, kprefix); } if(u.uhp < 1) { killer.format = kprefix; diff --git a/src/mthrowu.c b/src/mthrowu.c index b627a0f5a..a6501d5aa 100644 --- a/src/mthrowu.c +++ b/src/mthrowu.c @@ -73,8 +73,7 @@ const char *name; /* if null, then format `obj' */ pline("It doesn't seem to hurt you."); else { if (is_acid) pline("It burns!"); - if (Half_physical_damage) dam = (dam+1) / 2; - losehp(dam, knm, kprefix); + losehp(Maybe_Half_Phys(dam), knm, kprefix); exercise(A_STR, FALSE); } return(1); diff --git a/src/muse.c b/src/muse.c index 9d776f8ac..06b1476b0 100644 --- a/src/muse.c +++ b/src/muse.c @@ -1437,7 +1437,8 @@ struct monst *mtmp; stackobj(otmp2); newsym(u.ux, u.uy); } - if (dmg) losehp(dmg, "scroll of earth", KILLED_BY_AN); + if (dmg) losehp(Maybe_Half_Phys(dmg), "scroll of earth", + KILLED_BY_AN); } xxx_noobj: diff --git a/src/pickup.c b/src/pickup.c index bb44bf5ec..707a89c14 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -1525,8 +1525,7 @@ lootcont: You("carefully open the bag..."); pline("It develops a huge set of teeth and bites you!"); tmp = rnd(10); - if (Half_physical_damage) tmp = (tmp+1) / 2; - losehp(tmp, "carnivorous bag", KILLED_BY_AN); + losehp(Maybe_Half_Phys(tmp), "carnivorous bag", KILLED_BY_AN); makeknown(BAG_OF_TRICKS); timepassed = 1; continue; diff --git a/src/potion.c b/src/potion.c index 7d1d0c96e..ae4adec62 100644 --- a/src/potion.c +++ b/src/potion.c @@ -894,9 +894,11 @@ peffects(otmp) /* Not necessarily a creature who _likes_ acid */ pline("This tastes %s.", Hallucination ? "tangy" : "sour"); else { + int dmg; pline("This burns%s!", otmp->blessed ? " a little" : otmp->cursed ? " a lot" : " like acid"); - losehp(d(otmp->cursed ? 2 : 1, otmp->blessed ? 4 : 8), + dmg = d(otmp->cursed ? 2 : 1, otmp->blessed ? 4 : 8); + losehp(Maybe_Half_Phys(dmg), "potion of acid", KILLED_BY_AN); exercise(A_CON, FALSE); } @@ -1017,9 +1019,11 @@ boolean your_fault; break; case POT_ACID: if (!Acid_resistance) { + int dmg; pline("This burns%s!", obj->blessed ? " a little" : obj->cursed ? " a lot" : ""); - losehp(d(obj->cursed ? 2 : 1, obj->blessed ? 4 : 8), + dmg = d(obj->cursed ? 2 : 1, obj->blessed ? 4 : 8); + losehp(Maybe_Half_Phys(dmg), "potion of acid", KILLED_BY_AN); } break; @@ -1447,7 +1451,8 @@ register struct obj *obj; if (obj->otyp == POT_ACID) { pline("It boils vigorously!"); You("are caught in the explosion!"); - losehp(rnd(10), "elementary chemistry", KILLED_BY); + losehp(Maybe_Half_Phys(rnd(10)), "elementary chemistry", + KILLED_BY); makeknown(obj->otyp); update_inventory(); return (TRUE); @@ -1678,7 +1683,8 @@ dodip() potionbreathe(obj); useup(obj); useup(potion); - losehp(rnd(10), "alchemic blast", KILLED_BY_AN); + losehp(Maybe_Half_Phys(rnd(10)), "alchemic blast", + KILLED_BY_AN); return(1); } diff --git a/src/pray.c b/src/pray.c index 2faec7c24..a35259a9c 100644 --- a/src/pray.c +++ b/src/pray.c @@ -1601,6 +1601,7 @@ prayer_done() /* M. Stephenson (1.0.3b) */ You_feel("like you are falling apart."); /* KMH -- Gods have mastery over unchanging */ rehumanize(); + /* no Half_physical_damage adjustment here */ losehp(rnd(20), "residual undead turning effect", KILLED_BY_AN); exercise(A_CON, FALSE); return(1); diff --git a/src/read.c b/src/read.c index 3fce39ac0..a93e0bc50 100644 --- a/src/read.c +++ b/src/read.c @@ -276,7 +276,7 @@ int curse_bless; if (is_on) Ring_gone(obj); s = rnd(3 * abs(obj->spe)); /* amount of damage */ useup(obj); - losehp(s, "exploding ring", KILLED_BY_AN); + losehp(Maybe_Half_Phys(s), "exploding ring", KILLED_BY_AN); } else { long mask = is_on ? (obj == uleft ? LEFT_RING : RIGHT_RING) : 0L; @@ -1143,7 +1143,8 @@ register struct obj *sobj; } else { pline_The("scroll catches fire and you burn your %s.", makeplural(body_part(HAND))); - losehp(1, "scroll of fire", KILLED_BY_AN); + losehp(Half_physical_damage ? rn2(2) : 1, + "scroll of fire", KILLED_BY_AN); } return(1); } @@ -1268,7 +1269,8 @@ register struct obj *sobj; stackobj(otmp2); newsym(u.ux, u.uy); } - if (dmg) losehp(dmg, "scroll of earth", KILLED_BY_AN); + if (dmg) losehp(Maybe_Half_Phys(dmg), "scroll of earth", + KILLED_BY_AN); } } break; @@ -1310,10 +1312,12 @@ STATIC_OVL void wand_explode(obj) register struct obj *obj; { + int vibration_dmg; obj->in_use = TRUE; /* in case losehp() is fatal */ pline("%s vibrates violently, and explodes!", Yname2(obj)); nhbell(); - losehp(rnd(2*(u.uhpmax+1)/3), "exploding wand", KILLED_BY_AN); + vibration_dmg = rnd(2*(u.uhpmax+1)/3); + losehp(Maybe_Half_Phys(vibration_dmg), "exploding wand", KILLED_BY_AN); useup(obj); exercise(A_STR, FALSE); } diff --git a/src/trap.c b/src/trap.c index 276242521..0abeccd27 100644 --- a/src/trap.c +++ b/src/trap.c @@ -783,8 +783,7 @@ unsigned trflags; pline("%s you!", A_gush_of_water_hits); You("are covered with rust!"); - if (Half_physical_damage) dam = (dam+1) / 2; - losehp(dam, "rusting away", KILLED_BY); + losehp(Maybe_Half_Phys(dam), "rusting away", KILLED_BY); break; } else if (u.umonnum == PM_GREMLIN && rn2(3)) { pline("%s you!", A_gush_of_water_hits); @@ -2824,7 +2823,7 @@ drown() (void)split_mon(&youmonst, (struct monst *)0); else if (u.umonnum == PM_IRON_GOLEM) { You("rust!"); - i = d(2,6); + i = Maybe_Half_Phys(d(2,6)); if (u.mhmax > i) u.mhmax -= i; losehp(i, "rusting away", KILLED_BY); } @@ -3652,7 +3651,7 @@ boolean disarm; delobj(otmp); } wake_nearby(); - losehp(d(6,6), buf, KILLED_BY_AN); + losehp(Maybe_Half_Phys(d(6,6)), buf, KILLED_BY_AN); exercise(A_STR, FALSE); if(costly && loss) { if(insider)