forked from teamnwah/openmw-tes3coop
AI: take into account success chance when rating a spell
This commit is contained in:
parent
e02f35264f
commit
d3415387a5
1 changed files with 3 additions and 2 deletions
|
@ -167,7 +167,8 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
const CreatureStats& stats = actor.getClass().getCreatureStats(actor);
|
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;
|
return 0.f;
|
||||||
|
|
||||||
if (spell->mData.mType != ESM::Spell::ST_Spell)
|
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))
|
if ( ((types & Touch) || (types & Target)) && target.getClass().getCreatureStats(target).getActiveSpells().isSpellActive(spell->mId))
|
||||||
return 0.f;
|
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)
|
float rateMagicItem(const MWWorld::Ptr &ptr, const MWWorld::Ptr &actor, const MWWorld::Ptr& target)
|
||||||
|
|
Loading…
Reference in a new issue