libram 0.11.17 → 0.11.18
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.
|
@@ -31,3 +31,9 @@ export declare function availableCasts(skill: Skill, statFloor: number): number;
|
|
|
31
31
|
* @returns Whether you successfully cast the spell.
|
|
32
32
|
*/
|
|
33
33
|
export declare function castDownTo(skill: Skill, statFloor: number): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* @param skill The BCZ skill to cast.
|
|
36
|
+
* @param count How many times you want to cast the spell
|
|
37
|
+
* @returns Whether you successfully cast the spell.
|
|
38
|
+
*/
|
|
39
|
+
export declare function cast(skill: Skill, count: number): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { myBasestat, useSkill } from "kolmafia";
|
|
1
|
+
import { cliExecute, equip, myBasestat, useSkill } from "kolmafia";
|
|
2
2
|
import { $item, $skill, $stat } from "../../template-string.js";
|
|
3
3
|
import { have as have_ } from "../../lib.js";
|
|
4
4
|
import { get } from "../../property.js";
|
|
@@ -104,11 +104,29 @@ export function availableCasts(skill, statFloor) {
|
|
|
104
104
|
export function castDownTo(skill, statFloor) {
|
|
105
105
|
if (!have() || !COSTS.get(skill))
|
|
106
106
|
return false;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
if (!useSkill(skill, casts))
|
|
110
|
-
return false;
|
|
111
|
-
casts = availableCasts(skill, statFloor);
|
|
112
|
-
}
|
|
107
|
+
if (!cast(skill, availableCasts(skill, statFloor)))
|
|
108
|
+
return false;
|
|
113
109
|
return true;
|
|
114
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* @param skill The BCZ skill to cast.
|
|
113
|
+
* @param count How many times you want to cast the spell
|
|
114
|
+
* @returns Whether you successfully cast the spell.
|
|
115
|
+
*/
|
|
116
|
+
export function cast(skill, count) {
|
|
117
|
+
if (!have() || !COSTS.get(skill) || count <= 0)
|
|
118
|
+
return false;
|
|
119
|
+
cliExecute("checkpoint");
|
|
120
|
+
try {
|
|
121
|
+
equip($item `blood cubic zirconia`);
|
|
122
|
+
for (let i = 0; i < count; i++) {
|
|
123
|
+
if (!useSkill(skill)) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
finally {
|
|
130
|
+
cliExecute("outfit checkpoint");
|
|
131
|
+
}
|
|
132
|
+
}
|