mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 12:53:53 +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
|
// constant effects have no duration and no target
|
||||||
if (!mEffectParams.mIsConstant)
|
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);
|
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;
|
float magnitude = effectIt->mMagnMin + (effectIt->mMagnMax - effectIt->mMagnMin) * random;
|
||||||
magnitude *= magnitudeMult;
|
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)
|
if (target.getClass().isActor() && hasDuration)
|
||||||
{
|
{
|
||||||
ActiveSpells::ActiveEffect effect;
|
ActiveSpells::ActiveEffect effect;
|
||||||
|
@ -579,6 +579,30 @@ namespace MWMechanics
|
||||||
value.restore(magnitude);
|
value.restore(magnitude);
|
||||||
target.getClass().getCreatureStats(target).setAttribute(attribute, value);
|
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)
|
else if (effectId == ESM::MagicEffect::DamageSkill || effectId == ESM::MagicEffect::RestoreSkill)
|
||||||
{
|
{
|
||||||
if (target.getTypeName() != typeid(ESM::NPC).name())
|
if (target.getTypeName() != typeid(ESM::NPC).name())
|
||||||
|
@ -641,6 +665,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)
|
bool CastSpell::cast(const std::string &id)
|
||||||
{
|
{
|
||||||
if (const ESM::Spell *spell =
|
if (const ESM::Spell *spell =
|
||||||
|
|
|
@ -93,6 +93,8 @@ namespace MWMechanics
|
||||||
|
|
||||||
/// @note \a caster can be any type of object, or even an empty object.
|
/// @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 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