Skip to content
This repository has been archived by the owner on Oct 25, 2022. It is now read-only.

Commit

Permalink
fix(religion): OotS upgrades not purchased
Browse files Browse the repository at this point in the history
Also disabled the "Buy best unicron building first" feature. This is pending further investigation.

Fixes #95
  • Loading branch information
oliversalzburg committed May 30, 2022
1 parent 6b553bc commit d873aff
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion packages/userscript/source/BulkManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export class BulkManager {
continue;
}
// If the building isn't unlocked, skip it.
if (!buildMetaData.unlocked) {
if (buildMetaData.unlocked === false) {
continue;
}

Expand Down
19 changes: 9 additions & 10 deletions packages/userscript/source/Engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -743,10 +743,12 @@ export class Engine {
worship(): void {
const additions = this._host.options.auto.religion.addition;

const IS_BUILD_BEST_BUILDING_STILL_BROKEN = true;

// Build the best unicorn building if the option is enabled.
// TODO: This is stupid, as it *only* builds unicorn buildings, instead of all
// religion buildings.
if (additions.bestUnicornBuilding.enabled) {
if (!IS_BUILD_BEST_BUILDING_STILL_BROKEN && additions.bestUnicornBuilding.enabled) {
const bestUnicornBuilding = this.getBestUnicornBuilding();
if (bestUnicornBuilding !== null) {
if (bestUnicornBuilding === "unicornPasture") {
Expand Down Expand Up @@ -798,15 +800,12 @@ export class Engine {
}
}
} else {
// TODO: This seems needlessly complicated to filter out the unicorn pasture.
// Nothing in this branch makes any sense. Just build the buildings!
const builds = Object.assign(
{},
this._host.options.auto.religion.items,
Object.fromEntries(
Object.entries(this._host.options.auto.religion.items).filter(
([k, v]) => v.variant !== UnicornItemVariant.Unknown_zp
)
// TODO: It's not clear why this process is split into two steps.

// Create the list of builds, excluding the unicorn pasture.
const builds = Object.fromEntries(
Object.entries(this._host.options.auto.religion.items).filter(
([k, v]) => v.variant !== UnicornItemVariant.UnicornPasture
)
);
// Now we build a unicorn pasture if possible.
Expand Down
2 changes: 1 addition & 1 deletion packages/userscript/source/options/ReligionSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export class ReligionSettings extends SettingsSection {
items: {
[item in FaithItem | UnicornItem]: ReligionSettingsItem;
} = {
unicornPasture: { enabled: true, variant: UnicornItemVariant.Unknown_zp, require: false },
unicornPasture: { enabled: true, variant: UnicornItemVariant.UnicornPasture, require: false },
unicornTomb: { enabled: false, variant: UnicornItemVariant.Ziggurat, require: false },
ivoryTower: { enabled: false, variant: UnicornItemVariant.Ziggurat, require: false },
ivoryCitadel: { enabled: false, variant: UnicornItemVariant.Ziggurat, require: false },
Expand Down
2 changes: 1 addition & 1 deletion packages/userscript/source/options/TimeControlSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class TimeControlSettings extends SettingsSection {
unicornPasture: {
checkForReset: true,
triggerForReset: -1,
variant: UnicornItemVariant.Unknown_zp,
variant: UnicornItemVariant.UnicornPasture,
},
unicornTomb: { checkForReset: true, triggerForReset: -1, variant: UnicornItemVariant.Ziggurat },
ivoryTower: { checkForReset: true, triggerForReset: -1, variant: UnicornItemVariant.Ziggurat },
Expand Down
2 changes: 1 addition & 1 deletion packages/userscript/source/types/religion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export enum UnicornItemVariant {
Cryptotheology = "c",
OrderOfTheSun = "s",
Ziggurat = "z",
Unknown_zp = "zp",
UnicornPasture = "zp",
}

export type ReligionUpgrades =
Expand Down
2 changes: 1 addition & 1 deletion packages/userscript/source/ui/ReligionSettingsUi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ export class ReligionSettingsUi extends SettingsSectionUi<ReligionSettings> {
// enable all unicorn buildings
for (const [unicornName, option] of objectEntries(this._options.items)) {
if (
option.variant !== UnicornItemVariant.Unknown_zp &&
option.variant !== UnicornItemVariant.UnicornPasture &&
option.variant !== UnicornItemVariant.Ziggurat
) {
continue;
Expand Down

0 comments on commit d873aff

Please sign in to comment.