mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 08:23:53 +00:00
Acrobatics: cosmetic changes
This commit is contained in:
parent
b8c60dabb3
commit
4860514865
2 changed files with 18 additions and 14 deletions
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include <OgreSceneNode.h>
|
#include <OgreSceneNode.h>
|
||||||
|
|
||||||
|
#include <components/esm/loadmgef.hpp>
|
||||||
#include <components/esm/loadnpc.hpp>
|
#include <components/esm/loadnpc.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
|
@ -771,17 +772,20 @@ namespace MWClass
|
||||||
|
|
||||||
float Npc::getFallDamage(const MWWorld::Ptr &ptr, float fallHeight) const
|
float Npc::getFallDamage(const MWWorld::Ptr &ptr, float fallHeight) const
|
||||||
{
|
{
|
||||||
const float fallDistanceMin = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fFallDamageDistanceMin")->getFloat();
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||||
|
const MWWorld::Store<ESM::GameSetting> &gmst = world->getStore().get<ESM::GameSetting>();
|
||||||
|
|
||||||
|
const float fallDistanceMin = gmst.find("fFallDamageDistanceMin")->getFloat();
|
||||||
|
|
||||||
if (fallHeight >= fallDistanceMin)
|
if (fallHeight >= fallDistanceMin)
|
||||||
{
|
{
|
||||||
const float acrobaticsSkill = MWWorld::Class::get(ptr).getNpcStats (ptr).getSkill(ESM::Skill::Acrobatics).getModified();
|
const float acrobaticsSkill = MWWorld::Class::get(ptr).getNpcStats (ptr).getSkill(ESM::Skill::Acrobatics).getModified();
|
||||||
const CustomData *npcdata = static_cast<const CustomData*>(ptr.getRefData().getCustomData());
|
const CustomData *npcdata = static_cast<const CustomData*>(ptr.getRefData().getCustomData());
|
||||||
const float jumpSpellBonus = npcdata->mNpcStats.getMagicEffects().get(MWMechanics::EffectKey(9/*jump*/)).mMagnitude;
|
const float jumpSpellBonus = npcdata->mNpcStats.getMagicEffects().get(MWMechanics::EffectKey(ESM::MagicEffect::Jump)).mMagnitude;
|
||||||
const float fallAcroBase = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fFallAcroBase")->getFloat();
|
const float fallAcroBase = gmst.find("fFallAcroBase")->getFloat();
|
||||||
const float fallAcroMult = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fFallAcroMult")->getFloat();
|
const float fallAcroMult = gmst.find("fFallAcroMult")->getFloat();
|
||||||
const float fallDistanceBase = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fFallDistanceBase")->getFloat();
|
const float fallDistanceBase = gmst.find("fFallDistanceBase")->getFloat();
|
||||||
const float fallDistanceMult = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fFallDistanceMult")->getFloat();
|
const float fallDistanceMult = gmst.find("fFallDistanceMult")->getFloat();
|
||||||
|
|
||||||
float x = fallHeight - fallDistanceMin;
|
float x = fallHeight - fallDistanceMin;
|
||||||
x -= (1.5 * acrobaticsSkill) + jumpSpellBonus;
|
x -= (1.5 * acrobaticsSkill) + jumpSpellBonus;
|
||||||
|
|
|
@ -813,17 +813,18 @@ void CharacterController::update(float duration)
|
||||||
}
|
}
|
||||||
|
|
||||||
// advance acrobatics
|
// advance acrobatics
|
||||||
MWWorld::Class::get(mPtr).skillUsageSucceeded(mPtr, ESM::Skill::Acrobatics, 0);
|
cls.skillUsageSucceeded(mPtr, ESM::Skill::Acrobatics, 0);
|
||||||
|
|
||||||
// decrease fatigue
|
// decrease fatigue
|
||||||
const float fatigueJumpBase = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fFatigueJumpBase")->getFloat();
|
const MWWorld::Store<ESM::GameSetting> &gmst = world->getStore().get<ESM::GameSetting>();
|
||||||
const float fatigueJumpMult = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fFatigueJumpMult")->getFloat();
|
const float fatigueJumpBase = gmst.find("fFatigueJumpBase")->getFloat();
|
||||||
|
const float fatigueJumpMult = gmst.find("fFatigueJumpMult")->getFloat();
|
||||||
const float normalizedEncumbrance = cls.getEncumbrance(mPtr) / cls.getCapacity(mPtr);
|
const float normalizedEncumbrance = cls.getEncumbrance(mPtr) / cls.getCapacity(mPtr);
|
||||||
const int fatigueDecrease = fatigueJumpBase + (1 - normalizedEncumbrance) * fatigueJumpMult;
|
const int fatigueDecrease = fatigueJumpBase + (1 - normalizedEncumbrance) * fatigueJumpMult;
|
||||||
DynamicStat<float> fatigue = cls.getCreatureStats(mPtr).getDynamic(2);
|
DynamicStat<float> fatigue = cls.getCreatureStats(mPtr).getFatigue();
|
||||||
fatigue.setModified(fatigue.getModified() - fatigueDecrease, 0);
|
fatigue.setModified(fatigue.getModified() - fatigueDecrease, 0);
|
||||||
fatigue.setCurrent(fatigue.getCurrent() - fatigueDecrease);
|
fatigue.setCurrent(fatigue.getCurrent() - fatigueDecrease);
|
||||||
cls.getCreatureStats(mPtr).setDynamic(2, fatigue);
|
cls.getCreatureStats(mPtr).setFatigue(fatigue);
|
||||||
}
|
}
|
||||||
else if(mJumpState == JumpState_Falling)
|
else if(mJumpState == JumpState_Falling)
|
||||||
{
|
{
|
||||||
|
@ -838,10 +839,9 @@ void CharacterController::update(float duration)
|
||||||
{
|
{
|
||||||
// inflict fall damages
|
// inflict fall damages
|
||||||
DynamicStat<float> health = cls.getCreatureStats(mPtr).getHealth();
|
DynamicStat<float> health = cls.getCreatureStats(mPtr).getHealth();
|
||||||
int current = health.getCurrent();
|
|
||||||
int realHealthLost = healthLost * (1.0f - 0.25 * 1.25f /* * fatigueTerm */);
|
int realHealthLost = healthLost * (1.0f - 0.25 * 1.25f /* * fatigueTerm */);
|
||||||
health.setModified(health.getModified() - realHealthLost, 0);
|
health.setModified(health.getModified() - realHealthLost, 0);
|
||||||
health.setCurrent(current - realHealthLost);
|
health.setCurrent(health.getCurrent() - realHealthLost);
|
||||||
cls.getCreatureStats(mPtr).setHealth(health);
|
cls.getCreatureStats(mPtr).setHealth(health);
|
||||||
|
|
||||||
// report acrobatics progression
|
// report acrobatics progression
|
||||||
|
|
Loading…
Reference in a new issue