-
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?
Conversation
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.
Tentative approval. I'm concerned there may be other queue manipulators not being accounted for in your python script--it doesn't look like it checks for both the turtlesexy and the turtlesexless. But also I think we can just assume people have turtlesex; it's 300k and an autoperm, apparently
export function barfEncounterRate(options: { | ||
snapper?: boolean; | ||
snapperPhylum?: Phylum; | ||
olfact?: Monster; | ||
longCon?: Monster; | ||
motif?: Monster; | ||
turtle?: Monster; | ||
monkeyPoint?: Monster; | ||
humanity?: boolean; | ||
}): Map<Monster, number> { |
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.
just make this a Partial
const copies = (target: Monster | null, n: number): Monster[] => | ||
n === 0 ? [] : [...zoneMonsters.filter((m) => m === target), ...copies(target, n - 1)]; |
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.
I feel like a .fill
solution will be more performant and legible than the recursive one
const copies = (target: Monster | null, n: number): Monster[] => | ||
n === 0 ? [] : [...zoneMonsters.filter((m) => m === target), ...copies(target, n - 1)]; | ||
|
||
const monsterQueue = [ |
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.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
monsterPool
?
if (cachedValue) { | ||
return cachedValue; | ||
} |
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.
if (cachedValue) { | |
return cachedValue; | |
} | |
if (cachedValue) return cachedValue; |
...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 comment
The reason will be displayed to describe this comment to others. Learn more.
I have had trouble with polyfilling flatMap
before; definitely make sure this works the way you want it to
const encounters = monsterQueue.flatMap((m) => | ||
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 comment
The reason will be displayed to describe this comment to others. Learn more.
olfact === m || longCon === m || motif === m || !encounterQueue.includes(m) ? m : n, | |
[olfact, longCon, motif].includes(m) && !encounterQueue.includes(m) ? m : n, |
|
||
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 comment
The reason will be displayed to describe this comment to others. Learn more.
I think I prefer m.name
here but I think using the template literal below makes sense so maybe being consistent within this area is better
.flatMap((m) => copies(m, 2)), | ||
]; | ||
|
||
const encounters = monsterQueue.flatMap((m) => |
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.
I don't understand what this variable is meant to represent
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.
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.
I know that you're working on a whole new thing for this, but just as a reminder one decision we made in discord is that alongside this we should always print marginal familiar printouts in barf, not just when we pick marginal over it, and for snapper specifically we should add a |
const dudeRate = [...encounterRate.entries()].reduce( | ||
(acc: number, entry: [Monster, number]) => | ||
entry[0].phylum === $phylum`dude` ? entry[1] + acc : acc, | ||
0, | ||
); |
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.
const dudeRate = [...encounterRate.entries()].reduce( | |
(acc: number, entry: [Monster, number]) => | |
entry[0].phylum === $phylum`dude` ? entry[1] + acc : acc, | |
0, | |
); | |
const dudeRate = sum([...encounterRate.entries()], ([monster, weight]) => monster.phylum === $phylum`dude` ? weight : 0); |
No description provided.