New option: prompt to abandon spells/abilities
This commit is contained in:
parent
fd450ba0c3
commit
d98ba870ca
1
data.c
1
data.c
|
@ -10340,6 +10340,7 @@ void initoptions(void) {
|
||||||
addoption(OPT_STOPRUNONNOISE, "stop running if sound heard", B_TRUE);
|
addoption(OPT_STOPRUNONNOISE, "stop running if sound heard", B_TRUE);
|
||||||
addoption(OPT_TIMEDEBUG, "enable performance debugging", B_FALSE);
|
addoption(OPT_TIMEDEBUG, "enable performance debugging", B_FALSE);
|
||||||
addoption(OPT_ABSORBNOTIFY, "liquid absorption notifications", B_FALSE);
|
addoption(OPT_ABSORBNOTIFY, "liquid absorption notifications", B_FALSE);
|
||||||
|
addoption(OPT_CONFIRM_SPELLCANCEL, "confirm spell/ability cancellation", B_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initrace(void) {
|
void initrace(void) {
|
||||||
|
|
1
defs.h
1
defs.h
|
@ -4823,6 +4823,7 @@ enum OPTION {
|
||||||
OPT_STOPRUNONNOISE,
|
OPT_STOPRUNONNOISE,
|
||||||
OPT_TIMEDEBUG,
|
OPT_TIMEDEBUG,
|
||||||
OPT_ABSORBNOTIFY,
|
OPT_ABSORBNOTIFY,
|
||||||
|
OPT_CONFIRM_SPELLCANCEL,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct option_s {
|
typedef struct option_s {
|
||||||
|
|
7
io.c
7
io.c
|
@ -8476,7 +8476,12 @@ char *makedesc_spell(objecttype_t *ot, char *retbuf) {
|
||||||
strncat(retbuf, buf, BUFLEN);
|
strncat(retbuf, buf, BUFLEN);
|
||||||
|
|
||||||
if (range != UNLIMITED) {
|
if (range != UNLIMITED) {
|
||||||
sprintf(buf, "At this power, it has a range of %d cell%s",range, (range == 1) ? "" : "s");
|
|
||||||
|
if (getspellmaxpower(ot->id) == 1) {
|
||||||
|
sprintf(buf, "It has a range of %d cell%s",range, (range == 1) ? "" : "s");
|
||||||
|
} else {
|
||||||
|
sprintf(buf, "At this power, it has a range of %d cell%s",range, (range == 1) ? "" : "s");
|
||||||
|
}
|
||||||
if (minrange != 0) {
|
if (minrange != 0) {
|
||||||
char buf2[BUFLEN];
|
char buf2[BUFLEN];
|
||||||
sprintf(buf2, " (minimum %d)", minrange);
|
sprintf(buf2, " (minimum %d)", minrange);
|
||||||
|
|
5
lf.c
5
lf.c
|
@ -6023,12 +6023,13 @@ void enhanceskills(lifeform_t *lf) {
|
||||||
enum SPELLSCHOOL school;
|
enum SPELLSCHOOL school;
|
||||||
school = getspellschoolknown(lf, o->type->id);
|
school = getspellschoolknown(lf, o->type->id);
|
||||||
if (school == ch) {
|
if (school == ch) {
|
||||||
char buf[BUFLEN];
|
char buf[BUFLEN],descbuf[HUGEBUFLEN];
|
||||||
snprintf(buf, BUFLEN, "%s (%s) [%d points]", o->type->name,
|
snprintf(buf, BUFLEN, "%s (%s) [%d points]", o->type->name,
|
||||||
getschoolname(school),
|
getschoolname(school),
|
||||||
getspelllevel(o->type->id) );
|
getspelllevel(o->type->id) );
|
||||||
|
makedesc_spell(o->type, descbuf);
|
||||||
|
|
||||||
addchoice(&prompt, o->type->id, o->type->name, buf, o, NULL);
|
addchoice(&prompt, o->type->id, o->type->name, buf, o, descbuf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
addchoice(&prompt, '-', "(none)", NULL, NULL, NULL);
|
addchoice(&prompt, '-', "(none)", NULL, NULL, NULL);
|
||||||
|
|
10
spell.c
10
spell.c
|
@ -16032,11 +16032,13 @@ cell_t *validatespellcell(lifeform_t *caster, cell_t **targcell, int targtype, e
|
||||||
if (!where) {
|
if (!where) {
|
||||||
char ques[BUFLEN];
|
char ques[BUFLEN];
|
||||||
int ch;
|
int ch;
|
||||||
snprintf(ques, BUFLEN, "Abandon your %s?", (sp->obclass->id == OC_SPELL) ? "spell" : "ability");
|
if (getoption(OPT_CONFIRM_SPELLCANCEL)) {
|
||||||
ch = askchar(ques,"yn","n", B_TRUE, B_FALSE);
|
snprintf(ques, BUFLEN, "Abandon your %s?", (sp->obclass->id == OC_SPELL) ? "spell" : "ability");
|
||||||
if (ch == 'y') {
|
ch = askchar(ques,"yn","n", B_TRUE, B_FALSE);
|
||||||
return NULL;
|
} else {
|
||||||
|
ch = 'y';
|
||||||
}
|
}
|
||||||
|
if (ch == 'y') return NULL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO: fill in monster code?
|
// TODO: fill in monster code?
|
||||||
|
|
Loading…
Reference in New Issue