diff --git a/defs.h b/defs.h index b28a44a..0cbb43f 100644 --- a/defs.h +++ b/defs.h @@ -111,6 +111,9 @@ #define B_MAYBE (-2) #define B_ONEOF (-3) +#define B_RETAINATTR (-1) +#define B_MODATTR (0) + // askobject args #define B_DONTINCLUDENOTHING (0) diff --git a/io.c b/io.c index cb29100..04c7d3b 100644 --- a/io.c +++ b/io.c @@ -8534,7 +8534,7 @@ void makespellchoicelist(prompt_t *pr, lifeform_t *lf, char *ques, char *ques2, continue; } for (lev = 0; lev <= MAXSPELLLEV; lev++) { - // get list of spells/abilities we can cast at will + // get list of spells/abilities we can cast at will from this level for (ot = objecttype ; ot ; ot = ot->next) { if ((ot->obclass->id == OC_SPELL) || (ot->obclass->id == OC_ABILITY)) { // matches the current level? @@ -8542,7 +8542,7 @@ void makespellchoicelist(prompt_t *pr, lifeform_t *lf, char *ques, char *ques2, f = lfhasflagval(lf, F_CANWILL, ot->id, NA, NA, NULL); if (!wantunknown && f) { if (hasflagval(ot->flags, F_SPELLSCHOOL, i, NA, NA, NULL)) { - // make sure we don't already have it. + // make sure we don't already have it in the list. int found = B_FALSE; for (n = 0; n < nposs; n++) { if (poss[n] == ot->id) { @@ -8581,22 +8581,32 @@ void makespellchoicelist(prompt_t *pr, lifeform_t *lf, char *ques, char *ques2, } // end if spell/ability } // end foreach objecttype - // if we can't cast spells from this school, then just go to next spell. - if (getschoolskill(i) != SK_NONE) { - if (!getskill(lf, getschoolskill(i))) { - continue; - } - } - + // otherwise see if we can cast it using MP if (!lfhasflag(lf, F_NOSPELLS)) { // get list of spells we can cast using mp for (ot = objecttype ; ot ; ot = ot->next) { if ((ot->obclass->id == OC_SPELL) && (getspelllevel(ot->id) == lev)) { // is it a spell? if (hasflagval(ot->flags, F_SPELLSCHOOL, i, NA, NA, NULL)) { // from the current school? + int includeit = B_FALSE; // not using 'cancast' here because we want to list spells // even if we don't have enough mp f = lfhasflagval(lf, F_CANCAST, ot->id, NA, NA, NULL); - if ((f && !wantunknown) || (!f && wantunknown)) { + if (!f && wantunknown) { + includeit = B_TRUE; + } else if (f && !wantunknown) { + // ignore this if we are unskilled in this school, unless it's a + // racial ability. + if ((f->lifetime != FROMRACE) && + (getschoolskill(i) != SK_NONE) && + !getskill(lf, getschoolskill(i))) { + includeit = B_FALSE; + } else { + includeit = B_TRUE; + } + } + + + if (includeit) { int cost; int found = B_FALSE; cost = getmpcost(lf, ot->id); diff --git a/lf.c b/lf.c index 9cf79a4..9148b33 100644 --- a/lf.c +++ b/lf.c @@ -805,7 +805,7 @@ int cancast(lifeform_t *lf, enum OBTYPE oid, int *mpcost) { } else if ((f = lfhasflagval(lf, F_CANCAST, oid, NA, NA, NULL)) != NULL) { int cost,power; - // can only cast innate racial spels? + // can only cast innate racial spelsl? if ((ot->obclass->id == OC_SPELL) && lfhasflag(lf, F_NOSPELLS)) { if (f->lifetime != FROMRACE) { reason = E_NOSPELLS;