mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-10 04:46:08 -04:00
Subtract Charm from permanent disposition clamp range
This commit is contained in:
parent
8bf9b205b7
commit
01fa3cc4e6
@ -12,6 +12,7 @@
|
|||||||
#include <components/esm3/loaddial.hpp>
|
#include <components/esm3/loaddial.hpp>
|
||||||
#include <components/esm3/loadfact.hpp>
|
#include <components/esm3/loadfact.hpp>
|
||||||
#include <components/esm3/loadinfo.hpp>
|
#include <components/esm3/loadinfo.hpp>
|
||||||
|
#include <components/esm3/loadmgef.hpp>
|
||||||
|
|
||||||
#include <components/compiler/errorhandler.hpp>
|
#include <components/compiler/errorhandler.hpp>
|
||||||
#include <components/compiler/exception.hpp>
|
#include <components/compiler/exception.hpp>
|
||||||
@ -448,12 +449,14 @@ namespace MWDialogue
|
|||||||
{
|
{
|
||||||
updateOriginalDisposition();
|
updateOriginalDisposition();
|
||||||
MWMechanics::NpcStats& npcStats = mActor.getClass().getNpcStats(mActor);
|
MWMechanics::NpcStats& npcStats = mActor.getClass().getNpcStats(mActor);
|
||||||
// Clamp permanent disposition change so that final disposition doesn't go below 0 (could happen with
|
|
||||||
// intimidate)
|
|
||||||
npcStats.setBaseDisposition(0);
|
|
||||||
int zero = MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mActor, false);
|
|
||||||
int disposition = std::clamp(mOriginalDisposition + mPermanentDispositionChange, -zero, 100 - zero);
|
|
||||||
|
|
||||||
|
// Get the sum of disposition effects minus charm (shouldn't be made permanent)
|
||||||
|
npcStats.setBaseDisposition(0);
|
||||||
|
int zero = MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mActor, false)
|
||||||
|
- npcStats.getMagicEffects().getOrDefault(ESM::MagicEffect::Charm).getMagnitude();
|
||||||
|
|
||||||
|
// Clamp new permanent disposition to avoid negative derived disposition (can be caused by intimidate)
|
||||||
|
int disposition = std::clamp(mOriginalDisposition + mPermanentDispositionChange, -zero, 100 - zero);
|
||||||
npcStats.setBaseDisposition(disposition);
|
npcStats.setBaseDisposition(disposition);
|
||||||
}
|
}
|
||||||
mPermanentDispositionChange = 0;
|
mPermanentDispositionChange = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user