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/Pastor.ts

31 lines
811 B
TypeScript

/// <reference path="./Job.ts" />
class Pastor extends Job {
public readonly resourceKey = ResourceKey.pastors;
constructor() {
super(
'Pastors',
'pastor',
'pastors',
'Collect tithings for you and recruit new members from other faiths automatically.'
);
}
public max = (state: GameState): number => {
let max =
(state.resource.churches?.value ?? 0) *
(state.config.cfgCapacity.churches?.pastors ?? 0);
max +=
(state.resource.megaChurches?.value ?? 0) *
(state.config.cfgCapacity.megaChurches?.pastors ?? 0);
return max;
};
public isUnlocked = (state: GameState): boolean => {
if (this._isUnlocked) return true;
this._isUnlocked = state.resource.churches?.isUnlocked(state) === true;
return this._isUnlocked;
};
}