diff --git a/Source/items.cpp b/Source/items.cpp index 750c5e1a60d..ce1b4ec22d3 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -2997,14 +2997,17 @@ void CreatePlrItems(Player &player) case HeroClass::Warrior: InitializeItem(player.InvBody[INVLOC_HAND_LEFT], IDI_WARRIOR); GenerateNewSeed(player.InvBody[INVLOC_HAND_LEFT]); + player.InvBody[INVLOC_HAND_LEFT].updateRequiredStatsCacheForPlayer(player); InitializeItem(player.InvBody[INVLOC_HAND_RIGHT], IDI_WARRSHLD); GenerateNewSeed(player.InvBody[INVLOC_HAND_RIGHT]); + player.InvBody[INVLOC_HAND_RIGHT].updateRequiredStatsCacheForPlayer(player); { Item club; InitializeItem(club, IDI_WARRCLUB); GenerateNewSeed(club); + club.updateRequiredStatsCacheForPlayer(player); AutoPlaceItemInInventory(player, club, true); } @@ -3017,6 +3020,7 @@ void CreatePlrItems(Player &player) case HeroClass::Rogue: InitializeItem(player.InvBody[INVLOC_HAND_LEFT], IDI_ROGUE); GenerateNewSeed(player.InvBody[INVLOC_HAND_LEFT]); + player.InvBody[INVLOC_HAND_LEFT].updateRequiredStatsCacheForPlayer(player); InitializeItem(player.SpdList[0], IDI_HEAL); GenerateNewSeed(player.SpdList[0]); @@ -3027,6 +3031,7 @@ void CreatePlrItems(Player &player) case HeroClass::Sorcerer: InitializeItem(player.InvBody[INVLOC_HAND_LEFT], gbIsHellfire ? IDI_SORCERER : IDI_SORCERER_DIABLO); GenerateNewSeed(player.InvBody[INVLOC_HAND_LEFT]); + player.InvBody[INVLOC_HAND_LEFT].updateRequiredStatsCacheForPlayer(player); InitializeItem(player.SpdList[0], gbIsHellfire ? IDI_HEAL : IDI_MANA); GenerateNewSeed(player.SpdList[0]); @@ -3038,6 +3043,7 @@ void CreatePlrItems(Player &player) case HeroClass::Monk: InitializeItem(player.InvBody[INVLOC_HAND_LEFT], IDI_SHORTSTAFF); GenerateNewSeed(player.InvBody[INVLOC_HAND_LEFT]); + player.InvBody[INVLOC_HAND_LEFT].updateRequiredStatsCacheForPlayer(player); InitializeItem(player.SpdList[0], IDI_HEAL); GenerateNewSeed(player.SpdList[0]); @@ -3047,9 +3053,11 @@ void CreatePlrItems(Player &player) case HeroClass::Bard: InitializeItem(player.InvBody[INVLOC_HAND_LEFT], IDI_BARDSWORD); GenerateNewSeed(player.InvBody[INVLOC_HAND_LEFT]); + player.InvBody[INVLOC_HAND_LEFT].updateRequiredStatsCacheForPlayer(player); InitializeItem(player.InvBody[INVLOC_HAND_RIGHT], IDI_BARDDAGGER); GenerateNewSeed(player.InvBody[INVLOC_HAND_RIGHT]); + player.InvBody[INVLOC_HAND_RIGHT].updateRequiredStatsCacheForPlayer(player); InitializeItem(player.SpdList[0], IDI_HEAL); GenerateNewSeed(player.SpdList[0]); @@ -3059,9 +3067,11 @@ void CreatePlrItems(Player &player) case HeroClass::Barbarian: InitializeItem(player.InvBody[INVLOC_HAND_LEFT], IDI_BARBARIAN); GenerateNewSeed(player.InvBody[INVLOC_HAND_LEFT]); + player.InvBody[INVLOC_HAND_LEFT].updateRequiredStatsCacheForPlayer(player); InitializeItem(player.InvBody[INVLOC_HAND_RIGHT], IDI_WARRSHLD); GenerateNewSeed(player.InvBody[INVLOC_HAND_RIGHT]); + player.InvBody[INVLOC_HAND_RIGHT].updateRequiredStatsCacheForPlayer(player); InitializeItem(player.SpdList[0], IDI_HEAL); GenerateNewSeed(player.SpdList[0]); diff --git a/test/player_test.cpp b/test/player_test.cpp index 1f0cf9bc1e6..4e993406263 100644 --- a/test/player_test.cpp +++ b/test/player_test.cpp @@ -158,8 +158,9 @@ static void AssertPlayer(Player &player) ASSERT_EQ(player._pLghtResist, 0); ASSERT_EQ(CountBool(player._pLvlVisited, NUMLEVELS), 0); ASSERT_EQ(CountBool(player._pSLvlVisited, NUMLEVELS), 0); + // This test case uses a Rogue, starting loadout is a short bow with damage 1-4 ASSERT_EQ(player._pIMinDam, 1); - ASSERT_EQ(player._pIMaxDam, 1); + ASSERT_EQ(player._pIMaxDam, 4); ASSERT_EQ(player._pIAC, 0); ASSERT_EQ(player._pIBonusDam, 0); ASSERT_EQ(player._pIBonusToHit, 0);