@ -20,7 +20,7 @@ namespace MWMechanics
mAttacked ( false ) ,
mAttackingOrSpell ( false ) ,
mIsWerewolf ( false ) ,
mFallHeight ( 0 ) , mRecalc DynamicStats ( false ) , mKnockdown ( false ) , mKnockdownOneFrame ( false ) ,
mFallHeight ( 0 ) , mRecalc Magicka ( false ) , mKnockdown ( false ) , mKnockdownOneFrame ( false ) ,
mKnockdownOverOneFrame ( false ) , mHitRecovery ( false ) , mBlock ( false ) ,
mMovementFlags ( 0 ) , mDrawState ( DrawState_Nothing ) , mAttackStrength ( 0.f ) ,
mLastRestock ( 0 , 0 ) , mGoldPool ( 0 ) , mActorId ( - 1 ) ,
@ -147,10 +147,22 @@ namespace MWMechanics
if ( value ! = currentValue )
{
if ( index ! = ESM : : Attribute : : Luck
& & index ! = ESM : : Attribute : : Personality
& & index ! = ESM : : Attribute : : Speed )
mRecalcDynamicStats = true ;
if ( index = = ESM : : Attribute : : Intelligence )
mRecalcMagicka = true ;
else if ( index = = ESM : : Attribute : : Strength | |
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 )
@ -200,7 +212,7 @@ namespace MWMechanics
{
if ( effects . get ( ESM : : MagicEffect : : FortifyMaximumMagicka ) . getModifier ( )
! = mMagicEffects . get ( ESM : : MagicEffect : : FortifyMaximumMagicka ) . getModifier ( ) )
mRecalc DynamicStats = true ;
mRecalc Magicka = true ;
mMagicEffects . setModifiers ( effects ) ;
}
@ -361,9 +373,9 @@ namespace MWMechanics
bool CreatureStats : : needToRecalcDynamicStats ( )
{
if ( mRecalc DynamicStats )
if ( mRecalc Magicka )
{
mRecalc DynamicStats = false ;
mRecalc Magicka = false ;
return true ;
}
return false ;
@ -371,7 +383,7 @@ namespace MWMechanics
void CreatureStats : : setNeedRecalcDynamicStats ( bool val )
{
mRecalc DynamicStats = val ;
mRecalc Magicka = val ;
}
void CreatureStats : : setKnockedDown ( bool value )
@ -498,7 +510,7 @@ namespace MWMechanics
state . mAttackStrength = mAttackStrength ;
state . mFallHeight = mFallHeight ; // TODO: vertical velocity (move from PhysicActor to CreatureStats?)
state . mLastHitObject = mLastHitObject ;
state . mRecalcDynamicStats = mRecalc DynamicStats ;
state . mRecalcDynamicStats = mRecalc Magicka ;
state . mDrawState = mDrawState ;
state . mLevel = mLevel ;
state . mActorId = mActorId ;
@ -546,7 +558,7 @@ namespace MWMechanics
mAttackStrength = state . mAttackStrength ;
mFallHeight = state . mFallHeight ;
mLastHitObject = state . mLastHitObject ;
mRecalc DynamicStats = state . mRecalcDynamicStats ;
mRecalc Magicka = state . mRecalcDynamicStats ;
mDrawState = DrawState_ ( state . mDrawState ) ;
mLevel = state . mLevel ;
mActorId = state . mActorId ;