mirror of
https://github.com/thepaperpilot/Advent-Incremental.git
synced 2025-02-17 18:02:45 +00:00
Make joy and faith buy maxable
This commit is contained in:
parent
9f05571a35
commit
1a1e5d167c
2 changed files with 10 additions and 6 deletions
|
@ -584,6 +584,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
onPurchase?: VoidFunction; // Will get overriden by the custom onpurchase, but that's fine
|
onPurchase?: VoidFunction; // Will get overriden by the custom onpurchase, but that's fine
|
||||||
canBuy?: Computable<boolean>;
|
canBuy?: Computable<boolean>;
|
||||||
buyMax?: Computable<boolean>;
|
buyMax?: Computable<boolean>;
|
||||||
|
independent?: Computable<boolean>; // Whether or not the cost is independent of the current buyable amount
|
||||||
} & Partial<ClickableOptions>
|
} & Partial<ClickableOptions>
|
||||||
) {
|
) {
|
||||||
const buyProgress = persistent<DecimalSource>(0);
|
const buyProgress = persistent<DecimalSource>(0);
|
||||||
|
@ -594,6 +595,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
|
|
||||||
const isActive = convertComputable(options.canBuy ?? true);
|
const isActive = convertComputable(options.canBuy ?? true);
|
||||||
const buyMax = convertComputable(options.buyMax ?? false);
|
const buyMax = convertComputable(options.buyMax ?? false);
|
||||||
|
const independent = convertComputable(options.independent ?? false);
|
||||||
|
|
||||||
function update(diff: number) {
|
function update(diff: number) {
|
||||||
if (upgrade.bought.value && unref(isActive)) {
|
if (upgrade.bought.value && unref(isActive)) {
|
||||||
|
@ -615,7 +617,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
const buyAmount = Decimal.min(
|
const buyAmount = Decimal.min(
|
||||||
Decimal.sub(
|
Decimal.sub(
|
||||||
buyable.inverseCost(buyable.resource?.value),
|
buyable.inverseCost(buyable.resource?.value),
|
||||||
buyable.amount.value
|
unref(independent) ? 0 : buyable.amount.value
|
||||||
).add(1),
|
).add(1),
|
||||||
maxBuyAmount
|
maxBuyAmount
|
||||||
);
|
);
|
||||||
|
@ -747,6 +749,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
"Joy will automatically purchase small fires you can afford, without actually spending any logs. You can toggle whether or not to enable the purchased small fires automatically. Small fires will start giving a boost to ash and coal gain.",
|
"Joy will automatically purchase small fires you can afford, without actually spending any logs. You can toggle whether or not to enable the purchased small fires automatically. Small fires will start giving a boost to ash and coal gain.",
|
||||||
buyable: coal.buildFire,
|
buyable: coal.buildFire,
|
||||||
cooldownModifier: smallFireCooldown,
|
cooldownModifier: smallFireCooldown,
|
||||||
|
buyMax: () => management.elfTraining.heatedCutterElfTraining.milestones[2].earned.value,
|
||||||
visibility: () => showIf(boxes.upgrades.logsUpgrade.bought.value),
|
visibility: () => showIf(boxes.upgrades.logsUpgrade.bought.value),
|
||||||
hasToggle: true,
|
hasToggle: true,
|
||||||
toggleDesc: "Activate auto-purchased small fires",
|
toggleDesc: "Activate auto-purchased small fires",
|
||||||
|
@ -765,6 +768,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
"Faith will automatically purchase bonfires you can afford. You can toggle whether or not to enable the purchased bonfires automatically. Bonfires will start giving a boost to ash and coal gain.",
|
"Faith will automatically purchase bonfires you can afford. You can toggle whether or not to enable the purchased bonfires automatically. Bonfires will start giving a boost to ash and coal gain.",
|
||||||
buyable: coal.buildBonfire,
|
buyable: coal.buildBonfire,
|
||||||
cooldownModifier: bonfireCooldown,
|
cooldownModifier: bonfireCooldown,
|
||||||
|
buyMax: () => management.elfTraining.heatedPlanterElfTraining.milestones[2].earned.value,
|
||||||
visibility: () => showIf(boxes.upgrades.ashUpgrade.bought.value),
|
visibility: () => showIf(boxes.upgrades.ashUpgrade.bought.value),
|
||||||
hasToggle: true,
|
hasToggle: true,
|
||||||
toggleDesc: "Activate auto-purchased bonfires",
|
toggleDesc: "Activate auto-purchased bonfires",
|
||||||
|
@ -779,7 +783,8 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
||||||
onPurchase() {
|
onPurchase() {
|
||||||
main.days[4].recentlyUpdated.value = true;
|
main.days[4].recentlyUpdated.value = true;
|
||||||
},
|
},
|
||||||
canBuy: coal.unlockBonfire.bought
|
canBuy: coal.unlockBonfire.bought,
|
||||||
|
independent: true
|
||||||
});
|
});
|
||||||
const kilnElf = createElf({
|
const kilnElf = createElf({
|
||||||
name: "Snowball",
|
name: "Snowball",
|
||||||
|
|
|
@ -415,8 +415,7 @@ const layer = createLayer(id, () => {
|
||||||
createMilestone(() => ({
|
createMilestone(() => ({
|
||||||
display: {
|
display: {
|
||||||
requirement: "Hope Level 3",
|
requirement: "Hope Level 3",
|
||||||
effectDisplay:
|
effectDisplay: "The workshop can be expanded past 100%, but costs scale faster."
|
||||||
"The workshop can be expanded past 100%, but costs scale faster. It also buys max now."
|
|
||||||
},
|
},
|
||||||
visibility: () => showIf(expanderElfMilestones[1].earned.value),
|
visibility: () => showIf(expanderElfMilestones[1].earned.value),
|
||||||
shouldEarn: () => expandersElfTraining.level.value >= 3
|
shouldEarn: () => expandersElfTraining.level.value >= 3
|
||||||
|
@ -457,7 +456,7 @@ const layer = createLayer(id, () => {
|
||||||
createMilestone(() => ({
|
createMilestone(() => ({
|
||||||
display: {
|
display: {
|
||||||
requirement: "Jack Level 3",
|
requirement: "Jack Level 3",
|
||||||
effectDisplay: "Jack now buys max."
|
effectDisplay: "Jack and Joy now buy max."
|
||||||
},
|
},
|
||||||
visibility: () => showIf(heatedCutterElfMilestones[1].earned.value),
|
visibility: () => showIf(heatedCutterElfMilestones[1].earned.value),
|
||||||
shouldEarn: () => heatedCutterElfTraining.level.value >= 3
|
shouldEarn: () => heatedCutterElfTraining.level.value >= 3
|
||||||
|
@ -504,7 +503,7 @@ const layer = createLayer(id, () => {
|
||||||
createMilestone(() => ({
|
createMilestone(() => ({
|
||||||
display: {
|
display: {
|
||||||
requirement: "Mary Level 3",
|
requirement: "Mary Level 3",
|
||||||
effectDisplay: "Mary now buys max."
|
effectDisplay: "Mary and Faith now buy max."
|
||||||
},
|
},
|
||||||
visibility: () => showIf(heatedPlanterElfMilestones[1].earned.value),
|
visibility: () => showIf(heatedPlanterElfMilestones[1].earned.value),
|
||||||
shouldEarn: () => heatedPlanterElfTraining.level.value >= 3
|
shouldEarn: () => heatedPlanterElfTraining.level.value >= 3
|
||||||
|
|
Loading…
Add table
Reference in a new issue