diff --git a/src/features/decorators/bonusDecorator.ts b/src/features/decorators/bonusDecorator.ts index 1c26b14..b1c38cf 100644 --- a/src/features/decorators/bonusDecorator.ts +++ b/src/features/decorators/bonusDecorator.ts @@ -58,6 +58,11 @@ export type GenericBonusCompletionsFeature = Replace< * }), bonusAmountDecorator) as GenericRepeatable & GenericBonusAmountFeature */ export const bonusAmountDecorator: Decorator = { + preConstruct(feature) { + if (feature.amount === undefined) { + console.error(`Decorated feature ${feature.id} does not contain the required 'amount' property"`); + } + }, postConstruct(feature) { processComputable(feature, "bonusAmount"); if (feature.totalAmount === undefined) { diff --git a/src/features/decorators/common.ts b/src/features/decorators/common.ts index a4656d3..fb084db 100644 --- a/src/features/decorators/common.ts +++ b/src/features/decorators/common.ts @@ -2,11 +2,11 @@ import { Replace, OptionsObject } from "../feature"; import { Computable, GetComputableType, processComputable, ProcessedComputable } from "util/computed"; import { Persistent, State } from "game/persistence"; -export type Decorator = { +export type Decorator = { getPersistentData?(): Record>; - preConstruct?(feature: OptionsObject): void; - postConstruct?(feature: OptionsObject): void; - getGatheredProps?(feature: OptionsObject): Partial> + preConstruct?(feature: OptionsObject): void; + postConstruct?(feature: OptionsObject): void; + getGatheredProps?(feature: OptionsObject): Partial> } export type GenericDecorator = Decorator;