diff --git a/src/battle.c b/src/battle.c index 672baaf71..daf96ce1e 100644 --- a/src/battle.c +++ b/src/battle.c @@ -1852,7 +1852,7 @@ static void do_combatspell(troop at) log_error("spell '%s' has no function.\n", sp->sname); } else { - level = cast_combatspell(at, sp, level, MagicPower(power)); + level = cast_combatspell(at, sp, level, power); } } @@ -1870,7 +1870,7 @@ static void do_extra_spell(troop at, const att * a) } else { assert(a->level > 0); - cast_combatspell(at, sp, a->level, MagicPower(a->level)); + cast_combatspell(at, sp, a->level, a->level); } } diff --git a/src/bind_unit.c b/src/bind_unit.c index 94bd34e77..845d3ddf0 100755 --- a/src/bind_unit.c +++ b/src/bind_unit.c @@ -525,7 +525,7 @@ static void unit_castspell(unit * u, const char *name, int level) } else { castorder co; - create_castorder(&co, u, 0, sp, u->region, level, MagicPower((float)level), 0, 0, 0); + create_castorder(&co, u, 0, sp, u->region, level, (double)level, 0, 0, 0); sp->cast(&co); free_castorder(&co); } diff --git a/src/magic.c b/src/magic.c index 3ab5bc3c7..1221a7c95 100644 --- a/src/magic.c +++ b/src/magic.c @@ -118,7 +118,8 @@ static float MagicRegeneration(void) return value; } -double MagicPower(double force) { +static double MagicPower(double force) +{ if (force > 0) { const char *str = get_param(global.parameters, "magic.power"); double value = str ? atof(str) : 1.0; @@ -1074,8 +1075,6 @@ spellpower(region * r, unit * u, const spell * sp, int cast_level, struct order } } - force = MagicPower(force); - return _max(force, 0); } @@ -2073,7 +2072,7 @@ castorder *create_castorder(castorder * co, unit *caster, unit * familiar, const co->_familiar = familiar; co->sp = sp; co->level = lev; - co->force = force; + co->force = MagicPower(force); co->_rtarget = r ? r : (familiar ? familiar->region : (caster ? caster->region : 0)); co->distance = range; co->order = copy_order(ord); @@ -2821,7 +2820,7 @@ void magic(void) continue; } - co->force = spellpower(target_r, u, sp, co->level, ord); + co->force = MagicPower(spellpower(target_r, u, sp, co->level, ord)); /* die Stärke kann durch Antimagie auf 0 sinken */ if (co->force <= 0) { co->force = 0; diff --git a/src/magic.h b/src/magic.h index ed8ce4bc7..055182ded 100644 --- a/src/magic.h +++ b/src/magic.h @@ -360,7 +360,6 @@ extern "C" { extern void write_spells(struct quicklist *slist, struct storage *store); extern void read_spells(struct quicklist **slistp, magic_t mtype, struct storage *store); - double MagicPower(double force); extern struct spellbook * get_spellbook(const char * name); extern void free_spellbooks(void); diff --git a/src/study.test.c b/src/study.test.c index 58614d37c..ac9d3947a 100644 --- a/src/study.test.c +++ b/src/study.test.c @@ -2,6 +2,7 @@ #include "study.h" +#include #include #include #include @@ -26,6 +27,7 @@ static void setup_study(study_fixture *fix, skill_t sk) { assert(fix); test_cleanup(); + set_param(&global.parameters, "study.random_progress", "0"); test_create_world(); r = test_create_region(0, 0, 0); f = test_create_faction(0);