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.
irreligious/src/model/resource/Megachurch.ts

29 lines
814 B
TypeScript
Raw Normal View History

2021-09-04 23:16:32 -05:00
/// <reference path="./Infrastructure.ts" />
class Megachurch extends Infrastructure {
constructor(config: GameConfig) {
super(
2021-09-06 08:51:41 -05:00
'Megachurches',
'megachurch',
'megachurches',
`Room for ${formatNumber(
config.cfgCapacity.megaChurches?.pastors ?? 0
)} pastors`
);
2021-09-05 20:43:11 -05:00
this.cost.money = config.cfgInitialCost.megaChurches;
this._costMultiplier.money = config.cfgCostMultiplier.megaChurches;
2021-09-04 23:16:32 -05:00
}
2021-09-05 14:45:37 -05:00
public max: (state: GameState) => number = (state) =>
2021-09-05 20:43:11 -05:00
state.config.cfgInitialMax.megaChurches ?? 0;
2021-09-05 14:45:37 -05:00
public isUnlocked(state: GameState): boolean {
2021-09-04 23:16:32 -05:00
if (this._isUnlocked) return true;
const permit = state.resource.buildingPermit;
if (permit !== undefined && permit.value > 0) {
2021-09-04 23:16:32 -05:00
this._isUnlocked = true;
}
return this._isUnlocked;
}
}