more wishing assistance (trunk only)
It's possible to ask for help on the first wish attempt, even though
the prompt hasn't been adjusted to mention that yet, so the one message
which is composed dynamically needs to have its phrasing tweaked a bit
more if the user happens to do that.
Also, allow help to be requested even when the cmdassist option is
toggled off. Now that option just controls whether the prompt string is
augmented for retry attempts.
This commit is contained in:
@@ -4606,15 +4606,18 @@ int damage, tell;
|
|||||||
return(resisted);
|
return(resisted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define MAXWISHTRY 5
|
||||||
|
|
||||||
STATIC_OVL void
|
STATIC_OVL void
|
||||||
wishcmdassist(triesleft)
|
wishcmdassist(triesleft)
|
||||||
int triesleft;
|
int triesleft;
|
||||||
{
|
{
|
||||||
static NEARDATA const char *wishinfo[] = {
|
static NEARDATA const char *wishinfo[] = {
|
||||||
"cmdassist: wish mechanics",
|
"Wish details:",
|
||||||
"",
|
"",
|
||||||
"Enter the name of an object, such as \"potion of monster detection\",",
|
"Enter the name of an object, such as \"potion of monster detection\",",
|
||||||
"\"scroll labeled README\", \"elven mithril-coat\", or \"Grimtooth\".",
|
"\"scroll labeled README\", \"elven mithril-coat\", or \"Grimtooth\"",
|
||||||
|
"(without the quotes).",
|
||||||
"",
|
"",
|
||||||
"For object types which come in stacks, you may specify a plural name",
|
"For object types which come in stacks, you may specify a plural name",
|
||||||
"such as \"potions of healing\", or specify a count, such as \"1000 gold",
|
"such as \"potions of healing\", or specify a count, such as \"1000 gold",
|
||||||
@@ -4629,7 +4632,7 @@ int triesleft;
|
|||||||
},
|
},
|
||||||
preserve_wishless[] = "Doing so will preserve 'wishless' conduct.",
|
preserve_wishless[] = "Doing so will preserve 'wishless' conduct.",
|
||||||
retry_info[] =
|
retry_info[] =
|
||||||
"If you specify an unrecognized object name %s more time%s,",
|
"If you specify an unrecognized object name %s%s time%s,",
|
||||||
retry_too[] = "a randomly chosen item will be granted.",
|
retry_too[] = "a randomly chosen item will be granted.",
|
||||||
suppress_cmdassist[] =
|
suppress_cmdassist[] =
|
||||||
"(Suppress this assistance with !cmdassist in your config file.)",
|
"(Suppress this assistance with !cmdassist in your config file.)",
|
||||||
@@ -4649,17 +4652,17 @@ int triesleft;
|
|||||||
Sprintf(buf, retry_info,
|
Sprintf(buf, retry_info,
|
||||||
(triesleft >= 0 && triesleft < SIZE(cardinals)) ?
|
(triesleft >= 0 && triesleft < SIZE(cardinals)) ?
|
||||||
cardinals[triesleft] : too_many,
|
cardinals[triesleft] : too_many,
|
||||||
|
(triesleft < MAXWISHTRY) ? " more" : "",
|
||||||
plur(triesleft));
|
plur(triesleft));
|
||||||
putstr(win, 0, buf);
|
putstr(win, 0, buf);
|
||||||
putstr(win, 0, retry_too);
|
putstr(win, 0, retry_too);
|
||||||
putstr(win, 0, "");
|
putstr(win, 0, "");
|
||||||
putstr(win, 0, suppress_cmdassist);
|
if (iflags.cmdassist)
|
||||||
|
putstr(win, 0, suppress_cmdassist);
|
||||||
display_nhwindow(win, FALSE);
|
display_nhwindow(win, FALSE);
|
||||||
destroy_nhwindow(win);
|
destroy_nhwindow(win);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAXWISHTRY 5
|
|
||||||
|
|
||||||
void
|
void
|
||||||
makewish()
|
makewish()
|
||||||
{
|
{
|
||||||
@@ -4671,18 +4674,18 @@ makewish()
|
|||||||
nothing = zeroobj; /* lint suppression; only its address matters */
|
nothing = zeroobj; /* lint suppression; only its address matters */
|
||||||
if (flags.verbose) You("may wish for an object.");
|
if (flags.verbose) You("may wish for an object.");
|
||||||
retry:
|
retry:
|
||||||
Strcpy(promptbuf,"For what do you wish");
|
Strcpy(promptbuf, "For what do you wish");
|
||||||
if (iflags.cmdassist && tries > 0) {
|
if (iflags.cmdassist && tries > 0)
|
||||||
Sprintf(eos(promptbuf),
|
Strcat(promptbuf, " (enter 'help' for assistance)");
|
||||||
" (enter 'help' for assistance)");
|
Strcat(promptbuf, "?");
|
||||||
}
|
|
||||||
Strcat(promptbuf,"?");
|
|
||||||
getlin(promptbuf, buf);
|
getlin(promptbuf, buf);
|
||||||
if(iflags.cmdassist && !strcmpi(buf,"help")) {
|
(void)mungspaces(buf);
|
||||||
wishcmdassist(MAXWISHTRY - tries);
|
if (buf[0] == '\033') {
|
||||||
goto retry;
|
buf[0] = '\0';
|
||||||
|
} else if (!strcmpi(buf, "help")) {
|
||||||
|
wishcmdassist(MAXWISHTRY - tries);
|
||||||
|
goto retry;
|
||||||
}
|
}
|
||||||
if(buf[0] == '\033') buf[0] = 0;
|
|
||||||
/*
|
/*
|
||||||
* Note: if they wished for and got a non-object successfully,
|
* Note: if they wished for and got a non-object successfully,
|
||||||
* otmp == &zeroobj. That includes gold, or an artifact that
|
* otmp == &zeroobj. That includes gold, or an artifact that
|
||||||
|
|||||||
Reference in New Issue
Block a user