/
general-action.ts
38 lines (31 loc) · 1.1 KB
/
general-action.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { CraftingAction } from './crafting-action';
import { Simulation } from '../../simulation/simulation';
import { Buff } from '../buff.enum';
import { StepState } from '../step-state';
/**
* This is for every progress and quality actions
*/
export abstract class GeneralAction extends CraftingAction {
getDurabilityCost(simulationState: Simulation): number {
let divider = 1;
if (simulationState.hasBuff(Buff.WASTE_NOT) || simulationState.hasBuff(Buff.WASTE_NOT_II)) {
divider *= 2;
}
if (simulationState.state === StepState.STURDY) {
divider *= 2;
}
return Math.ceil(this.getBaseDurabilityCost(simulationState) / divider);
}
_getSuccessRate(simulationState: Simulation): number {
return this.getBaseSuccessRate(simulationState);
}
getBaseBonus(simulation: Simulation): number {
return 1;
}
getBaseCondition(simulation: Simulation): number {
return 1;
}
abstract getPotency(simulation: Simulation): number;
abstract getBaseDurabilityCost(simulationState: Simulation): number;
abstract getBaseSuccessRate(simulationState: Simulation): number;
}