diff --git a/src/lib.ts b/src/lib.ts index 333cd0f..8e727c4 100644 --- a/src/lib.ts +++ b/src/lib.ts @@ -36,6 +36,7 @@ import { toStat, use, useSkill, + visitUrl, } from "kolmafia"; import { $effect, @@ -54,6 +55,7 @@ import { getKramcoWandererChance, have, haveInCampground, + maxBy, set, SongBoom, sumNumbers, @@ -808,3 +810,77 @@ export function checkPull(item: Item): boolean { return true; return false; } + +export function goVote(): void { + const initPriority: Map = new Map([ + ["Weapon Damage Percent: +100", 5], + ["Item Drop: +15", 4], + ["Booze Drop: +30", 4], + ["Monster Level: +10", 3], + [`${mainStat} Percent: +25`, 3], + ["Adventures: +1", 3], + ["Spell Damage Percent: +20", 3], + ["Familiar Experience: +2", 2], + [`Experience (${mainStat}): +4`, 2], + ["Hot Resistance: +3", 2], + ["Meat Drop: +30", 1], + [`Experience: +3`, 1], + ["Meat Drop: -30", -2], + ["Item Drop: -15", -4], + ["Familiar Experience: -2", -4], + [`Experience: -3`, -4], + [`Maximum HP Percent: -50`, -4], + ["Weapon Damage Percent: -50", -6], + ["Spell Damage Percent: -50", -6], + ["Adventures: -2", -6], + ]); + + const voteLocalPriorityArr = [1, 2, 3, 4].map((index) => ({ + urlString: index - 1, + value: + initPriority.get(get(`_voteLocal${index}`)) ?? + (get(`_voteLocal${index}`).includes("-") ? -1 : 1), + })); + + const init = maxBy(voteLocalPriorityArr, "value").urlString; + + //Dear Panto, + //For the purposes of this script it *makes sense* to rotate through monsters like Garbo would, but it is less than optimal. + //Optimal would be always pick terrible mutant. It offers a small benefit to some people (+wDmg%). However, this could warp the voters space. + //If you would prefer to exclude this code, let me know and I will revert. If you would prefer another solution, let me know. + //For now, I have chosen optimal. Terrible mutant when we can, likely profit when we can't, outfit stuff last. + const voterValueTable = [ + { + monster: $monster`terrible mutant`, + value: 3, + }, + { + monster: $monster`angry ghost`, + value: 2, + }, + { + monster: $monster`government bureaucrat`, + value: 2, + }, + { + monster: $monster`annoyed snake`, + value: 1, + }, + { + monster: $monster`slime blob`, + value: 1, + }, + ]; + + const votingMonsterPriority = voterValueTable + .sort((a, b) => b.value - a.value) + .map((element) => element.monster.name); + + const monsterVote = + votingMonsterPriority.indexOf(get("_voteMonster1")) < + votingMonsterPriority.indexOf(get("_voteMonster2")) + ? 1 + : 2; + + visitUrl(`choice.php?option=1&whichchoice=1331&g=${monsterVote}&local[]=${init}&local[]=${init}`); +} diff --git a/src/tasks/runstart.ts b/src/tasks/runstart.ts index 2df556b..5aa4245 100644 --- a/src/tasks/runstart.ts +++ b/src/tasks/runstart.ts @@ -49,7 +49,6 @@ import { $monster, $skill, $slot, - byClass, clamp, CommunityService, get, @@ -62,7 +61,7 @@ import { } from "libram"; import { canConfigure, setConfiguration, Station } from "libram/dist/resources/2022/TrainSet"; import { Quest } from "../engine/task"; -import { getGarden, statToMaximizerString, tryAcquiringEffect } from "../lib"; +import { getGarden, goVote, statToMaximizerString, tryAcquiringEffect } from "../lib"; import Macro from "../combat"; import { mapMonster } from "libram/dist/resources/2020/Cartography"; import { baseOutfit, chooseFamiliar, unbreakableUmbrella } from "../engine/outfit"; @@ -73,16 +72,6 @@ const bestSIT = ? 1 : 2; -const BEST_INITIATIVE = byClass({ - "Seal Clubber": 2, // Familiar exp: 2 - "Turtle Tamer": 0, // Weapon Damage Percent: 100 - "Disco Bandit": 0, // Maximum MP Percent: 30 - "Accordion Thief": 2, // Booze Drop: 30 - Pastamancer: 2, // Weapon Damage Percent: 2 - Sauceror: 1, // Exp: 3 - default: 0, -}); - const useParkaSpit = have($item`Fourth of May Cosplay Saber`) && have($skill`Feel Envy`); export const RunStartQuest: Quest = { name: "Run Start", @@ -375,10 +364,7 @@ export const RunStartQuest: Quest = { completed: () => have($item`"I Voted!" sticker`) || !get("voteAlways"), do: (): void => { visitUrl("place.php?whichplace=town_right&action=townright_vote"); - visitUrl( - `choice.php?option=1&whichchoice=1331&g=2&local%5B%5D=${BEST_INITIATIVE}&local%5B%5D=${BEST_INITIATIVE}` - ); - visitUrl("place.php?whichplace=town_right&action=townright_vote"); + goVote(); }, }, {