mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 23:53:52 +00:00
Merge pull request #2351 from akortunov/aifix
AI: use a consistent check if a target is hidden
This commit is contained in:
commit
aa54beec38
7 changed files with 13 additions and 14 deletions
|
@ -60,6 +60,7 @@
|
||||||
Bug #4911: Editor: QOpenGLContext::swapBuffers() warning with Qt5
|
Bug #4911: Editor: QOpenGLContext::swapBuffers() warning with Qt5
|
||||||
Bug #4916: Specular power (shininess) material parameter is ignored when shaders are used.
|
Bug #4916: Specular power (shininess) material parameter is ignored when shaders are used.
|
||||||
Bug #4918: Abilities don't play looping VFX when they're initially applied
|
Bug #4918: Abilities don't play looping VFX when they're initially applied
|
||||||
|
Bug #4920: Combat AI uses incorrect invisibility check
|
||||||
Bug #4922: Werewolves can not attack if the transformation happens during attack
|
Bug #4922: Werewolves can not attack if the transformation happens during attack
|
||||||
Bug #4927: Spell effect having both a skill and an attribute assigned is a fatal error
|
Bug #4927: Spell effect having both a skill and an attribute assigned is a fatal error
|
||||||
Bug #4932: Invalid records matching when loading save with edited plugin
|
Bug #4932: Invalid records matching when loading save with edited plugin
|
||||||
|
|
|
@ -403,11 +403,8 @@ namespace MWMechanics
|
||||||
ESM::Position actorPos = actor.getRefData().getPosition();
|
ESM::Position actorPos = actor.getRefData().getPosition();
|
||||||
ESM::Position enemyPos = enemy.getRefData().getPosition();
|
ESM::Position enemyPos = enemy.getRefData().getPosition();
|
||||||
|
|
||||||
const CreatureStats& enemyStats = enemy.getClass().getCreatureStats(enemy);
|
if (isTargetMagicallyHidden(enemy) && !MWBase::Environment::get().getMechanicsManager()->awarenessCheck(enemy, actor))
|
||||||
if (enemyStats.getMagicEffects().get(ESM::MagicEffect::Invisibility).getMagnitude() > 0
|
|
||||||
|| enemyStats.getMagicEffects().get(ESM::MagicEffect::Chameleon).getMagnitude() > 0)
|
|
||||||
{
|
{
|
||||||
if (!MWBase::Environment::get().getMechanicsManager()->awarenessCheck(enemy, actor))
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -335,13 +335,6 @@ bool MWMechanics::AiPackage::doesPathNeedRecalc(const osg::Vec3f& newDest, const
|
||||||
|| mPathFinder.getPathCell() != currentCell;
|
|| mPathFinder.getPathCell() != currentCell;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MWMechanics::AiPackage::isTargetMagicallyHidden(const MWWorld::Ptr& target)
|
|
||||||
{
|
|
||||||
const MagicEffects& magicEffects(target.getClass().getCreatureStats(target).getMagicEffects());
|
|
||||||
return (magicEffects.get(ESM::MagicEffect::Invisibility).getMagnitude() > 0)
|
|
||||||
|| (magicEffects.get(ESM::MagicEffect::Chameleon).getMagnitude() > 75);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool MWMechanics::AiPackage::isNearInactiveCell(osg::Vec3f position)
|
bool MWMechanics::AiPackage::isNearInactiveCell(osg::Vec3f position)
|
||||||
{
|
{
|
||||||
const ESM::Cell* playerCell(getPlayer().getCell()->getCell());
|
const ESM::Cell* playerCell(getPlayer().getCell()->getCell());
|
||||||
|
|
|
@ -102,8 +102,6 @@ namespace MWMechanics
|
||||||
/// Reset pathfinding state
|
/// Reset pathfinding state
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
bool isTargetMagicallyHidden(const MWWorld::Ptr& target);
|
|
||||||
|
|
||||||
/// Return if actor's rotation speed is sufficient to rotate to the destination pathpoint on the run. Otherwise actor should rotate while standing.
|
/// Return if actor's rotation speed is sufficient to rotate to the destination pathpoint on the run. Otherwise actor should rotate while standing.
|
||||||
static bool isReachableRotatingOnTheRun(const MWWorld::Ptr& actor, const osg::Vec3f& dest);
|
static bool isReachableRotatingOnTheRun(const MWWorld::Ptr& actor, const osg::Vec3f& dest);
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
#include "movement.hpp"
|
#include "movement.hpp"
|
||||||
#include "creaturestats.hpp"
|
#include "creaturestats.hpp"
|
||||||
|
#include "combat.hpp"
|
||||||
|
|
||||||
namespace MWMechanics
|
namespace MWMechanics
|
||||||
{
|
{
|
||||||
|
|
|
@ -485,4 +485,11 @@ namespace MWMechanics
|
||||||
|
|
||||||
return (iFightDistanceBase - fFightDistanceMultiplier * d);
|
return (iFightDistanceBase - fFightDistanceMultiplier * d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isTargetMagicallyHidden(const MWWorld::Ptr& target)
|
||||||
|
{
|
||||||
|
const MagicEffects& magicEffects = target.getClass().getCreatureStats(target).getMagicEffects();
|
||||||
|
return (magicEffects.get(ESM::MagicEffect::Invisibility).getMagnitude() > 0)
|
||||||
|
|| (magicEffects.get(ESM::MagicEffect::Chameleon).getMagnitude() > 75);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,8 @@ void getHandToHandDamage (const MWWorld::Ptr& attacker, const MWWorld::Ptr& vict
|
||||||
void applyFatigueLoss(const MWWorld::Ptr& attacker, const MWWorld::Ptr& weapon, float attackStrength);
|
void applyFatigueLoss(const MWWorld::Ptr& attacker, const MWWorld::Ptr& weapon, float attackStrength);
|
||||||
|
|
||||||
float getFightDistanceBias(const MWWorld::Ptr& actor1, const MWWorld::Ptr& actor2);
|
float getFightDistanceBias(const MWWorld::Ptr& actor1, const MWWorld::Ptr& actor2);
|
||||||
|
|
||||||
|
bool isTargetMagicallyHidden(const MWWorld::Ptr& target);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue