mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-29 21:45:32 +00:00
Merge remote-tracking branch 'internecine/bug2031'
This commit is contained in:
commit
31f6ccdf4d
3 changed files with 35 additions and 2 deletions
|
@ -447,7 +447,7 @@ namespace MWGui
|
|||
// constant effects have no duration and no target
|
||||
if (!mEffectParams.mIsConstant)
|
||||
{
|
||||
if (mEffectParams.mDuration >= 0 && !(magicEffect->mData.mFlags & ESM::MagicEffect::NoDuration))
|
||||
if (mEffectParams.mDuration > 0 && !(magicEffect->mData.mFlags & ESM::MagicEffect::NoDuration))
|
||||
{
|
||||
spellLine += " " + MWBase::Environment::get().getWindowManager()->getGameSettingString("sfor", "") + " " + boost::lexical_cast<std::string>(mEffectParams.mDuration) + ((mEffectParams.mDuration == 1) ? sec : secs);
|
||||
}
|
||||
|
|
|
@ -435,7 +435,7 @@ namespace MWMechanics
|
|||
float magnitude = effectIt->mMagnMin + (effectIt->mMagnMax - effectIt->mMagnMin) * random;
|
||||
magnitude *= magnitudeMult;
|
||||
|
||||
bool hasDuration = !(magicEffect->mData.mFlags & ESM::MagicEffect::NoDuration);
|
||||
bool hasDuration = !(magicEffect->mData.mFlags & ESM::MagicEffect::NoDuration) && effectIt->mDuration > 0;
|
||||
if (target.getClass().isActor() && hasDuration)
|
||||
{
|
||||
ActiveSpells::ActiveEffect effect;
|
||||
|
@ -579,6 +579,30 @@ namespace MWMechanics
|
|||
value.restore(magnitude);
|
||||
target.getClass().getCreatureStats(target).setAttribute(attribute, value);
|
||||
}
|
||||
else if (effectId == ESM::MagicEffect::DamageHealth)
|
||||
{
|
||||
applyDynamicStatsEffect(0, target, magnitude * -1);
|
||||
}
|
||||
else if (effectId == ESM::MagicEffect::RestoreHealth)
|
||||
{
|
||||
applyDynamicStatsEffect(0, target, magnitude);
|
||||
}
|
||||
else if (effectId == ESM::MagicEffect::DamageFatigue)
|
||||
{
|
||||
applyDynamicStatsEffect(2, target, magnitude * -1);
|
||||
}
|
||||
else if (effectId == ESM::MagicEffect::RestoreFatigue)
|
||||
{
|
||||
applyDynamicStatsEffect(2, target, magnitude);
|
||||
}
|
||||
else if (effectId == ESM::MagicEffect::DamageMagicka)
|
||||
{
|
||||
applyDynamicStatsEffect(1, target, magnitude * -1);
|
||||
}
|
||||
else if (effectId == ESM::MagicEffect::RestoreMagicka)
|
||||
{
|
||||
applyDynamicStatsEffect(1, target, magnitude);
|
||||
}
|
||||
else if (effectId == ESM::MagicEffect::DamageSkill || effectId == ESM::MagicEffect::RestoreSkill)
|
||||
{
|
||||
if (target.getTypeName() != typeid(ESM::NPC).name())
|
||||
|
@ -640,6 +664,13 @@ namespace MWMechanics
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CastSpell::applyDynamicStatsEffect(int attribute, const MWWorld::Ptr& target, float magnitude)
|
||||
{
|
||||
DynamicStat<float> value = target.getClass().getCreatureStats(target).getDynamic(attribute);
|
||||
value.modify(magnitude);
|
||||
target.getClass().getCreatureStats(target).setDynamic(attribute, value);
|
||||
}
|
||||
|
||||
bool CastSpell::cast(const std::string &id)
|
||||
{
|
||||
|
|
|
@ -93,6 +93,8 @@ namespace MWMechanics
|
|||
|
||||
/// @note \a caster can be any type of object, or even an empty object.
|
||||
void applyInstantEffect (const MWWorld::Ptr& target, const MWWorld::Ptr& caster, const MWMechanics::EffectKey& effect, float magnitude);
|
||||
|
||||
void applyDynamicStatsEffect (int attribute, const MWWorld::Ptr& target, float magnitude);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue