Skip to content

Commit

Permalink
Adds conditions to avoid equipping 2handed when occupied
Browse files Browse the repository at this point in the history
  • Loading branch information
radzki committed Mar 15, 2024
1 parent 29229f6 commit 68891cc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/GameLogic/PlayerActions/Items/MoveItemAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,16 @@ 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;

static bool RightHandOccupied(ItemDefinition definition) => definition != null;

// Bolts = 7, Arrows = 15
static bool IsArrowOrBolt(ItemDefinition definition) =>
definition.Group == 4 && (definition.Number == 7 || definition.Number == 15);

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

0 comments on commit 68891cc

Please sign in to comment.