libram 0.11.4 → 0.11.5

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.
package/dist/mood.js CHANGED
@@ -1,4 +1,4 @@
1
- import { availableAmount, buy, cliExecute, eat, effectModifier, equip, equippedItem, haveEffect, haveSkill, hpCost, mallPrice, mpCost, myHp, myMaxmp, myMp, numericModifier, restoreMp, retrieveItem, Slot, toEffect, toSkill, turnsPerCast, use, useSkill, } from "kolmafia";
1
+ import { availableAmount, buy, cliExecute, eat, effectModifier, equip, equippedItem, haveEffect, haveSkill, hpCost, mallPrice, mpCost, myHp, myMaxmp, myMp, numericModifier, restoreMp, retrieveItem, Slot, toEffect, toSkill, turnsPerCast, use, useSkill, weaponHands, } from "kolmafia";
2
2
  import { getActiveSongs, have, isSong, unequip } from "./lib.js";
3
3
  import { get } from "./property.js";
4
4
  import { AsdonMartin } from "./resources/index.js";
@@ -103,6 +103,7 @@ class SkillMoodElement extends MoodElement {
103
103
  // Track these separately because of LHM
104
104
  const shieldSlot = Slot.all().find((slot) => equippedItem(slot) === $item `April Shower Thoughts shield`);
105
105
  const initialOffhand = equippedItem($slot `off-hand`);
106
+ const initialWeapon = equippedItem($slot `weapon`);
106
107
  if (initialTurns >= ensureTurns)
107
108
  return true;
108
109
  if (!haveSkill(this.skill))
@@ -125,6 +126,8 @@ class SkillMoodElement extends MoodElement {
125
126
  try {
126
127
  while (remainingCasts > 0 && oldRemainingCasts !== remainingCasts) {
127
128
  if (this.options.requireAprilShield && !shieldSlot) {
129
+ if (weaponHands(initialWeapon) > 1)
130
+ unequip(initialWeapon);
128
131
  if (!equip($item `April Shower Thoughts shield`))
129
132
  return false;
130
133
  }
@@ -153,6 +156,8 @@ class SkillMoodElement extends MoodElement {
153
156
  equip($item `April Shower Thoughts shield`, shieldSlot);
154
157
  if (initialOffhand !== equippedItem($slot `off-hand`))
155
158
  equip(initialOffhand, $slot `off-hand`);
159
+ if (initialWeapon !== equippedItem($slot `weapon`))
160
+ equip(initialWeapon, $slot `weapon`);
156
161
  }
157
162
  }
158
163
  }
@@ -78,7 +78,7 @@ export declare function increment(property: NumericProperty, delta?: number, max
78
78
  * @returns New value
79
79
  */
80
80
  export declare function decrement(property: NumericProperty, delta?: number, min?: number): number;
81
- type Properties = Partial<{
81
+ export type Properties = Partial<{
82
82
  [P in KnownProperty]: unknown;
83
83
  }> & {
84
84
  [x in string]: unknown;
@@ -223,4 +223,3 @@ export declare class PropertiesManager {
223
223
  */
224
224
  static merge(...mergees: PropertiesManager[]): PropertiesManager;
225
225
  }
226
- export {};
@@ -85,7 +85,7 @@ const INGREDIENTS = {
85
85
  },
86
86
  diet: {
87
87
  modifier: { Initiative: 50 },
88
- location: $location `Battlefield (No Uniform)`,
88
+ location: $location `The Cola Wars Battlefield`,
89
89
  },
90
90
  dwarf: {
91
91
  modifier: { Muscle: 30 },
@@ -93,7 +93,7 @@ const INGREDIENTS = {
93
93
  },
94
94
  dyspepsi: {
95
95
  modifier: { Initiative: 25 },
96
- location: $location `Battlefield (Dyspepsi Uniform)`,
96
+ location: $location `Cola Wars Battlefield (Dyspepsi Uniform)`,
97
97
  },
98
98
  filth: {
99
99
  modifier: { "Damage Reduction": 20 },
@@ -0,0 +1,36 @@
1
+ import { Location, Monster } from "kolmafia";
2
+ import { Properties } from "../../property.js";
3
+ /**
4
+ * @returns Whether you `have` the Peridot of Peril.
5
+ */
6
+ export declare function have(): boolean;
7
+ /**
8
+ * @returns An array of what locations you've used your peridot of peril in today.
9
+ */
10
+ export declare function zonesToday(): Location[];
11
+ /**
12
+ * Determine if you've already used your peridot NC in a particular location today.
13
+ * @param location The location in question.
14
+ *
15
+ * @returns Whether or not you've used the peridot in that location yet today.
16
+ */
17
+ export declare function periledToday(location: Location): boolean;
18
+ /**
19
+ * Determine if you can get the peridot NC in a particular location.
20
+ * @param location The location in question.
21
+ *
22
+ * @returns Whether or not you can currently get the peridot NC in that location.
23
+ */
24
+ export declare function canImperil(location: Location): boolean;
25
+ /**
26
+ * Create a `Properties` object for handling the peridot choice for a given monster.
27
+ * @param monster The monster in question.
28
+ *
29
+ * @returns A `Properties` object to handle the peridot choice for the given monster.
30
+ */
31
+ export declare function getChoiceProperty(monster: Monster): Properties;
32
+ /**
33
+ * Set the `choiceAdventure1557` pref to fight the given monster.
34
+ * @param monster The monster in question.
35
+ */
36
+ export declare function setChoice(monster: Monster): void;
@@ -0,0 +1,57 @@
1
+ import { getMonsters, setProperty, toLocation, } from "kolmafia";
2
+ import { have as have_ } from "../../lib.js";
3
+ import { get } from "../../property.js";
4
+ import { $item } from "../../template-string.js";
5
+ const peridot = $item `Peridot of Peril`;
6
+ /**
7
+ * @returns Whether you `have` the Peridot of Peril.
8
+ */
9
+ export function have() {
10
+ return have_(peridot);
11
+ }
12
+ /**
13
+ * @returns An array of what locations you've used your peridot of peril in today.
14
+ */
15
+ export function zonesToday() {
16
+ return get("_perilLocations")
17
+ .split(",")
18
+ .filter(Boolean)
19
+ .map((id) => toLocation(Number(id)));
20
+ }
21
+ /**
22
+ * Determine if you've already used your peridot NC in a particular location today.
23
+ * @param location The location in question.
24
+ *
25
+ * @returns Whether or not you've used the peridot in that location yet today.
26
+ */
27
+ export function periledToday(location) {
28
+ return RegExp(`(?:^|,)${location.id}(?:$|,)`).test(get("_perilLocations"));
29
+ }
30
+ /**
31
+ * Determine if you can get the peridot NC in a particular location.
32
+ * @param location The location in question.
33
+ *
34
+ * @returns Whether or not you can currently get the peridot NC in that location.
35
+ */
36
+ export function canImperil(location) {
37
+ return (location.wanderers &&
38
+ location.combatPercent >= 0 &&
39
+ getMonsters(location).length > 0 &&
40
+ !periledToday(location));
41
+ }
42
+ /**
43
+ * Create a `Properties` object for handling the peridot choice for a given monster.
44
+ * @param monster The monster in question.
45
+ *
46
+ * @returns A `Properties` object to handle the peridot choice for the given monster.
47
+ */
48
+ export function getChoiceProperty(monster) {
49
+ return { 1557: `1&bandersnatch=${monster.id}` };
50
+ }
51
+ /**
52
+ * Set the `choiceAdventure1557` pref to fight the given monster.
53
+ * @param monster The monster in question.
54
+ */
55
+ export function setChoice(monster) {
56
+ setProperty("choiceAdventure1557", `1&bandersnatch=${monster.id}`);
57
+ }
@@ -65,6 +65,7 @@ import * as ToyCupidBow from "./2025/ToyCupidBow.js";
65
65
  import * as Leprecondo from "./2025/Leprecondo.js";
66
66
  import * as Raffle from "./evergreen/Raffle.js";
67
67
  import * as CyberRealm from "./2025/CyberRealm.js";
68
- export { AprilingBandHelmet, AsdonMartin, AugustScepter, AutumnAton, Bandersnatch, BarrelShrine, BatWings, BeachComb, BoxingDaycare, BurningLeaves, CampAway, Cartography, ChateauMantegna, ChestMimic, CinchoDeMayo, ClosedCircuitPayphone, CombatLoversLocket, CommaChameleon, ConspiracyIsland, CrepeParachute, CrimboShrub, CrownOfThrones, CrystalBall, CursedMonkeyPaw, CyberRealm, DaylightShavings, DeckOfEveryCard, DesignerSweatpants, Dinseylandfill, DNALab, EverfullDarts, FloristFriar, GingerBread, GreyGoose, Guzzlr, Horsery, JuneCleaver, JungMan, Latte, Leprecondo, LookingGlass, MayamCalendar, MayoClinic, MummingTrunk, ObtuseAngel, Pantogram, PocketProfessor, Raffle, RainDoh, ReagnimatedGnome, RetroCape, Robortender, Snapper, SongBoom, SourceTerminal, Spacegate, SpookyPutty, Stickers, StillSuit, StompingBoots, TakerSpace, TearawayPants, ToyCupidBow, TrainSet, TunnelOfLove, WinterGarden, Witchess, };
68
+ import * as PeridotOfPeril from "./2025/PeridotOfPeril.js";
69
+ export { AprilingBandHelmet, AsdonMartin, AugustScepter, AutumnAton, Bandersnatch, BarrelShrine, BatWings, BeachComb, BoxingDaycare, BurningLeaves, CampAway, Cartography, ChateauMantegna, ChestMimic, CinchoDeMayo, ClosedCircuitPayphone, CombatLoversLocket, CommaChameleon, ConspiracyIsland, CrepeParachute, CrimboShrub, CrownOfThrones, CrystalBall, CursedMonkeyPaw, CyberRealm, DaylightShavings, DeckOfEveryCard, DesignerSweatpants, Dinseylandfill, DNALab, EverfullDarts, FloristFriar, GingerBread, GreyGoose, Guzzlr, Horsery, JuneCleaver, JungMan, Latte, Leprecondo, LookingGlass, MayamCalendar, MayoClinic, MummingTrunk, ObtuseAngel, Pantogram, PeridotOfPeril, PocketProfessor, Raffle, RainDoh, ReagnimatedGnome, RetroCape, Robortender, Snapper, SongBoom, SourceTerminal, Spacegate, SpookyPutty, Stickers, StillSuit, StompingBoots, TakerSpace, TearawayPants, ToyCupidBow, TrainSet, TunnelOfLove, WinterGarden, Witchess, };
69
70
  export * from "./putty-likes.js";
70
71
  export * from "./LibramSummon.js";
@@ -65,6 +65,7 @@ import * as ToyCupidBow from "./2025/ToyCupidBow.js";
65
65
  import * as Leprecondo from "./2025/Leprecondo.js";
66
66
  import * as Raffle from "./evergreen/Raffle.js";
67
67
  import * as CyberRealm from "./2025/CyberRealm.js";
68
- export { AprilingBandHelmet, AsdonMartin, AugustScepter, AutumnAton, Bandersnatch, BarrelShrine, BatWings, BeachComb, BoxingDaycare, BurningLeaves, CampAway, Cartography, ChateauMantegna, ChestMimic, CinchoDeMayo, ClosedCircuitPayphone, CombatLoversLocket, CommaChameleon, ConspiracyIsland, CrepeParachute, CrimboShrub, CrownOfThrones, CrystalBall, CursedMonkeyPaw, CyberRealm, DaylightShavings, DeckOfEveryCard, DesignerSweatpants, Dinseylandfill, DNALab, EverfullDarts, FloristFriar, GingerBread, GreyGoose, Guzzlr, Horsery, JuneCleaver, JungMan, Latte, Leprecondo, LookingGlass, MayamCalendar, MayoClinic, MummingTrunk, ObtuseAngel, Pantogram, PocketProfessor, Raffle, RainDoh, ReagnimatedGnome, RetroCape, Robortender, Snapper, SongBoom, SourceTerminal, Spacegate, SpookyPutty, Stickers, StillSuit, StompingBoots, TakerSpace, TearawayPants, ToyCupidBow, TrainSet, TunnelOfLove, WinterGarden, Witchess, };
68
+ import * as PeridotOfPeril from "./2025/PeridotOfPeril.js";
69
+ export { AprilingBandHelmet, AsdonMartin, AugustScepter, AutumnAton, Bandersnatch, BarrelShrine, BatWings, BeachComb, BoxingDaycare, BurningLeaves, CampAway, Cartography, ChateauMantegna, ChestMimic, CinchoDeMayo, ClosedCircuitPayphone, CombatLoversLocket, CommaChameleon, ConspiracyIsland, CrepeParachute, CrimboShrub, CrownOfThrones, CrystalBall, CursedMonkeyPaw, CyberRealm, DaylightShavings, DeckOfEveryCard, DesignerSweatpants, Dinseylandfill, DNALab, EverfullDarts, FloristFriar, GingerBread, GreyGoose, Guzzlr, Horsery, JuneCleaver, JungMan, Latte, Leprecondo, LookingGlass, MayamCalendar, MayoClinic, MummingTrunk, ObtuseAngel, Pantogram, PeridotOfPeril, PocketProfessor, Raffle, RainDoh, ReagnimatedGnome, RetroCape, Robortender, Snapper, SongBoom, SourceTerminal, Spacegate, SpookyPutty, Stickers, StillSuit, StompingBoots, TakerSpace, TearawayPants, ToyCupidBow, TrainSet, TunnelOfLove, WinterGarden, Witchess, };
69
70
  export * from "./putty-likes.js";
70
71
  export * from "./LibramSummon.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libram",
3
- "version": "0.11.4",
3
+ "version": "0.11.5",
4
4
  "description": "JavaScript helper library for KoLmafia",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -48,7 +48,7 @@
48
48
  "eslint-config-prettier": "^9.1.0",
49
49
  "eslint-import-resolver-typescript": "^3.6.3",
50
50
  "eslint-plugin-jsdoc": "^50.2.3",
51
- "eslint-plugin-libram": "^0.4.26",
51
+ "eslint-plugin-libram": "^0.4.28",
52
52
  "husky": "^9.1.6",
53
53
  "java-parser": "^2.3.2",
54
54
  "kolmafia": "^5.28498.0",