Skip to content

Commit

Permalink
Merge pull request #404 from radzki/fix/392
Browse files Browse the repository at this point in the history
fix: Adds conditions to avoid equipping two-handed item when all slots are occupied
  • Loading branch information
sven-n authored Apr 10, 2024
2 parents 29229f6 + c23b6b8 commit 4b5ffb9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/GameLogic/PlayerActions/Items/MoveItemAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,12 @@ private async ValueTask<Movement> CanMoveAsync(Player player, Item item, byte to
static bool IsOneHandedOrShield(ItemDefinition definition) =>
(definition.ItemSlot!.ItemSlots.Contains(RightHandSlot) && definition.ItemSlot.ItemSlots.Contains(LeftHandSlot)) || definition.Group == 6;

var rightHandItemDefinition = storage.GetItem(RightHandSlot)?.Definition!;

if ((toSlot == LeftHandSlot
&& itemDefinition.Width >= 2
&& storage.GetItem(RightHandSlot)?.Definition!.Group == 6)
&& rightHandItemDefinition != null
&& !rightHandItemDefinition.IsAmmunition)
|| (toSlot == RightHandSlot
&& IsOneHandedOrShield(itemDefinition)
&& storage.GetItem(LeftHandSlot)?.Definition!.Width >= 2))
Expand Down

0 comments on commit 4b5ffb9

Please sign in to comment.