Adding the Choice of Balance event and aura system#102
Conversation
|
|
||
| addMoney(amount: integer): void { | ||
| this.money = Math.min(this.money + amount, Number.MAX_SAFE_INTEGER); | ||
| const mysteryIncomeAura = this.mysteryEncounterAuras.FindAura(AuraType.INCOME); |
There was a problem hiding this comment.
Just leaving a comment here so I don’t forget, this functionality should probably be moved to an applyModifiers() function
| this.validateAchvs(MoneyAchv); | ||
| } | ||
|
|
||
| getFormattedMoneyString(moneyAmount: number): string { |
There was a problem hiding this comment.
Why are we having to multiply the current money value in the string by modifiers? Shouldn’t this just be a function to obtain a string.
| //const userLocale = navigator.language || "en-US"; | ||
| //const formattedMoneyAmount = moneyAmount.value.toLocaleString(userLocale); | ||
| //const message = i18next.t("battle:moneyPickedUp", { moneyAmount: formattedMoneyAmount }); | ||
| const message = this.scene.getFormattedMoneyString(moneyAmount.value); |
There was a problem hiding this comment.
Similar to above, you should probably move the logic of that function back to here where it was before, or at least have the util function in this class
| encounter.misc.push(rewardsArray[i]); | ||
| } | ||
|
|
||
| encounter.setDialogueToken("dynamic1", rewardsArray[0].generateMessage()); |
There was a problem hiding this comment.
minor nit: can we have the names of these tokens be more descriptive to their function? "option1Tooltip" or something like that
| this.positiveOption = positiveOption; | ||
| } | ||
|
|
||
| generateMessage(): string { |
There was a problem hiding this comment.
This type of function is going to probably cause lots of issues with translations. Could we instead just have a few properly formatted string templates that are stored in the locales file? And you can inject the programmatic logic in via token instead
There was a problem hiding this comment.
Examples of a string template:
"augmentTextTemplate": "{{descriptor}} for {{duration}}"
"augmentTextJoiner": ", then "
etc.
There was a problem hiding this comment.
and to get the proper string, you would just do i18next.t("mysteryEncounter:augmentTextTemplate", { descriptor: this.getDescriptorText(negativeText), duration: this.formattedWaves(negativeDuration) });
| break; | ||
| // These are for money rewards | ||
| case PositiveRewards.INSTANT_MONEY: | ||
| newStrength = "$" + String(strength); |
There was a problem hiding this comment.
there is a proper "poke dollar" character you can use.
| //} | ||
| } | ||
|
|
||
| private formattedStrengths(type: number, strength: number): string { |
There was a problem hiding this comment.
I'd recommend moving this function to i18n formatters. Check out this example:
PokeRogue-Events/src/plugins/i18n.ts
Line 142 in ec49cd0
| } | ||
| } | ||
|
|
||
| export class MysteryEncounterAuras { |
There was a problem hiding this comment.
just a note/reminder since we've already discussed. This logic can probably sit in Modifier class extensions :)
✅ Deploy Preview for pokerogue-mystery-encounter-beta ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
What are the changes?
Starting to add the Choice of Balance event and aura system to go with it
Why am I doing these changes?
What did change?
Screenshots/Videos
How to test the changes?
Checklist
npm run test)