cmdassist for wishing

This commit is contained in:
nethack.allison
2006-08-26 04:03:27 +00:00
parent 422bfa686e
commit 90fba2f9f9
2 changed files with 51 additions and 3 deletions

View File

@@ -196,7 +196,11 @@ extern NEARDATA struct window_procs windowprocs;
#define WC_MAP_MODE 0x10000000L /* 29 map_mode option */
#define WC_WINDOWCOLORS 0x20000000L /* 30 background color for message window */
#define WC_PLAYER_SELECTION 0x40000000L /* 31 background color for message window */
#ifdef NHSTDC
#define WC_MOUSE_SUPPORT 0x80000000UL /* 32 mouse support */
#else
#define WC_MOUSE_SUPPORT 0x80000000L /* 32 mouse support */
#endif
/* no free bits */
#define WC2_FULLSCREEN 0x01L /* 01 display full screen */

View File

@@ -4350,17 +4350,61 @@ int damage, tell;
return(resisted);
}
#define MAXWISHTRY 5
STATIC_OVL void
wishcmdassist(tries)
int tries;
{
winid win;
char buf[BUFSZ];
win = create_nhwindow(NHW_TEXT);
if (!win) return;
Sprintf(buf, "cmdassist: wish mechanics");
putstr(win, 0, buf);
putstr(win, 0, "");
buf[0] = 0;
Sprintf(buf,
"You can enter 'nothing' explicitly to scratch this wish.");
putstr(win, 0, buf);
if (!u.uconduct.wishes) {
Sprintf(buf,"Entering 'nothing' will not alter your wishless status.");
putstr(win, 0, buf);
}
Sprintf(buf,
"You will by granted something random after %d more failed attempts.",
MAXWISHTRY - tries);
putstr(win, 0, buf);
putstr(win, 0, "");
putstr(win, 0,
"(Suppress this assistance with !cmdassist in config file.)");
display_nhwindow(win, FALSE);
destroy_nhwindow(win);
}
void
makewish()
{
char buf[BUFSZ];
char buf[BUFSZ], promptbuf[BUFSZ];
struct obj *otmp, nothing;
int tries = 0;
promptbuf[0] = '\0';
nothing = zeroobj; /* lint suppression; only its address matters */
if (flags.verbose) You("may wish for an object.");
retry:
getlin("For what do you wish?", buf);
Strcpy(promptbuf,"For what do you wish");
if (iflags.cmdassist && tries > 0) {
Sprintf(eos(promptbuf),
" (enter 'help' for assistance)");
}
Strcat(promptbuf,"?");
getlin(promptbuf, buf);
if(iflags.cmdassist && !strcmpi(buf,"help")) {
wishcmdassist(tries);
goto retry;
}
if(buf[0] == '\033') buf[0] = 0;
/*
* Note: if they wished for and got a non-object successfully,
@@ -4371,7 +4415,7 @@ retry:
otmp = readobjnam(buf, &nothing);
if (!otmp) {
pline("Nothing fitting that description exists in the game.");
if (++tries < 5) goto retry;
if (++tries < MAXWISHTRY) goto retry;
pline(thats_enough_tries);
otmp = readobjnam((char *)0, (struct obj *)0);
if (!otmp) return; /* for safety; should never happen */