This repository has been archived on 2022-01-16. You can view files and clone it, but cannot push or open issues or pull requests.
2021-08-22 11:07:49 -05:00
|
|
|
/// <reference path="./Infrastructure.ts" />
|
|
|
|
|
|
|
|
class Church extends Infrastructure {
|
2021-09-05 17:33:28 -05:00
|
|
|
constructor (config: GameConfig) {
|
2021-08-22 11:07:49 -05:00
|
|
|
super('Churches',
|
2021-09-05 17:33:28 -05:00
|
|
|
`Preaching grounds for ${config.formatNumber(config.cfgChurchPastorCapacity)} pastors.`);
|
|
|
|
this.cost.money = config.cfgChurchStartingCost;
|
|
|
|
this._costMultiplier.money = config.cfgChurchCostMultiplier;
|
2021-08-22 13:48:48 -05:00
|
|
|
}
|
|
|
|
|
2021-09-05 14:45:37 -05:00
|
|
|
public max: (state: GameState) => number = (state) =>
|
2021-09-05 19:20:24 -05:00
|
|
|
(state.resource.compounds?.value ?? 0)
|
|
|
|
* state.config.cfgCompoundChurchCapacity;
|
2021-08-22 13:48:48 -05:00
|
|
|
|
|
|
|
public isUnlocked (state: GameState): boolean {
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|