Skip to content

Commit

Permalink
Fix broken test case
Browse files Browse the repository at this point in the history
  • Loading branch information
ephphatha committed Sep 17, 2023
1 parent 8af212b commit 68d1cf1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions Source/items.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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]);
Expand All @@ -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]);
Expand All @@ -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]);

Expand All @@ -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]);

Expand All @@ -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]);

Expand Down
3 changes: 2 additions & 1 deletion test/player_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 68d1cf1

Please sign in to comment.