mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 23:23:52 +00:00
Merge pull request #1313 from akortunov/spellpriority
Make combat AI to do not cast target spells under water
This commit is contained in:
commit
80eb2ea35d
3 changed files with 15 additions and 3 deletions
|
@ -383,6 +383,7 @@ namespace MWBase
|
||||||
///Is the head of the creature underwater?
|
///Is the head of the creature underwater?
|
||||||
virtual bool isSubmerged(const MWWorld::ConstPtr &object) const = 0;
|
virtual bool isSubmerged(const MWWorld::ConstPtr &object) const = 0;
|
||||||
virtual bool isUnderwater(const MWWorld::CellStore* cell, const osg::Vec3f &pos) const = 0;
|
virtual bool isUnderwater(const MWWorld::CellStore* cell, const osg::Vec3f &pos) const = 0;
|
||||||
|
virtual bool isUnderwater(const MWWorld::ConstPtr &object, const float heightRatio) const = 0;
|
||||||
virtual bool isWaterWalkingCastableOnTarget(const MWWorld::ConstPtr &target) const = 0;
|
virtual bool isWaterWalkingCastableOnTarget(const MWWorld::ConstPtr &target) const = 0;
|
||||||
virtual bool isOnGround(const MWWorld::Ptr &ptr) const = 0;
|
virtual bool isOnGround(const MWWorld::Ptr &ptr) const = 0;
|
||||||
|
|
||||||
|
|
|
@ -545,6 +545,19 @@ namespace MWMechanics
|
||||||
|
|
||||||
const ESM::MagicEffect* magicEffect = MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(effect.mEffectID);
|
const ESM::MagicEffect* magicEffect = MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(effect.mEffectID);
|
||||||
|
|
||||||
|
// Underwater casting not possible
|
||||||
|
if (effect.mRange == ESM::RT_Target)
|
||||||
|
{
|
||||||
|
if (MWBase::Environment::get().getWorld()->isUnderwater(MWWorld::ConstPtr(actor), 0.75f))
|
||||||
|
return 0.f;
|
||||||
|
|
||||||
|
if (enemy.isEmpty())
|
||||||
|
return 0.f;
|
||||||
|
|
||||||
|
if (MWBase::Environment::get().getWorld()->isUnderwater(MWWorld::ConstPtr(enemy), 0.75f))
|
||||||
|
return 0.f;
|
||||||
|
}
|
||||||
|
|
||||||
rating *= magicEffect->mData.mBaseCost;
|
rating *= magicEffect->mData.mBaseCost;
|
||||||
|
|
||||||
if (magicEffect->mData.mFlags & ESM::MagicEffect::Harmful)
|
if (magicEffect->mData.mFlags & ESM::MagicEffect::Harmful)
|
||||||
|
|
|
@ -166,9 +166,6 @@ namespace MWWorld
|
||||||
|
|
||||||
float mDistanceToFacedObject;
|
float mDistanceToFacedObject;
|
||||||
|
|
||||||
bool isUnderwater(const MWWorld::ConstPtr &object, const float heightRatio) const;
|
|
||||||
///< helper function for implementing isSwimming(), isSubmerged(), isWading()
|
|
||||||
|
|
||||||
bool mTeleportEnabled;
|
bool mTeleportEnabled;
|
||||||
bool mLevitationEnabled;
|
bool mLevitationEnabled;
|
||||||
bool mGoToJail;
|
bool mGoToJail;
|
||||||
|
@ -488,6 +485,7 @@ namespace MWWorld
|
||||||
virtual bool isSubmerged(const MWWorld::ConstPtr &object) const;
|
virtual bool isSubmerged(const MWWorld::ConstPtr &object) const;
|
||||||
virtual bool isSwimming(const MWWorld::ConstPtr &object) const;
|
virtual bool isSwimming(const MWWorld::ConstPtr &object) const;
|
||||||
virtual bool isUnderwater(const MWWorld::CellStore* cell, const osg::Vec3f &pos) const;
|
virtual bool isUnderwater(const MWWorld::CellStore* cell, const osg::Vec3f &pos) const;
|
||||||
|
virtual bool isUnderwater(const MWWorld::ConstPtr &object, const float heightRatio) const;
|
||||||
virtual bool isWading(const MWWorld::ConstPtr &object) const;
|
virtual bool isWading(const MWWorld::ConstPtr &object) const;
|
||||||
virtual bool isWaterWalkingCastableOnTarget(const MWWorld::ConstPtr &target) const;
|
virtual bool isWaterWalkingCastableOnTarget(const MWWorld::ConstPtr &target) const;
|
||||||
virtual bool isOnGround(const MWWorld::Ptr &ptr) const;
|
virtual bool isOnGround(const MWWorld::Ptr &ptr) const;
|
||||||
|
|
Loading…
Reference in a new issue