mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-10 15:45:37 +00:00
Restructure function isCommanded
This commit is contained in:
parent
1c70b9790c
commit
f5b527e445
@ -56,14 +56,17 @@ bool isConscious(const MWWorld::Ptr& ptr)
|
|||||||
|
|
||||||
bool isCommanded(const MWWorld::Ptr& actor)
|
bool isCommanded(const MWWorld::Ptr& actor)
|
||||||
{
|
{
|
||||||
const auto& stats = actor.getClass().getCreatureStats(actor);
|
const auto& actorClass = actor.getClass();
|
||||||
for(const auto& params : stats.getActiveSpells())
|
const auto& stats = actorClass.getCreatureStats(actor);
|
||||||
|
const bool isActorNpc = actorClass.isNpc();
|
||||||
|
const auto level = stats.getLevel();
|
||||||
|
for (const auto& params : stats.getActiveSpells())
|
||||||
{
|
{
|
||||||
for(const auto& effect : params.getEffects())
|
for (const auto& effect : params.getEffects())
|
||||||
{
|
{
|
||||||
if(((effect.mEffectId == ESM::MagicEffect::CommandHumanoid && actor.getClass().isNpc())
|
if (((effect.mEffectId == ESM::MagicEffect::CommandHumanoid && isActorNpc)
|
||||||
|| (effect.mEffectId == ESM::MagicEffect::CommandCreature && !actor.getClass().isNpc()))
|
|| (effect.mEffectId == ESM::MagicEffect::CommandCreature && !isActorNpc))
|
||||||
&& effect.mMagnitude >= stats.getLevel())
|
&& effect.mMagnitude >= level)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user