more Sting,&c

Add "(glowing light blue)" to the formatted object description when
Sting or Orcrist is glowing due to presence of orcs or "(glowing red)"
if Grimtooth is glowing due to elves.  Use "(glowing)" if blind;
assumes that some aspect of the glow (perhaps warmth or vibration) can
be noticed via touch.

Make enlightenment's "you are warned about <monster class> because of
<artifact>" catch up with Orcrist and Grimtooth.  It was attributing
Orcrist's warning against orcs to Sting, and Grimtooth's warning was
against "something" rather than elves.

The glow color is now a new field in artilist[], so the biggest part
of this patch is adding an extra value to each artifact's definition.
This commit is contained in:
PatR
2015-05-30 22:41:30 -07:00
parent 69596a58b3
commit 0171345aad
7 changed files with 110 additions and 69 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 artifact.c $NHDT-Date: 1432946531 2015/05/30 00:42:11 $ $NHDT-Branch: master $:$NHDT-Revision: 1.89 $ */
/* NetHack 3.6 artifact.c $NHDT-Date: 1433050876 2015/05/31 05:41:16 $ $NHDT-Branch: master $:$NHDT-Revision: 1.90 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1784,10 +1784,12 @@ long *abil;
unsigned long spfx;
long wornbits;
long wornmask =
(W_ARM | W_ARMC | W_ARMH | W_ARMS | W_ARMG | W_ARMF | W_WEP | W_QUIVER
| W_SWAPWEP | W_ART | W_ARTI | W_AMUL | W_RINGL | W_RINGR | W_TOOL
| W_BALL | W_CHAIN | W_SADDLE | W_ARMU);
(W_ARM | W_ARMC | W_ARMH | W_ARMS | W_ARMG | W_ARMF | W_ARMU
| W_AMUL | W_RINGL | W_RINGR | W_TOOL | W_ART | W_ARTI);
/* [do W_ART and W_ARTI actually belong here?] */
if (u.twoweap)
wornmask |= W_SWAPWEP;
dtyp = abil_to_adtyp(abil);
spfx = abil_to_spfx(abil);
wornbits = (wornmask & *abil);
@@ -1795,14 +1797,21 @@ long *abil;
for (obj = invent; obj; obj = obj->nobj) {
if (obj->oartifact
&& ((abil != &EWarn_of_mon) || context.warntype.obj)) {
register const struct artifact *art = get_artifact(obj);
const struct artifact *art = get_artifact(obj);
if (art) {
if (dtyp
&& (art->cary.adtyp == dtyp || art->defn.adtyp == dtyp))
return obj;
if (spfx && ((art->cspfx & spfx) == spfx
|| (art->spfx & spfx) == spfx))
return obj;
if (dtyp) {
if (art->cary.adtyp == dtyp || art->defn.adtyp == dtyp)
return obj;
}
if (spfx) {
/* property conferred when carried */
if ((art->cspfx & spfx) == spfx)
return obj;
/* property conferred when wielded or worn */
if ((art->spfx & spfx) == spfx && obj->owornmask)
return obj;
}
}
} else {
if (wornbits && wornbits == (wornmask & obj->owornmask))
@@ -1812,6 +1821,16 @@ long *abil;
return (struct obj *) 0;
}
const char *
glow_color(arti_indx)
int arti_indx;
{
int colornum = artilist[arti_indx].acolor;
const char *colorstr = clr2colorname(colornum);
return hcolor(colorstr);
}
/* use for warning "glow" for Sting, Orcrist, and Grimtooth */
void
Sting_effects(orc_count)
@@ -1831,10 +1850,7 @@ int orc_count;
if (orc_count > 0 && warn_obj_cnt == 0) {
if (!Blind)
pline("%s %s %s!", bare_artifactname(uwep),
otense(uwep, "glow"),
hcolor((uwep->oartifact == ART_GRIMTOOTH)
? NH_RED
: NH_LIGHT_BLUE));
otense(uwep, "glow"), glow_color(uwep->oartifact));
else
pline("%s quivers slightly.", bare_artifactname(uwep));
} else if (orc_count == 0 && warn_obj_cnt > 0) {

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 cmd.c $NHDT-Date: 1432512764 2015/05/25 00:12:44 $ $NHDT-Branch: master $:$NHDT-Revision: 1.192 $ */
/* NetHack 3.6 cmd.c $NHDT-Date: 1433050877 2015/05/31 05:41:17 $ $NHDT-Branch: master $:$NHDT-Revision: 1.193 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1952,10 +1952,9 @@ int final;
you_are("warned", from_what(WARNING));
if (Warn_of_mon && context.warntype.obj) {
Sprintf(buf, "aware of the presence of %s",
(context.warntype.obj & M2_ORC)
? "orcs"
: (context.warntype.obj & M2_DEMON) ? "demons"
: something);
(context.warntype.obj & M2_ORC) ? "orcs"
: (context.warntype.obj & M2_ELF) ? "elves"
: (context.warntype.obj & M2_DEMON) ? "demons" : something);
you_are(buf, from_what(WARN_OF_MON));
}
if (Warn_of_mon && context.warntype.polyd) {

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 objnam.c $NHDT-Date: 1432722918 2015/05/27 10:35:18 $ $NHDT-Branch: master $:$NHDT-Revision: 1.137 $ */
/* NetHack 3.6 objnam.c $NHDT-Date: 1433050879 2015/05/31 05:41:19 $ $NHDT-Branch: master $:$NHDT-Revision: 1.140 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -550,9 +550,9 @@ unsigned cxn_flags; /* bitmask of CXN_xxx values */
/* similar to simple_typename but minimal_xname operates on a particular
object rather than its general type; it formats the most basic info:
potion -- if description not known
brown potion -- if oc_name_known not set
potion of object detection -- if discovered
potion -- if description not known
brown potion -- if oc_name_known not set
potion of object detection -- if discovered
*/
static char *
minimal_xname(obj)
@@ -945,6 +945,13 @@ boolean with_price;
if (bimanual(obj))
hand_s = makeplural(hand_s);
Sprintf(eos(bp), " (weapon in %s)", hand_s);
if (obj == uwep && obj->oartifact && warn_obj_cnt) {
/* presumeably can be felt when blind */
Strcat(bp, " (glowing");
if (!Blind)
Sprintf(eos(bp), " %s", glow_color(obj->oartifact));
Strcat(bp, ")");
}
}
}
if (obj->owornmask & W_SWAPWEP) {
@@ -991,6 +998,7 @@ boolean with_price;
quotedprice, currency(quotedprice));
} else if (with_price) {
long price = get_cost_of_shop_item(obj);
if (price > 0)
Sprintf(eos(bp), " (%ld %s)", price, currency(price));
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 options.c $NHDT-Date: 1432974335 2015/05/30 08:25:35 $ $NHDT-Branch: master $:$NHDT-Revision: 1.207 $ */
/* NetHack 3.6 options.c $NHDT-Date: 1433050879 2015/05/31 05:41:19 $ $NHDT-Branch: master $:$NHDT-Revision: 1.208 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -502,7 +502,6 @@ STATIC_OVL boolean FDECL(wc2_supported, (const char *));
STATIC_DCL void FDECL(remove_autopickup_exception,
(struct autopickup_exception *));
STATIC_OVL int FDECL(count_ape_maps, (int *, int *));
STATIC_DCL const char *FDECL(clr2colorname, (int));
STATIC_DCL const char *FDECL(attr2attrname, (int));
STATIC_DCL int NDECL(query_color);
STATIC_DCL int NDECL(query_msgtype);