libram 0.10.12 → 0.10.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -36,6 +36,18 @@ export declare function sweatCost(skill: Skill): number;
|
|
|
36
36
|
* @returns If this skill can be cast
|
|
37
37
|
*/
|
|
38
38
|
export declare function canUseSkill(skill: Skill): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Get the available number of times a sweat skill can be cast with current sweat
|
|
41
|
+
* @param skill The skill to check
|
|
42
|
+
* @returns The available number of casts
|
|
43
|
+
*/
|
|
44
|
+
export declare function availableCasts(skill: Skill): number;
|
|
45
|
+
/**
|
|
46
|
+
* Get the potential number of times a sweat skill can be cast, with maximum sweat
|
|
47
|
+
* @param skill The skill to check
|
|
48
|
+
* @returns The potential number of casts
|
|
49
|
+
*/
|
|
50
|
+
export declare function potentialCasts(skill: Skill): number;
|
|
39
51
|
/**
|
|
40
52
|
* Cast a sweat skill, on failure refresh sweat amount
|
|
41
53
|
* @param skill The skill to cast
|
|
@@ -2,6 +2,7 @@ import { availableAmount, useSkill as useSkill_ } from "kolmafia";
|
|
|
2
2
|
import { get } from "../../property.js";
|
|
3
3
|
import { $item, $skill } from "../../template-string.js";
|
|
4
4
|
import { examine } from "../../lib.js";
|
|
5
|
+
import { clamp } from "../../utils.js";
|
|
5
6
|
/** designer sweatpants */
|
|
6
7
|
const item = $item `designer sweatpants`;
|
|
7
8
|
/** designer sweatpants sweat skills */
|
|
@@ -62,6 +63,26 @@ export function sweatCost(skill) {
|
|
|
62
63
|
export function canUseSkill(skill) {
|
|
63
64
|
return have() && skill.dailylimit !== 0 && sweatCost(skill) <= sweat();
|
|
64
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Get the available number of times a sweat skill can be cast with current sweat
|
|
68
|
+
* @param skill The skill to check
|
|
69
|
+
* @returns The available number of casts
|
|
70
|
+
*/
|
|
71
|
+
export function availableCasts(skill) {
|
|
72
|
+
if (!canUseSkill(skill))
|
|
73
|
+
return 0;
|
|
74
|
+
return clamp(Math.floor(sweat() / sweatCost(skill)), 0, skill.dailylimit > -1 ? skill.dailylimit : Infinity);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Get the potential number of times a sweat skill can be cast, with maximum sweat
|
|
78
|
+
* @param skill The skill to check
|
|
79
|
+
* @returns The potential number of casts
|
|
80
|
+
*/
|
|
81
|
+
export function potentialCasts(skill) {
|
|
82
|
+
if (!have() || sweatCost(skill) === 0)
|
|
83
|
+
return 0;
|
|
84
|
+
return clamp(Math.floor(100 / sweatCost(skill)), 0, skill.dailylimit > -1 ? skill.dailylimit : Infinity);
|
|
85
|
+
}
|
|
65
86
|
/**
|
|
66
87
|
* Cast a sweat skill, on failure refresh sweat amount
|
|
67
88
|
* @param skill The skill to cast
|