Fix sleep explosion causing impossible().

Also clean up come ternaries while I'm here.

My first attempt to fix was to add AD_SLEE to explode(), but that failed
because do_break_wand() already does the sleeping portion. I don't
generally like the duplication between explode() and do_break_wand as a
result, but I consider that issue a project for another day.
This commit is contained in:
Sean Hunt
2015-05-24 21:40:31 +09:00
committed by nhmall
parent 137bc4a493
commit 6aaece4ba7

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 explode.c $NHDT-Date: 1431192763 2015/05/09 17:32:43 $ $NHDT-Branch: master $:$NHDT-Revision: 1.40 $ */ /* NetHack 3.6 explode.c $NHDT-Date: 1432454165 2015/05/24 07:56:05 $ $NHDT-Branch: master $:$NHDT-Revision: 1.41 $ */
/* NetHack 3.6 explode.c $Date: 2013/11/05 00:57:55 $ $Revision: 1.34 $ */ /* NetHack 3.6 explode.c $Date: 2013/11/05 00:57:55 $ $Revision: 1.34 $ */
/* Copyright (C) 1990 by Ken Arromdee */ /* Copyright (C) 1990 by Ken Arromdee */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -56,7 +56,8 @@ int expltype;
exploding_wand_typ = (short) type; exploding_wand_typ = (short) type;
/* most attack wands produce specific explosions; /* most attack wands produce specific explosions;
other types produce a generic magical explosion */ other types produce a generic magical explosion */
if (objects[type].oc_dir == RAY && type != WAN_DIGGING) { if (objects[type].oc_dir == RAY && type != WAN_DIGGING &&
type != WAN_SLEEP) {
type -= WAN_MAGIC_MISSILE; type -= WAN_MAGIC_MISSILE;
if (type < 0 || type > 9) { if (type < 0 || type > 9) {
impossible("explode: wand has bad zap type (%d).", type); impossible("explode: wand has bad zap type (%d).", type);
@@ -317,43 +318,64 @@ int expltype;
str = hallu_buf; str = hallu_buf;
} }
if (u.uswallow && mtmp == u.ustuck) { if (u.uswallow && mtmp == u.ustuck) {
if (is_animal(u.ustuck->data)) const char *adj = NULL;
pline("%s gets %s!", Monnam(u.ustuck), if (is_animal(u.ustuck->data)) {
(adtyp == AD_FIRE) switch (adtyp) {
? "heartburn" case AD_FIRE:
: (adtyp == AD_COLD) adj = "heartburn";
? "chilly" break;
: (adtyp == AD_DISN) case AD_COLD:
? ((olet == WAND_CLASS) adj = "chilly";
? "irradiated by pure " break;
"energy" case AD_DISN:
: "perforated") if (olet == WAND_CLASS)
: (adtyp == AD_ELEC) adj = "irradiated by pure energy";
? "shocked" else
: (adtyp == AD_DRST) adj = "perforated";
? "poisoned" break;
: (adtyp == AD_ACID) case AD_ELEC:
? "an upset " adj = "shocked";
"stomach" break;
: "fried"); case AD_DRST:
else adj = "poisoned";
pline("%s gets slightly %s!", Monnam(u.ustuck), break;
(adtyp == AD_FIRE) case AD_ACID:
? "toasted" adj = "an upset stomach";
: (adtyp == AD_COLD) break;
? "chilly" default:
: (adtyp == AD_DISN) adj = "fried";
? ((olet == WAND_CLASS) break;
? "overwhelmed by pure " }
"energy" pline("%s gets %s!", Monnam(u.ustuck), adj);
: "perforated") } else {
: (adtyp == AD_ELEC) switch (adtyp) {
? "shocked" case AD_FIRE:
: (adtyp == AD_DRST) adj = "toasted";
? "intoxicated" break;
: (adtyp == AD_ACID) case AD_COLD:
? "burned" adj = "chilly";
: "fried"); break;
case AD_DISN:
if (olet == WAND_CLASS)
adj = "overwhelmed by pure energy";
else
adj = "perforated";
break;
case AD_ELEC:
adj = "shocked";
break;
case AD_DRST:
adj = "intoxicated";
break;
case AD_ACID:
adj = "burned";
break;
default:
adj = "fried";
break;
}
pline("%s gets slightly %s!", Monnam(u.ustuck), adj);
}
} else if (cansee(i + x - 1, j + y - 1)) { } else if (cansee(i + x - 1, j + y - 1)) {
if (mtmp->m_ap_type) if (mtmp->m_ap_type)
seemimic(mtmp); seemimic(mtmp);