]> granicus.if.org Git - nethack/commitdiff
Half_physical_damage 06
authornethack.allison <nethack.allison>
Wed, 22 Oct 2003 03:02:11 +0000 (03:02 +0000)
committernethack.allison <nethack.allison>
Wed, 22 Oct 2003 03:02:11 +0000 (03:02 +0000)
- [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.

14 files changed:
src/artifact.c
src/dig.c
src/dothrow.c
src/eat.c
src/fountain.c
src/mhitu.c
src/mon.c
src/mthrowu.c
src/muse.c
src/pickup.c
src/potion.c
src/pray.c
src/read.c
src/trap.c

index ee18f5e547881c3068405dbf255f68110ef34747..c00cb4396837ae78d1d80448d08217e384435fa9 100644 (file)
@@ -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);
     }
 
index 854313da37c4ef09923d5394ba5bb7cf3903300a..1f0df540920e524b2fb378a72fc9aec918a0347c 100644 (file)
--- 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.",
index 59378e5e0eff1ef80d9aa26a9c5c95bc5ffa55e5..c82b2f3b4a34d1ac69207a064594e5a9b8169106 100644 (file)
@@ -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;
 }
index 314cf92db2b45ab1a7963bdcbbecabedc62de613..347e8b13c18e1002c6bd7985d600d7df31f94fd1 100644 (file)
--- 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!");
index 7e1587da8b73033d56ce928971b2dcacd607ddb0..366aa25c6c3721439f91d9a41084dd226fbeebd4 100644 (file)
@@ -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.");
index 0fc9759086ec49373b47b3ed08f66034c5777a40..4dba6b387ad61eab77302df18ac33e0e0ce6aff7 100644 (file)
@@ -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;
                        }
                }
index 960d98f94801b247777f7642950ee739f16f02db..21894887ef50c229829cb5ee6e44282741febe71 100644 (file)
--- 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;
index b627a0f5ab1d1439b15d3ace38ccafa0b36de046..a6501d5aab1feb13cc531de172cc875944cfced1 100644 (file)
@@ -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);
index 9d776f8aca07a0b4b304fa2291ba7e74dc16563c..06b1476b0ba3ad01c87ed7d2acead90c49d22008 100644 (file)
@@ -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:
 
index bb44bf5ecc3227032c5e3847775b447a18c44ff0..707a89c14eca6985e07953ca03c2f0df6547b596 100644 (file)
@@ -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;
index 7d1d0c96e059bffa5322f003eb361ad857a157c1..ae4adec62b1607ec821f8c91c08e15c6e570c3ed 100644 (file)
@@ -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);
                }
 
index 2faec7c2477242dc5ba2b4cd81fa0325b8e9bf61..a35259a9c6fbcf044e55d360d529d0c043e492da 100644 (file)
@@ -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);
index 3fce39ac0679b71f78a3c8b6100ac5b33f5a4d95..a93e0bc50a6b2b77da01c72eaa9218731b421945 100644 (file)
@@ -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);
 }
index 2762425214584a009777000f5e7145b7b6d56adc..0abeccd274a595af1a5068f60e76e2b2978854a8 100644 (file)
@@ -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)