mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +00:00
Fix incorrect handling of baseDisposition >= 100 in testDisposition(), enable unbounded getDerivedDisposition() (Fixes #3233)
This commit is contained in:
parent
0fc65db6bb
commit
000597236e
4 changed files with 5 additions and 5 deletions
|
@ -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 bounded = true) = 0;
|
||||
///< Calculate the diposition of an NPC toward the player.
|
||||
|
||||
virtual int countDeaths (const std::string& id) const = 0;
|
||||
|
|
|
@ -145,7 +145,7 @@ bool MWDialogue::Filter::testDisposition (const ESM::DialInfo& info, bool invert
|
|||
if (isCreature)
|
||||
return true;
|
||||
|
||||
int actorDisposition = MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mActor)
|
||||
int actorDisposition = MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mActor, false)
|
||||
+ MWBase::Environment::get().getDialogueManager()->getTemporaryDispositionChange();
|
||||
// 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)
|
||||
|
|
|
@ -581,7 +581,7 @@ namespace MWMechanics
|
|||
mUpdatePlayer = true;
|
||||
}
|
||||
|
||||
int MechanicsManager::getDerivedDisposition(const MWWorld::Ptr& ptr)
|
||||
int MechanicsManager::getDerivedDisposition(const MWWorld::Ptr& ptr, bool bounded /* = true */)
|
||||
{
|
||||
const MWMechanics::NpcStats& npcSkill = ptr.getClass().getNpcStats(ptr);
|
||||
float x = static_cast<float>(npcSkill.getBaseDisposition());
|
||||
|
@ -653,7 +653,7 @@ namespace MWMechanics
|
|||
|
||||
x += ptr.getClass().getCreatureStats(ptr).getMagicEffects().get(ESM::MagicEffect::Charm).getMagnitude();
|
||||
|
||||
int effective_disposition = std::max(0,std::min(int(x),100));//, normally clamped to [0..100] when used
|
||||
int effective_disposition = std::max(0,std::min(int(x), (bounded ? 100 : std::numeric_limits<int>::max()) )); // clamped to [0..100] unless !bounded
|
||||
return effective_disposition;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 bounded = true);
|
||||
///< Calculate the diposition of an NPC toward the player.
|
||||
|
||||
virtual int countDeaths (const std::string& id) const;
|
||||
|
|
Loading…
Reference in a new issue