|
|
@ -20,6 +20,7 @@
|
|
|
|
#include "spellcasting.hpp"
|
|
|
|
#include "spellcasting.hpp"
|
|
|
|
#include "difficultyscaling.hpp"
|
|
|
|
#include "difficultyscaling.hpp"
|
|
|
|
#include "actorutil.hpp"
|
|
|
|
#include "actorutil.hpp"
|
|
|
|
|
|
|
|
#include "pathfinding.hpp"
|
|
|
|
|
|
|
|
|
|
|
|
namespace
|
|
|
|
namespace
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -467,13 +468,8 @@ namespace MWMechanics
|
|
|
|
{
|
|
|
|
{
|
|
|
|
osg::Vec3f pos1 (actor1.getRefData().getPosition().asVec3());
|
|
|
|
osg::Vec3f pos1 (actor1.getRefData().getPosition().asVec3());
|
|
|
|
osg::Vec3f pos2 (actor2.getRefData().getPosition().asVec3());
|
|
|
|
osg::Vec3f pos2 (actor2.getRefData().getPosition().asVec3());
|
|
|
|
if (canActorMoveByZAxis(actor2))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
pos1.z() = 0.f;
|
|
|
|
|
|
|
|
pos2.z() = 0.f;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float d = (pos1 - pos2).length();
|
|
|
|
float d = getAggroDistance(actor2, pos1, pos2);
|
|
|
|
|
|
|
|
|
|
|
|
static const int iFightDistanceBase = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find(
|
|
|
|
static const int iFightDistanceBase = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find(
|
|
|
|
"iFightDistanceBase")->mValue.getInteger();
|
|
|
|
"iFightDistanceBase")->mValue.getInteger();
|
|
|
@ -489,4 +485,11 @@ namespace MWMechanics
|
|
|
|
return (magicEffects.get(ESM::MagicEffect::Invisibility).getMagnitude() > 0)
|
|
|
|
return (magicEffects.get(ESM::MagicEffect::Invisibility).getMagnitude() > 0)
|
|
|
|
|| (magicEffects.get(ESM::MagicEffect::Chameleon).getMagnitude() > 75);
|
|
|
|
|| (magicEffects.get(ESM::MagicEffect::Chameleon).getMagnitude() > 75);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float getAggroDistance(const MWWorld::Ptr& actor, const osg::Vec3f& lhs, const osg::Vec3f& rhs)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (canActorMoveByZAxis(actor))
|
|
|
|
|
|
|
|
return distanceIgnoreZ(lhs, rhs);
|
|
|
|
|
|
|
|
return distance(lhs, rhs);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|