Half_physical_damage 2

Another batch of missing Half_physical_damage checks
from the list provided by <Someone>:
- Scrolls of fire (!confused)
- Broken wands
- Splattered burning oil from thrown potion
- Dipping a lit lamp into a potion of oil
- Scrolls of fire (confused, didn't bother with non-confused)
- Being caught in a fireball

Adds a macro Maybe_Half_Phys to assist.
This commit is contained in:
nethack.allison
2003-10-21 16:47:59 +00:00
parent 6c63831645
commit 47e1a6873a
5 changed files with 28 additions and 10 deletions

View File

@@ -146,6 +146,13 @@ NEARDATA extern coord bhitpos; /* place where throw or zap hits or stops */
/* special mhpmax value when loading bones monster to flag as extinct or genocided */
#define DEFUNCT_MONSTER (-100)
/* macro form of adjustments of physical damage based on Half_physical_damage.
* Can be used on-the-fly with the 1st parameter to losehp() if you don't
* need to retain the dmg value beyond that call scope.
* Take care to ensure it doesn't get used more than once in other instances.
*/
#define Maybe_Half_Phys(dmg) ((Half_physical_damage) ? (((dmg) + 1) / 2) : (dmg))
/* flags for special ggetobj status returns */
#define ALL_FINISHED 0x01 /* called routine already finished the job */

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)apply.c 3.4 2003/05/25 */
/* SCCS Id: @(#)apply.c 3.4 2003/10/21 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2611,6 +2611,7 @@ do_break_wand(obj)
boolean fillmsg = FALSE;
int expltype = EXPL_MAGICAL;
char confirm[QBUFSZ], the_wand[BUFSZ], buf[BUFSZ];
boolean physical_dmg = FALSE;
Strcpy(the_wand, yname(obj));
Sprintf(confirm, "Are you really sure you want to break %s?",
@@ -2736,7 +2737,7 @@ do_break_wand(obj)
damage = zapyourself(obj, FALSE);
if (damage) {
Sprintf(buf, "killed %sself by breaking a wand", uhim());
losehp(damage, buf, NO_KILLER_PREFIX);
losehp(Maybe_Half_Phys(damage), buf, NO_KILLER_PREFIX);
}
if (context.botl) bot(); /* blindness */
} else if ((mon = m_at(x, y)) != 0) {

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)dothrow.c 3.4 2003/01/24 */
/* SCCS Id: @(#)dothrow.c 3.4 2003/10/21 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -798,7 +798,7 @@ boolean hitsroof;
if (dmg > 1 && less_damage) dmg = 1;
if (dmg > 0) dmg += u.udaminc;
if (dmg < 0) dmg = 0; /* beware negative rings of increase damage */
if (Half_physical_damage) dmg = (dmg + 1) / 2;
dmg = Maybe_Half_Phys(dmg);
if (uarmh) {
if (less_damage && dmg < (Upolyd ? u.mh : u.uhp)) {

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)explode.c 3.4 2002/11/10 */
/* SCCS Id: @(#)explode.c 3.4 2003/10/21 */
/* Copyright (C) 1990 by Ken Arromdee */
/* NetHack may be freely redistributed. See license for details. */
@@ -18,6 +18,13 @@ static int expl[3][3] = {
* they don't supply enough information--was it a player or a monster that
* did it, and with a wand, spell, or breath weapon? Object types share both
* these disadvantages....
*
* Important note about Half_physical_damage:
* Unlike losehp() , explode() makes the Half_physical_damage adjustments
* itself, so the caller should never have done that ahead of time.
* It has to be done this way because the damage value is applied to
* things beside the player. Care is taken within explode() to ensure
* that Half_physical_damage only affects the damage applied to the hero.
*/
void
explode(x, y, type, dam, olet, expltype)
@@ -39,6 +46,7 @@ int expltype;
/* 0=normal explosion, 1=do shieldeff, 2=do nothing */
boolean shopdamage = FALSE;
boolean generic = FALSE;
boolean physical_dmg = FALSE;
if (olet == WAND_CLASS) /* retributive strike */
switch (Role_switch) {
@@ -64,6 +72,7 @@ int expltype;
olet == SCROLL_CLASS ? "tower of flame" :
"fireball";
adtyp = AD_FIRE;
physical_dmg = TRUE;
break;
case 2: str = "ball of cold";
adtyp = AD_COLD;
@@ -94,7 +103,7 @@ int expltype;
if (i+x-1 == u.ux && j+y-1 == u.uy) {
switch(adtyp) {
case AD_PHYS:
case AD_PHYS:
explmask[i][j] = 0;
break;
case AD_MAGM:
@@ -119,6 +128,7 @@ int expltype;
break;
case AD_ACID:
explmask[i][j] = !!Acid_resistance;
physical_dmg = TRUE;
break;
default:
impossible("explosion type %d?", adtyp);
@@ -313,8 +323,8 @@ int expltype;
if (Invulnerable) {
damu = 0;
You("are unharmed!");
} else if (Half_physical_damage && adtyp == AD_PHYS)
damu = (damu+1) / 2;
} else if (adtyp == AD_PHYS || physical_dmg)
damu = Maybe_Half_Phys(damu);
if (adtyp == AD_FIRE) (void) burnarmor(&youmonst);
destroy_item(SCROLL_CLASS, (int) adtyp);
destroy_item(SPBOOK_CLASS, (int) adtyp);

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)potion.c 3.4 2002/10/02 */
/* SCCS Id: @(#)potion.c 3.4 2003/10/21 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -876,7 +876,7 @@ peffects(otmp)
good_for_you = TRUE;
} else {
You("burn your %s.", body_part(FACE));
losehp(d(Fire_resistance ? 1 : 3, 4),
losehp(Maybe_Half_Phys(d(Fire_resistance ? 1 : 3, 4)),
"burning potion of oil", KILLED_BY_AN);
}
} else if(otmp->cursed)