Sting revisited

Replace recent "(light blue aura)" with
"(flickering light blue)" if there are 1..4 orcs,
"(glimmering light blue)" if 5..12, or
"(gleaming light blue)" if there are 13 or more, and move its place
in the formatted name.
_3.6.1_: Sting (weapon in hand) (glowing light blue)
_recent: Sting (weapon in hand) (light blue aura)
_now___: Sting (weapon in hand, flickering light blue)

The thresholds for intensity may need to be tweaked.  The start
message has been changed from "glows" to "flickers/glimmers/gleams"
and is given when the intensity changes (up or down) as well as when
first glowing.  Stop message will usually be "stops flickering" but
some form of mass kill (genocide for sure, maybe explosion, probably
not wand zap) might result in stopping directly from higher intensity.

It still "quivers" if hero is blind when there are orcs on the level,
but no name augmentation shows in inventory for that situation;
describing it as "(weapon in hand, quivering)" would be too silly.
Also, the quiver or glow intermediate message if blindness is toggled
while Sting is active only worked for make_blinded(), not for putting
on and taking off a blindfold.  Now fixed.  I think becoming blind due
to polymorphing into an eyeless form is still not handled, but there
are no eyeless creatures capable of wielding weapons so that can wait.
Polymorphing from eyeless to sighted is handled but moot for Sting.
This commit is contained in:
PatR
2018-12-02 02:09:22 -08:00
parent 9e047f871b
commit 26a3a53786
6 changed files with 100 additions and 55 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 artifact.c $NHDT-Date: 1509836679 2017/11/04 23:04:39 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.106 $ */
/* NetHack 3.6 artifact.c $NHDT-Date: 1543745353 2018/12/02 10:09:13 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.127 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */
@@ -27,6 +27,7 @@ STATIC_DCL boolean FDECL(Mb_hit, (struct monst * magr, struct monst *mdef,
struct obj *, int *, int, BOOLEAN_P, char *));
STATIC_DCL unsigned long FDECL(abil_to_spfx, (long *));
STATIC_DCL uchar FDECL(abil_to_adtyp, (long *));
STATIC_DCL int FDECL(glow_strength, (int));
STATIC_DCL boolean FDECL(untouchable, (struct obj *, BOOLEAN_P));
STATIC_DCL int FDECL(count_surround_traps, (int, int));
@@ -1852,6 +1853,37 @@ int arti_indx;
return hcolor(colorstr);
}
/* glow verb; [0] holds the value used when blind */
static const char *glow_verbs[] = {
"quiver", "flicker", "glimmer", "gleam"
};
/* relative strength that Sting is glowing (0..3), to select verb */
STATIC_OVL int
glow_strength(count)
int count;
{
/* glow strength should also be proportional to proximity and
probably difficulty, but we don't have that information and
gathering it is more trouble than this would be worth */
return (count > 12) ? 3 : (count > 4) ? 2 : (count > 0);
}
const char *
glow_verb(count, ingsfx)
int count; /* 0 means blind rather than no applicable creatures */
boolean ingsfx;
{
static char resbuf[20];
Strcpy(resbuf, glow_verbs[glow_strength(count)]);
/* ing_suffix() will double the last consonant for all the words
we're using and none of them should have that, so bypass it */
if (ingsfx)
Strcat(resbuf, "ing");
return resbuf;
}
/* use for warning "glow" for Sting, Orcrist, and Grimtooth */
void
Sting_effects(orc_count)
@@ -1861,22 +1893,28 @@ int orc_count; /* new count (warn_obj_cnt is old count); -1 is a flag value */
&& (uwep->oartifact == ART_STING
|| uwep->oartifact == ART_ORCRIST
|| uwep->oartifact == ART_GRIMTOOTH)) {
int oldstr = glow_strength(warn_obj_cnt),
newstr = glow_strength(orc_count);
if (orc_count == -1 && warn_obj_cnt > 0) {
/* -1 means that blindness has just been toggled; give a
'continue' message that eventual 'stop' message will match */
pline("%s is %s.", bare_artifactname(uwep),
!Blind ? "glowing" : "quivering");
} else if (orc_count > 0 && warn_obj_cnt == 0) {
glow_verb(Blind ? 0 : warn_obj_cnt, TRUE));
} else if (newstr > 0 && newstr != oldstr) {
/* 'start' message */
if (!Blind)
pline("%s %s %s!", bare_artifactname(uwep),
otense(uwep, "glow"), glow_color(uwep->oartifact));
else
pline("%s quivers slightly.", bare_artifactname(uwep));
pline("%s %s %s%c", bare_artifactname(uwep),
otense(uwep, glow_verb(orc_count, FALSE)),
glow_color(uwep->oartifact),
(newstr > oldstr) ? '!' : '.');
else if (oldstr == 0) /* quivers */
pline("%s %s slightly.", bare_artifactname(uwep),
otense(uwep, glow_verb(0, FALSE)));
} else if (orc_count == 0 && warn_obj_cnt > 0) {
/* 'stop' message */
pline("%s stops %s.", bare_artifactname(uwep),
!Blind ? "glowing" : "quivering");
glow_verb(Blind ? 0 : warn_obj_cnt, TRUE));
}
}
}