mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 18:35:20 +00:00
AI: take into account success chance when rating a spell
This commit is contained in:
parent
e02f35264f
commit
d3415387a5
@ -167,7 +167,8 @@ namespace MWMechanics
|
||||
{
|
||||
const CreatureStats& stats = actor.getClass().getCreatureStats(actor);
|
||||
|
||||
if (MWMechanics::getSpellSuccessChance(spell, actor) == 0)
|
||||
float successChance = MWMechanics::getSpellSuccessChance(spell, actor);
|
||||
if (successChance == 0.f)
|
||||
return 0.f;
|
||||
|
||||
if (spell->mData.mType != ESM::Spell::ST_Spell)
|
||||
@ -192,7 +193,7 @@ namespace MWMechanics
|
||||
if ( ((types & Touch) || (types & Target)) && target.getClass().getCreatureStats(target).getActiveSpells().isSpellActive(spell->mId))
|
||||
return 0.f;
|
||||
|
||||
return rateEffects(spell->mEffects, actor, target);
|
||||
return rateEffects(spell->mEffects, actor, target) * (successChance / 100.f);
|
||||
}
|
||||
|
||||
float rateMagicItem(const MWWorld::Ptr &ptr, const MWWorld::Ptr &actor, const MWWorld::Ptr& target)
|
||||
|
Loading…
x
Reference in New Issue
Block a user