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

32 lines
792 B
TypeScript
Raw Normal View History

2021-08-21 19:02:57 -05:00
/// <reference path="./Passive.ts" />
2021-08-21 12:45:58 -05:00
2021-08-21 19:02:57 -05:00
class Credibility extends Passive {
public readonly resourceKey = ResourceKey.credibility;
constructor(config: GameConfig) {
2021-08-21 19:02:57 -05:00
super(
2021-09-06 08:51:41 -05:00
'Credibility',
'credibility',
'credibilities',
'Affects your ability to retain followers and collect tithes.'
);
this.rawValue = config.cfgPassiveMax;
2021-08-21 17:06:51 -05:00
}
2021-09-11 22:45:52 -05:00
public static ratio(state: GameState): number {
const cred = state.resource.credibility;
return cred === undefined
? 0
: cred.max === undefined
? 0
: cred.max(state) === 0
? 0
: cred.value / cred.max(state);
}
public max = (state: GameState): number => state.config.cfgPassiveMax;
public inc = (state: GameState): number =>
2021-09-05 14:45:37 -05:00
state.config.cfgCredibilityRestoreRate;
2021-08-21 12:45:58 -05:00
}