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

32 lines
881 B
TypeScript

/// <reference path="./Infrastructure.ts" />
class Megachurch extends Infrastructure {
public readonly resourceKey = ResourceKey.megaChurches;
constructor(config: GameConfig) {
super(
'Megachurches',
'megachurch',
'megachurches',
`Room for ${formatNumber(
config.cfgCapacity.megaChurches?.pastors ?? 0
)} pastors`,
true
);
this.cost.money = config.cfgInitialCost.megaChurches;
this._costMultiplier.money = config.cfgCostMultiplier.megaChurches;
}
public max = (state: GameState): number =>
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;
};
}