viewing geno'd monsters at "genocide what?" prompt

At either of the genocide prompts,
|What type of monster do you want to genocide?
or
|What class of monsters do you want to genocide?
answering "?<return>" will show the list of monster types that have
already been genocided, then re-prompt.
This commit is contained in:
PatR
2023-09-09 16:56:24 -07:00
parent 9472c0b797
commit 0a7cdeae3c
3 changed files with 37 additions and 10 deletions

View File

@@ -2234,6 +2234,9 @@ new status highlight rule type for hitpoints: "criticalhp" rule overrides
hit point rules if current HP is so low that prayer will consider it hit point rules if current HP is so low that prayer will consider it
to be major problem; applies to hitpointbar as well as HP status to be major problem; applies to hitpointbar as well as HP status
high skill level in martial arts or bare-handed combat sometimes hits twice high skill level in martial arts or bare-handed combat sometimes hits twice
answering '?<return>' at the "genocide what?" prompt (for either monster class
or single species) runs the #genocided command to show what types of
monsters have already been genocided and then re-prompts
Platform- and/or Interface-Specific New Features Platform- and/or Interface-Specific New Features

View File

@@ -2882,14 +2882,18 @@ list_genocided(char defquery, boolean ask)
char c; char c;
winid klwin; winid klwin;
char buf[BUFSZ]; char buf[BUFSZ];
boolean dumping; /* for DUMPLOG; doesn't need to be conditional */ boolean genoing, /* prompting for genocide or class genocide */
dumping; /* for DUMPLOG; doesn't need to be conditional */
boolean both = (gp.program_state.gameover || wizard || discover); boolean both = (gp.program_state.gameover || wizard || discover);
dumping = (defquery == 'd'); dumping = (defquery == 'd');
if (dumping) genoing = (defquery == 'g');
if (dumping || genoing)
defquery = 'y'; defquery = 'y';
if (genoing)
both = FALSE; /* genocides only, not extinctions */
/* this goess through the whole monster list up to three times but will /* this goes through the whole monster list up to three times but will
happen rarely and is simpler than a more general single pass check; happen rarely and is simpler than a more general single pass check;
extinctions are only revealed during end of game disclosure or when extinctions are only revealed during end of game disclosure or when
running in wizard or explore mode */ running in wizard or explore mode */
@@ -2985,7 +2989,7 @@ list_genocided(char defquery, boolean ask)
} else if (!gp.program_state.gameover) { } else if (!gp.program_state.gameover) {
/* #genocided rather than final disclosure, so pline() is ok and /* #genocided rather than final disclosure, so pline() is ok and
extinction has been ignored */ extinction has been ignored */
pline("No creatures have been genocided."); pline("No creatures have been genocided%s.", genoing ? " yet" : "");
#ifdef DUMPLOG #ifdef DUMPLOG
} else if (dumping) { /* 'gameover' is True if we make it here */ } else if (dumping) { /* 'gameover' is True if we make it here */
putstr(0, 0, "No species were genocided or became extinct."); putstr(0, 0, "No species were genocided or became extinct.");

View File

@@ -2506,15 +2506,18 @@ do_class_genocide(void)
boolean gameover = FALSE; /* true iff killed self */ boolean gameover = FALSE; /* true iff killed self */
buf[0] = '\0'; /* for EDIT_GETLIN */ buf[0] = '\0'; /* for EDIT_GETLIN */
for (j = 0;; j++) { for (j = 0; ; j++) {
if (j >= 5) { if (j >= 5) {
pline1(thats_enough_tries); pline1(thats_enough_tries);
return; return;
} }
Strcpy(promptbuf, "What class of monsters do you want to genocide?"); Strcpy(promptbuf, "What class of monsters do you want to genocide?");
if (iflags.cmdassist && j > 0) if (j > 0)
Strcat(promptbuf, Snprintf(eos(promptbuf), sizeof promptbuf - strlen(promptbuf),
" [enter the symbol or name representing a class]"); " [enter %s]",
iflags.cmdassist
? "the symbol or name representing a class, or '?'"
: "'?' to see previous genocides");
getlin(promptbuf, buf); getlin(promptbuf, buf);
(void) mungspaces(buf); (void) mungspaces(buf);
/* avoid 'that does not represent any monster' for empty input */ /* avoid 'that does not represent any monster' for empty input */
@@ -2534,6 +2537,13 @@ do_class_genocide(void)
"declined to perform class genocide"); "declined to perform class genocide");
return; return;
} }
/* "?" runs #genocided to show existing genocides, then re-prompts;
accept "'?'" too because the prompt's hint shows it that way */
if (!strcmp(buf, "?") || !strcmp(buf, "'?'")) {
list_genocided('g', FALSE);
--j; /* don't count this iteration as one of the tries */
continue;
}
class = name_to_monclass(buf, (int *) 0); class = name_to_monclass(buf, (int *) 0);
if (class == 0 && (i = name_to_mon(buf, (int *) 0)) != NON_PM) if (class == 0 && (i = name_to_mon(buf, (int *) 0)) != NON_PM)
@@ -2705,8 +2715,12 @@ do_genocide(
return; return;
} }
Strcpy(promptbuf, "What type of monster do you want to genocide?"); Strcpy(promptbuf, "What type of monster do you want to genocide?");
if (iflags.cmdassist && i > 0) if (i > 0)
Strcat(promptbuf, " [enter the name of a type of monster]"); Snprintf(eos(promptbuf), sizeof promptbuf - strlen(promptbuf),
" [enter %s]",
iflags.cmdassist
? "the name of a type of monster, or '?'"
: "'?' to see previous genocides");
getlin(promptbuf, buf); getlin(promptbuf, buf);
(void) mungspaces(buf); (void) mungspaces(buf);
/* avoid 'such creatures do not exist' for empty input */ /* avoid 'such creatures do not exist' for empty input */
@@ -2728,6 +2742,12 @@ do_genocide(
livelog_printf(LL_GENOCIDE, "declined to perform genocide"); livelog_printf(LL_GENOCIDE, "declined to perform genocide");
return; return;
} }
/* "?" or "'?'" runs #genocided to show existing genocides */
if (!strcmp(buf, "?") || !strcmp(buf, "'?'")) {
list_genocided('g', FALSE);
--i; /* don't count this iteration as one of the tries */
continue;
}
mndx = name_to_mon(buf, (int *) 0); mndx = name_to_mon(buf, (int *) 0);
if (mndx == NON_PM || (gm.mvitals[mndx].mvflags & G_GENOD)) { if (mndx == NON_PM || (gm.mvitals[mndx].mvflags & G_GENOD)) {