Skip to content

Commit

Permalink
🫗 Add 10 points for each empty slot
Browse files Browse the repository at this point in the history
  • Loading branch information
tomrijnbeek committed Oct 2, 2023
1 parent 33808ef commit 857924c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions scenes/inventory/Inventory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public int Height
private readonly List<Item> heldItems = new();

public IReadOnlyList<Item> HeldItems => heldItems.AsReadOnly();
public int EmptySlotCount => itemGrid.Count(i => i is null);

public Item? this[Coord coord]
{
Expand Down
4 changes: 3 additions & 1 deletion scenes/main/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ private void onPlayerDied()

private void addLootScore()
{
score += GetNode<Inventory>("Inventory").HeldItems.Sum(i => i.Type.Score());
var inventory = GetNode<Inventory>("Inventory");
score += inventory.HeldItems.Sum(i => i.Type.Score());
score += inventory.EmptySlotCount * 10;
}

private void doGameOver()
Expand Down

0 comments on commit 857924c

Please sign in to comment.