mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-31 06:32:39 +00:00
Don't apply spell multiplier to on hit enchantments
This commit is contained in:
parent
114daa5938
commit
dfca5d95c2
@ -656,23 +656,29 @@ namespace MWMechanics
|
||||
return rating;
|
||||
}
|
||||
|
||||
float rateEffects(const ESM::EffectList& list, const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy)
|
||||
float rateEffects(
|
||||
const ESM::EffectList& list, const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy, bool useSpellMult)
|
||||
{
|
||||
// NOTE: enemy may be empty
|
||||
|
||||
float rating = 0.f;
|
||||
float ratingMult = 1.f; // NB: this multiplier is applied to the effect rating, not the final rating
|
||||
|
||||
const MWWorld::Store<ESM::GameSetting>& gmst
|
||||
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||
static const float fAIMagicSpellMult = gmst.find("fAIMagicSpellMult")->mValue.getFloat();
|
||||
static const float fAIRangeMagicSpellMult = gmst.find("fAIRangeMagicSpellMult")->mValue.getFloat();
|
||||
|
||||
for (std::vector<ESM::ENAMstruct>::const_iterator it = list.mList.begin(); it != list.mList.end(); ++it)
|
||||
for (const ESM::ENAMstruct& effect : list.mList)
|
||||
{
|
||||
ratingMult = (it->mRange == ESM::RT_Target) ? fAIRangeMagicSpellMult : fAIMagicSpellMult;
|
||||
|
||||
rating += rateEffect(*it, actor, enemy) * ratingMult;
|
||||
float effectRating = rateEffect(effect, actor, enemy);
|
||||
if (useSpellMult)
|
||||
{
|
||||
if (effect.mRange == ESM::RT_Target)
|
||||
effectRating *= fAIRangeMagicSpellMult;
|
||||
else
|
||||
effectRating *= fAIMagicSpellMult;
|
||||
}
|
||||
rating += effectRating;
|
||||
}
|
||||
return rating;
|
||||
}
|
||||
|
@ -32,7 +32,8 @@ namespace MWMechanics
|
||||
/// @note target may be empty
|
||||
float rateEffect(const ESM::ENAMstruct& effect, const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy);
|
||||
/// @note target may be empty
|
||||
float rateEffects(const ESM::EffectList& list, const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy);
|
||||
float rateEffects(
|
||||
const ESM::EffectList& list, const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy, bool useSpellMult = true);
|
||||
|
||||
float vanillaRateSpell(const ESM::Spell* spell, const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy);
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ namespace MWMechanics
|
||||
|
||||
if (charge == -1 || charge >= castCost || weapclass == ESM::WeaponType::Thrown
|
||||
|| weapclass == ESM::WeaponType::Ammo)
|
||||
rating += rateEffects(enchantment->mEffects, actor, enemy);
|
||||
rating += rateEffects(enchantment->mEffects, actor, enemy, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user