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

23 lines
741 B
TypeScript

/// <reference path="./Infrastructure.ts" />
class MegaChurch extends Infrastructure {
constructor (config: GameConfig) {
super('MegaChurches',
`Room for ${config.formatNumber(config.cfgMegaChurchPastorCapacity)} pastors`);
this.cost.money = config.cfgMegaChurchStartingCost;
this._costMultiplier.money = config.cfgMegaChurchCostMultiplier;
}
public max: (state: GameState) => number = (state) =>
state.config.cfgMegaChurchStartingMax;
public isUnlocked (state: GameState): boolean {
if (this._isUnlocked) return true;
const permit = state.getResource(ResourceKey.buildingPermit);
if (permit !== null && permit.value > 0) {
this._isUnlocked = true;
}
return this._isUnlocked;
}
}