Use fCombatDistance as the creature attack range

pull/1/head
scrawl 9 years ago
parent 07abaf8777
commit 8fcc1911d9

@ -242,13 +242,10 @@ namespace MWClass
MWMechanics::applyFatigueLoss(ptr, weapon, attackStrength);
// TODO: where is the distance defined?
float dist = 200.f;
float dist = gmst.find("fCombatDistance")->getFloat();
if (!weapon.isEmpty())
{
const float fCombatDistance = gmst.find("fCombatDistance")->getFloat();
dist = fCombatDistance * weapon.get<ESM::Weapon>()->mBase->mData.mReach;
}
dist *= weapon.get<ESM::Weapon>()->mBase->mData.mReach;
std::pair<MWWorld::Ptr, osg::Vec3f> result = MWBase::Environment::get().getWorld()->getHitContact(ptr, dist);
if (result.first.isEmpty())
return; // Didn't hit anything

@ -261,6 +261,7 @@ namespace MWMechanics
// Get weapon characteristics
MWBase::World* world = MWBase::Environment::get().getWorld();
static const float fCombatDistance = world->getStore().get<ESM::GameSetting>().find("fCombatDistance")->getFloat();
if (actorClass.hasInventoryStore(actor))
{
//Get weapon range
@ -279,12 +280,12 @@ namespace MWMechanics
weapon = weaponSlot->get<ESM::Weapon>()->mBase;
weapRange = weapon->mData.mReach;
}
weapRange *= 100.0f;
weapRange *= fCombatDistance;
}
else //is creature
{
weaptype = actorClass.getCreatureStats(actor).getDrawState() == DrawState_Spell ? WeapType_Spell : WeapType_HandToHand;
weapRange = 150.0f; //TODO: use true attack range (the same problem in Creature::hit)
weapRange = fCombatDistance;
}
bool distantCombat = false;

Loading…
Cancel
Save