libram 0.7.11 → 0.7.14

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.
Files changed (147) hide show
  1. package/dist/Clan.d.ts +34 -6
  2. package/dist/Clan.js +33 -6
  3. package/dist/Copier.d.ts +5 -5
  4. package/dist/Dungeon.d.ts +45 -0
  5. package/dist/Dungeon.js +115 -0
  6. package/dist/Kmail.d.ts +8 -5
  7. package/dist/Kmail.js +8 -5
  8. package/dist/actions/ActionSource.d.ts +5 -0
  9. package/dist/actions/ActionSource.js +20 -2
  10. package/dist/actions/FreeKill.d.ts +2 -0
  11. package/dist/actions/FreeKill.js +2 -0
  12. package/dist/actions/FreeRun.d.ts +2 -0
  13. package/dist/actions/FreeRun.js +2 -0
  14. package/dist/ascend.d.ts +20 -4
  15. package/dist/ascend.js +32 -4
  16. package/dist/challengePaths/2015/CommunityService.d.ts +7 -0
  17. package/dist/challengePaths/2015/CommunityService.js +12 -1
  18. package/dist/combat.d.ts +55 -0
  19. package/dist/combat.js +85 -0
  20. package/dist/counter.d.ts +3 -0
  21. package/dist/counter.js +3 -0
  22. package/dist/diet/index.d.ts +2 -0
  23. package/dist/diet/index.js +27 -8
  24. package/dist/diet/knapsack.d.ts +1 -0
  25. package/dist/diet/knapsack.js +11 -3
  26. package/dist/index.d.ts +3 -7
  27. package/dist/index.js +1 -3
  28. package/dist/lib.d.ts +101 -33
  29. package/dist/lib.js +132 -42
  30. package/dist/logger.d.ts +24 -11
  31. package/dist/logger.js +38 -12
  32. package/dist/maximize.d.ts +20 -1
  33. package/dist/maximize.js +30 -3
  34. package/dist/modifier.d.ts +13 -1
  35. package/dist/modifier.js +87 -3
  36. package/dist/mood.d.ts +15 -1
  37. package/dist/mood.js +15 -1
  38. package/dist/property.d.ts +52 -17
  39. package/dist/property.js +64 -7
  40. package/dist/propertyTypes.d.ts +5 -5
  41. package/dist/propertyTypes.js +5 -5
  42. package/dist/propertyTyping.d.ts +54 -0
  43. package/dist/propertyTyping.js +54 -0
  44. package/dist/resources/2008/Stickers.d.ts +28 -0
  45. package/dist/resources/2008/Stickers.js +28 -0
  46. package/dist/resources/2009/Bandersnatch.d.ts +17 -7
  47. package/dist/resources/2009/Bandersnatch.js +17 -7
  48. package/dist/resources/2009/SpookyPutty.d.ts +25 -0
  49. package/dist/resources/2009/SpookyPutty.js +25 -0
  50. package/dist/resources/2010/CrownOfThrones.d.ts +23 -0
  51. package/dist/resources/2010/CrownOfThrones.js +31 -15
  52. package/dist/resources/2010/LookingGlass.d.ts +4 -0
  53. package/dist/resources/2010/LookingGlass.js +5 -0
  54. package/dist/resources/2011/ObtuseAngel.d.ts +8 -6
  55. package/dist/resources/2011/ObtuseAngel.js +8 -6
  56. package/dist/resources/2011/StompingBoots.d.ts +9 -15
  57. package/dist/resources/2011/StompingBoots.js +9 -15
  58. package/dist/resources/2012/RainDoh.d.ts +20 -0
  59. package/dist/resources/2012/RainDoh.js +20 -0
  60. package/dist/resources/2012/ReagnimatedGnome.d.ts +18 -0
  61. package/dist/resources/2012/ReagnimatedGnome.js +18 -0
  62. package/dist/resources/2012/Resolutions.d.ts +2 -2
  63. package/dist/resources/2012/Resolutions.js +2 -2
  64. package/dist/resources/2013/Florist.d.ts +15 -0
  65. package/dist/resources/2013/Florist.js +21 -0
  66. package/dist/resources/2014/CrimboShrub.d.ts +12 -0
  67. package/dist/resources/2014/CrimboShrub.js +22 -1
  68. package/dist/resources/2014/DNALab.d.ts +10 -2
  69. package/dist/resources/2014/DNALab.js +10 -2
  70. package/dist/resources/2014/WinterGarden.d.ts +15 -0
  71. package/dist/resources/2014/WinterGarden.js +15 -0
  72. package/dist/resources/2015/BarrelShrine.d.ts +6 -0
  73. package/dist/resources/2015/BarrelShrine.js +8 -1
  74. package/dist/resources/2015/ChateauMantegna.d.ts +35 -0
  75. package/dist/resources/2015/ChateauMantegna.js +35 -0
  76. package/dist/resources/2015/DeckOfEveryCard.d.ts +23 -1
  77. package/dist/resources/2015/DeckOfEveryCard.js +24 -0
  78. package/dist/resources/2015/Dinseylandfill.d.ts +1 -0
  79. package/dist/resources/2015/Dinseylandfill.js +2 -0
  80. package/dist/resources/2015/MayoClinic.d.ts +8 -1
  81. package/dist/resources/2015/MayoClinic.js +8 -1
  82. package/dist/resources/2016/SourceTerminal.d.ts +42 -21
  83. package/dist/resources/2016/SourceTerminal.js +42 -21
  84. package/dist/resources/2016/Witchess.d.ts +12 -0
  85. package/dist/resources/2016/Witchess.js +12 -0
  86. package/dist/resources/2017/AsdonMartin.d.ts +11 -3
  87. package/dist/resources/2017/AsdonMartin.js +44 -7
  88. package/dist/resources/2017/MummingTrunk.d.ts +1 -0
  89. package/dist/resources/2017/MummingTrunk.js +8 -1
  90. package/dist/resources/2017/Pantogram.d.ts +9 -0
  91. package/dist/resources/2017/Pantogram.js +33 -0
  92. package/dist/resources/2017/Robortender.d.ts +1 -0
  93. package/dist/resources/2017/Robortender.js +1 -0
  94. package/dist/resources/2017/Spacegate.js +1 -0
  95. package/dist/resources/2017/TunnelOfLove.d.ts +19 -0
  96. package/dist/resources/2017/TunnelOfLove.js +37 -0
  97. package/dist/resources/2018/LatteLoversMembersMug.d.ts +388 -0
  98. package/dist/resources/2018/LatteLoversMembersMug.js +294 -4
  99. package/dist/resources/2018/SongBoom.d.ts +9 -4
  100. package/dist/resources/2018/SongBoom.js +9 -4
  101. package/dist/resources/2019/BeachComb.d.ts +38 -1
  102. package/dist/resources/2019/BeachComb.js +39 -2
  103. package/dist/resources/2019/Snapper.d.ts +4 -0
  104. package/dist/resources/2019/Snapper.js +4 -0
  105. package/dist/resources/2020/Cartography.d.ts +13 -0
  106. package/dist/resources/2020/Cartography.js +13 -0
  107. package/dist/resources/2020/Guzzlr.d.ts +89 -23
  108. package/dist/resources/2020/Guzzlr.js +100 -29
  109. package/dist/resources/2020/RetroCape.d.ts +4 -0
  110. package/dist/resources/2020/RetroCape.js +4 -0
  111. package/dist/resources/2021/CrystalBall.d.ts +6 -0
  112. package/dist/resources/2021/CrystalBall.js +13 -1
  113. package/dist/resources/2021/DaylightShavings.d.ts +6 -0
  114. package/dist/resources/2021/DaylightShavings.js +6 -0
  115. package/dist/resources/2022/AutumnAton.d.ts +15 -0
  116. package/dist/resources/2022/AutumnAton.js +21 -0
  117. package/dist/resources/2022/CombatLoversLocket.d.ts +9 -0
  118. package/dist/resources/2022/CombatLoversLocket.js +10 -2
  119. package/dist/resources/2022/GreyGoose.d.ts +46 -0
  120. package/dist/resources/2022/GreyGoose.js +47 -1
  121. package/dist/resources/2022/JuneCleaver.d.ts +20 -0
  122. package/dist/resources/2022/JuneCleaver.js +20 -0
  123. package/dist/resources/2022/TrainSet.d.ts +48 -0
  124. package/dist/resources/2022/TrainSet.js +54 -0
  125. package/dist/resources/2023/ClosedCircuitPayphone.d.ts +75 -0
  126. package/dist/resources/2023/ClosedCircuitPayphone.js +117 -0
  127. package/dist/resources/LibramSummon.d.ts +5 -0
  128. package/dist/resources/LibramSummon.js +5 -0
  129. package/dist/resources/index.d.ts +2 -1
  130. package/dist/resources/index.js +2 -1
  131. package/dist/resources/putty-likes.d.ts +15 -0
  132. package/dist/resources/putty-likes.js +15 -0
  133. package/dist/session.d.ts +12 -0
  134. package/dist/session.js +20 -17
  135. package/dist/since.d.ts +3 -2
  136. package/dist/since.js +4 -2
  137. package/dist/utils.d.ts +90 -6
  138. package/dist/utils.js +108 -0
  139. package/package.json +4 -8
  140. package/dist/dungeons/Dreadsylvania.d.ts +0 -5
  141. package/dist/dungeons/Dreadsylvania.js +0 -14
  142. package/dist/dungeons/Dungeon.d.ts +0 -29
  143. package/dist/dungeons/Dungeon.js +0 -99
  144. package/dist/dungeons/Hobopolis.d.ts +0 -5
  145. package/dist/dungeons/Hobopolis.js +0 -14
  146. package/dist/dungeons/SlimeTube.d.ts +0 -5
  147. package/dist/dungeons/SlimeTube.js +0 -14
@@ -3,13 +3,16 @@ import { have as haveItem } from "../../lib";
3
3
  import { get } from "../../property";
4
4
  import { $item } from "../../template-string";
5
5
  import { clamp } from "../../utils";
6
- // eslint-disable-next-line libram/verify-constants
7
- export const locket = $item `Combat Lover's Locket`;
6
+ export const locket = $item `combat lover's locket`;
7
+ /**
8
+ * @returns Whether you `have` the Combat Lover's Locket
9
+ */
8
10
  export function have() {
9
11
  return haveItem(locket);
10
12
  }
11
13
  /**
12
14
  * Filters the set of all unlocked locket monsters to only the ones available to be locketed right now.
15
+ *
13
16
  * @returns An array consisting of all Monsters you can fight with your locket right now.
14
17
  */
15
18
  export function availableLocketMonsters() {
@@ -21,6 +24,7 @@ export function availableLocketMonsters() {
21
24
  }
22
25
  /**
23
26
  * Parses getLocketMonsters and returns the collection of all Monsters as an Array.
27
+ *
24
28
  * @returns An array consisting of all Monsters you can hypothetically fight, regardless of whether they've been fought today.
25
29
  */
26
30
  export function unlockedLocketMonsters() {
@@ -33,6 +37,7 @@ function parseLocketProperty() {
33
37
  }
34
38
  /**
35
39
  * Determines how many reminisces remain by parsing the _locketMonstersFought property.
40
+ *
36
41
  * @returns The number of reminisces a player has available; 0 if they lack the Locket.
37
42
  */
38
43
  export function reminiscesLeft() {
@@ -40,6 +45,7 @@ export function reminiscesLeft() {
40
45
  }
41
46
  /**
42
47
  * Determines which monsters were reminisced today by parsing the _locketMonstersFought property.
48
+ *
43
49
  * @returns An array consisting of the Monsters reminisced today.
44
50
  */
45
51
  export function monstersReminisced() {
@@ -47,6 +53,7 @@ export function monstersReminisced() {
47
53
  }
48
54
  /**
49
55
  * Fight a Monster using the Combat Lover's Locket
56
+ *
50
57
  * @param monster The Monster to fight
51
58
  * @returns false if we are unable to reminisce about this monster. Else, returns whether, at the end of all things, we have reminisced about this monster.
52
59
  */
@@ -60,6 +67,7 @@ export function reminisce(monster) {
60
67
  }
61
68
  /**
62
69
  * This function efficiently evaluates all of an adventurer's possibly reminiscable monsters, placing them through a filtering criteria and evaluating them based on a passed function.
70
+ *
63
71
  * @param criteria A filtering function for delineating which monsters are "fair game" for the search, such as "is this monster free".
64
72
  * @param value A function for deciding which monsters are "better" than others.
65
73
  * @returns A singular monster that fulfills the criteria function and maximizes the value function.
@@ -1,14 +1,60 @@
1
1
  export declare const goose: import("kolmafia").Familiar;
2
+ /**
3
+ * Determines whether you `have` the Grey Goose
4
+ *
5
+ * @returns Whether you `have` the Grey Goose
6
+ */
2
7
  export declare function have(): boolean;
8
+ /**
9
+ * Determines your expected Grey Goose experience, were you to make it your active familiar
10
+ *
11
+ * @returns Your current expected Grey Goose experience, paying attention to potential experience from the Shorter-Order Cook
12
+ */
3
13
  export declare function currentExperience(): number;
14
+ /**
15
+ * Determines the current expected weight of your goose, were you to make it your active familiar
16
+ *
17
+ * @returns Your current expected Grey Goose weight, paying attention to potential experience from the Shorter-Order Cook
18
+ */
4
19
  export declare function currentWeight(): number;
20
+ /**
21
+ * Determines the number of drones emitted for a given weight
22
+ *
23
+ * @param weight The weight to test; defaults to current weight
24
+ * @returns The nubmer of drones expected to be emitted for the weight in question
25
+ */
5
26
  export declare function expectedDrones(weight?: number): number;
6
27
  /**
28
+ * Determines the experience (or, in Grey You, fullstats) you'd get from using the appropriate Grey Goose skill for a given weight
29
+ *
7
30
  * @param weight The goose weight you care about; defaults to current weight
8
31
  * @returns In Grey You, returns the fullstats you'll gain from goose levelling; outside Grey You, returns substats
9
32
  */
10
33
  export declare function expectedExperience(weight?: number): number;
34
+ /**
35
+ * Determines the meat you'd expect to get from using Meatify Matter at the given weight
36
+ *
37
+ * @param weight The weight in question (defaults to current)
38
+ * @returns The expected meat from Meatify Matter
39
+ */
11
40
  export declare function expectedMeat(weight?: number): number;
41
+ /**
42
+ * Determines whether you've used Meatify Matter today
43
+ *
44
+ * @returns Whether you've used Meatify Matter today
45
+ */
12
46
  export declare function hasMeatified(): boolean;
47
+ /**
48
+ * Calculates the number of fights you need to reach a particular weight
49
+ *
50
+ * @param target The weight you want to reach
51
+ * @param bonusExperience The amount of bonus exdperience you'll be running--defaults to the current value
52
+ * @returns Number of fights needed
53
+ */
13
54
  export declare function fightsUntil(target: number, bonusExperience?: number): number;
55
+ /**
56
+ * Determines how many matter-duplicating drones are currently hovering around you
57
+ *
58
+ * @returns The number of matter-duplicating drones currently hovering around you
59
+ */
14
60
  export declare function currentDrones(): number;
@@ -4,41 +4,87 @@ import { get as getModifier } from "../../modifier";
4
4
  import { get } from "../../property";
5
5
  import { $familiar, $item, $skill } from "../../template-string";
6
6
  export const goose = $familiar `Grey Goose`;
7
+ /**
8
+ * Determines whether you `have` the Grey Goose
9
+ *
10
+ * @returns Whether you `have` the Grey Goose
11
+ */
7
12
  export function have() {
8
13
  return have_(goose);
9
14
  }
15
+ /**
16
+ * Determines your expected Grey Goose experience, were you to make it your active familiar
17
+ *
18
+ * @returns Your current expected Grey Goose experience, paying attention to potential experience from the Shorter-Order Cook
19
+ */
10
20
  export function currentExperience() {
11
21
  return goose.experience ||
12
22
  (have_($familiar `Shorter-Order Cook`) && !get("gooseReprocessed"))
13
23
  ? 81 + (have_($item `blue plate`) ? 19 : 0)
14
24
  : 0;
15
25
  }
26
+ /**
27
+ * Determines the current expected weight of your goose, were you to make it your active familiar
28
+ *
29
+ * @returns Your current expected Grey Goose weight, paying attention to potential experience from the Shorter-Order Cook
30
+ */
16
31
  export function currentWeight() {
17
32
  return Math.min(Math.floor(Math.sqrt(currentExperience())), 20);
18
33
  }
34
+ /**
35
+ * Determines the number of drones emitted for a given weight
36
+ *
37
+ * @param weight The weight to test; defaults to current weight
38
+ * @returns The nubmer of drones expected to be emitted for the weight in question
39
+ */
19
40
  export function expectedDrones(weight = currentWeight()) {
20
41
  return Math.max(0, weight - 5);
21
42
  }
22
43
  /**
44
+ * Determines the experience (or, in Grey You, fullstats) you'd get from using the appropriate Grey Goose skill for a given weight
45
+ *
23
46
  * @param weight The goose weight you care about; defaults to current weight
24
47
  * @returns In Grey You, returns the fullstats you'll gain from goose levelling; outside Grey You, returns substats
25
48
  */
26
49
  export function expectedExperience(weight = currentWeight()) {
27
50
  return Math.pow(Math.max(weight - 5, 0), toInt(myClass()) === 27 ? 2 : 3);
28
51
  }
52
+ /**
53
+ * Determines the meat you'd expect to get from using Meatify Matter at the given weight
54
+ *
55
+ * @param weight The weight in question (defaults to current)
56
+ * @returns The expected meat from Meatify Matter
57
+ */
29
58
  export function expectedMeat(weight = currentWeight()) {
30
59
  return Math.pow(Math.max(weight - 5, 0), 4);
31
60
  }
61
+ /**
62
+ * Determines whether you've used Meatify Matter today
63
+ *
64
+ * @returns Whether you've used Meatify Matter today
65
+ */
32
66
  export function hasMeatified() {
33
67
  return get("_meatifyMatterUsed");
34
68
  }
69
+ /**
70
+ * Calculates the number of fights you need to reach a particular weight
71
+ *
72
+ * @param target The weight you want to reach
73
+ * @param bonusExperience The amount of bonus exdperience you'll be running--defaults to the current value
74
+ * @returns Number of fights needed
75
+ */
35
76
  export function fightsUntil(target, bonusExperience = getModifier("Familiar Experience")) {
36
- const diff = target - currentWeight();
77
+ const diff = Math.pow(target, 2) - currentExperience();
37
78
  if (diff <= 0)
38
79
  return 0;
39
80
  return Math.ceil(diff /
40
81
  (1 + bonusExperience + (have_($skill `Testudinal Teachings`) ? 1 / 6 : 0)));
41
82
  }
83
+ /**
84
+ * Determines how many matter-duplicating drones are currently hovering around you
85
+ *
86
+ * @returns The number of matter-duplicating drones currently hovering around you
87
+ */
42
88
  export function currentDrones() {
43
89
  return get("gooseDronesRemaining");
44
90
  }
@@ -1,27 +1,47 @@
1
1
  export declare const cleaver: import("kolmafia").Item;
2
+ /**
3
+ * Determines whether you currently `have` the June cleaver
4
+ *
5
+ * @returns Whether you currently `have` the June cleaver
6
+ */
2
7
  export declare function have(): boolean;
3
8
  /**
9
+ * Determines the number of cleaver-combats it takes to get a particular encounter number.
10
+ *
11
+ * @param encounters The ordinal value of the June cleaver encounter you're asking about
4
12
  * @returns The number of cleaver-combats it takes to get a particular encounter number--this is agnostic of your current fights.
5
13
  */
6
14
  export declare function getInterval(encounters?: number): number;
7
15
  /**
16
+ * Determines the number of cleaver-combats it takes to get a particular encounter number, when a skip is in the mix
17
+ *
18
+ * @param encounters The ordinal value of the June cleaver encounter you're asking about, assuming you've skipped
8
19
  * @returns The number of cleaver-combats it would take to get a particular encounter after skipping.
9
20
  */
10
21
  export declare function getSkippedInterval(encounters?: number): number;
11
22
  /**
23
+ * Determines the amount of bonus elemental damage your cleaver currently grants
24
+ *
25
+ * @param element The element in question
12
26
  * @returns The bonus damage your cleaver currently gives for a given element.
13
27
  */
14
28
  export declare function damage(element: "Hot" | "Stench" | "Sleaze" | "Spooky" | "Cold"): number;
15
29
  /**
30
+ * Determines the number of times today you can skip a june cleaver choice
31
+ *
16
32
  * @returns The number of additional times you can select option 4 in a cleaver choice today.
17
33
  */
18
34
  export declare function skipsRemaining(): number;
19
35
  export declare const choices: readonly [1467, 1468, 1469, 1470, 1471, 1472, 1473, 1474, 1475];
20
36
  /**
37
+ * Returns the current June cleaver queue; you are not currently able to encounter any June cleaver choice adventure in this list
38
+ *
21
39
  * @returns An array consisting of the cleaver choice adventures currently in the queue.
22
40
  */
23
41
  export declare function queue(): typeof choices[number][];
24
42
  /**
43
+ * Determines which choices are currently eligible to be encountered with your June cleaver
44
+ *
25
45
  * @returns An array consisting of the cleaver choice adventures not currently in the queue.
26
46
  */
27
47
  export declare function choicesAvailable(): typeof choices[number][];
@@ -1,28 +1,44 @@
1
1
  import { toItem, availableAmount } from "kolmafia";
2
2
  import { get } from "../../property";
3
3
  export const cleaver = toItem("June cleaver");
4
+ /**
5
+ * Determines whether you currently `have` the June cleaver
6
+ *
7
+ * @returns Whether you currently `have` the June cleaver
8
+ */
4
9
  export function have() {
5
10
  return availableAmount(cleaver) > 0;
6
11
  }
7
12
  /**
13
+ * Determines the number of cleaver-combats it takes to get a particular encounter number.
14
+ *
15
+ * @param encounters The ordinal value of the June cleaver encounter you're asking about
8
16
  * @returns The number of cleaver-combats it takes to get a particular encounter number--this is agnostic of your current fights.
9
17
  */
10
18
  export function getInterval(encounters = get("_juneCleaverEncounters")) {
11
19
  return [1, 6, 10, 12, 15, 20][encounters] ?? 30;
12
20
  }
13
21
  /**
22
+ * Determines the number of cleaver-combats it takes to get a particular encounter number, when a skip is in the mix
23
+ *
24
+ * @param encounters The ordinal value of the June cleaver encounter you're asking about, assuming you've skipped
14
25
  * @returns The number of cleaver-combats it would take to get a particular encounter after skipping.
15
26
  */
16
27
  export function getSkippedInterval(encounters = get("_juneCleaverEncounters")) {
17
28
  return [1, 2, 3, 3, 4, 5][encounters] ?? 8;
18
29
  }
19
30
  /**
31
+ * Determines the amount of bonus elemental damage your cleaver currently grants
32
+ *
33
+ * @param element The element in question
20
34
  * @returns The bonus damage your cleaver currently gives for a given element.
21
35
  */
22
36
  export function damage(element) {
23
37
  return get(`_juneCleaver${element}`);
24
38
  }
25
39
  /**
40
+ * Determines the number of times today you can skip a june cleaver choice
41
+ *
26
42
  * @returns The number of additional times you can select option 4 in a cleaver choice today.
27
43
  */
28
44
  export function skipsRemaining() {
@@ -32,6 +48,8 @@ export const choices = [
32
48
  1467, 1468, 1469, 1470, 1471, 1472, 1473, 1474, 1475,
33
49
  ];
34
50
  /**
51
+ * Returns the current June cleaver queue; you are not currently able to encounter any June cleaver choice adventure in this list
52
+ *
35
53
  * @returns An array consisting of the cleaver choice adventures currently in the queue.
36
54
  */
37
55
  export function queue() {
@@ -41,6 +59,8 @@ export function queue() {
41
59
  .map((x) => parseInt(x));
42
60
  }
43
61
  /**
62
+ * Determines which choices are currently eligible to be encountered with your June cleaver
63
+ *
44
64
  * @returns An array consisting of the cleaver choice adventures not currently in the queue.
45
65
  */
46
66
  export function choicesAvailable() {
@@ -1,7 +1,17 @@
1
1
  import { Effect } from "kolmafia";
2
2
  import { Tuple } from "../../utils";
3
3
  export declare const item: import("kolmafia").Item;
4
+ /**
5
+ * Determines whether the Model Train Set is your current workshed
6
+ *
7
+ * @returns Whether the Model Train Set is your current workshed
8
+ */
4
9
  export declare function installed(): boolean;
10
+ /**
11
+ * Determines whether you `have` the model train set (or if it is installed)
12
+ *
13
+ * @returns Whether you `have` the model train set or it's installed
14
+ */
5
15
  export declare function have(): boolean;
6
16
  export declare enum Station {
7
17
  /**
@@ -89,11 +99,49 @@ export declare enum Station {
89
99
  */
90
100
  ORE_HOPPER = "ore_hopper"
91
101
  }
102
+ /**
103
+ * Returns an effect--if one exists--for a given train station
104
+ *
105
+ * @param station The train station to check the effect of
106
+ * @returns The effect associated with the given station
107
+ */
92
108
  export declare function effect(station: Station): Effect | null;
109
+ /**
110
+ * Returns an effect--if one exists--for a given train station, assuming it's been primed by the coal station
111
+ *
112
+ * @param station The train station to check the doubled effect of
113
+ * @returns The effect associated with given station, under the influence of coal
114
+ */
93
115
  export declare function doubledEffect(station: Station): Effect | null;
94
116
  export declare type Cycle = Tuple<Station, 8>;
117
+ /**
118
+ * Determines the current configuration of train stations
119
+ *
120
+ * @returns An 8-tuple consisting of the stations currently installed in your Model Train Set; this functions even if the Model Train Set isn't your active workshed
121
+ */
95
122
  export declare function cycle(): Cycle;
123
+ /**
124
+ * Determines how many turns until you can next configure the Model Train Set
125
+ *
126
+ * @returns How many turns until you can next configure the Model Train Set
127
+ */
96
128
  export declare function nextConfigurable(): number;
129
+ /**
130
+ * Determines whether you can currently configure your Model Train Set
131
+ *
132
+ * @returns Whether you can currently configure your Model Train Set
133
+ */
97
134
  export declare function canConfigure(): boolean;
135
+ /**
136
+ * Sets your model train station to the given configuration, if able
137
+ *
138
+ * @param configuration The cycle to try to set your model train station to
139
+ * @returns Whether your model train station matches the given configuration
140
+ */
98
141
  export declare function setConfiguration(configuration: Cycle): boolean;
142
+ /**
143
+ * Determines the next station you expect to encounter when the Model Train Station is active
144
+ *
145
+ * @returns The next station you expect to encounter when the Model Train Station is active
146
+ */
99
147
  export declare function next(): Station;
@@ -4,9 +4,19 @@ import { get } from "../../property";
4
4
  import { $item } from "../../template-string";
5
5
  import { clamp } from "../../utils";
6
6
  export const item = $item `model train set`;
7
+ /**
8
+ * Determines whether the Model Train Set is your current workshed
9
+ *
10
+ * @returns Whether the Model Train Set is your current workshed
11
+ */
7
12
  export function installed() {
8
13
  return getWorkshed() === item;
9
14
  }
15
+ /**
16
+ * Determines whether you `have` the model train set (or if it is installed)
17
+ *
18
+ * @returns Whether you `have` the model train set or it's installed
19
+ */
10
20
  export function have() {
11
21
  return installed() || have_(item);
12
22
  }
@@ -117,18 +127,45 @@ const trainsetEffectsDoubled = new Map([
117
127
  [Station.WATER_BRIDGE, Effect.get("Doubly Troubled Waters")],
118
128
  [Station.PRAWN_SILO, Effect.get("Doubly Craving Prawns")],
119
129
  ]);
130
+ /**
131
+ * Returns an effect--if one exists--for a given train station
132
+ *
133
+ * @param station The train station to check the effect of
134
+ * @returns The effect associated with the given station
135
+ */
120
136
  export function effect(station) {
121
137
  return trainsetEffects.get(station) ?? null;
122
138
  }
139
+ /**
140
+ * Returns an effect--if one exists--for a given train station, assuming it's been primed by the coal station
141
+ *
142
+ * @param station The train station to check the doubled effect of
143
+ * @returns The effect associated with given station, under the influence of coal
144
+ */
123
145
  export function doubledEffect(station) {
124
146
  return trainsetEffectsDoubled.get(station) ?? null;
125
147
  }
148
+ /**
149
+ * Determines the current configuration of train stations
150
+ *
151
+ * @returns An 8-tuple consisting of the stations currently installed in your Model Train Set; this functions even if the Model Train Set isn't your active workshed
152
+ */
126
153
  export function cycle() {
127
154
  return get("trainsetConfiguration").split(",");
128
155
  }
156
+ /**
157
+ * Determines how many turns until you can next configure the Model Train Set
158
+ *
159
+ * @returns How many turns until you can next configure the Model Train Set
160
+ */
129
161
  export function nextConfigurable() {
130
162
  return clamp(get("lastTrainsetConfiguration") + 40 - get("trainsetPosition"), 0, 40);
131
163
  }
164
+ /**
165
+ * Determines whether you can currently configure your Model Train Set
166
+ *
167
+ * @returns Whether you can currently configure your Model Train Set
168
+ */
132
169
  export function canConfigure() {
133
170
  return installed() && !nextConfigurable();
134
171
  }
@@ -155,9 +192,21 @@ const pieces = [
155
192
  Station.TRACKSIDE_DINER,
156
193
  Station.ORE_HOPPER,
157
194
  ];
195
+ /**
196
+ * Converts a given station to the integer value KoL associates with them
197
+ *
198
+ * @param station The station in question
199
+ * @returns The integer value KoL assigns the train station in question
200
+ */
158
201
  function stationToInt(station) {
159
202
  return pieces.indexOf(station);
160
203
  }
204
+ /**
205
+ * Sets your model train station to the given configuration, if able
206
+ *
207
+ * @param configuration The cycle to try to set your model train station to
208
+ * @returns Whether your model train station matches the given configuration
209
+ */
161
210
  export function setConfiguration(configuration) {
162
211
  if (!canConfigure())
163
212
  return false;
@@ -169,6 +218,11 @@ export function setConfiguration(configuration) {
169
218
  const currentConfiguration = cycle();
170
219
  return configuration.every((station, index) => station === currentConfiguration[index]);
171
220
  }
221
+ /**
222
+ * Determines the next station you expect to encounter when the Model Train Station is active
223
+ *
224
+ * @returns The next station you expect to encounter when the Model Train Station is active
225
+ */
172
226
  export function next() {
173
227
  return cycle()[get("trainsetPosition") % 8];
174
228
  }
@@ -0,0 +1,75 @@
1
+ import { Monster, Item, Location } from "kolmafia";
2
+ export declare const item: Item;
3
+ /**
4
+ * @returns Whether we currently have the closed-circuit pay phone
5
+ */
6
+ export declare function have(): boolean;
7
+ /**
8
+ * @returns Rufus's currently expected quest target, if he has one
9
+ */
10
+ export declare function rufusTarget(): Monster | Item | string | null;
11
+ declare const INGRESS_RIFTS: {
12
+ readonly desertbeach: Location;
13
+ readonly forestvillage: Location;
14
+ readonly mclargehuge: Location;
15
+ readonly beanstalk: Location;
16
+ readonly manor3: Location;
17
+ readonly "8bit": Location;
18
+ readonly pyramid: Location;
19
+ readonly giantcastle: Location;
20
+ readonly woods: Location;
21
+ readonly hiddencity: Location;
22
+ readonly cemetery: Location;
23
+ readonly plains: Location;
24
+ readonly town_right: Location;
25
+ };
26
+ export declare type Ingress = "" | keyof typeof INGRESS_RIFTS;
27
+ /**
28
+ * @returns Your current `shadowRiftIngress`; `null` if none is set this ascension
29
+ */
30
+ export declare function currentIngress(): Ingress;
31
+ /**
32
+ * @returns The current shadow rift that Mafia thinks KoL thinks you're in.
33
+ */
34
+ export declare function currentRift(): Location | null;
35
+ /**
36
+ * Choose a shadow rift to suit your needs
37
+ *
38
+ * @param options An object of various requirements you might have for the rift you want
39
+ * @param options.canAdventure Set to `true` if you want to only select a rift that you can currently access
40
+ * @param options.monsters Set to an array of Shadow Monsters you want to be available in the rift
41
+ * @param options.drops Set to an array of item drops you want to come from monsters in the rift
42
+ * @param options.otherFilter Set an optional additional filtering function not covered by the above logic
43
+ * @param options.sortBy Set a function used to compare valid rifts between eachother; bigger numbers are better
44
+ * @returns A rift that meets the criteria you specify, if one exists
45
+ */
46
+ export declare function chooseRift(options: {
47
+ canAdventure?: boolean;
48
+ monsters?: Monster[];
49
+ drops?: Item[];
50
+ otherFilter?: (l: Location) => boolean;
51
+ sortBy?: (l: Location) => number;
52
+ }): Location | null;
53
+ /**
54
+ * Choose a quest based on the options available to us
55
+ *
56
+ * @param chooser A function that maps quest-options to a choice
57
+ * @returns Whether we successfully accepted a quest
58
+ */
59
+ export declare function chooseQuest(chooser: ({ entity, artifact, items, }: {
60
+ entity: Monster;
61
+ artifact: Item;
62
+ items: Item;
63
+ }) => 1 | 2 | 3 | 4): boolean;
64
+ /**
65
+ * @returns Array containing all shadow rift locations
66
+ */
67
+ export declare function rifts(): Location[];
68
+ /**
69
+ * Picks an option based on your current shadow rift ingress
70
+ *
71
+ * @param options An object keyed by shadow rift ingress; it must either contain all possible ingresses, or have a `default` parameter.
72
+ * @returns The option corresponding to your current shadow rift ingress.
73
+ */
74
+ export declare const byIngress: <S>(options: import("../../utils").Switch<Ingress, S>) => S;
75
+ export {};
@@ -0,0 +1,117 @@
1
+ import { Monster, Item, getMonsters, itemDrops, canAdventure, use, runChoice, toItem, toMonster, } from "kolmafia";
2
+ import { have as have_ } from "../../lib";
3
+ import { get, withChoice } from "../../property";
4
+ import { $item, $location } from "../../template-string";
5
+ import { makeByXFunction, maxBy } from "../../utils";
6
+ export const item = $item `closed-circuit pay phone`;
7
+ /**
8
+ * @returns Whether we currently have the closed-circuit pay phone
9
+ */
10
+ export function have() {
11
+ return have_(item);
12
+ }
13
+ /**
14
+ * @returns Rufus's currently expected quest target, if he has one
15
+ */
16
+ export function rufusTarget() {
17
+ const target = get("rufusQuestTarget");
18
+ switch (get("rufusQuestType")) {
19
+ case "entity":
20
+ return Monster.get(target);
21
+ case "artifact":
22
+ case "items":
23
+ return Item.get(target);
24
+ default:
25
+ return null;
26
+ }
27
+ }
28
+ const INGRESS_RIFTS = {
29
+ desertbeach: $location `Shadow Rift (Desert Beach)`,
30
+ forestvillage: $location `Shadow Rift (Forest Village)`,
31
+ mclargehuge: $location `Shadow Rift (Mt. McLargeHuge)`,
32
+ beanstalk: $location `Shadow Rift (Somewhere Over the Beanstalk)`,
33
+ manor3: $location `Shadow Rift (Spookyraven Manor Third Floor)`,
34
+ "8bit": $location `Shadow Rift (The 8-Bit Realm)`,
35
+ pyramid: $location `Shadow Rift (The Ancient Buried Pyramid)`,
36
+ giantcastle: $location `Shadow Rift (The Castle in the Clouds in the Sky)`,
37
+ woods: $location `Shadow Rift (The Distant Woods)`,
38
+ hiddencity: $location `Shadow Rift (The Hidden City)`,
39
+ cemetery: $location `Shadow Rift (The Misspelled Cemetary)`,
40
+ plains: $location `Shadow Rift (The Nearby Plains)`,
41
+ town_right: $location `Shadow Rift (The Right Side of the Tracks)`,
42
+ };
43
+ /**
44
+ * @returns Your current `shadowRiftIngress`; `null` if none is set this ascension
45
+ */
46
+ export function currentIngress() {
47
+ return get("shadowRiftIngress");
48
+ }
49
+ /**
50
+ * @returns The current shadow rift that Mafia thinks KoL thinks you're in.
51
+ */
52
+ export function currentRift() {
53
+ const ingress = currentIngress();
54
+ return ingress ? INGRESS_RIFTS[ingress] : null;
55
+ }
56
+ const RIFTS = Array.from(Object.values(INGRESS_RIFTS));
57
+ /**
58
+ * Choose a shadow rift to suit your needs
59
+ *
60
+ * @param options An object of various requirements you might have for the rift you want
61
+ * @param options.canAdventure Set to `true` if you want to only select a rift that you can currently access
62
+ * @param options.monsters Set to an array of Shadow Monsters you want to be available in the rift
63
+ * @param options.drops Set to an array of item drops you want to come from monsters in the rift
64
+ * @param options.otherFilter Set an optional additional filtering function not covered by the above logic
65
+ * @param options.sortBy Set a function used to compare valid rifts between eachother; bigger numbers are better
66
+ * @returns A rift that meets the criteria you specify, if one exists
67
+ */
68
+ export function chooseRift(options) {
69
+ const filterFunction = (l) => {
70
+ const monsters = getMonsters(l);
71
+ if (options.canAdventure && !canAdventure(l))
72
+ return false;
73
+ if (options.monsters?.some((m) => !monsters.includes(m)))
74
+ return false;
75
+ if (options.drops?.every((i) => !monsters.some((m) => i.name in itemDrops(m))))
76
+ return false;
77
+ return options.otherFilter?.(l) ?? true;
78
+ };
79
+ const validRifts = [...RIFTS].filter(filterFunction);
80
+ if (!validRifts.length)
81
+ return null;
82
+ return options.sortBy ? maxBy(validRifts, options.sortBy) : validRifts[0];
83
+ }
84
+ /**
85
+ * Choose a quest based on the options available to us
86
+ *
87
+ * @param chooser A function that maps quest-options to a choice
88
+ * @returns Whether we successfully accepted a quest
89
+ */
90
+ export function chooseQuest(chooser) {
91
+ if (get("questRufus") !== "unstarted")
92
+ return false;
93
+ if (!have())
94
+ return false;
95
+ withChoice(1497, "", () => {
96
+ use(item);
97
+ runChoice(chooser({
98
+ artifact: toItem(get("rufusDesiredArtifact")),
99
+ entity: toMonster(get("rufusDesiredEntity")),
100
+ items: toItem(get("rufusDesiredItems")),
101
+ }));
102
+ });
103
+ return get("questRufus") !== "unstarted";
104
+ }
105
+ /**
106
+ * @returns Array containing all shadow rift locations
107
+ */
108
+ export function rifts() {
109
+ return [...RIFTS];
110
+ }
111
+ /**
112
+ * Picks an option based on your current shadow rift ingress
113
+ *
114
+ * @param options An object keyed by shadow rift ingress; it must either contain all possible ingresses, or have a `default` parameter.
115
+ * @returns The option corresponding to your current shadow rift ingress.
116
+ */
117
+ export const byIngress = makeByXFunction(currentIngress);