mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-05 15:55:45 +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
@ -269,15 +269,18 @@ namespace MWMechanics
|
||||
case ESM::MagicEffect::RestoreFatigue:
|
||||
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).
|
||||
getDynamic(effect.mEffectID - ESM::MagicEffect::RestoreHealth);
|
||||
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
|
||||
if (current.getModified() - current.getCurrent() > toHeal
|
||||
|| current.getCurrent() < current.getModified()*0.5)
|
||||
return 10000.f;
|
||||
return 10000.f * priority;
|
||||
else
|
||||
return -10000.f; // Save for later
|
||||
return -10000.f * priority; // Save for later
|
||||
}
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user