Ensure that Battlemage's initial three spell schools are unique.
This commit is contained in:
parent
8500c020cb
commit
980daa1d8c
11
objects.c
11
objects.c
|
@ -1945,6 +1945,8 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum
|
|||
// select actual random schools to use.
|
||||
for (i = 0; i < nschools; i++) {
|
||||
if (where->owner && hasjob(where->owner, J_BATTLEMAGE)) {
|
||||
int isnew = B_FALSE;
|
||||
while (!isnew) {
|
||||
switch (rnd(1,5)) {
|
||||
case 1: school[i] = SS_FIRE; break;
|
||||
case 2: school[i] = SS_COLD; break;
|
||||
|
@ -1952,6 +1954,15 @@ object_t *addobject(obpile_t *where, char *name, int canstack, int dolinks, enum
|
|||
case 4: school[i] = SS_TRANSLOCATION; break;
|
||||
case 5: school[i] = SS_WILD; break;
|
||||
}
|
||||
isnew = B_TRUE;
|
||||
// make sure it's not a school we already have
|
||||
for (n = 0; n < i; n++) {
|
||||
if (school[n] == school[i]) {
|
||||
isnew = B_FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (where->owner && hasjobcat(where->owner, JC_MAGE)) {
|
||||
school[i] = getrandomspellschool(where->owner, B_TRUE);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue