diff options
author | Bardur Arantsson <bardur@scientician.net> | 2015-02-23 09:11:55 +0100 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2015-02-23 09:11:55 +0100 |
commit | 8e4d24451390dbf4250ad5908faaffe43dc366f1 (patch) | |
tree | 9e50ebf6f3c126c0fc6cb93af337eda008730520 | |
parent | 4d799dc22d9a8632f4de31753a12586a8cba67bb (diff) |
Use get_level_{school,device}_1 explicitly where we can
This gets us a little further away from relying on the
get_level_use_stick global variable.
-rw-r--r-- | src/lua_bind.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/lua_bind.cc b/src/lua_bind.cc index c664e192..046883a8 100644 --- a/src/lua_bind.cc +++ b/src/lua_bind.cc @@ -100,17 +100,21 @@ static s32b get_level_school_1(s32b s, s32b max, s32b min) int get_mana(s32b s) { + // Does not make sense in "device" mode. + assert(get_level_use_stick == -1); + // Extract the spell's mana range. spell_type *spell = spell_at(s); range_type mana_range; spell_type_mana_range(spell, &mana_range); - return get_level(s, mana_range.max, mana_range.min); + // Scale + return get_level_school_1(s, mana_range.max, mana_range.min); } /** Returns spell change of failure for spell cast from a device */ static s32b spell_chance_device(s32b s) { spell_type *s_ptr = spell_at(s); - int level = get_level(s, 50, 1); + int level = get_level_device_1(s, 50, 1); int minfail; s32b chance = spell_type_failure_rate(s_ptr); @@ -128,7 +132,7 @@ static s32b spell_chance_device(s32b s) static s32b spell_chance_school(s32b s) { spell_type *s_ptr = spell_at(s); - int level = get_level(s, 50, 1); + int level = get_level_school_1(s, 50, 1); s32b chance = spell_type_failure_rate(s_ptr); int mana = get_mana(s); int cur_mana = get_power(s); |