mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-17 10:21:11 +00:00
Merge pull request #2849 from Capostrophic/spellsuccess
Fix spell school calculation
This commit is contained in:
commit
8c4acc69c4
@ -101,6 +101,9 @@ namespace MWMechanics
|
|||||||
|
|
||||||
float getSpellSuccessChance (const ESM::Spell* spell, const MWWorld::Ptr& actor, int* effectiveSchool, bool cap, bool checkMagicka)
|
float getSpellSuccessChance (const ESM::Spell* spell, const MWWorld::Ptr& actor, int* effectiveSchool, bool cap, bool checkMagicka)
|
||||||
{
|
{
|
||||||
|
// NB: Base chance is calculated here because the effective school pointer must be filled
|
||||||
|
float baseChance = calcSpellBaseSuccessChance(spell, actor, effectiveSchool);
|
||||||
|
|
||||||
bool godmode = actor == getPlayer() && MWBase::Environment::get().getWorld()->getGodModeState();
|
bool godmode = actor == getPlayer() && MWBase::Environment::get().getWorld()->getGodModeState();
|
||||||
|
|
||||||
CreatureStats& stats = actor.getClass().getCreatureStats(actor);
|
CreatureStats& stats = actor.getClass().getCreatureStats(actor);
|
||||||
@ -124,7 +127,7 @@ namespace MWMechanics
|
|||||||
return 100;
|
return 100;
|
||||||
|
|
||||||
float castBonus = -stats.getMagicEffects().get(ESM::MagicEffect::Sound).getMagnitude();
|
float castBonus = -stats.getMagicEffects().get(ESM::MagicEffect::Sound).getMagnitude();
|
||||||
float castChance = calcSpellBaseSuccessChance(spell, actor, effectiveSchool) + castBonus;
|
float castChance = baseChance + castBonus;
|
||||||
castChance *= stats.getFatigueTerm();
|
castChance *= stats.getFatigueTerm();
|
||||||
|
|
||||||
return std::max(0.f, cap ? std::min(100.f, castChance) : castChance);
|
return std::max(0.f, cap ? std::min(100.f, castChance) : castChance);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user