mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 06:53:53 +00:00
Make recalculation of magicka less aggressive (Fixes #2155)
This commit is contained in:
parent
ff8bdd74ed
commit
0a466ad643
3 changed files with 24 additions and 22 deletions
|
@ -396,11 +396,7 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
CreatureStats& creatureStats = ptr.getClass().getCreatureStats (ptr);
|
CreatureStats& creatureStats = ptr.getClass().getCreatureStats (ptr);
|
||||||
|
|
||||||
int strength = creatureStats.getAttribute(ESM::Attribute::Strength).getModified();
|
|
||||||
int intelligence = creatureStats.getAttribute(ESM::Attribute::Intelligence).getModified();
|
int intelligence = creatureStats.getAttribute(ESM::Attribute::Intelligence).getModified();
|
||||||
int willpower = creatureStats.getAttribute(ESM::Attribute::Willpower).getModified();
|
|
||||||
int agility = creatureStats.getAttribute(ESM::Attribute::Agility).getModified();
|
|
||||||
int endurance = creatureStats.getAttribute(ESM::Attribute::Endurance).getModified();
|
|
||||||
|
|
||||||
float base = 1.f;
|
float base = 1.f;
|
||||||
if (ptr.getCellRef().getRefId() == "player")
|
if (ptr.getCellRef().getRefId() == "player")
|
||||||
|
@ -415,11 +411,6 @@ namespace MWMechanics
|
||||||
float diff = (static_cast<int>(magickaFactor*intelligence)) - magicka.getBase();
|
float diff = (static_cast<int>(magickaFactor*intelligence)) - magicka.getBase();
|
||||||
magicka.modify(diff);
|
magicka.modify(diff);
|
||||||
creatureStats.setMagicka(magicka);
|
creatureStats.setMagicka(magicka);
|
||||||
|
|
||||||
DynamicStat<float> fatigue = creatureStats.getFatigue();
|
|
||||||
diff = (strength+willpower+agility+endurance) - fatigue.getBase();
|
|
||||||
fatigue.modify(diff);
|
|
||||||
creatureStats.setFatigue(fatigue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Actors::restoreDynamicStats (const MWWorld::Ptr& ptr, bool sleep)
|
void Actors::restoreDynamicStats (const MWWorld::Ptr& ptr, bool sleep)
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace MWMechanics
|
||||||
mAttacked (false),
|
mAttacked (false),
|
||||||
mAttackingOrSpell(false),
|
mAttackingOrSpell(false),
|
||||||
mIsWerewolf(false),
|
mIsWerewolf(false),
|
||||||
mFallHeight(0), mRecalcDynamicStats(false), mKnockdown(false), mKnockdownOneFrame(false),
|
mFallHeight(0), mRecalcMagicka(false), mKnockdown(false), mKnockdownOneFrame(false),
|
||||||
mKnockdownOverOneFrame(false), mHitRecovery(false), mBlock(false),
|
mKnockdownOverOneFrame(false), mHitRecovery(false), mBlock(false),
|
||||||
mMovementFlags(0), mDrawState (DrawState_Nothing), mAttackStrength(0.f),
|
mMovementFlags(0), mDrawState (DrawState_Nothing), mAttackStrength(0.f),
|
||||||
mLastRestock(0,0), mGoldPool(0), mActorId(-1),
|
mLastRestock(0,0), mGoldPool(0), mActorId(-1),
|
||||||
|
@ -147,10 +147,22 @@ namespace MWMechanics
|
||||||
|
|
||||||
if (value != currentValue)
|
if (value != currentValue)
|
||||||
{
|
{
|
||||||
if (index != ESM::Attribute::Luck
|
if (index == ESM::Attribute::Intelligence)
|
||||||
&& index != ESM::Attribute::Personality
|
mRecalcMagicka = true;
|
||||||
&& index != ESM::Attribute::Speed)
|
else if (index == ESM::Attribute::Strength ||
|
||||||
mRecalcDynamicStats = true;
|
index == ESM::Attribute::Willpower ||
|
||||||
|
index == ESM::Attribute::Agility ||
|
||||||
|
index == ESM::Attribute::Endurance)
|
||||||
|
{
|
||||||
|
int strength = getAttribute(ESM::Attribute::Strength).getModified();
|
||||||
|
int willpower = getAttribute(ESM::Attribute::Willpower).getModified();
|
||||||
|
int agility = getAttribute(ESM::Attribute::Agility).getModified();
|
||||||
|
int endurance = getAttribute(ESM::Attribute::Endurance).getModified();
|
||||||
|
DynamicStat<float> fatigue = getFatigue();
|
||||||
|
float diff = (strength+willpower+agility+endurance) - fatigue.getBase();
|
||||||
|
fatigue.modify(diff);
|
||||||
|
setFatigue(fatigue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!mIsWerewolf)
|
if(!mIsWerewolf)
|
||||||
|
@ -199,7 +211,7 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
if (effects.get(ESM::MagicEffect::FortifyMaximumMagicka).getModifier()
|
if (effects.get(ESM::MagicEffect::FortifyMaximumMagicka).getModifier()
|
||||||
!= mMagicEffects.get(ESM::MagicEffect::FortifyMaximumMagicka).getModifier())
|
!= mMagicEffects.get(ESM::MagicEffect::FortifyMaximumMagicka).getModifier())
|
||||||
mRecalcDynamicStats = true;
|
mRecalcMagicka = true;
|
||||||
|
|
||||||
mMagicEffects.setModifiers(effects);
|
mMagicEffects.setModifiers(effects);
|
||||||
}
|
}
|
||||||
|
@ -360,9 +372,9 @@ namespace MWMechanics
|
||||||
|
|
||||||
bool CreatureStats::needToRecalcDynamicStats()
|
bool CreatureStats::needToRecalcDynamicStats()
|
||||||
{
|
{
|
||||||
if (mRecalcDynamicStats)
|
if (mRecalcMagicka)
|
||||||
{
|
{
|
||||||
mRecalcDynamicStats = false;
|
mRecalcMagicka = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -370,7 +382,7 @@ namespace MWMechanics
|
||||||
|
|
||||||
void CreatureStats::setNeedRecalcDynamicStats(bool val)
|
void CreatureStats::setNeedRecalcDynamicStats(bool val)
|
||||||
{
|
{
|
||||||
mRecalcDynamicStats = val;
|
mRecalcMagicka = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreatureStats::setKnockedDown(bool value)
|
void CreatureStats::setKnockedDown(bool value)
|
||||||
|
@ -497,7 +509,7 @@ namespace MWMechanics
|
||||||
state.mAttackStrength = mAttackStrength;
|
state.mAttackStrength = mAttackStrength;
|
||||||
state.mFallHeight = mFallHeight; // TODO: vertical velocity (move from PhysicActor to CreatureStats?)
|
state.mFallHeight = mFallHeight; // TODO: vertical velocity (move from PhysicActor to CreatureStats?)
|
||||||
state.mLastHitObject = mLastHitObject;
|
state.mLastHitObject = mLastHitObject;
|
||||||
state.mRecalcDynamicStats = mRecalcDynamicStats;
|
state.mRecalcDynamicStats = mRecalcMagicka;
|
||||||
state.mDrawState = mDrawState;
|
state.mDrawState = mDrawState;
|
||||||
state.mLevel = mLevel;
|
state.mLevel = mLevel;
|
||||||
state.mActorId = mActorId;
|
state.mActorId = mActorId;
|
||||||
|
@ -545,7 +557,7 @@ namespace MWMechanics
|
||||||
mAttackStrength = state.mAttackStrength;
|
mAttackStrength = state.mAttackStrength;
|
||||||
mFallHeight = state.mFallHeight;
|
mFallHeight = state.mFallHeight;
|
||||||
mLastHitObject = state.mLastHitObject;
|
mLastHitObject = state.mLastHitObject;
|
||||||
mRecalcDynamicStats = state.mRecalcDynamicStats;
|
mRecalcMagicka = state.mRecalcDynamicStats;
|
||||||
mDrawState = DrawState_(state.mDrawState);
|
mDrawState = DrawState_(state.mDrawState);
|
||||||
mLevel = state.mLevel;
|
mLevel = state.mLevel;
|
||||||
mActorId = state.mActorId;
|
mActorId = state.mActorId;
|
||||||
|
|
|
@ -53,8 +53,7 @@ namespace MWMechanics
|
||||||
|
|
||||||
std::string mLastHitObject; // The last object to hit this actor
|
std::string mLastHitObject; // The last object to hit this actor
|
||||||
|
|
||||||
// Do we need to recalculate stats derived from attributes or other factors?
|
bool mRecalcMagicka;
|
||||||
bool mRecalcDynamicStats;
|
|
||||||
|
|
||||||
// For merchants: the last time items were restocked and gold pool refilled.
|
// For merchants: the last time items were restocked and gold pool refilled.
|
||||||
MWWorld::TimeStamp mLastRestock;
|
MWWorld::TimeStamp mLastRestock;
|
||||||
|
|
Loading…
Reference in a new issue