mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-17 10:21:11 +00:00
Apply command spell effects on impact
Command spells should apply their effects, including taking an actor out of combat, every time a spell successfully hits, even if a previous command effect is still active.
This commit is contained in:
parent
a46c4de918
commit
e825010107
@ -93,6 +93,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Check for command effects having ended and remove package if necessary
|
||||||
void adjustCommandedActor (const MWWorld::Ptr& actor)
|
void adjustCommandedActor (const MWWorld::Ptr& actor)
|
||||||
{
|
{
|
||||||
CheckActorCommanded check(actor);
|
CheckActorCommanded check(actor);
|
||||||
@ -112,13 +113,7 @@ void adjustCommandedActor (const MWWorld::Ptr& actor)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (check.mCommanded && !hasCommandPackage)
|
if (!check.mCommanded && hasCommandPackage)
|
||||||
{
|
|
||||||
// FIXME: don't use refid string
|
|
||||||
MWMechanics::AiFollow package("player", true);
|
|
||||||
stats.getAiSequence().stack(package, actor);
|
|
||||||
}
|
|
||||||
else if (!check.mCommanded && hasCommandPackage)
|
|
||||||
{
|
{
|
||||||
stats.getAiSequence().erase(it);
|
stats.getAiSequence().erase(it);
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "magiceffects.hpp"
|
#include "magiceffects.hpp"
|
||||||
#include "npcstats.hpp"
|
#include "npcstats.hpp"
|
||||||
#include "actorutil.hpp"
|
#include "actorutil.hpp"
|
||||||
|
#include "aifollow.hpp"
|
||||||
|
|
||||||
namespace MWMechanics
|
namespace MWMechanics
|
||||||
{
|
{
|
||||||
@ -490,6 +491,15 @@ namespace MWMechanics
|
|||||||
|
|
||||||
appliedLastingEffects.push_back(effect);
|
appliedLastingEffects.push_back(effect);
|
||||||
|
|
||||||
|
// Command spells should have their effect, including taking the target out of combat, each time the spell successfully affects the target
|
||||||
|
if (effectIt->mEffectID == ESM::MagicEffect::CommandHumanoid && target.getClass().isNpc()
|
||||||
|
|| (effectIt->mEffectID == ESM::MagicEffect::CommandCreature && target.getTypeName() == typeid(ESM::Creature).name())
|
||||||
|
&& caster == getPlayer() && magnitude >= target.getClass().getCreatureStats(target).getLevel())
|
||||||
|
{
|
||||||
|
MWMechanics::AiFollow package(caster.getCellRef().getRefId(), true);
|
||||||
|
target.getClass().getCreatureStats(target).getAiSequence().stack(package, target);
|
||||||
|
}
|
||||||
|
|
||||||
// For absorb effects, also apply the effect to the caster - but with a negative
|
// For absorb effects, also apply the effect to the caster - but with a negative
|
||||||
// magnitude, since we're transferring stats from the target to the caster
|
// magnitude, since we're transferring stats from the target to the caster
|
||||||
if (!caster.isEmpty() && caster.getClass().isActor())
|
if (!caster.isEmpty() && caster.getClass().isActor())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user