more #U1233 - specifying mon class instead type for polyself (trunk only)

Another item from the Dec'04 report sent in by <email deleted>.  When prompted for a type of monster to polymorph
into, giving a monster class description like "dog or other canine" (or
single letter like 'd'), triggered "I've never heard of such monsters".
Instead of adjusting the message, this chooses a member from the class.

     I put this into the fixes file as a new feature.
This commit is contained in:
nethack.rankin
2007-04-10 03:39:52 +00:00
parent a8913c2366
commit 4777c898f8
5 changed files with 55 additions and 3 deletions

View File

@@ -664,10 +664,15 @@ int *mndx_p;
/* multiple-letter input which matches any of these gets rejected */
"an", "the", "or", "other", "or other", 0
};
/* positive pm_val => specific monster; negative => class */
static NEARDATA const struct alt_spl truematch[] = {
/* "long worm" won't match "worm" class but would accidentally match
"long worm tail" class before the comparison with monster types */
{ "long worm", PM_LONG_WORM },
/* matches wrong--or at least suboptimal--class */
{ "demon", -S_DEMON }, /* hits "imp or minor demon" */
/* matches specific monster (overly restrictive) */
{ "devil", -S_DEMON }, /* always "horned devil" */
/* some plausible guesses which need help */
{ "bug", -S_XAN }, /* would match bugbear... */
{ "fish", -S_EEL }, /* wouldn't match anything */
@@ -685,7 +690,12 @@ int *mndx_p;
} else if (!in_str[1]) {
/* single character */
i = def_char_to_monclass(*in_str);
if (i == MAXMCLASSES)
if (i == S_MIMIC_DEF) { /* ']' -> 'm' */
i = S_MIMIC;
} else if (i == S_WORM_TAIL) { /* '~' -> 'w' */
i = S_WORM;
if (mndx_p) *mndx_p = PM_LONG_WORM;
} else if (i == MAXMCLASSES) /* maybe 'I' */
i = (*in_str == DEF_INVISIBLE) ? S_invisible : 0;
return i;
} else {