Skip to content

Commit

Permalink
fix(mercantile): shop multiplier should multiply correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
seiyria committed Mar 29, 2023
1 parent 7b4bee2 commit 21fa11f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/app/components/item-tooltip/item-tooltip.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ export class ItemTooltipComponent implements OnInit {
}

realSellValue(item: IGameItem) {
return itemValue(item,
2 + shopRegisterMultiplier(this.store.selectSnapshot(state => state.mercantile.shop.saleBonusLevel ?? 0))) * (item.quantity ?? 1);
const baseMultiplier = shopRegisterMultiplier(this.store.selectSnapshot(state => state.mercantile.shop.saleBonusLevel ?? 0), 3);
return itemValue(item, baseMultiplier) * (item.quantity ?? 1);
}

}
6 changes: 3 additions & 3 deletions src/stores/mercantile/mercantile.functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ export function maxShopRegisterUpgradeCost(currentLevel: number): number {
return 10000 * (currentLevel + 1);
}

export function shopRegisterMultiplier(currentLevel: number): number {
return 1 + (currentLevel * 0.1);
export function shopRegisterMultiplier(currentLevel: number, addition = 1): number {
return addition + (addition * (currentLevel * 0.1));
}

// decoration functions
Expand Down Expand Up @@ -154,7 +154,7 @@ export function decreaseDuration(ctx: StateContext<IGameMercantile>, { ticks }:
ctx.dispatch(new IncrementStat(AchievementStat.MercantileSellItems, soldItems.length));
}

const soldValue = sum(soldItems.map(item => itemValue(item, 2 + shopRegisterMultiplier(state.shop.saleBonusLevel))));
const soldValue = sum(soldItems.map(item => itemValue(item, shopRegisterMultiplier(state.shop.saleBonusLevel, 3))));
gainCoins(ctx, { amount: soldValue });

const newItems = items.filter(item => !soldItems.includes(item));
Expand Down

0 comments on commit 21fa11f

Please sign in to comment.