-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support snapper as a familiar #1578
base: main
Are you sure you want to change the base?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -34,6 +34,7 @@ import { | |||||||||
mySoulsauce, | ||||||||||
myTurncount, | ||||||||||
numericModifier, | ||||||||||
Phylum, | ||||||||||
print, | ||||||||||
printHtml, | ||||||||||
restoreHp, | ||||||||||
|
@@ -60,6 +61,8 @@ import { | |||||||||
$item, | ||||||||||
$location, | ||||||||||
$monster, | ||||||||||
$monsters, | ||||||||||
$phylum, | ||||||||||
$skill, | ||||||||||
$slot, | ||||||||||
ActionSource, | ||||||||||
|
@@ -80,6 +83,7 @@ import { | |||||||||
PropertiesManager, | ||||||||||
property, | ||||||||||
set, | ||||||||||
Snapper, | ||||||||||
SongBoom, | ||||||||||
sum, | ||||||||||
uneffect, | ||||||||||
|
@@ -683,3 +687,80 @@ export function printEventLog(): void { | |||||||||
); | ||||||||||
} | ||||||||||
} | ||||||||||
|
||||||||||
const rateCache = new Map<string, Map<Monster, number>>(); | ||||||||||
|
||||||||||
export function barfEncounterRate(options: { | ||||||||||
snapper?: boolean; | ||||||||||
snapperPhylum?: Phylum; | ||||||||||
olfact?: Monster; | ||||||||||
longCon?: Monster; | ||||||||||
motif?: Monster; | ||||||||||
turtle?: Monster; | ||||||||||
monkeyPoint?: Monster; | ||||||||||
humanity?: boolean; | ||||||||||
}): Map<Monster, number> { | ||||||||||
Comment on lines
+693
to
+702
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just make this a |
||||||||||
const olfact = options.olfact ?? get("olfactedMonster"); | ||||||||||
const longCon = options.longCon ?? get("longConMonster"); | ||||||||||
const motif = options.motif ?? get("motifMonster"); | ||||||||||
const turtle = options.turtle ?? get("_gallapagosMonster"); | ||||||||||
const monkeyPoint = options.monkeyPoint ?? get("monkeyPointMonster"); | ||||||||||
const snapper = options.snapper ?? myFamiliar() === $familiar`Red-Nosed Snapper`; | ||||||||||
const snapperPhylum = options.snapperPhylum ?? Snapper.getTrackedPhylum(); | ||||||||||
const humanity = options.humanity ?? have($effect`Ew, The Humanity`); | ||||||||||
horrible-little-slime marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
|
||||||||||
const zoneMonsters = $monsters`garbage tourist, angry tourist, horrible tourist family`; | ||||||||||
const encounterQueue = zoneMonsters.filter((m) => | ||||||||||
$location`Barf Mountain`.combatQueue.includes(`${m}`), | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I prefer |
||||||||||
); | ||||||||||
|
||||||||||
const cacheKey = [ | ||||||||||
olfact, | ||||||||||
longCon, | ||||||||||
motif, | ||||||||||
turtle, | ||||||||||
monkeyPoint, | ||||||||||
snapper, | ||||||||||
snapperPhylum, | ||||||||||
humanity, | ||||||||||
...encounterQueue, | ||||||||||
] | ||||||||||
.map((v) => `${v}`) | ||||||||||
.join(":"); | ||||||||||
|
||||||||||
const cachedValue = rateCache.get(cacheKey); | ||||||||||
if (cachedValue) { | ||||||||||
return cachedValue; | ||||||||||
} | ||||||||||
Comment on lines
+732
to
+734
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
const copies = (target: Monster | null, n: number): Monster[] => | ||||||||||
n === 0 ? [] : [...zoneMonsters.filter((m) => m === target), ...copies(target, n - 1)]; | ||||||||||
Comment on lines
+736
to
+737
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel like a |
||||||||||
|
||||||||||
const monsterQueue = [ | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. call this the CSV, not the queue. Or call it some other thing. But don't call it the queue There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||||
...zoneMonsters, | ||||||||||
...copies(olfact, 3), | ||||||||||
...copies(longCon, 3), | ||||||||||
...copies(motif, 2), | ||||||||||
...copies(turtle, 1), | ||||||||||
...copies(monkeyPoint, 2), | ||||||||||
...zoneMonsters | ||||||||||
.filter((m) => snapper && m.phylum === snapperPhylum) | ||||||||||
.flatMap((m) => copies(m, 2)), | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have had trouble with polyfilling |
||||||||||
...zoneMonsters | ||||||||||
.filter((m) => humanity && m.phylum === $phylum`dude`) | ||||||||||
.flatMap((m) => copies(m, 2)), | ||||||||||
]; | ||||||||||
|
||||||||||
const encounters = monsterQueue.flatMap((m) => | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand what this variable is meant to represent There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. update: I think I might understand it, but if I do then it's not quite right: we only reroll 75% of the time, but even a reroll can reroll. This math is really hard to do--slaw wrote a big ol' thesis about it. I think we have to do it numerically instead of analytically. |
||||||||||
monsterQueue.map((n) => | ||||||||||
// olfaction, longcon, and motif caus that monster to ignore queue rejection | ||||||||||
olfact === m || longCon === m || motif === m || !encounterQueue.includes(m) ? m : n, | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
), | ||||||||||
); | ||||||||||
|
||||||||||
const encounterRate = new Map<Monster, number>( | ||||||||||
zoneMonsters.map((m) => [m, encounters.filter((n) => n === m).length / encounters.length]), | ||||||||||
); | ||||||||||
rateCache.set(cacheKey, encounterRate); | ||||||||||
return encounterRate; | ||||||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.