mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 10:53:51 +00:00
Combat AI: do not use range weapons under water
This commit is contained in:
parent
3356fb81ce
commit
62b24eb078
2 changed files with 16 additions and 0 deletions
|
@ -535,6 +535,10 @@ namespace MWMechanics
|
||||||
// opponent's weapon range, or not backing up if opponent is also using a ranged weapon
|
// opponent's weapon range, or not backing up if opponent is also using a ranged weapon
|
||||||
if (isDistantCombat && distToTarget < rangeAttack / 4)
|
if (isDistantCombat && distToTarget < rangeAttack / 4)
|
||||||
{
|
{
|
||||||
|
// actor should not back up into water
|
||||||
|
if (MWBase::Environment::get().getWorld()->isUnderwater(MWWorld::ConstPtr(actor), 0.5f))
|
||||||
|
return;
|
||||||
|
|
||||||
mMovement.mPosition[1] = -1;
|
mMovement.mPosition[1] = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,19 @@ namespace MWMechanics
|
||||||
float bonus=0.f;
|
float bonus=0.f;
|
||||||
|
|
||||||
if (weapon->mData.mType >= ESM::Weapon::MarksmanBow && weapon->mData.mType <= ESM::Weapon::MarksmanThrown)
|
if (weapon->mData.mType >= ESM::Weapon::MarksmanBow && weapon->mData.mType <= ESM::Weapon::MarksmanThrown)
|
||||||
|
{
|
||||||
|
// Range weapon is useless under water
|
||||||
|
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;
|
||||||
|
|
||||||
bonus+=1.5f;
|
bonus+=1.5f;
|
||||||
|
}
|
||||||
|
|
||||||
if (weapon->mData.mType >= ESM::Weapon::MarksmanBow)
|
if (weapon->mData.mType >= ESM::Weapon::MarksmanBow)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue