refine genocide prompting
More PR #882; give a different message for empty input than "such creatures do not exist". The new message mentions 'none' (with single quotes) as a potential choice so recognize "'none'" as well as "none" to decline.
This commit is contained in:
+38
-18
@@ -2463,9 +2463,10 @@ do_class_genocide(void)
|
|||||||
{
|
{
|
||||||
int i, j, immunecnt, gonecnt, goodcnt, class, feel_dead = 0;
|
int i, j, immunecnt, gonecnt, goodcnt, class, feel_dead = 0;
|
||||||
int ll_done = 0;
|
int ll_done = 0;
|
||||||
char buf[BUFSZ] = DUMMY, promptbuf[QBUFSZ];
|
char buf[BUFSZ], promptbuf[QBUFSZ];
|
||||||
boolean gameover = FALSE; /* true iff killed self */
|
boolean gameover = FALSE; /* true iff killed self */
|
||||||
|
|
||||||
|
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);
|
||||||
@@ -2474,12 +2475,22 @@ do_class_genocide(void)
|
|||||||
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 (iflags.cmdassist && j > 0)
|
||||||
Strcat(promptbuf,
|
Strcat(promptbuf,
|
||||||
" [type the symbol or name representing a class]");
|
" [enter the symbol or name representing a class]");
|
||||||
getlin(promptbuf, buf);
|
getlin(promptbuf, buf);
|
||||||
(void) mungspaces(buf);
|
(void) mungspaces(buf);
|
||||||
|
/* avoid 'that does not represent any monster' for empty input */
|
||||||
|
if (!*buf) {
|
||||||
|
pline("%s.", (j + 1 < 5)
|
||||||
|
? "Type letter (or punctuation)"
|
||||||
|
" or name used for a class of monsters or 'none'"
|
||||||
|
/* next iteration gives "that's enough tries"
|
||||||
|
so don't suggest typing anything this time */
|
||||||
|
: "No class of monsters specified");
|
||||||
|
continue; /* try again */
|
||||||
|
}
|
||||||
/* choosing "none" preserves genocideless conduct */
|
/* choosing "none" preserves genocideless conduct */
|
||||||
if (*buf == '\033' || !strcmpi(buf, "none")
|
if (*buf == '\033' || !strcmpi(buf, "none")
|
||||||
|| !strcmpi(buf, "nothing")) {
|
|| !strcmpi(buf, "'none'") || !strcmpi(buf, "nothing")) {
|
||||||
livelog_printf(LL_GENOCIDE,
|
livelog_printf(LL_GENOCIDE,
|
||||||
"declined to perform class genocide");
|
"declined to perform class genocide");
|
||||||
return;
|
return;
|
||||||
@@ -2555,7 +2566,7 @@ do_class_genocide(void)
|
|||||||
if (Upolyd && vampshifted(&g.youmonst)
|
if (Upolyd && vampshifted(&g.youmonst)
|
||||||
/* current shifted form or base vampire form */
|
/* current shifted form or base vampire form */
|
||||||
&& (i == u.umonnum || i == g.youmonst.cham))
|
&& (i == u.umonnum || i == g.youmonst.cham))
|
||||||
polyself(POLY_REVERT); /* vampshifter back to vampire */
|
polyself(POLY_REVERT); /* vampshifter to vampire */
|
||||||
if (Upolyd && i == u.umonnum) {
|
if (Upolyd && i == u.umonnum) {
|
||||||
u.mh = -1;
|
u.mh = -1;
|
||||||
if (Unchanging) {
|
if (Unchanging) {
|
||||||
@@ -2626,17 +2637,16 @@ do_class_genocide(void)
|
|||||||
#define PLAYER 2
|
#define PLAYER 2
|
||||||
#define ONTHRONE 4
|
#define ONTHRONE 4
|
||||||
void
|
void
|
||||||
do_genocide(int how)
|
do_genocide(
|
||||||
/* how: */
|
int how) /* 0 = no genocide; create monsters (cursed scroll)
|
||||||
/* 0 = no genocide; create monsters (cursed scroll) */
|
* 1 = normal genocide
|
||||||
/* 1 = normal genocide */
|
* 3 = forced genocide of player
|
||||||
/* 3 = forced genocide of player */
|
* 5 (4 | 1) = normal genocide from throne */
|
||||||
/* 5 (4 | 1) = normal genocide from throne */
|
|
||||||
{
|
{
|
||||||
char buf[BUFSZ] = DUMMY, promptbuf[QBUFSZ];
|
char buf[BUFSZ], promptbuf[QBUFSZ];
|
||||||
register int i, killplayer = 0;
|
int i, killplayer = 0;
|
||||||
register int mndx;
|
int mndx;
|
||||||
register struct permonst *ptr;
|
struct permonst *ptr;
|
||||||
const char *which;
|
const char *which;
|
||||||
|
|
||||||
if (how & PLAYER) {
|
if (how & PLAYER) {
|
||||||
@@ -2645,7 +2655,8 @@ do_genocide(int how)
|
|||||||
Strcpy(buf, pmname(ptr, Ugender));
|
Strcpy(buf, pmname(ptr, Ugender));
|
||||||
killplayer++;
|
killplayer++;
|
||||||
} else {
|
} else {
|
||||||
for (i = 0;; i++) {
|
buf[0] = '\0'; /* init for EDIT_GETLIN */
|
||||||
|
for (i = 0; ; i++) {
|
||||||
if (i >= 5) {
|
if (i >= 5) {
|
||||||
/* cursed effect => no free pass (unless rndmonst() fails) */
|
/* cursed effect => no free pass (unless rndmonst() fails) */
|
||||||
if (!(how & REALLY) && (ptr = rndmonst()) != 0)
|
if (!(how & REALLY) && (ptr = rndmonst()) != 0)
|
||||||
@@ -2659,9 +2670,18 @@ do_genocide(int how)
|
|||||||
Strcat(promptbuf, " [enter the name of a type of monster]");
|
Strcat(promptbuf, " [enter the name of a type of monster]");
|
||||||
getlin(promptbuf, buf);
|
getlin(promptbuf, buf);
|
||||||
(void) mungspaces(buf);
|
(void) mungspaces(buf);
|
||||||
|
/* avoid 'such creatures do not exist' for empty input */
|
||||||
|
if (!*buf) {
|
||||||
|
pline("%s.", (i + 1 < 5)
|
||||||
|
? "Type the name of a type of monster or 'none'"
|
||||||
|
/* next iteration gives "that's enough tries"
|
||||||
|
so don't suggest typing anything this time */
|
||||||
|
: "No type of monster specified");
|
||||||
|
continue; /* try again */
|
||||||
|
}
|
||||||
/* choosing "none" preserves genocideless conduct */
|
/* choosing "none" preserves genocideless conduct */
|
||||||
if (*buf == '\033' || !strcmpi(buf, "none")
|
if (*buf == '\033' || !strcmpi(buf, "none")
|
||||||
|| !strcmpi(buf, "nothing")) {
|
|| !strcmpi(buf, "'none'") || !strcmpi(buf, "nothing")) {
|
||||||
/* ... but no free pass if cursed */
|
/* ... but no free pass if cursed */
|
||||||
if (!(how & REALLY) && (ptr = rndmonst()) != 0)
|
if (!(how & REALLY) && (ptr = rndmonst()) != 0)
|
||||||
break; /* remaining checks don't apply */
|
break; /* remaining checks don't apply */
|
||||||
@@ -2680,7 +2700,7 @@ do_genocide(int how)
|
|||||||
/* first revert if current shifted form or base vampire form */
|
/* first revert if current shifted form or base vampire form */
|
||||||
if (Upolyd && vampshifted(&g.youmonst)
|
if (Upolyd && vampshifted(&g.youmonst)
|
||||||
&& (mndx == u.umonnum || mndx == g.youmonst.cham))
|
&& (mndx == u.umonnum || mndx == g.youmonst.cham))
|
||||||
polyself(POLY_REVERT); /* vampshifter (bat, &c) back to vampire */
|
polyself(POLY_REVERT); /* vampshifter (bat, &c) to vampire */
|
||||||
/* Although "genus" is Latin for race, the hero benefits
|
/* Although "genus" is Latin for race, the hero benefits
|
||||||
* from both race and role; thus genocide affects either.
|
* from both race and role; thus genocide affects either.
|
||||||
*/
|
*/
|
||||||
@@ -2723,7 +2743,7 @@ do_genocide(int how)
|
|||||||
buf[0] = lowc(buf[0]);
|
buf[0] = lowc(buf[0]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Strcpy(buf, ptr->pmnames[NEUTRAL]); /* make sure we have standard singular */
|
Strcpy(buf, ptr->pmnames[NEUTRAL]); /* standard singular */
|
||||||
if ((ptr->geno & G_UNIQ) && ptr != &mons[PM_HIGH_CLERIC])
|
if ((ptr->geno & G_UNIQ) && ptr != &mons[PM_HIGH_CLERIC])
|
||||||
which = !type_is_pname(ptr) ? "the " : "";
|
which = !type_is_pname(ptr) ? "the " : "";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user