Merge pull request #1647 from Capostrophic/fatigue

Improve the logic of trading formulae (bug #2222)
pull/456/head
Bret Curtis 7 years ago committed by GitHub
commit 45957dd707
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,6 +2,7 @@
------
Bug #1990: Sunrise/sunset not set correct
Bug #2222: Fatigue's effect on selling price is backwards
Bug #2326: After a bound item expires the last equipped item of that type is not automatically re-equipped
Bug #2835: Player able to slowly move when overencumbered
Bug #3374: Touch spells not hitting kwama foragers

@ -630,22 +630,12 @@ namespace MWMechanics
float d = static_cast<float>(std::min(sellerStats.getSkill(ESM::Skill::Mercantile).getModified(), 100));
float e = std::min(0.1f * sellerStats.getAttribute(ESM::Attribute::Luck).getModified(), 10.f);
float f = std::min(0.2f * sellerStats.getAttribute(ESM::Attribute::Personality).getModified(), 10.f);
float pcTerm = (clampedDisposition - 50 + a + b + c) * playerStats.getFatigueTerm();
float npcTerm = (d + e + f) * sellerStats.getFatigueTerm();
float buyTerm = 0.01f * (100 - 0.5f * (pcTerm - npcTerm));
float sellTerm = 0.01f * (50 - 0.5f * (npcTerm - pcTerm));
float x;
if(buying) x = buyTerm;
else x = std::min(buyTerm, sellTerm);
int offerPrice;
if (x < 1)
offerPrice = int(x * basePrice);
else
offerPrice = basePrice + int((x - 1) * basePrice);
offerPrice = std::max(1, offerPrice);
return offerPrice;
float buyTerm = 0.01f * std::max(75.f, (100 - 0.5f * (pcTerm - npcTerm)));
float sellTerm = 0.01f * std::min(75.f, (50 - 0.5f * (npcTerm - pcTerm)));
int offerPrice = int(basePrice * (buying ? buyTerm : sellTerm));
return std::max(1, offerPrice);
}
int MechanicsManager::countDeaths (const std::string& id) const

@ -32,7 +32,6 @@ namespace MWMechanics
// Is the player buying?
bool buying = (merchantOffer < 0);
int a = std::abs(merchantOffer);
int b = std::abs(playerOffer);
int d = (buying)
@ -56,7 +55,7 @@ namespace MWMechanics
float npcTerm = (d1 + e1 + f1) * merchantStats.getFatigueTerm();
float x = gmst.find("fBargainOfferMulti")->getFloat() * d
+ gmst.find("fBargainOfferBase")->getFloat()
+ std::abs(int(pcTerm - npcTerm));
+ int(pcTerm - npcTerm);
int roll = Misc::Rng::rollDice(100) + 1;

Loading…
Cancel
Save