mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-21 07:39:40 +00:00
Fix AI not using Restore Health effect when it is complemented by unnecessary restore magicka/fatigue effects (e.g. in sc_purityofbody)
This commit is contained in:
parent
0c67ff9ed0
commit
31b31115af
1 changed files with 5 additions and 2 deletions
|
@ -269,15 +269,18 @@ namespace MWMechanics
|
||||||
case ESM::MagicEffect::RestoreFatigue:
|
case ESM::MagicEffect::RestoreFatigue:
|
||||||
if (effect.mRange == ESM::RT_Self)
|
if (effect.mRange == ESM::RT_Self)
|
||||||
{
|
{
|
||||||
|
int priority = 1;
|
||||||
|
if (effect.mEffectID == ESM::MagicEffect::RestoreHealth)
|
||||||
|
priority = 10;
|
||||||
const DynamicStat<float>& current = actor.getClass().getCreatureStats(actor).
|
const DynamicStat<float>& current = actor.getClass().getCreatureStats(actor).
|
||||||
getDynamic(effect.mEffectID - ESM::MagicEffect::RestoreHealth);
|
getDynamic(effect.mEffectID - ESM::MagicEffect::RestoreHealth);
|
||||||
float toHeal = (effect.mMagnMin + effect.mMagnMax)/2.f * effect.mDuration;
|
float toHeal = (effect.mMagnMin + effect.mMagnMax)/2.f * effect.mDuration;
|
||||||
// Effect doesn't heal more than we need, *or* we are below 1/2 health
|
// Effect doesn't heal more than we need, *or* we are below 1/2 health
|
||||||
if (current.getModified() - current.getCurrent() > toHeal
|
if (current.getModified() - current.getCurrent() > toHeal
|
||||||
|| current.getCurrent() < current.getModified()*0.5)
|
|| current.getCurrent() < current.getModified()*0.5)
|
||||||
return 10000.f;
|
return 10000.f * priority;
|
||||||
else
|
else
|
||||||
return -10000.f; // Save for later
|
return -10000.f * priority; // Save for later
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue