libram 0.8.26 → 0.8.28

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 (195) hide show
  1. package/package.json +9 -8
  2. package/dist/Clan.d.ts +0 -128
  3. package/dist/Clan.js +0 -300
  4. package/dist/Copier.d.ts +0 -9
  5. package/dist/Copier.js +0 -15
  6. package/dist/Dungeon.d.ts +0 -45
  7. package/dist/Dungeon.js +0 -115
  8. package/dist/Kmail.d.ts +0 -104
  9. package/dist/Kmail.js +0 -182
  10. package/dist/actions/ActionSource.d.ts +0 -131
  11. package/dist/actions/ActionSource.js +0 -177
  12. package/dist/actions/Banish.d.ts +0 -16
  13. package/dist/actions/Banish.js +0 -121
  14. package/dist/actions/FreeKill.d.ts +0 -16
  15. package/dist/actions/FreeKill.js +0 -94
  16. package/dist/actions/FreeRun.d.ts +0 -16
  17. package/dist/actions/FreeRun.js +0 -77
  18. package/dist/actions/index.d.ts +0 -4
  19. package/dist/actions/index.js +0 -4
  20. package/dist/ascend.d.ts +0 -83
  21. package/dist/ascend.js +0 -268
  22. package/dist/challengePaths/2014/HeavyRains.d.ts +0 -22
  23. package/dist/challengePaths/2014/HeavyRains.js +0 -75
  24. package/dist/challengePaths/2015/CommunityService.d.ts +0 -125
  25. package/dist/challengePaths/2015/CommunityService.js +0 -334
  26. package/dist/challengePaths/2016/NuclearAutumn.d.ts +0 -13
  27. package/dist/challengePaths/2016/NuclearAutumn.js +0 -21
  28. package/dist/challengePaths/index.d.ts +0 -4
  29. package/dist/challengePaths/index.js +0 -4
  30. package/dist/combat.d.ts +0 -414
  31. package/dist/combat.js +0 -711
  32. package/dist/console.d.ts +0 -12
  33. package/dist/console.js +0 -14
  34. package/dist/counter.d.ts +0 -22
  35. package/dist/counter.js +0 -37
  36. package/dist/diet/index.d.ts +0 -80
  37. package/dist/diet/index.js +0 -662
  38. package/dist/diet/knapsack.d.ts +0 -8
  39. package/dist/diet/knapsack.js +0 -128
  40. package/dist/index.d.ts +0 -29
  41. package/dist/index.js +0 -26
  42. package/dist/lib.d.ts +0 -497
  43. package/dist/lib.js +0 -958
  44. package/dist/logger.d.ts +0 -35
  45. package/dist/logger.js +0 -62
  46. package/dist/maximize.d.ts +0 -121
  47. package/dist/maximize.js +0 -525
  48. package/dist/modifier.d.ts +0 -41
  49. package/dist/modifier.js +0 -160
  50. package/dist/modifierTypes.d.ts +0 -16
  51. package/dist/modifierTypes.js +0 -9
  52. package/dist/mood.d.ts +0 -105
  53. package/dist/mood.js +0 -349
  54. package/dist/moonSign.d.ts +0 -13
  55. package/dist/moonSign.js +0 -25
  56. package/dist/overlappingNames.d.ts +0 -3
  57. package/dist/overlappingNames.js +0 -42
  58. package/dist/property.d.ts +0 -222
  59. package/dist/property.js +0 -385
  60. package/dist/propertyTypes.d.ts +0 -19
  61. package/dist/propertyTypes.js +0 -10
  62. package/dist/propertyTyping.d.ts +0 -65
  63. package/dist/propertyTyping.js +0 -91
  64. package/dist/resources/2007/CandyHearts.d.ts +0 -9
  65. package/dist/resources/2007/CandyHearts.js +0 -24
  66. package/dist/resources/2008/DivineFavors.d.ts +0 -9
  67. package/dist/resources/2008/DivineFavors.js +0 -27
  68. package/dist/resources/2008/Stickers.d.ts +0 -49
  69. package/dist/resources/2008/Stickers.js +0 -84
  70. package/dist/resources/2009/Bandersnatch.d.ts +0 -56
  71. package/dist/resources/2009/Bandersnatch.js +0 -93
  72. package/dist/resources/2009/LoveSongs.d.ts +0 -9
  73. package/dist/resources/2009/LoveSongs.js +0 -24
  74. package/dist/resources/2009/SpookyPutty.d.ts +0 -31
  75. package/dist/resources/2009/SpookyPutty.js +0 -49
  76. package/dist/resources/2010/Brickos.d.ts +0 -9
  77. package/dist/resources/2010/Brickos.js +0 -21
  78. package/dist/resources/2010/CrownOfThrones.d.ts +0 -68
  79. package/dist/resources/2010/CrownOfThrones.js +0 -418
  80. package/dist/resources/2010/LookingGlass.d.ts +0 -29
  81. package/dist/resources/2010/LookingGlass.js +0 -89
  82. package/dist/resources/2011/Gygaxian.d.ts +0 -9
  83. package/dist/resources/2011/Gygaxian.js +0 -24
  84. package/dist/resources/2011/ObtuseAngel.d.ts +0 -33
  85. package/dist/resources/2011/ObtuseAngel.js +0 -51
  86. package/dist/resources/2011/StompingBoots.d.ts +0 -37
  87. package/dist/resources/2011/StompingBoots.js +0 -57
  88. package/dist/resources/2012/RainDoh.d.ts +0 -25
  89. package/dist/resources/2012/RainDoh.js +0 -37
  90. package/dist/resources/2012/ReagnimatedGnome.d.ts +0 -31
  91. package/dist/resources/2012/ReagnimatedGnome.js +0 -46
  92. package/dist/resources/2012/Resolutions.d.ts +0 -9
  93. package/dist/resources/2012/Resolutions.js +0 -28
  94. package/dist/resources/2013/Florist.d.ts +0 -81
  95. package/dist/resources/2013/Florist.js +0 -245
  96. package/dist/resources/2013/JungMan.d.ts +0 -33
  97. package/dist/resources/2013/JungMan.js +0 -69
  98. package/dist/resources/2013/PulledTaffy.d.ts +0 -9
  99. package/dist/resources/2013/PulledTaffy.js +0 -33
  100. package/dist/resources/2014/CrimboShrub.d.ts +0 -42
  101. package/dist/resources/2014/CrimboShrub.js +0 -89
  102. package/dist/resources/2014/DNALab.d.ts +0 -56
  103. package/dist/resources/2014/DNALab.js +0 -162
  104. package/dist/resources/2014/WinterGarden.d.ts +0 -23
  105. package/dist/resources/2014/WinterGarden.js +0 -35
  106. package/dist/resources/2015/BarrelShrine.d.ts +0 -8
  107. package/dist/resources/2015/BarrelShrine.js +0 -25
  108. package/dist/resources/2015/ChateauMantegna.d.ts +0 -52
  109. package/dist/resources/2015/ChateauMantegna.js +0 -99
  110. package/dist/resources/2015/DeckOfEveryCard.d.ts +0 -29
  111. package/dist/resources/2015/DeckOfEveryCard.js +0 -122
  112. package/dist/resources/2015/Dinseylandfill.d.ts +0 -89
  113. package/dist/resources/2015/Dinseylandfill.js +0 -205
  114. package/dist/resources/2015/MayoClinic.d.ts +0 -23
  115. package/dist/resources/2015/MayoClinic.js +0 -49
  116. package/dist/resources/2016/GingerBread.d.ts +0 -32
  117. package/dist/resources/2016/GingerBread.js +0 -73
  118. package/dist/resources/2016/SourceTerminal.d.ts +0 -181
  119. package/dist/resources/2016/SourceTerminal.js +0 -275
  120. package/dist/resources/2016/Witchess.d.ts +0 -17
  121. package/dist/resources/2016/Witchess.js +0 -47
  122. package/dist/resources/2017/AsdonMartin.d.ts +0 -59
  123. package/dist/resources/2017/AsdonMartin.js +0 -238
  124. package/dist/resources/2017/Horsery.d.ts +0 -19
  125. package/dist/resources/2017/Horsery.js +0 -42
  126. package/dist/resources/2017/MummingTrunk.d.ts +0 -8
  127. package/dist/resources/2017/MummingTrunk.js +0 -33
  128. package/dist/resources/2017/Pantogram.d.ts +0 -92
  129. package/dist/resources/2017/Pantogram.js +0 -174
  130. package/dist/resources/2017/Robortender.d.ts +0 -30
  131. package/dist/resources/2017/Robortender.js +0 -90
  132. package/dist/resources/2017/Spacegate.d.ts +0 -86
  133. package/dist/resources/2017/Spacegate.js +0 -178
  134. package/dist/resources/2017/TunnelOfLove.d.ts +0 -39
  135. package/dist/resources/2017/TunnelOfLove.js +0 -120
  136. package/dist/resources/2018/LatteLoversMembersMug.d.ts +0 -392
  137. package/dist/resources/2018/LatteLoversMembersMug.js +0 -303
  138. package/dist/resources/2018/SongBoom.d.ts +0 -33
  139. package/dist/resources/2018/SongBoom.js +0 -55
  140. package/dist/resources/2019/BeachComb.d.ts +0 -72
  141. package/dist/resources/2019/BeachComb.js +0 -118
  142. package/dist/resources/2019/CampAway.d.ts +0 -39
  143. package/dist/resources/2019/CampAway.js +0 -72
  144. package/dist/resources/2019/Snapper.d.ts +0 -33
  145. package/dist/resources/2019/Snapper.js +0 -73
  146. package/dist/resources/2020/Cartography.d.ts +0 -16
  147. package/dist/resources/2020/Cartography.js +0 -48
  148. package/dist/resources/2020/Guzzlr.d.ts +0 -160
  149. package/dist/resources/2020/Guzzlr.js +0 -275
  150. package/dist/resources/2020/RetroCape.d.ts +0 -51
  151. package/dist/resources/2020/RetroCape.js +0 -115
  152. package/dist/resources/2021/CrystalBall.d.ts +0 -14
  153. package/dist/resources/2021/CrystalBall.js +0 -39
  154. package/dist/resources/2021/DaylightShavings.d.ts +0 -40
  155. package/dist/resources/2021/DaylightShavings.js +0 -74
  156. package/dist/resources/2022/AutumnAton.d.ts +0 -78
  157. package/dist/resources/2022/AutumnAton.js +0 -182
  158. package/dist/resources/2022/CombatLoversLocket.d.ts +0 -44
  159. package/dist/resources/2022/CombatLoversLocket.js +0 -82
  160. package/dist/resources/2022/GreyGoose.d.ts +0 -59
  161. package/dist/resources/2022/GreyGoose.js +0 -90
  162. package/dist/resources/2022/JuneCleaver.d.ts +0 -47
  163. package/dist/resources/2022/JuneCleaver.js +0 -69
  164. package/dist/resources/2022/TrainSet.d.ts +0 -146
  165. package/dist/resources/2022/TrainSet.js +0 -228
  166. package/dist/resources/2023/AugustScepter.d.ts +0 -25
  167. package/dist/resources/2023/AugustScepter.js +0 -40
  168. package/dist/resources/2023/BurningLeaves.d.ts +0 -25
  169. package/dist/resources/2023/BurningLeaves.js +0 -74
  170. package/dist/resources/2023/CinchoDeMayo.d.ts +0 -25
  171. package/dist/resources/2023/CinchoDeMayo.js +0 -45
  172. package/dist/resources/2023/ClosedCircuitPayphone.d.ts +0 -80
  173. package/dist/resources/2023/ClosedCircuitPayphone.js +0 -129
  174. package/dist/resources/2023/CursedMonkeyPaw.d.ts +0 -46
  175. package/dist/resources/2023/CursedMonkeyPaw.js +0 -113
  176. package/dist/resources/2024/AprilingBandHelmet.d.ts +0 -50
  177. package/dist/resources/2024/AprilingBandHelmet.js +0 -103
  178. package/dist/resources/2024/ChestMimic.d.ts +0 -35
  179. package/dist/resources/2024/ChestMimic.js +0 -108
  180. package/dist/resources/LibramSummon.d.ts +0 -18
  181. package/dist/resources/LibramSummon.js +0 -74
  182. package/dist/resources/index.d.ts +0 -54
  183. package/dist/resources/index.js +0 -54
  184. package/dist/resources/putty-likes.d.ts +0 -21
  185. package/dist/resources/putty-likes.js +0 -33
  186. package/dist/session.d.ts +0 -169
  187. package/dist/session.js +0 -284
  188. package/dist/since.d.ts +0 -51
  189. package/dist/since.js +0 -108
  190. package/dist/template-string.d.ts +0 -324
  191. package/dist/template-string.js +0 -265
  192. package/dist/url.d.ts +0 -35
  193. package/dist/url.js +0 -67
  194. package/dist/utils.d.ts +0 -178
  195. package/dist/utils.js +0 -255
package/dist/modifier.js DELETED
@@ -1,160 +0,0 @@
1
- import { booleanModifier, classModifier, cliExecuteOutput, effectModifier, familiarWeight, monsterModifier, myFamiliar, numericModifier, print, skillModifier, statModifier, stringModifier, } from "kolmafia";
2
- import { have } from "./lib";
3
- import { booleanModifiers, classModifiers, effectModifiers, monsterModifiers, numericModifiers, skillModifiers, statModifiers, stringModifiers, } from "./modifierTypes";
4
- import { $effect } from "./template-string";
5
- import { arrayContains, sum } from "./utils";
6
- /**
7
- * Get the value of a modifier
8
- *
9
- * @param name Modifier name
10
- * @param subject Subject of modifier
11
- * @returns Value of modifier
12
- */
13
- export function get(name, subject) {
14
- if (arrayContains(name, booleanModifiers)) {
15
- return subject === undefined
16
- ? booleanModifier(name)
17
- : booleanModifier(subject, name);
18
- }
19
- if (arrayContains(name, classModifiers)) {
20
- return classModifier(subject, name);
21
- }
22
- if (arrayContains(name, effectModifiers)) {
23
- return effectModifier(subject, name);
24
- }
25
- if (arrayContains(name, monsterModifiers)) {
26
- return monsterModifier(subject, name);
27
- }
28
- if (arrayContains(name, numericModifiers)) {
29
- return subject === undefined
30
- ? numericModifier(name)
31
- : numericModifier(subject, name);
32
- }
33
- if (arrayContains(name, skillModifiers)) {
34
- return skillModifier(subject, name);
35
- }
36
- if (arrayContains(name, stringModifiers)) {
37
- return subject === undefined
38
- ? stringModifier(name)
39
- : stringModifier(subject, name);
40
- }
41
- if (arrayContains(name, statModifiers)) {
42
- return statModifier(subject, name);
43
- }
44
- }
45
- /**
46
- * Merge two Modifiers objects into one, summing all numeric modifiers, ||ing all boolean modifiers, and otherwise letting the second object overwrite the first.
47
- *
48
- * @param modifiers1 Modifiers objects to be merged onto.
49
- * @param modifiers2 Modifiers object to merge.
50
- * @returns A single Modifiers object obtained by merging.
51
- */
52
- function pairwiseMerge(modifiers1, modifiers2) {
53
- const returnValue = { ...modifiers1, ...modifiers2 };
54
- for (const modifier in modifiers1) {
55
- if (Array.from(Object.values(modifiers2)).includes(modifier)) {
56
- if (arrayContains(modifier, numericModifiers)) {
57
- returnValue[modifier] =
58
- (modifiers1[modifier] ?? 0) + (modifiers2[modifier] ?? 0);
59
- }
60
- if (arrayContains(modifier, booleanModifiers)) {
61
- returnValue[modifier] =
62
- (modifiers1[modifier] ?? false) || (modifiers2[modifier] ?? false);
63
- }
64
- }
65
- }
66
- return returnValue;
67
- }
68
- /**
69
- * Merge arbitrarily many Modifiers objects into one, summing all numeric modifiers, and ||ing all boolean modifiers.
70
- *
71
- * @param modifierss Modifiers objects to be merged together.
72
- * @returns A single Modifiers object obtained by merging.
73
- */
74
- export function mergeModifiers(...modifierss) {
75
- return modifierss.reduce((a, b) => pairwiseMerge(a, b), {});
76
- }
77
- /**
78
- * Prints the modtrace to the log.
79
- * Example: printModtrace("Meat Drop") or printModtrace(["Item Drop", "Booze Drop"])
80
- *
81
- * @param inputModifiers A string (or string[]) containing the modtrace lookup term(s).
82
- * @param baseModifier A string where all the info about modifiers in the string[] array can be grabbed with this one lookup term. (Automatically generated in most cases)
83
- * @param componentColor The print color for the sum returned for each input modifier
84
- * @param totalColor The print color for the total sum over every input modifier
85
- * @returns void
86
- */
87
- export function printModtrace(inputModifiers, // the user's list of modifiers to look up
88
- baseModifier, componentColor = "purple", totalColor = "blue") {
89
- if (typeof inputModifiers === "string")
90
- return printModtrace([inputModifiers], inputModifiers);
91
- else if (inputModifiers.length === 0)
92
- return;
93
- else if (!baseModifier) {
94
- return inputModifiers
95
- .filter((mod1) => !inputModifiers.some((mod2) => mod2 !== mod1 && mod1.includes(mod2)))
96
- .forEach((baseMod) => printModtrace(inputModifiers.filter((mod) => mod.includes(baseMod)), baseMod));
97
- }
98
- const htmlOutput = cliExecuteOutput(`modtrace ${baseModifier}`);
99
- // The list of matched modifiers that mafia returns
100
- const modtraceModifiers = Array.from(htmlOutput.match(RegExp(/(>)(.*?)(<\/td>)/g)) ?? [])
101
- .map((s) => s.slice(1, -5))
102
- .slice(2);
103
- if (!modtraceModifiers.some((modifier) => modifier.toLowerCase() === baseModifier.toLowerCase())) {
104
- return print(`Could not find exact string match of ${baseModifier} in ${inputModifiers.toString()}`, "red");
105
- }
106
- const initialVal = baseModifier.toLowerCase() === "familiar weight"
107
- ? (() => {
108
- const wt = familiarWeight(myFamiliar());
109
- print(`[Familiar Weight] Base weight (${wt})`);
110
- return wt;
111
- })()
112
- : 0;
113
- const modifierVals = new Map(modtraceModifiers.map((modifier) => [modifier, initialVal])); // Maps modifier name to its value
114
- const lowerCaseModifiers = inputModifiers.map((modifier) => modifier.toLowerCase());
115
- Array.from(htmlOutput.match(RegExp(/<tr>(.*?)<\/tr>/g)) ?? [])
116
- .slice(1)
117
- .map((s) => s.slice(4, -5))
118
- .forEach((s) => {
119
- const rowArr = Array.from(s
120
- .replace(RegExp(/><\/td>/g), ">0</td>")
121
- .match(RegExp(/(>)(.*?)(<\/td>)/g)) ?? []).map((s) => s.slice(1, -5));
122
- const rowName = rowArr[1];
123
- rowArr
124
- .slice(2)
125
- .filter((e, idx) => idx % 2 === 0)
126
- .forEach((e, idx) => {
127
- const val = parseFloat(e);
128
- modifierVals.set(modtraceModifiers[idx], (modifierVals.get(modtraceModifiers[idx]) ?? 0) + val);
129
- if (val !== 0 &&
130
- lowerCaseModifiers.includes(modtraceModifiers[idx].toLowerCase())) {
131
- print(`[${modtraceModifiers[idx]}] ${rowName} (${val.toFixed(1)})`);
132
- }
133
- });
134
- });
135
- const total = sum(modtraceModifiers, (modifier) => {
136
- if (lowerCaseModifiers.includes(modifier.toLowerCase())) {
137
- let modVal = modifierVals.get(modifier) ?? 0;
138
- if (have($effect `Bow-Legged Swagger`) &&
139
- modifier.includes("Weapon Damage")) {
140
- print(`[${modifier}] Bow-Legged Swagger (${modVal.toFixed(1)})`);
141
- modVal *= 2;
142
- }
143
- print(`${modifier} => ${modVal.toFixed(1)}`, componentColor);
144
- return modVal;
145
- }
146
- else
147
- return 0;
148
- });
149
- print(`Total ${baseModifier}: ${total.toFixed(1)}`, totalColor);
150
- }
151
- /**
152
- * Take the sum of a modifier over an array of Skills, Effects, and Items
153
- *
154
- * @param modifier A NumericModifier that we want to find the total value of
155
- * @param subjects A rested array of Skills, Effects, and Items that we want to find the total value of
156
- * @returns The sum of the appropriate modifier for all of the subjects
157
- */
158
- export function getTotalModifier(modifier, ...subjects) {
159
- return sum(subjects, (subject) => get(modifier, subject));
160
- }
@@ -1,16 +0,0 @@
1
- export declare const booleanModifiers: readonly ["Softcore Only", "Single Equip", "Never Fumble", "Weakens Monster", "Free Pull", "Variable", "Nonstackable Watch", "Cold Immunity", "Hot Immunity", "Sleaze Immunity", "Spooky Immunity", "Stench Immunity", "Cold Vulnerability", "Hot Vulnerability", "Sleaze Vulnerability", "Spooky Vulnerability", "Stench Vulnerability", "Moxie Controls MP", "Moxie May Control MP", "Four Songs", "Adventure Underwater", "Underwater Familiar", "Generic", "Unarmed", "No Pull", "Lasts Until Rollover", "Attacks Can't Miss", "Pirate", "Breakable", "Drops Items", "Drops Meat"];
2
- export declare type BooleanModifier = typeof booleanModifiers[number];
3
- export declare const classModifiers: readonly ["Class"];
4
- export declare type ClassModifier = typeof classModifiers[number];
5
- export declare const numericModifiers: readonly ["Familiar Weight", "Monster Level", "Combat Rate", "Initiative", "Experience", "Item Drop", "Meat Drop", "Damage Absorption", "Damage Reduction", "Cold Resistance", "Hot Resistance", "Sleaze Resistance", "Spooky Resistance", "Stench Resistance", "Mana Cost", "Moxie", "Moxie Percent", "Muscle", "Muscle Percent", "Mysticality", "Mysticality Percent", "Maximum HP", "Maximum HP Percent", "Maximum MP", "Maximum MP Percent", "Weapon Damage", "Ranged Damage", "Spell Damage", "Spell Damage Percent", "Cold Damage", "Hot Damage", "Sleaze Damage", "Spooky Damage", "Stench Damage", "Cold Spell Damage", "Hot Spell Damage", "Sleaze Spell Damage", "Spooky Spell Damage", "Stench Spell Damage", "Underwater Combat Rate", "Fumble", "HP Regen Min", "HP Regen Max", "MP Regen Min", "MP Regen Max", "Adventures", "Familiar Weight Percent", "Weapon Damage Percent", "Ranged Damage Percent", "Stackable Mana Cost", "Hobo Power", "Base Resting HP", "Resting HP Percent", "Bonus Resting HP", "Base Resting MP", "Resting MP Percent", "Bonus Resting MP", "Critical Hit Percent", "PvP Fights", "Volleyball", "Sombrero", "Leprechaun", "Fairy", "Meat Drop Penalty", "Hidden Familiar Weight", "Item Drop Penalty", "Initiative Penalty", "Food Drop", "Booze Drop", "Hat Drop", "Weapon Drop", "Offhand Drop", "Shirt Drop", "Pants Drop", "Accessory Drop", "Volleyball Effectiveness", "Sombrero Effectiveness", "Leprechaun Effectiveness", "Fairy Effectiveness", "Familiar Weight Cap", "Slime Resistance", "Slime Hates It", "Spell Critical Percent", "Muscle Experience", "Mysticality Experience", "Moxie Experience", "Effect Duration", "Candy Drop", "DB Combat Damage", "Sombrero Bonus", "Familiar Experience", "Sporadic Meat Drop", "Sporadic Item Drop", "Meat Bonus", "Pickpocket Chance", "Combat Mana Cost", "Muscle Experience Percent", "Mysticality Experience Percent", "Moxie Experience Percent", "Minstrel Level", "Muscle Limit", "Mysticality Limit", "Moxie Limit", "Song Duration", "Prismatic Damage", "Smithsness", "Supercold Resistance", "Reduce Enemy Defense", "Pool Skill", "Surgeonosity", "Familiar Damage", "Gear Drop", "Maximum Hooch", "Water Level", "Crimbot Outfit Power", "Familiar Tuning Muscle", "Familiar Tuning Mysticality", "Familiar Tuning Moxie", "Random Monster Modifiers", "Luck", "Othello Skill", "Disco Style", "Rollover Effect Duration", "Sixgun Damage", "Fishing Skill", "Additional Song", "Sprinkle Drop", "Absorb Adventures", "Absorb Stats", "Rubee Drop", "Kruegerand Drop", "WarBear Armor Penetration", "Clowniness", "Maximum PP", "Plumber Power", "Drippy Damage", "Drippy Resistance", "Energy", "Scrap", "Familiar Action Bonus", "Water"];
6
- export declare type NumericModifier = typeof numericModifiers[number];
7
- export declare const effectModifiers: readonly ["Effect", "Rollover Effect"];
8
- export declare type EffectModifier = typeof effectModifiers[number];
9
- export declare const monsterModifiers: readonly ["Avatar"];
10
- export declare type MonsterModifier = typeof monsterModifiers[number];
11
- export declare const skillModifiers: readonly ["Skill"];
12
- export declare type SkillModifier = typeof skillModifiers[number];
13
- export declare const statModifiers: readonly ["Plumber Stat"];
14
- export declare type StatModifier = typeof statModifiers[number];
15
- export declare const stringModifiers: readonly ["Intrinsic Effect", "Equalize", "Wiki Name", "Modifiers", "Outfit", "Stat Tuning", "Equips On", "Familiar Effect", "Jiggle", "Equalize Muscle", "Equalize Mysticality", "Equalize Moxie", "Floor Buffed Muscle", "Floor Buffed Mysticality", "Floor Buffed Moxie"];
16
- export declare type StringModifier = typeof stringModifiers[number];
@@ -1,9 +0,0 @@
1
- // THIS FILE IS AUTOMATICALLY GENERATED. See tools/parseModifiers.ts for more information
2
- export const booleanModifiers = ["Softcore Only", "Single Equip", "Never Fumble", "Weakens Monster", "Free Pull", "Variable", "Nonstackable Watch", "Cold Immunity", "Hot Immunity", "Sleaze Immunity", "Spooky Immunity", "Stench Immunity", "Cold Vulnerability", "Hot Vulnerability", "Sleaze Vulnerability", "Spooky Vulnerability", "Stench Vulnerability", "Moxie Controls MP", "Moxie May Control MP", "Four Songs", "Adventure Underwater", "Underwater Familiar", "Generic", "Unarmed", "No Pull", "Lasts Until Rollover", "Attacks Can't Miss", "Pirate", "Breakable", "Drops Items", "Drops Meat"];
3
- export const classModifiers = ["Class"];
4
- export const numericModifiers = ["Familiar Weight", "Monster Level", "Combat Rate", "Initiative", "Experience", "Item Drop", "Meat Drop", "Damage Absorption", "Damage Reduction", "Cold Resistance", "Hot Resistance", "Sleaze Resistance", "Spooky Resistance", "Stench Resistance", "Mana Cost", "Moxie", "Moxie Percent", "Muscle", "Muscle Percent", "Mysticality", "Mysticality Percent", "Maximum HP", "Maximum HP Percent", "Maximum MP", "Maximum MP Percent", "Weapon Damage", "Ranged Damage", "Spell Damage", "Spell Damage Percent", "Cold Damage", "Hot Damage", "Sleaze Damage", "Spooky Damage", "Stench Damage", "Cold Spell Damage", "Hot Spell Damage", "Sleaze Spell Damage", "Spooky Spell Damage", "Stench Spell Damage", "Underwater Combat Rate", "Fumble", "HP Regen Min", "HP Regen Max", "MP Regen Min", "MP Regen Max", "Adventures", "Familiar Weight Percent", "Weapon Damage Percent", "Ranged Damage Percent", "Stackable Mana Cost", "Hobo Power", "Base Resting HP", "Resting HP Percent", "Bonus Resting HP", "Base Resting MP", "Resting MP Percent", "Bonus Resting MP", "Critical Hit Percent", "PvP Fights", "Volleyball", "Sombrero", "Leprechaun", "Fairy", "Meat Drop Penalty", "Hidden Familiar Weight", "Item Drop Penalty", "Initiative Penalty", "Food Drop", "Booze Drop", "Hat Drop", "Weapon Drop", "Offhand Drop", "Shirt Drop", "Pants Drop", "Accessory Drop", "Volleyball Effectiveness", "Sombrero Effectiveness", "Leprechaun Effectiveness", "Fairy Effectiveness", "Familiar Weight Cap", "Slime Resistance", "Slime Hates It", "Spell Critical Percent", "Muscle Experience", "Mysticality Experience", "Moxie Experience", "Effect Duration", "Candy Drop", "DB Combat Damage", "Sombrero Bonus", "Familiar Experience", "Sporadic Meat Drop", "Sporadic Item Drop", "Meat Bonus", "Pickpocket Chance", "Combat Mana Cost", "Muscle Experience Percent", "Mysticality Experience Percent", "Moxie Experience Percent", "Minstrel Level", "Muscle Limit", "Mysticality Limit", "Moxie Limit", "Song Duration", "Prismatic Damage", "Smithsness", "Supercold Resistance", "Reduce Enemy Defense", "Pool Skill", "Surgeonosity", "Familiar Damage", "Gear Drop", "Maximum Hooch", "Water Level", "Crimbot Outfit Power", "Familiar Tuning Muscle", "Familiar Tuning Mysticality", "Familiar Tuning Moxie", "Random Monster Modifiers", "Luck", "Othello Skill", "Disco Style", "Rollover Effect Duration", "Sixgun Damage", "Fishing Skill", "Additional Song", "Sprinkle Drop", "Absorb Adventures", "Absorb Stats", "Rubee Drop", "Kruegerand Drop", "WarBear Armor Penetration", "Clowniness", "Maximum PP", "Plumber Power", "Drippy Damage", "Drippy Resistance", "Energy", "Scrap", "Familiar Action Bonus", "Water"];
5
- export const effectModifiers = ["Effect", "Rollover Effect"];
6
- export const monsterModifiers = ["Avatar"];
7
- export const skillModifiers = ["Skill"];
8
- export const statModifiers = ["Plumber Stat"];
9
- export const stringModifiers = ["Intrinsic Effect", "Equalize", "Wiki Name", "Modifiers", "Outfit", "Stat Tuning", "Equips On", "Familiar Effect", "Jiggle", "Equalize Muscle", "Equalize Mysticality", "Equalize Moxie", "Floor Buffed Muscle", "Floor Buffed Mysticality", "Floor Buffed Moxie"];
package/dist/mood.d.ts DELETED
@@ -1,105 +0,0 @@
1
- import { Effect, Item, Skill } from "kolmafia";
2
- export declare abstract class MpSource {
3
- usesRemaining(): number;
4
- abstract availableMpMin(): number;
5
- availableMpMax(): number;
6
- abstract execute(): void;
7
- }
8
- export declare class OscusSoda extends MpSource {
9
- static instance: OscusSoda;
10
- available(): boolean;
11
- usesRemaining(): number;
12
- availableMpMin(): number;
13
- availableMpMax(): number;
14
- execute(): void;
15
- }
16
- export declare class MagicalSausages extends MpSource {
17
- static instance: MagicalSausages;
18
- available(): boolean;
19
- usesRemaining(): number;
20
- availableMpMin(): number;
21
- execute(): void;
22
- }
23
- declare type MoodOptions = {
24
- songSlots: Effect[][];
25
- mpSources: MpSource[];
26
- reserveMp: number;
27
- useNativeRestores: boolean;
28
- };
29
- declare abstract class MoodElement {
30
- mpCostPerTurn(): number;
31
- turnIncrement(): number;
32
- abstract execute(mood: Mood, ensureTurns: number): boolean;
33
- }
34
- /**
35
- * Class representing a mood object. Add mood elements using the instance methods, which can be chained.
36
- */
37
- export declare class Mood {
38
- static defaultOptions: MoodOptions;
39
- /**
40
- * Set default options for new Mood instances.
41
- *
42
- * @param options Default options for new Mood instances.
43
- */
44
- static setDefaultOptions(options: Partial<MoodOptions>): void;
45
- options: MoodOptions;
46
- elements: MoodElement[];
47
- /**
48
- * Construct a new Mood instance.
49
- *
50
- * @param options Options for mood.
51
- */
52
- constructor(options?: Partial<MoodOptions>);
53
- /**
54
- * Get the MP available for casting skills.
55
- *
56
- * @returns Available MP
57
- */
58
- availableMp(): number;
59
- moreMp(minimumTarget: number): void;
60
- /**
61
- * Add a skill to the mood.
62
- *
63
- * @param skill Skill to add.
64
- * @returns This mood to enable chaining
65
- */
66
- skill(skill: Skill): Mood;
67
- /**
68
- * Add an effect to the mood, with casting based on {effect.default}.
69
- *
70
- * @param effect Effect to add.
71
- * @param gainEffect How to gain the effect. Only runs if we don't have the effect.
72
- * @returns This mood to enable chaining
73
- */
74
- effect(effect: Effect, gainEffect?: () => void): Mood;
75
- /**
76
- * Add a potion to the mood.
77
- *
78
- * @param potion Potion to add.
79
- * @param maxPricePerTurn Maximum price to pay per turn of the effect.
80
- * @returns This mood to enable chaining
81
- */
82
- potion(potion: Item, maxPricePerTurn: number): Mood;
83
- /**
84
- * Add an effect to acquire via pocket wishes to the mood.
85
- *
86
- * @param effect Effect to wish for in the mood.
87
- * @returns This mood to enable chaining
88
- */
89
- genie(effect: Effect): Mood;
90
- /**
91
- * Add an Asdon Martin driving style to the mood.
92
- *
93
- * @param effect Driving style to add to the mood.
94
- * @returns This mood to enable chaining
95
- */
96
- drive(effect: Effect): Mood;
97
- /**
98
- * Execute the mood, trying to ensure {ensureTurns} of each effect.
99
- *
100
- * @param ensureTurns Turns of each effect to try and achieve.
101
- * @returns Whether or not we successfully got this many turns of every effect in the mood.
102
- */
103
- execute(ensureTurns?: number): boolean;
104
- }
105
- export {};
package/dist/mood.js DELETED
@@ -1,349 +0,0 @@
1
- import { availableAmount, buy, cliExecute, eat, effectModifier, haveEffect, haveSkill, hpCost, mallPrice, mpCost, myHp, myMaxmp, myMp, numericModifier, restoreMp, retrieveItem, toEffect, toSkill, turnsPerCast, use, useSkill, } from "kolmafia";
2
- import { getActiveSongs, have, isSong } from "./lib";
3
- import { get } from "./property";
4
- import { AsdonMartin } from "./resources";
5
- import { $item, $skill } from "./template-string";
6
- import { clamp, sum } from "./utils";
7
- export class MpSource {
8
- usesRemaining() {
9
- return 0;
10
- }
11
- availableMpMax() {
12
- return this.availableMpMin();
13
- }
14
- }
15
- export class OscusSoda extends MpSource {
16
- static instance = new OscusSoda();
17
- available() {
18
- return have($item `Oscus's neverending soda`);
19
- }
20
- usesRemaining() {
21
- return get("oscusSodaUsed") ? 0 : 1;
22
- }
23
- availableMpMin() {
24
- return this.available() && this.usesRemaining() > 0 ? 200 : 0;
25
- }
26
- availableMpMax() {
27
- return this.available() && this.usesRemaining() > 0 ? 300 : 0;
28
- }
29
- execute() {
30
- use($item `Oscus's neverending soda`);
31
- }
32
- }
33
- export class MagicalSausages extends MpSource {
34
- static instance = new MagicalSausages();
35
- available() {
36
- return have($item `Kramco Sausage-o-Matic™`);
37
- }
38
- usesRemaining() {
39
- const maxSausages = availableAmount($item `magical sausage`) +
40
- availableAmount($item `magical sausage casing`);
41
- return this.available()
42
- ? clamp(23 - get("_sausagesEaten"), 0, maxSausages)
43
- : 0;
44
- }
45
- availableMpMin() {
46
- return this.available()
47
- ? Math.min(myMaxmp(), 999) * this.usesRemaining()
48
- : 0;
49
- }
50
- execute() {
51
- const mpSpaceAvailable = myMaxmp() - myMp();
52
- if (mpSpaceAvailable < 700)
53
- return;
54
- const maxSausages = Math.min(this.usesRemaining(), Math.floor((myMaxmp() - myMp()) / Math.min(myMaxmp() - myMp(), 999)));
55
- retrieveItem(maxSausages, $item `magical sausage`);
56
- eat(maxSausages, $item `magical sausage`);
57
- }
58
- }
59
- class MoodElement {
60
- mpCostPerTurn() {
61
- return 0;
62
- }
63
- turnIncrement() {
64
- return 1;
65
- }
66
- }
67
- class SkillMoodElement extends MoodElement {
68
- skill;
69
- constructor(skill) {
70
- super();
71
- this.skill = skill;
72
- }
73
- mpCostPerTurn() {
74
- const turns = turnsPerCast(this.skill);
75
- return turns > 0 ? mpCost(this.skill) / turns : 0;
76
- }
77
- turnIncrement() {
78
- return turnsPerCast(this.skill);
79
- }
80
- execute(mood, ensureTurns) {
81
- const effect = toEffect(this.skill);
82
- const initialTurns = haveEffect(effect);
83
- if (!haveSkill(this.skill))
84
- return false;
85
- if (initialTurns >= ensureTurns)
86
- return true;
87
- // Deal with song slots.
88
- if (mood.options.songSlots.length > 0 &&
89
- isSong(this.skill) &&
90
- !have(effect)) {
91
- const activeSongs = getActiveSongs();
92
- for (const song of activeSongs) {
93
- const slot = mood.options.songSlots.find((slot) => slot.includes(song));
94
- if (!slot || slot.includes(effect)) {
95
- cliExecute(`shrug ${song}`);
96
- break;
97
- }
98
- }
99
- }
100
- let oldRemainingCasts = -1;
101
- let remainingCasts = Math.ceil((ensureTurns - haveEffect(effect)) / turnsPerCast(this.skill));
102
- while (remainingCasts > 0 && oldRemainingCasts !== remainingCasts) {
103
- let maxCasts;
104
- if (hpCost(this.skill) > 0) {
105
- // FIXME: restore HP
106
- maxCasts = Math.max(0, Math.floor((myHp() - 1) / hpCost(this.skill))); // Do not allow ourselves to hit 0 hp
107
- }
108
- else {
109
- const cost = mpCost(this.skill);
110
- maxCasts = Math.floor(Math.min(mood.availableMp(), myMp()) / cost);
111
- if (maxCasts < remainingCasts) {
112
- const bestMp = Math.min(remainingCasts * mpCost(this.skill), myMaxmp());
113
- mood.moreMp(bestMp);
114
- maxCasts = Math.floor(Math.min(mood.availableMp(), myMp()) / cost);
115
- }
116
- }
117
- const casts = clamp(remainingCasts, 0, Math.min(100, maxCasts));
118
- useSkill(casts, this.skill);
119
- oldRemainingCasts = remainingCasts;
120
- remainingCasts = Math.ceil((ensureTurns - haveEffect(effect)) / turnsPerCast(this.skill));
121
- }
122
- return haveEffect(effect) > ensureTurns;
123
- }
124
- }
125
- class PotionMoodElement extends MoodElement {
126
- potion;
127
- maxPricePerTurn;
128
- constructor(potion, maxPricePerTurn) {
129
- super();
130
- this.potion = potion;
131
- this.maxPricePerTurn = maxPricePerTurn;
132
- }
133
- execute(mood, ensureTurns) {
134
- // FIXME: Smarter buying logic.
135
- // FIXME: Allow constructing stuff (e.g. snow cleats)
136
- const effect = effectModifier(this.potion, "Effect");
137
- const effectTurns = haveEffect(effect);
138
- const turnsPerUse = numericModifier(this.potion, "Effect Duration");
139
- if (mallPrice(this.potion) > this.maxPricePerTurn * turnsPerUse) {
140
- return false;
141
- }
142
- // integer part
143
- if (effectTurns < ensureTurns) {
144
- const uses = Math.floor((ensureTurns - effectTurns) / turnsPerUse);
145
- const quantityToBuy = clamp(uses - availableAmount(this.potion), 0, 100);
146
- buy(quantityToBuy, this.potion, Math.floor(this.maxPricePerTurn * turnsPerUse));
147
- const quantityToUse = clamp(uses, 0, availableAmount(this.potion));
148
- use(quantityToUse, this.potion);
149
- }
150
- // fractional part
151
- const remainingDifference = ensureTurns - haveEffect(effect);
152
- if (remainingDifference > 0) {
153
- const maxPrice = Math.floor(this.maxPricePerTurn * remainingDifference);
154
- if (mallPrice(this.potion) <= maxPrice) {
155
- if (availableAmount(this.potion) || buy(1, this.potion, maxPrice)) {
156
- use(1, this.potion);
157
- }
158
- }
159
- }
160
- return haveEffect(effect) >= ensureTurns;
161
- }
162
- }
163
- class GenieMoodElement extends MoodElement {
164
- effect;
165
- constructor(effect) {
166
- super();
167
- this.effect = effect;
168
- }
169
- execute(mood, ensureTurns) {
170
- if (haveEffect(this.effect) >= ensureTurns)
171
- return true;
172
- const neededWishes = Math.ceil((haveEffect(this.effect) - ensureTurns) / 20);
173
- const wishesToBuy = clamp(neededWishes - availableAmount($item `pocket wish`), 0, 20);
174
- buy(wishesToBuy, $item `pocket wish`, 50000);
175
- let wishesToUse = clamp(neededWishes, 0, availableAmount($item `pocket wish`));
176
- for (; wishesToUse > 0; wishesToUse--) {
177
- cliExecute(`genie effect ${this.effect.name}`);
178
- }
179
- return haveEffect(this.effect) >= ensureTurns;
180
- }
181
- }
182
- class CustomMoodElement extends MoodElement {
183
- effect;
184
- gainEffect;
185
- constructor(effect, gainEffect) {
186
- super();
187
- this.effect = effect;
188
- this.gainEffect = gainEffect ?? (() => cliExecute(effect.default));
189
- }
190
- execute(mood, ensureTurns) {
191
- let currentTurns = haveEffect(this.effect);
192
- let lastCurrentTurns = -1;
193
- while (currentTurns < ensureTurns && currentTurns !== lastCurrentTurns) {
194
- this.gainEffect();
195
- lastCurrentTurns = currentTurns;
196
- currentTurns = haveEffect(this.effect);
197
- }
198
- return haveEffect(this.effect) > ensureTurns;
199
- }
200
- }
201
- class AsdonMoodElement extends MoodElement {
202
- effect;
203
- preferInventory;
204
- constructor(effect, preferInventory = false) {
205
- super();
206
- this.effect = effect;
207
- this.preferInventory = preferInventory;
208
- }
209
- execute(mood, ensureTurns) {
210
- return AsdonMartin.drive(this.effect, ensureTurns, this.preferInventory);
211
- }
212
- }
213
- /**
214
- * Class representing a mood object. Add mood elements using the instance methods, which can be chained.
215
- */
216
- export class Mood {
217
- static defaultOptions = {
218
- songSlots: [],
219
- mpSources: [MagicalSausages.instance, OscusSoda.instance],
220
- reserveMp: 0,
221
- useNativeRestores: false,
222
- };
223
- /**
224
- * Set default options for new Mood instances.
225
- *
226
- * @param options Default options for new Mood instances.
227
- */
228
- static setDefaultOptions(options) {
229
- Mood.defaultOptions = { ...Mood.defaultOptions, ...options };
230
- }
231
- options;
232
- elements = [];
233
- /**
234
- * Construct a new Mood instance.
235
- *
236
- * @param options Options for mood.
237
- */
238
- constructor(options = {}) {
239
- this.options = { ...Mood.defaultOptions, ...options };
240
- }
241
- /**
242
- * Get the MP available for casting skills.
243
- *
244
- * @returns Available MP
245
- */
246
- availableMp() {
247
- return this.options.useNativeRestores
248
- ? Infinity
249
- : sum(this.options.mpSources, (mpSource) => mpSource.availableMpMin()) + Math.max(myMp() - this.options.reserveMp, 0);
250
- }
251
- moreMp(minimumTarget) {
252
- if (myMp() >= minimumTarget)
253
- return;
254
- for (const mpSource of this.options.mpSources) {
255
- if (mpSource.usesRemaining() > 0) {
256
- mpSource.execute();
257
- if (myMp() >= minimumTarget)
258
- break;
259
- }
260
- }
261
- if (this.options.useNativeRestores) {
262
- restoreMp(minimumTarget);
263
- }
264
- }
265
- /**
266
- * Add a skill to the mood.
267
- *
268
- * @param skill Skill to add.
269
- * @returns This mood to enable chaining
270
- */
271
- skill(skill) {
272
- this.elements.push(new SkillMoodElement(skill));
273
- return this;
274
- }
275
- /**
276
- * Add an effect to the mood, with casting based on {effect.default}.
277
- *
278
- * @param effect Effect to add.
279
- * @param gainEffect How to gain the effect. Only runs if we don't have the effect.
280
- * @returns This mood to enable chaining
281
- */
282
- effect(effect, gainEffect) {
283
- const skill = toSkill(effect);
284
- if (!gainEffect && skill !== $skill.none) {
285
- this.skill(skill);
286
- }
287
- else {
288
- this.elements.push(new CustomMoodElement(effect, gainEffect));
289
- }
290
- return this;
291
- }
292
- /**
293
- * Add a potion to the mood.
294
- *
295
- * @param potion Potion to add.
296
- * @param maxPricePerTurn Maximum price to pay per turn of the effect.
297
- * @returns This mood to enable chaining
298
- */
299
- potion(potion, maxPricePerTurn) {
300
- this.elements.push(new PotionMoodElement(potion, maxPricePerTurn));
301
- return this;
302
- }
303
- /**
304
- * Add an effect to acquire via pocket wishes to the mood.
305
- *
306
- * @param effect Effect to wish for in the mood.
307
- * @returns This mood to enable chaining
308
- */
309
- genie(effect) {
310
- this.elements.push(new GenieMoodElement(effect));
311
- return this;
312
- }
313
- /**
314
- * Add an Asdon Martin driving style to the mood.
315
- *
316
- * @param effect Driving style to add to the mood.
317
- * @returns This mood to enable chaining
318
- */
319
- drive(effect) {
320
- if (Object.values(AsdonMartin.Driving).includes(effect) &&
321
- AsdonMartin.installed()) {
322
- this.elements.push(new AsdonMoodElement(effect));
323
- }
324
- return this;
325
- }
326
- /**
327
- * Execute the mood, trying to ensure {ensureTurns} of each effect.
328
- *
329
- * @param ensureTurns Turns of each effect to try and achieve.
330
- * @returns Whether or not we successfully got this many turns of every effect in the mood.
331
- */
332
- execute(ensureTurns = 1) {
333
- const availableMp = this.availableMp();
334
- const totalMpPerTurn = sum(this.elements, (element) => element.mpCostPerTurn());
335
- const potentialTurns = Math.floor(availableMp / totalMpPerTurn);
336
- let completeSuccess = true;
337
- for (const element of this.elements) {
338
- let elementTurns = ensureTurns;
339
- if (element.mpCostPerTurn() > 0) {
340
- const elementPotentialTurns = Math.floor(potentialTurns / element.turnIncrement()) *
341
- element.turnIncrement();
342
- elementTurns = Math.min(ensureTurns, elementPotentialTurns);
343
- }
344
- completeSuccess = element.execute(this, elementTurns) && completeSuccess;
345
- }
346
- this.moreMp(this.options.reserveMp);
347
- return completeSuccess;
348
- }
349
- }
@@ -1,13 +0,0 @@
1
- declare const MoonSigns: readonly ["Mongoose", "Wallaby", "Vole", "Platypus", "Opossum", "Marmot", "Wombat", "Blender", "Packrat"];
2
- export declare type MoonSign = typeof MoonSigns[number];
3
- /**
4
- * @param moon Moon sign name
5
- * @returns Moon sign id else 0
6
- */
7
- export declare function signNameToId(moon: MoonSign): number;
8
- /**
9
- * @param id Moon sign id
10
- * @returns Name of moon sign else "None"
11
- */
12
- export declare function signIdToName(id: number): MoonSign | "None";
13
- export {};