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

/// <reference path="./Infrastructure.ts" />
class Megachurch extends Infrastructure {
constructor(config: GameConfig) {
super(
'Megachurches',
'megachurch',
'megachurches',
`Room for ${formatNumber(
config.cfgCapacity.megaChurches?.pastors ?? 0
)} pastors`
);
this.cost.money = config.cfgInitialCost.megaChurches;
this._costMultiplier.money = config.cfgCostMultiplier.megaChurches;
}
public max: (state: GameState) => number = (state) =>
state.config.cfgInitialMax.megaChurches ?? 0;
public isUnlocked(state: GameState): boolean {
if (this._isUnlocked) return true;
const permit = state.resource.buildingPermit;
if (permit !== undefined && permit.value > 0) {
this._isUnlocked = true;
}
return this._isUnlocked;
}
}