libram 0.8.30 → 0.8.32

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.
@@ -7,11 +7,10 @@ import * as Bandersnatch from "../resources/2009/Bandersnatch";
7
7
  import * as StompingBoots from "../resources/2011/StompingBoots";
8
8
  import { $effect, $familiar, $item, $items, $skill } from "../template-string";
9
9
  import { ActionSource, findActionSource, } from "./ActionSource";
10
- // eslint-disable-next-line libram/verify-constants
11
- const EVERYTHING_LOOKS_GREEN = $effect `Everything Looks Green`;
10
+ const everythingLooksGreen = () => have($effect `Everything Looks Green`) ? 0 : 1;
12
11
  const freeRunSources = [
13
12
  // Free unlimited source
14
- new ActionSource($item `spring shoes`, () => (have(EVERYTHING_LOOKS_GREEN) ? 1 : 0), Macro.skill($skill `Spring Away`), {
13
+ new ActionSource($item `spring shoes`, everythingLooksGreen, Macro.skill($skill `Spring Away`), {
15
14
  equipmentRequirements: () => new Requirement([], { forceEquip: $items `spring shoes` }),
16
15
  }),
17
16
  // Free limited sources
@@ -45,7 +44,7 @@ const freeRunSources = [
45
44
  cost: () => Math.min(ActionSource.defaultPriceFunction($item `peppermint sprout`) * 5, ActionSource.defaultPriceFunction($item `peppermint parasol`)) / 10, // Breaks after 10 successful runaways.
46
45
  }),
47
46
  // unlimited items that trigger everything looks green
48
- ...$items `green smoke bomb, tattered scrap of paper, GOTO, T.U.R.D.S. Key`.map((item) => new ActionSource(item, () => (have(EVERYTHING_LOOKS_GREEN) ? 0 : 1), Macro.item(item), {
47
+ ...$items `green smoke bomb, tattered scrap of paper, GOTO, T.U.R.D.S. Key`.map((item) => new ActionSource(item, everythingLooksGreen, Macro.item(item), {
49
48
  preparation: () => retrieveItem(item),
50
49
  cost: () => ActionSource.defaultPriceFunction(item),
51
50
  })),
@@ -116,10 +116,12 @@ export function differentiate(monster, ...combatParams) {
116
116
  export function differentiableQuantity(monster) {
117
117
  if (!have_($item `mimic egg`))
118
118
  return 0;
119
- const regex = new RegExp(`${monster.name}\\s*(?:\\((\\d+)\\))?`);
119
+ const regex = new RegExp(`<!-- monsterid: ${monster.id}-->(?:\\s\\((\\d+)\\))?`);
120
120
  const page = examine($item `mimic egg`);
121
121
  const match = page.match(regex);
122
122
  if (!match)
123
123
  return 0;
124
- return clamp(parseInt(match[1]), 0, availableAmount($item `mimic egg`)) || 1;
124
+ if (!match[1])
125
+ return 1;
126
+ return clamp(Number(match[1]), 1, availableAmount($item `mimic egg`));
125
127
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libram",
3
- "version": "0.8.30",
3
+ "version": "0.8.32",
4
4
  "description": "JavaScript helper library for KoLmafia",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",