mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-01 09:45:35 +00:00
Implements vanilla's off-by-one error, fixing #4611
This commit is contained in:
parent
778dfa0350
commit
bbcdfd4078
5 changed files with 15 additions and 6 deletions
|
@ -449,11 +449,13 @@ namespace MWGui
|
|||
const MWWorld::ESMStore &store =
|
||||
MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
static const bool vanillaCost = Settings::Manager::getBool("expensive spells", "Game");
|
||||
|
||||
for (std::vector<ESM::ENAMstruct>::const_iterator it = mEffects.begin(); it != mEffects.end(); ++it)
|
||||
{
|
||||
const ESM::ENAMstruct& effect = *it;
|
||||
|
||||
y += std::max(1.f, MWMechanics::calcEffectCost(effect));
|
||||
y += std::max(1.f, MWMechanics::calcEffectCost(effect, vanillaCost));
|
||||
|
||||
if (effect.mRange == ESM::RT_Target)
|
||||
y *= 1.5;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <components/esm/loadmgef.hpp>
|
||||
#include <components/esm/loadspel.hpp>
|
||||
#include <components/settings/settings.hpp>
|
||||
|
||||
#include "windowbase.hpp"
|
||||
#include "referenceinterface.hpp"
|
||||
|
|
|
@ -49,13 +49,13 @@ namespace MWMechanics
|
|||
return schoolSkillMap[school];
|
||||
}
|
||||
|
||||
float calcEffectCost(const ESM::ENAMstruct& effect)
|
||||
float calcEffectCost(const ESM::ENAMstruct& effect, const bool customSpellCost)
|
||||
{
|
||||
const ESM::MagicEffect* magicEffect = MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(effect.mEffectID);
|
||||
return calcEffectCost(effect, magicEffect);
|
||||
return calcEffectCost(effect, magicEffect, customSpellCost);
|
||||
}
|
||||
|
||||
float calcEffectCost(const ESM::ENAMstruct& effect, const ESM::MagicEffect* magicEffect)
|
||||
float calcEffectCost(const ESM::ENAMstruct& effect, const ESM::MagicEffect* magicEffect, const bool customSpellCost)
|
||||
{
|
||||
int minMagn = 1;
|
||||
int maxMagn = 1;
|
||||
|
@ -68,6 +68,9 @@ namespace MWMechanics
|
|||
int duration = 0;
|
||||
if (!(magicEffect->mData.mFlags & ESM::MagicEffect::NoDuration))
|
||||
duration = effect.mDuration;
|
||||
//The wonders of vanilla spellmaking
|
||||
if (customSpellCost && duration < 1)
|
||||
duration = 1;
|
||||
|
||||
static const float fEffectCostMult = MWBase::Environment::get().getWorld()->getStore()
|
||||
.get<ESM::GameSetting>().find("fEffectCostMult")->mValue.getFloat();
|
||||
|
|
|
@ -25,8 +25,8 @@ namespace MWMechanics
|
|||
|
||||
ESM::Skill::SkillEnum spellSchoolToSkill(int school);
|
||||
|
||||
float calcEffectCost(const ESM::ENAMstruct& effect);
|
||||
float calcEffectCost(const ESM::ENAMstruct& effect, const ESM::MagicEffect* magicEffect);
|
||||
float calcEffectCost(const ESM::ENAMstruct& effect, const bool customSpellCost = false);
|
||||
float calcEffectCost(const ESM::ENAMstruct& effect, const ESM::MagicEffect* magicEffect, const bool customSpellCost = false);
|
||||
|
||||
bool isSummoningEffect(int effectId);
|
||||
|
||||
|
|
|
@ -230,6 +230,9 @@ barter disposition change is permanent = false
|
|||
# 2 means werewolves are ignored)
|
||||
strength influences hand to hand = 0
|
||||
|
||||
# Makes custom spells cost the same as in vanilla
|
||||
expensive spells = true
|
||||
|
||||
[General]
|
||||
|
||||
# Anisotropy reduces distortion in textures at low angles (e.g. 0 to 16).
|
||||
|
|
Loading…
Reference in a new issue