Repository navigation
Conversation
| * @param effect the fountain effect you want to gain | ||
| * @returns whether you successfully gained the effect | ||
| */ | ||
| export function useBloodFountain(effect: Effect): boolean { |
There was a problem hiding this comment.
optional but cool: make a string union type to represent the effects a la AprilingBandHelmet
There was a problem hiding this comment.
What's the advantage of this?
| const choices = new Map<number, RoseChoice>(); | ||
|
|
||
| for (const { decision, extras_joined, label } of Object.values( | ||
| availableChoiceExtras(), | ||
| )) { | ||
| const monsterText = label.match(/^Fight (.+) at position \d+,\d+$/); | ||
|
|
||
| if (monsterText) continue; | ||
|
|
||
| choices.set(decision, { | ||
| text: label, | ||
| extras: extras_joined, | ||
| }); | ||
| } |
There was a problem hiding this comment.
to clarify: when I said "this all can be a .map call", I meant that you could do
const choices = Object.values(availableChoiceExtras).map(({ decision, extras_joined, label }) => stuff);
There was a problem hiding this comment.
I didn't make this change because I don't understand how this works any differently than what I've got.
spaghetti-squash
left a comment
There was a problem hiding this comment.
Two more general comments that can't really be targeted at a specific thing:
- This is failing linting because you need to bump the
VERIFY_CONSTANTS_SINCEvalue. - I think this operates in a moderately counterintuitive and potentially problematic but probably fine way, and that is that it "enters" the garden implicitly in the
getChoicesfunction. This is weird because it means we have a really important side-effect hidden in a function whose name suggests it's purely informational. I would look at the implementation of AutumnAton and ChestMimic for design patterns that handle the situation more appropriately. In particular, many of these functions will leave the user "in the garden", which can interfere withhandlingChoicechecks elsewhere in the code. That part we need to resolve regardless of whether we plan to restructure thegetChoicessituation
|
|
||
| if (!fountain) return false; | ||
|
|
||
| runChoice(fountain.decision, `${fountain.extras}&option=${buff.option}`); |
There was a problem hiding this comment.
This is a very odd runChoice call, are you sure it's correct? You're essentially double-sending the option URL parameter, first as fountain.decision and second as buff.option. I suspect we want to do two consecutive runChoices, the first with fountain.decision and fountain.extras, and the second time with just buff.option; when I navigated around in my browser, the two calls I got were
whichchoice=1637&pwd=REDACTED&option=1&rgpoi=2&rgx=16&rgy=19&rgf=1
pwd=REDACTED&whichchoice=1639&option=1
| FOUNTAIN_OPTIONS.map((ef) => toEffect(ef)), | ||
| ); | ||
|
|
||
| export type FountainEffect = (typeof FOUNTAIN_EFFECTS)[number]; |
There was a problem hiding this comment.
This type is identical to Effect. It does nothing. Look at the types used by functions like AprilingBandHelmet.joinSection or AprilingBandHelmet.changeSong; they accept a string union type (i.e., (typeof FOUNTAIN_OPTIONS)[number] unioned with a MafiaClass (i.e., Effect). All you've done here is create an alias for effect
There was a problem hiding this comment.
The fuller thing you need to do is:
- update this type to reference
FOUNTAIN_OPTIONS, giving you the union type you need - Either throw a
| Effectat the end of this type or change the input type ofuseBloodFountainto beFountainEffect | Effect, dealer's choice. - either way, add some quick little step to
useBloodFountainwhere we take the input and use some quick ternary (either withtypeoforinstanceof, dealer's choice) to map both cases to anEffect.
| /** | ||
| * @returns whether you successfully retrieved all free rose garden items | ||
| */ | ||
| export function obtainItems(): boolean { |
There was a problem hiding this comment.
Is it worth returning the items we obtain, or is that not really practical? I think obtaining items is essentially costless, so I can understand having just a "get them all" function with no "what are they" function, but it still feels like the results would be a better return value than just a boolean.
No description provided.