forked from github/server
use rc_maxaura wrapper everywhere.
This commit is contained in:
parent
f22cc3b419
commit
e51742da90
4 changed files with 10 additions and 5 deletions
|
@ -282,10 +282,14 @@ bool r_insectstalled(const region * r)
|
||||||
return fval(r->terrain, ARCTIC_REGION);
|
return fval(r->terrain, ARCTIC_REGION);
|
||||||
}
|
}
|
||||||
|
|
||||||
double rc_magres(const struct race *rc) {
|
double rc_magres(const race *rc) {
|
||||||
return rc->magres / 100.0;
|
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* rc_name(const race * rc, name_t n, char *name, size_t size) {
|
||||||
const char * postfix = 0;
|
const char * postfix = 0;
|
||||||
if (!rc) {
|
if (!rc) {
|
||||||
|
|
|
@ -185,6 +185,7 @@ extern "C" {
|
||||||
const char * rc_name(const race *rc, name_t n, char *name, size_t size);
|
const char * rc_name(const race *rc, name_t n, char *name, size_t size);
|
||||||
|
|
||||||
double rc_magres(const struct race *rc);
|
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 */
|
/* 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_NPC (1<<0) /* cannot be the race for a player faction (and other limits?) */
|
||||||
#define RCF_KILLPEASANTS (1<<1) /* a monster that eats peasants */
|
#define RCF_KILLPEASANTS (1<<1) /* a monster that eats peasants */
|
||||||
|
|
|
@ -26,7 +26,7 @@ static void test_rc_defaults(CuTest *tc) {
|
||||||
CuAssertIntEquals(tc, 0, rc->magres);
|
CuAssertIntEquals(tc, 0, rc->magres);
|
||||||
CuAssertDblEquals(tc, 0.0, rc_magres(rc), 0.0);
|
CuAssertDblEquals(tc, 0.0, rc_magres(rc), 0.0);
|
||||||
CuAssertIntEquals(tc, 0, rc->healing);
|
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->recruit_multi, 0.0);
|
||||||
CuAssertDblEquals(tc, 1.0, rc->regaura, 0.0);
|
CuAssertDblEquals(tc, 1.0, rc->regaura, 0.0);
|
||||||
CuAssertDblEquals(tc, 1.0, rc->speed, 0.0);
|
CuAssertDblEquals(tc, 1.0, rc->speed, 0.0);
|
||||||
|
|
|
@ -719,7 +719,7 @@ static int use_item_aura(const region * r, const unit * u)
|
||||||
int sk, n;
|
int sk, n;
|
||||||
|
|
||||||
sk = effskill(u, SK_MAGIC, r);
|
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;
|
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 max_spellpoints(const region * r, const unit * u)
|
||||||
{
|
{
|
||||||
int sk;
|
int sk;
|
||||||
double n, msp;
|
double n, msp = 0;
|
||||||
double potenz = 2.1;
|
double potenz = 2.1;
|
||||||
double divisor = 1.2;
|
double divisor = 1.2;
|
||||||
const struct resource_type *rtype;
|
const struct resource_type *rtype;
|
||||||
|
|
||||||
sk = effskill(u, SK_MAGIC, r);
|
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");
|
rtype = rt_find("aurafocus");
|
||||||
if (rtype && i_get(u->items, rtype->itype) > 0) {
|
if (rtype && i_get(u->items, rtype->itype) > 0) {
|
||||||
|
|
Loading…
Reference in a new issue