From d3a74da5ab35cdd7c8ff8098536b1de6652b92ab Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Mon, 15 May 2023 21:16:28 -0500 Subject: [PATCH 1/5] Add utility for getting requirement that's met when a conversion can convert --- src/features/conversion.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/features/conversion.ts b/src/features/conversion.ts index 9f7d176..aa19839 100644 --- a/src/features/conversion.ts +++ b/src/features/conversion.ts @@ -292,3 +292,20 @@ export function setupPassiveGeneration( } }); } + +/** + * Creates requirement that is met when the conversion hits a specified gain amount + * @param conversion The conversion to check the gain amount of + * @param minGainAmount The minimum gain amount that must be met for the requirement to be met + */ +export function createCanConvertRequirement( + conversion: GenericConversion, + minGainAmount: Computable = 1, + display?: CoercableComponent +) { + const computedMinGainAmount = convertComputable(minGainAmount); + return createBooleanRequirement( + () => Decimal.gte(unref(conversion.actualGain), unref(computedMinGainAmount)), + display + ); +} From 539282bef83ea19030aa0caf5f93628a9d0551b6 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Tue, 16 May 2023 23:38:31 -0500 Subject: [PATCH 2/5] Improve error handling --- src/App.vue | 39 ++-- src/components/Error.vue | 103 +++++++++++ src/components/Layer.vue | 21 ++- src/data/common.tsx | 2 +- src/features/tabs/tabFamily.ts | 3 +- src/game/formulas/formulas.ts | 39 ++-- src/game/formulas/operations.ts | 315 +++++++++++++++++++++----------- src/game/layers.tsx | 4 +- src/game/persistence.ts | 17 +- src/game/state.ts | 7 +- src/main.ts | 27 ++- src/util/proxies.ts | 2 +- 12 files changed, 424 insertions(+), 155 deletions(-) create mode 100644 src/components/Error.vue diff --git a/src/App.vue b/src/App.vue index 9613f04..6a365ef 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,18 +1,25 @@ + + diff --git a/src/components/Layer.vue b/src/components/Layer.vue index c00cf8a..1857535 100644 --- a/src/components/Layer.vue +++ b/src/components/Layer.vue @@ -1,5 +1,6 @@