-
Notifications
You must be signed in to change notification settings - Fork 1
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
Adding the Choice of Balance event and aura system #102
base: mystery-battle-events
Are you sure you want to change the base?
Changes from all commits
6accb0b
a195509
13b4f1d
0479f44
75c81a0
d631564
02643ef
92c7ec4
f1ea6b2
dfbc129
55611ea
bbc9497
018c290
c825f1f
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 |
---|---|---|
|
@@ -69,7 +69,7 @@ import { TimedEventManager } from "#app/timed-event-manager.js"; | |
import i18next from "i18next"; | ||
import IMysteryEncounter, { MysteryEncounterTier, MysteryEncounterVariant } from "./data/mystery-encounters/mystery-encounter"; | ||
import { mysteryEncountersByBiome, allMysteryEncounters, BASE_MYSTERY_ENCOUNTER_SPAWN_WEIGHT, AVERAGE_ENCOUNTERS_PER_RUN_TARGET, WIGHT_INCREMENT_ON_SPAWN_MISS } from "./data/mystery-encounters/mystery-encounters"; | ||
import { MysteryEncounterData } from "#app/data/mystery-encounters/mystery-encounter-data"; | ||
import { MysteryEncounterData, MysteryEncounterAuras, AuraType } from "#app/data/mystery-encounters/mystery-encounter-data"; | ||
import { MysteryEncounterType } from "#enums/mystery-encounter-type"; | ||
|
||
export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1"; | ||
|
@@ -216,6 +216,7 @@ export default class BattleScene extends SceneBase { | |
public pokemonInfoContainer: PokemonInfoContainer; | ||
private party: PlayerPokemon[]; | ||
public mysteryEncounterData: MysteryEncounterData = new MysteryEncounterData(null); | ||
public mysteryEncounterAuras: MysteryEncounterAuras = new MysteryEncounterAuras(); | ||
public lastMysteryEncounter: IMysteryEncounter; | ||
/** Combined Biome and Wave count text */ | ||
private biomeWaveText: Phaser.GameObjects.Text; | ||
|
@@ -2151,12 +2152,23 @@ export default class BattleScene extends SceneBase { | |
} | ||
|
||
addMoney(amount: integer): void { | ||
this.money = Math.min(this.money + amount, Number.MAX_SAFE_INTEGER); | ||
const mysteryIncomeAura = this.mysteryEncounterAuras.FindAura(AuraType.INCOME); | ||
const mysteryIncomeMult = 1 + (mysteryIncomeAura.length > 0 ? this.mysteryEncounterAuras.FindAuraTotals(AuraType.INCOME) : 0); | ||
this.money = Math.min(this.money + Math.floor(amount * mysteryIncomeMult), Number.MAX_SAFE_INTEGER); | ||
this.updateMoneyText(); | ||
this.animateMoneyChanged(true); | ||
this.validateAchvs(MoneyAchv); | ||
} | ||
|
||
getFormattedMoneyString(moneyAmount: number): string { | ||
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. 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 mysteryIncomeAura = this.mysteryEncounterAuras.FindAura(AuraType.INCOME); | ||
const mysteryIncomeMult = 1 + (mysteryIncomeAura.length > 0 ? this.mysteryEncounterAuras.FindAuraTotals(AuraType.INCOME) : 0); | ||
const formattedMoneyAmount = (moneyAmount * mysteryIncomeMult).toLocaleString(userLocale); | ||
const message = i18next.t("battle:moneyWon", { moneyAmount: formattedMoneyAmount }); | ||
return message; | ||
} | ||
|
||
getWaveMoneyAmount(moneyMultiplier: number): integer { | ||
const waveIndex = this.currentBattle.waveIndex; | ||
const waveSetIndex = Math.ceil(waveIndex / 10) - 1; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ import { Moves } from "#enums/moves"; | |
import { PlayerGender } from "#enums/player-gender"; | ||
import { Species } from "#enums/species"; | ||
import { TrainerType } from "#enums/trainer-type"; | ||
import i18next from "#app/plugins/i18n"; | ||
//import i18next from "#app/plugins/i18n"; | ||
import IMysteryEncounter, { MysteryEncounterVariant } from "./data/mystery-encounters/mystery-encounter"; | ||
|
||
export enum BattleType { | ||
|
@@ -177,9 +177,10 @@ export default class Battle { | |
|
||
scene.addMoney(moneyAmount.value); | ||
|
||
const userLocale = navigator.language || "en-US"; | ||
const formattedMoneyAmount = moneyAmount.value.toLocaleString(userLocale); | ||
const message = i18next.t("battle:moneyPickedUp", { moneyAmount: formattedMoneyAmount }); | ||
//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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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 |
||
scene.queueMessage(message, null, true); | ||
|
||
scene.currentBattle.moneyScattered = 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.
Just leaving a comment here so I don’t forget, this functionality should probably be moved to an applyModifiers() function