|
|
|
@ -581,7 +581,7 @@ namespace MWMechanics
|
|
|
|
|
mUpdatePlayer = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int MechanicsManager::getDerivedDisposition(const MWWorld::Ptr& ptr)
|
|
|
|
|
int MechanicsManager::getDerivedDisposition(const MWWorld::Ptr& ptr, bool addTemporaryDispositionChange/* = false */)
|
|
|
|
|
{
|
|
|
|
|
const MWMechanics::NpcStats& npcSkill = ptr.getClass().getNpcStats(ptr);
|
|
|
|
|
float x = static_cast<float>(npcSkill.getBaseDisposition());
|
|
|
|
@ -653,6 +653,9 @@ namespace MWMechanics
|
|
|
|
|
|
|
|
|
|
x += ptr.getClass().getCreatureStats(ptr).getMagicEffects().get(ESM::MagicEffect::Charm).getMagnitude();
|
|
|
|
|
|
|
|
|
|
if(addTemporaryDispositionChange)
|
|
|
|
|
x += MWBase::Environment::get().getDialogueManager()->getTemporaryDispositionChange();
|
|
|
|
|
|
|
|
|
|
int effective_disposition = std::max(0,std::min(int(x),100));//, normally clamped to [0..100] when used
|
|
|
|
|
return effective_disposition;
|
|
|
|
|
}
|
|
|
|
@ -667,10 +670,9 @@ namespace MWMechanics
|
|
|
|
|
MWWorld::Ptr playerPtr = getPlayer();
|
|
|
|
|
const MWMechanics::NpcStats &playerStats = playerPtr.getClass().getNpcStats(playerPtr);
|
|
|
|
|
|
|
|
|
|
// I suppose the temporary disposition change _has_ to be considered here,
|
|
|
|
|
// I suppose the temporary disposition change (second param to getDerivedDisposition()) _has_ to be considered here,
|
|
|
|
|
// otherwise one would get different prices when exiting and re-entering the dialogue window...
|
|
|
|
|
int clampedDisposition = std::max(0, std::min(getDerivedDisposition(ptr)
|
|
|
|
|
+ MWBase::Environment::get().getDialogueManager()->getTemporaryDispositionChange(),100));
|
|
|
|
|
int clampedDisposition = std::max(0, std::min(getDerivedDisposition(ptr, true),100));
|
|
|
|
|
float a = static_cast<float>(std::min(playerStats.getSkill(ESM::Skill::Mercantile).getModified(), 100));
|
|
|
|
|
float b = std::min(0.1f * playerStats.getAttribute(ESM::Attribute::Luck).getModified(), 10.f);
|
|
|
|
|
float c = std::min(0.2f * playerStats.getAttribute(ESM::Attribute::Personality).getModified(), 10.f);
|
|
|
|
|