Browse Source

Restore level 50 experience cap from Diablo

pull/6504/head
ephphatha 3 years ago committed by Anders Jenbo
parent
commit
996841e82e
  1. 7
      Source/playerdat.cpp
  2. 2
      Source/qol/xpbar.cpp
  3. 2
      test/writehero_test.cpp

7
Source/playerdat.cpp

@ -20,7 +20,7 @@ namespace devilution {
namespace {
constexpr uint8_t MaxCharacterLevel = 50;
/** Specifies the experience point limit of each level. */
const std::array<uint32_t, MaxCharacterLevel> ExpLvlsTbl {
const std::array<uint32_t, MaxCharacterLevel + 1> ExpLvlsTbl {
0,
2000,
4620,
@ -70,13 +70,14 @@ const std::array<uint32_t, MaxCharacterLevel> ExpLvlsTbl {
733825617,
892680222,
1082908612,
1310707109
1310707109,
1583495809
};
} // namespace
uint32_t GetNextExperienceThresholdForLevel(unsigned level)
{
return ExpLvlsTbl[std::min<size_t>(level, ExpLvlsTbl.size() - 1)];
return ExpLvlsTbl[std::min<size_t>(level, static_cast<size_t>(GetMaximumCharacterLevel()))];
}
uint8_t GetMaximumCharacterLevel()

2
Source/qol/xpbar.cpp

@ -128,7 +128,7 @@ bool CheckXPBarInfo()
// Show a maximum level indicator for max level players.
InfoColor = UiFlags::ColorWhitegold;
AddPanelString(fmt::format(fmt::runtime(_("Experience: {:s}")), FormatInteger(GetNextExperienceThresholdForLevel(charLevel - 1))));
AddPanelString(fmt::format(fmt::runtime(_("Experience: {:s}")), FormatInteger(player._pExperience)));
AddPanelString(_("Maximum Level"));
return true;

2
test/writehero_test.cpp

@ -323,7 +323,7 @@ void AssertPlayer(Player &player)
ASSERT_EQ(player._pMaxHP, 16640);
ASSERT_EQ(player._pMana, 14624);
ASSERT_EQ(player._pMaxMana, 14624);
ASSERT_EQ(player.getNextExperienceThreshold(), 1310707109);
ASSERT_EQ(player.getNextExperienceThreshold(), 1583495809);
ASSERT_EQ(player._pMagResist, 75);
ASSERT_EQ(player._pFireResist, 16);
ASSERT_EQ(player._pLghtResist, 75);

Loading…
Cancel
Save