2021-08-22 11:07:49 -05:00
|
|
|
/// <reference path="./Infrastructure.ts" />
|
|
|
|
|
|
|
|
class Church extends Infrastructure {
|
2021-09-06 12:02:38 -05:00
|
|
|
constructor(config: GameConfig) {
|
2021-09-06 00:12:05 -05:00
|
|
|
super(
|
2021-09-06 08:51:41 -05:00
|
|
|
'Churches',
|
2021-09-06 00:12:05 -05:00
|
|
|
'church',
|
|
|
|
'churches',
|
2021-09-06 12:02:38 -05:00
|
|
|
`Preaching grounds for ${formatNumber(
|
|
|
|
config.cfgCapacity.churches?.pastors ?? 0
|
2021-09-06 20:37:23 -05:00
|
|
|
)} pastors.`,
|
|
|
|
true,
|
|
|
|
undefined,
|
|
|
|
undefined
|
2021-09-06 12:02:38 -05:00
|
|
|
);
|
2021-09-05 20:43:11 -05:00
|
|
|
this.cost.money = config.cfgInitialCost.churches;
|
|
|
|
this._costMultiplier.money = config.cfgCostMultiplier.churches;
|
2021-08-22 13:48:48 -05:00
|
|
|
}
|
|
|
|
|
2021-09-05 14:45:37 -05:00
|
|
|
public max: (state: GameState) => number = (state) =>
|
2021-09-06 12:02:38 -05:00
|
|
|
(state.resource.compounds?.value ?? 0) *
|
|
|
|
(state.config.cfgCapacity.compounds?.churches ?? 0);
|
2021-08-22 13:48:48 -05:00
|
|
|
|
2021-09-06 12:02:38 -05:00
|
|
|
public isUnlocked(state: GameState): boolean {
|
2021-08-22 13:48:48 -05:00
|
|
|
if (this._isUnlocked) return true;
|
2021-09-05 18:39:08 -05:00
|
|
|
const compounds = state.resource.compounds;
|
|
|
|
if (compounds !== undefined && compounds.value > 0) {
|
2021-08-22 13:48:48 -05:00
|
|
|
this._isUnlocked = true;
|
|
|
|
}
|
|
|
|
return this._isUnlocked;
|
2021-08-22 11:07:49 -05:00
|
|
|
}
|
|
|
|
}
|