diff --git a/src/kernel/race.c b/src/kernel/race.c index 16eff8695..75ff16436 100644 --- a/src/kernel/race.c +++ b/src/kernel/race.c @@ -282,10 +282,14 @@ bool r_insectstalled(const region * r) return fval(r->terrain, ARCTIC_REGION); } -double rc_magres(const struct race *rc) { +double rc_magres(const race *rc) { return rc->magres / 100.0; } +double rc_maxaura(const race *rc) { + return rc->maxaura; +} + const char* rc_name(const race * rc, name_t n, char *name, size_t size) { const char * postfix = 0; if (!rc) { diff --git a/src/kernel/race.h b/src/kernel/race.h index a7d495f6b..7acc7fea5 100644 --- a/src/kernel/race.h +++ b/src/kernel/race.h @@ -185,6 +185,7 @@ extern "C" { const char * rc_name(const race *rc, name_t n, char *name, size_t size); double rc_magres(const struct race *rc); + double rc_maxaura(const struct race *rc); /* Flags. Do not reorder these without changing json_race() in jsonconf.c */ #define RCF_NPC (1<<0) /* cannot be the race for a player faction (and other limits?) */ #define RCF_KILLPEASANTS (1<<1) /* a monster that eats peasants */ diff --git a/src/kernel/race.test.c b/src/kernel/race.test.c index 01ce41443..eaf497168 100644 --- a/src/kernel/race.test.c +++ b/src/kernel/race.test.c @@ -26,7 +26,7 @@ static void test_rc_defaults(CuTest *tc) { CuAssertIntEquals(tc, 0, rc->magres); CuAssertDblEquals(tc, 0.0, rc_magres(rc), 0.0); CuAssertIntEquals(tc, 0, rc->healing); - CuAssertDblEquals(tc, 0.0, rc->maxaura, 0.0); + CuAssertDblEquals(tc, 0.0, rc_maxaura(rc), 0.0); CuAssertDblEquals(tc, 1.0, rc->recruit_multi, 0.0); CuAssertDblEquals(tc, 1.0, rc->regaura, 0.0); CuAssertDblEquals(tc, 1.0, rc->speed, 0.0); diff --git a/src/magic.c b/src/magic.c index e48ec6d5d..89774e96a 100644 --- a/src/magic.c +++ b/src/magic.c @@ -719,7 +719,7 @@ static int use_item_aura(const region * r, const unit * u) int sk, n; sk = effskill(u, SK_MAGIC, r); - n = (int)(sk * sk * u_race(u)->maxaura / 4); + n = (int)(sk * sk * rc_maxaura(u_race(u)) / 4); return n; } @@ -727,13 +727,13 @@ static int use_item_aura(const region * r, const unit * u) int max_spellpoints(const region * r, const unit * u) { int sk; - double n, msp; + double n, msp = 0; double potenz = 2.1; double divisor = 1.2; const struct resource_type *rtype; sk = effskill(u, SK_MAGIC, r); - msp = u_race(u)->maxaura * (pow(sk, potenz) / divisor + 1) + get_spchange(u); + msp = rc_maxaura(u_race(u)) * (pow(sk, potenz) / divisor + 1) + get_spchange(u); rtype = rt_find("aurafocus"); if (rtype && i_get(u->items, rtype->itype) > 0) {