mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 18:35:20 +00:00
Merge pull request #913
This commit is contained in:
commit
bc5adfa4fe
@ -97,7 +97,7 @@ namespace MWBase
|
||||
virtual int getBarterOffer(const MWWorld::Ptr& ptr,int basePrice, bool buying) = 0;
|
||||
///< This is used by every service to determine the price of objects given the trading skills of the player and NPC.
|
||||
|
||||
virtual int getDerivedDisposition(const MWWorld::Ptr& ptr) = 0;
|
||||
virtual int getDerivedDisposition(const MWWorld::Ptr& ptr, bool addTemporaryDispositionChange = false) = 0;
|
||||
///< Calculate the diposition of an NPC toward the player.
|
||||
|
||||
virtual int countDeaths (const std::string& id) const = 0;
|
||||
|
@ -145,8 +145,7 @@ bool MWDialogue::Filter::testDisposition (const ESM::DialInfo& info, bool invert
|
||||
if (isCreature)
|
||||
return true;
|
||||
|
||||
int actorDisposition = MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mActor)
|
||||
+ MWBase::Environment::get().getDialogueManager()->getTemporaryDispositionChange();
|
||||
int actorDisposition = MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mActor, true);
|
||||
// For service refusal, the disposition check is inverted. However, a value of 0 still means "always succeed".
|
||||
return invert ? (info.mData.mDisposition == 0 || actorDisposition < info.mData.mDisposition)
|
||||
: (actorDisposition >= info.mData.mDisposition);
|
||||
|
@ -640,8 +640,7 @@ namespace MWGui
|
||||
if(mMainWidget->getVisible() && mEnabled && mPtr.getTypeName() == typeid(ESM::NPC).name())
|
||||
{
|
||||
int disp = std::max(0, std::min(100,
|
||||
MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mPtr)
|
||||
+ MWBase::Environment::get().getDialogueManager()->getTemporaryDispositionChange()));
|
||||
MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mPtr, true)));
|
||||
mDispositionBar->setProgressRange(100);
|
||||
mDispositionBar->setProgressPosition(disp);
|
||||
mDispositionText->setCaption(MyGUI::utility::toString(disp)+std::string("/100"));
|
||||
|
@ -346,8 +346,7 @@ namespace MWGui
|
||||
else
|
||||
d = int(100 * (b - a) / a);
|
||||
|
||||
int clampedDisposition = std::max(0, std::min(MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mPtr)
|
||||
+ MWBase::Environment::get().getDialogueManager()->getTemporaryDispositionChange(),100));
|
||||
int clampedDisposition = std::max(0, std::min(MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mPtr, true),100));
|
||||
|
||||
const MWMechanics::CreatureStats &sellerStats = mPtr.getClass().getCreatureStats(mPtr);
|
||||
const MWMechanics::CreatureStats &playerStats = player.getClass().getCreatureStats(player);
|
||||
|
@ -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);
|
||||
|
@ -92,7 +92,7 @@ namespace MWMechanics
|
||||
virtual int getBarterOffer(const MWWorld::Ptr& ptr,int basePrice, bool buying);
|
||||
///< This is used by every service to determine the price of objects given the trading skills of the player and NPC.
|
||||
|
||||
virtual int getDerivedDisposition(const MWWorld::Ptr& ptr);
|
||||
virtual int getDerivedDisposition(const MWWorld::Ptr& ptr, bool addTemporaryDispositionChange = false);
|
||||
///< Calculate the diposition of an NPC toward the player.
|
||||
|
||||
virtual int countDeaths (const std::string& id) const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user