Skip to content

Commit

Permalink
Improved Voters!
Browse files Browse the repository at this point in the history
  • Loading branch information
Ignose committed Nov 9, 2023
1 parent 75b0a72 commit 96350f2
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 16 deletions.
76 changes: 76 additions & 0 deletions src/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {
toStat,
use,
useSkill,
visitUrl,
} from "kolmafia";
import {
$effect,
Expand All @@ -54,6 +55,7 @@ import {
getKramcoWandererChance,
have,
haveInCampground,
maxBy,
set,
SongBoom,
sumNumbers,
Expand Down Expand Up @@ -808,3 +810,77 @@ export function checkPull(item: Item): boolean {
return true;
return false;
}

export function goVote(): void {
const initPriority: Map<string, number> = 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}`);
}
18 changes: 2 additions & 16 deletions src/tasks/runstart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ import {
$monster,
$skill,
$slot,
byClass,
clamp,
CommunityService,
get,
Expand All @@ -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";
Expand All @@ -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",
Expand Down Expand Up @@ -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();
},
},
{
Expand Down

0 comments on commit 96350f2

Please sign in to comment.