diff --git a/Source/items.cpp b/Source/items.cpp index 2e74bacc3b0..88f83cd54f9 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -2522,10 +2522,10 @@ void CalcPlrPrimaryStats(Player &player, int strength, int &magic, int dexterity vitality -= 2 * playerLevel; } - player._pStrength = std::max(0, strength + player._pBaseStr); - player._pMagic = std::max(0, magic + player._pBaseMag); - player._pDexterity = std::max(0, dexterity + player._pBaseDex); - player._pVitality = std::max(0, vitality + player._pBaseVit); + player._pStrength = std::clamp(strength + player._pBaseStr, 0, 750); + player._pMagic = std::clamp(magic + player._pBaseMag, 0, 750); + player._pDexterity = std::clamp(dexterity + player._pBaseDex, 0, 750); + player._pVitality = std::clamp(vitality + player._pBaseVit, 0, 750); } void CalcPlrLightRadius(Player &player, int lrad) diff --git a/Source/player.cpp b/Source/player.cpp index a4e26c81f44..2e16cfb8907 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -1458,33 +1458,6 @@ void ValidatePlayer() myPlayer._pInfraFlag = false; } -void CheckCheatStats(Player &player) -{ - if (player._pStrength > 750) { - player._pStrength = 750; - } - - if (player._pDexterity > 750) { - player._pDexterity = 750; - } - - if (player._pMagic > 750) { - player._pMagic = 750; - } - - if (player._pVitality > 750) { - player._pVitality = 750; - } - - if (player._pHitPoints > 128000) { - player._pHitPoints = 128000; - } - - if (player._pMana > 128000) { - player._pMana = 128000; - } -} - HeroClass GetPlayerSpriteClass(HeroClass cls) { if (cls == HeroClass::Bard && !gbBard) @@ -2974,8 +2947,6 @@ void ProcessPlayers() for (size_t pnum = 0; pnum < Players.size(); pnum++) { Player &player = Players[pnum]; if (player.plractive && player.isOnActiveLevel() && (&player == MyPlayer || !player._pLvlChanging)) { - CheckCheatStats(player); - if (!PlrDeathModeOK(player) && (player._pHitPoints >> 6) <= 0) { SyncPlrKill(player, DeathReason::Unknown); }