libram 0.8.32 → 0.8.33
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.
|
@@ -37,7 +37,7 @@ export declare function differentiate(monster: Monster, ...combatParams: CombatP
|
|
|
37
37
|
/**
|
|
38
38
|
* Check how many of a monster is available to differentiate into
|
|
39
39
|
*
|
|
40
|
-
* @param monster The monster to differentiate your egg into
|
|
40
|
+
* @param monster The monster to differentiate your egg into
|
|
41
41
|
* @returns How many of a Monster we can differentiate
|
|
42
42
|
*/
|
|
43
43
|
export declare function differentiableQuantity(monster: Monster): number;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { itemAmount, runChoice, runCombat, toMonster, visitUrl, xpath, } from "kolmafia";
|
|
2
2
|
import { directlyUse, examine, have as have_ } from "../../lib";
|
|
3
3
|
import { get } from "../../property";
|
|
4
4
|
import { $familiar, $item } from "../../template-string";
|
|
5
|
-
import { clamp } from "../../utils";
|
|
6
5
|
const familiar = $familiar `Chest Mimic`;
|
|
7
6
|
/**
|
|
8
7
|
* @returns Whether you `have` the Chest Mimic familiar.
|
|
@@ -110,18 +109,16 @@ export function differentiate(monster, ...combatParams) {
|
|
|
110
109
|
/**
|
|
111
110
|
* Check how many of a monster is available to differentiate into
|
|
112
111
|
*
|
|
113
|
-
* @param monster The monster to differentiate your egg into
|
|
112
|
+
* @param monster The monster to differentiate your egg into
|
|
114
113
|
* @returns How many of a Monster we can differentiate
|
|
115
114
|
*/
|
|
116
115
|
export function differentiableQuantity(monster) {
|
|
117
116
|
if (!have_($item `mimic egg`))
|
|
118
117
|
return 0;
|
|
119
|
-
const regex = new RegExp(`<!-- monsterid
|
|
118
|
+
const regex = new RegExp(`<!-- monsterid:${monster.id} --> \\((\\d+)\\)`);
|
|
120
119
|
const page = examine($item `mimic egg`);
|
|
121
120
|
const match = page.match(regex);
|
|
122
|
-
if (!match)
|
|
121
|
+
if (!match?.[1])
|
|
123
122
|
return 0;
|
|
124
|
-
|
|
125
|
-
return 1;
|
|
126
|
-
return clamp(Number(match[1]), 1, availableAmount($item `mimic egg`));
|
|
123
|
+
return Math.min(Number(match[1]), itemAmount($item `mimic egg`));
|
|
127
124
|
}
|