bugfix: racial abilities now work properly after polymorph
This commit is contained in:
parent
e4cdde4f98
commit
43c20fbbaf
3
defs.h
3
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)
|
||||
|
|
30
io.c
30
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);
|
||||
|
|
2
lf.c
2
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;
|
||||
|
|
Loading…
Reference in New Issue