libram 0.8.25 → 0.8.26

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/lib.d.ts CHANGED
@@ -488,4 +488,10 @@ export declare function withCombatFlags<T>(action: () => T, ...flags: {
488
488
  flag: AccountCombatFlag;
489
489
  value: boolean;
490
490
  }[]): T;
491
+ /**
492
+ * Determines whether you currently have an effect intrinsically
493
+ * @param effect The effect in question
494
+ * @returns Whether you have that effect as an intrinsic. Alternately you could just have over 2147483647 turns of that effect, but that seems unlikely.
495
+ */
496
+ export declare function haveIntrinsic(effect: Effect): boolean;
491
497
  export {};
package/dist/lib.js CHANGED
@@ -948,3 +948,11 @@ export function withCombatFlags(action, ...flags) {
948
948
  setCombatFlags(...initialValues);
949
949
  }
950
950
  }
951
+ /**
952
+ * Determines whether you currently have an effect intrinsically
953
+ * @param effect The effect in question
954
+ * @returns Whether you have that effect as an intrinsic. Alternately you could just have over 2147483647 turns of that effect, but that seems unlikely.
955
+ */
956
+ export function haveIntrinsic(effect) {
957
+ return haveEffect(effect) >= 2147483647;
958
+ }
@@ -3,7 +3,7 @@ import { Effect, Item } from "kolmafia";
3
3
  * @returns whether you `have` the Apriling band helmet
4
4
  */
5
5
  export declare function have(): boolean;
6
- export declare const MARCHING_SONGS: readonly ["Patrol Beat", "Battle Cadence", "Celebration Bop"];
6
+ export declare const MARCHING_SONGS: readonly ["Apriling Band Patrol Beat", "Apriling Band Battle Cadence", "Apriling Band Celebration Bop"];
7
7
  export declare type MarchingSong = typeof MARCHING_SONGS[number];
8
8
  export declare const MARCHING_SONG_EFFECTS: readonly Effect[];
9
9
  export declare const INSTRUMENTS: readonly ["Apriling band saxophone", "Apriling band quad tom", "Apriling band tuba", "Apriling band staff", "Apriling band piccolo"];
@@ -32,7 +32,7 @@ export declare function canChangeSong(): boolean;
32
32
  *
33
33
  * @returns Whether we have the effect, at the end of all things
34
34
  */
35
- export declare const changeSong: (input: Effect | "Patrol Beat" | "Battle Cadence" | "Celebration Bop") => boolean;
35
+ export declare const changeSong: (input: Effect | "Apriling Band Patrol Beat" | "Apriling Band Battle Cadence" | "Apriling Band Celebration Bop") => boolean;
36
36
  /**
37
37
  * Conduct your Apriling band helmet
38
38
  *
@@ -1,4 +1,4 @@
1
- import { Effect, Item, MafiaClass, myHash, runChoice, toEffect, toItem, totalTurnsPlayed, visitUrl, } from "kolmafia";
1
+ import { Effect, Item, myHash, runChoice, toEffect, toItem, totalTurnsPlayed, visitUrl, } from "kolmafia";
2
2
  import { have as have_ } from "../../lib";
3
3
  import { get } from "../../property";
4
4
  import { $item } from "../../template-string";
@@ -11,9 +11,9 @@ export function have() {
11
11
  return have_(helmet);
12
12
  }
13
13
  export const MARCHING_SONGS = Object.freeze([
14
- "Patrol Beat",
15
- "Battle Cadence",
16
- "Celebration Bop",
14
+ "Apriling Band Patrol Beat",
15
+ "Apriling Band Battle Cadence",
16
+ "Apriling Band Celebration Bop",
17
17
  ]);
18
18
  export const MARCHING_SONG_EFFECTS = Object.freeze(MARCHING_SONGS.map((song) => toEffect(song)));
19
19
  export const INSTRUMENTS = Object.freeze([
@@ -35,7 +35,7 @@ function makeConductFunction(mafiaClass, canDo, set, offset) {
35
35
  return (input) => {
36
36
  if (!canDo())
37
37
  return false;
38
- const [name, instance] = input instanceof MafiaClass
38
+ const [name, instance] = typeof input === "object"
39
39
  ? [input.toString(), input]
40
40
  : [input, mafiaClass.get(input)];
41
41
  if (have_(instance))
@@ -56,7 +56,7 @@ function makeConductFunction(mafiaClass, canDo, set, offset) {
56
56
  *
57
57
  * @returns Whether we have the item, at the end of all things
58
58
  */
59
- export const joinSection = makeConductFunction(Item, canJoinSection, INSTRUMENTS, 1);
59
+ export const joinSection = makeConductFunction(Item, canJoinSection, INSTRUMENTS, 4);
60
60
  /**
61
61
  * @returns Whether we can currently change the marching song of our Apriling Band
62
62
  */
@@ -70,7 +70,7 @@ export function canChangeSong() {
70
70
  *
71
71
  * @returns Whether we have the effect, at the end of all things
72
72
  */
73
- export const changeSong = makeConductFunction(Effect, canChangeSong, MARCHING_SONGS, 4);
73
+ export const changeSong = makeConductFunction(Effect, canChangeSong, MARCHING_SONGS, 1);
74
74
  /**
75
75
  * Conduct your Apriling band helmet
76
76
  *
@@ -78,7 +78,8 @@ export const changeSong = makeConductFunction(Effect, canChangeSong, MARCHING_SO
78
78
  * @returns Whether we successfully completed the task
79
79
  */
80
80
  export function conduct(result) {
81
- if (result instanceof Item || arrayContains(result, INSTRUMENTS)) {
81
+ if ((typeof result === "object" && result instanceof Item) ||
82
+ arrayContains(result, INSTRUMENTS)) {
82
83
  return joinSection(result);
83
84
  }
84
85
  return changeSong(result);
@@ -91,7 +92,7 @@ export function conduct(result) {
91
92
  * @returns Whether we successfully played our instrument
92
93
  */
93
94
  export function play(instrument, acquire = false) {
94
- const item = instrument instanceof Item ? instrument : Item.get(instrument);
95
+ const item = typeof instrument === "object" ? instrument : Item.get(instrument);
95
96
  if (!(acquire ? joinSection : have_)(item))
96
97
  return false;
97
98
  const currentUsesRemaining = item.dailyusesleft;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libram",
3
- "version": "0.8.25",
3
+ "version": "0.8.26",
4
4
  "description": "JavaScript helper library for KoLmafia",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",