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.
2021-08-21 12:45:58 -05:00
|
|
|
/// <reference path="./Hidden.ts" />
|
|
|
|
|
|
|
|
class Credibility extends Hidden {
|
2021-08-21 17:06:51 -05:00
|
|
|
private _lastValue: number;
|
|
|
|
|
|
|
|
constructor (public value: number) {
|
|
|
|
super(value);
|
|
|
|
this._lastValue = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
public max (state: GameState): number {
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
public inc (state: GameState): number {
|
|
|
|
return 0.01;
|
|
|
|
}
|
|
|
|
|
|
|
|
public advanceAction (time: number, state: GameState): void {
|
|
|
|
if (Math.ceil(this._lastValue) < Math.ceil(this.value)) {
|
|
|
|
state.log('Your credibility has gone up.');
|
|
|
|
} else if (Math.ceil(this._lastValue) > Math.ceil(this.value)) {
|
|
|
|
state.log('Your credibility has gone down.');
|
|
|
|
}
|
|
|
|
this._lastValue = this.value;
|
|
|
|
}
|
2021-08-21 12:45:58 -05:00
|
|
|
}
|