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 09:24:11 -04:00
committed by nhmall
parent 137bc4a493
commit 6aaece4ba7
+60 -38
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"
: (adtyp == AD_DRST)
? "poisoned"
: (adtyp == AD_ACID)
? "an upset "
"stomach"
: "fried");
else else
pline("%s gets slightly %s!", Monnam(u.ustuck), adj = "perforated";
(adtyp == AD_FIRE) break;
? "toasted" case AD_ELEC:
: (adtyp == AD_COLD) adj = "shocked";
? "chilly" break;
: (adtyp == AD_DISN) case AD_DRST:
? ((olet == WAND_CLASS) adj = "poisoned";
? "overwhelmed by pure " break;
"energy" case AD_ACID:
: "perforated") adj = "an upset stomach";
: (adtyp == AD_ELEC) break;
? "shocked" default:
: (adtyp == AD_DRST) adj = "fried";
? "intoxicated" break;
: (adtyp == AD_ACID) }
? "burned" pline("%s gets %s!", Monnam(u.ustuck), adj);
: "fried"); } else {
switch (adtyp) {
case AD_FIRE:
adj = "toasted";
break;
case AD_COLD:
adj = "chilly";
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);