forked from mirror/openmw-tes3mp
Fix fortify maximum magicka expiration (Fixes #3648)
This commit is contained in:
parent
9febb3e824
commit
6816e935f1
3 changed files with 14 additions and 7 deletions
|
@ -512,8 +512,8 @@ namespace MWMechanics
|
||||||
if (magnitude > 0 && remainingTime > 0 && remainingTime < mDuration)
|
if (magnitude > 0 && remainingTime > 0 && remainingTime < mDuration)
|
||||||
{
|
{
|
||||||
CreatureStats& creatureStats = mActor.getClass().getCreatureStats(mActor);
|
CreatureStats& creatureStats = mActor.getClass().getCreatureStats(mActor);
|
||||||
effectTick(creatureStats, mActor, key, magnitude * remainingTime);
|
if (effectTick(creatureStats, mActor, key, magnitude * remainingTime))
|
||||||
creatureStats.getMagicEffects().add(key, -magnitude);
|
creatureStats.getMagicEffects().add(key, -magnitude);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -527,8 +527,10 @@ namespace MWMechanics
|
||||||
|
|
||||||
if (duration > 0)
|
if (duration > 0)
|
||||||
{
|
{
|
||||||
// apply correct magnitude for tickable effects that have just expired,
|
// Apply correct magnitude for tickable effects that have just expired,
|
||||||
// in case duration > remaining time of effect
|
// in case duration > remaining time of effect.
|
||||||
|
// One case where this will happen is when the player uses the rest/wait command
|
||||||
|
// while there is a tickable effect active that should expire before the end of the rest/wait.
|
||||||
ExpiryVisitor visitor(ptr, duration);
|
ExpiryVisitor visitor(ptr, duration);
|
||||||
creatureStats.getActiveSpells().visitEffectSources(visitor);
|
creatureStats.getActiveSpells().visitEffectSources(visitor);
|
||||||
|
|
||||||
|
|
|
@ -1009,10 +1009,10 @@ namespace MWMechanics
|
||||||
creatureStats.setDynamic(index, stat);
|
creatureStats.setDynamic(index, stat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void effectTick(CreatureStats& creatureStats, const MWWorld::Ptr& actor, const EffectKey &effectKey, float magnitude)
|
bool effectTick(CreatureStats& creatureStats, const MWWorld::Ptr& actor, const EffectKey &effectKey, float magnitude)
|
||||||
{
|
{
|
||||||
if (magnitude == 0.f)
|
if (magnitude == 0.f)
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
bool receivedMagicDamage = false;
|
bool receivedMagicDamage = false;
|
||||||
|
|
||||||
|
@ -1144,10 +1144,13 @@ namespace MWMechanics
|
||||||
case ESM::MagicEffect::RemoveCurse:
|
case ESM::MagicEffect::RemoveCurse:
|
||||||
actor.getClass().getCreatureStats(actor).getSpells().purgeCurses();
|
actor.getClass().getCreatureStats(actor).getSpells().purgeCurses();
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (receivedMagicDamage && actor == getPlayer())
|
if (receivedMagicDamage && actor == getPlayer())
|
||||||
MWBase::Environment::get().getWindowManager()->activateHitOverlay(false);
|
MWBase::Environment::get().getWindowManager()->activateHitOverlay(false);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,9 @@ namespace MWMechanics
|
||||||
|
|
||||||
int getEffectiveEnchantmentCastCost (float castCost, const MWWorld::Ptr& actor);
|
int getEffectiveEnchantmentCastCost (float castCost, const MWWorld::Ptr& actor);
|
||||||
|
|
||||||
void effectTick(CreatureStats& creatureStats, const MWWorld::Ptr& actor, const MWMechanics::EffectKey& effectKey, float magnitude);
|
/// Apply a magic effect that is applied in tick intervals until its remaining time ends or it is removed
|
||||||
|
/// @return Was the effect a tickable effect with a magnitude?
|
||||||
|
bool effectTick(CreatureStats& creatureStats, const MWWorld::Ptr& actor, const MWMechanics::EffectKey& effectKey, float magnitude);
|
||||||
|
|
||||||
class CastSpell
|
class CastSpell
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue