Skip to content

Commit

Permalink
Creatures always have max gold set
Browse files Browse the repository at this point in the history
  • Loading branch information
tonihele committed Jul 9, 2024
1 parent 4df262e commit f50c52c
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -860,8 +860,7 @@ public void addGold(int amount) {
Gold gold = entityData.getComponent(entityId, Gold.class);

// Drop excess gold, we can only carry so much
boolean hasMaxGold = gold.maxGold > 0;
int maxGoldCanAdd = hasMaxGold ? gold.maxGold - gold.gold : Integer.MAX_VALUE;
int maxGoldCanAdd = gold.maxGold - gold.gold;
int goldToAdd = Math.min(amount, maxGoldCanAdd);
int looseGold = amount - goldToAdd;

Expand Down

0 comments on commit f50c52c

Please sign in to comment.