diff --git a/changelog.md b/changelog.md index edeedc6..10a78e5 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,7 @@ - The prestige/sec display now shows decimals. - resetsNothing now works immediately on a reset that enables it. - Added onComplete for milestones. +- Added addBuyables. - Fixed challenges with no currencyDisplayName using "points" instead of the mod's pointsName. - inChallenge no longer can return undefined. diff --git a/docs/buyables.md b/docs/buyables.md index 12854eb..f75d37e 100644 --- a/docs/buyables.md +++ b/docs/buyables.md @@ -7,6 +7,7 @@ The amount of a buyable owned is a `Decimal`. Useful functions for dealing with buyables and implementing their effects: - getBuyableAmount(layer, id): get the amount of the buyable the player has +- addBuyables(layer, id, amount): add to the amount of the buyable - setBuyableAmount(layer, id, amount): set the amount of the buyable the player has - buyableEffect(layer, id): Returns the current effects of the buyable, if any. diff --git a/js/utils/easyAccess.js b/js/utils/easyAccess.js index 7f5370d..b6c4afc 100644 --- a/js/utils/easyAccess.js +++ b/js/utils/easyAccess.js @@ -30,6 +30,10 @@ function setBuyableAmount(layer, id, amt) { player[layer].buyables[id] = amt } +function addBuyables(layer, id, amt) { + player[layer].buyables[id] = player[layer].buyables[id].add(amt) +} + function getClickableState(layer, id) { return (player[layer].clickables[id]) }