mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 15:35:23 +00:00
Combat AI: Don't attempt to cast spells when impossible to succeed (Fixes #2059)
This commit is contained in:
parent
6960cac5eb
commit
c684c99a95
@ -9,6 +9,7 @@
|
||||
#include "../mwworld/actionequip.hpp"
|
||||
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
#include "../mwmechanics/spellcasting.hpp"
|
||||
|
||||
#include <components/esm/loadench.hpp>
|
||||
#include <components/esm/loadmgef.hpp>
|
||||
@ -166,6 +167,9 @@ namespace MWMechanics
|
||||
{
|
||||
const CreatureStats& stats = actor.getClass().getCreatureStats(actor);
|
||||
|
||||
if (MWMechanics::getSpellSuccessChance(spell, actor) == 0)
|
||||
return 0.f;
|
||||
|
||||
if (spell->mData.mType != ESM::Spell::ST_Spell)
|
||||
return 0.f;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user