[Refactor] Another Audio clean up (#4077)
* Cleaned up how cry keys were retrieved * Legendary Pokemon Changes + Cry Cleanup * Spelling mistake * Fixed settings. * correcting typedocs * eslint * eslint cleanup * music pref * gdfafa * Music * Apply suggestions from code review Co-authored-by: PigeonBar <56974298+PigeonBar@users.noreply.github.com> * Update src/battle.ts Co-authored-by: PigeonBar <56974298+PigeonBar@users.noreply.github.com> * Update src/battle.ts Co-authored-by: PigeonBar <56974298+PigeonBar@users.noreply.github.com> * fixed default * Apply suggestions from code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Added changes * Update src/battle-scene.ts Co-authored-by: Adrian T. <68144167+torranx@users.noreply.github.com> * Fix variable usage * Fix `getFormSpriteKey()` and `.concat()` usage Co-authored-by: PigeonBar <56974298+PigeonBar@users.noreply.github.com> * asdsafafaf * i need to do the dishes ughhh --------- Co-authored-by: frutescens <info@laptop> Co-authored-by: PigeonBar <56974298+PigeonBar@users.noreply.github.com> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: Adrian T. <68144167+torranx@users.noreply.github.com> Co-authored-by: Tempoanon <163687446+Tempo-anon@users.noreply.github.com>
This commit is contained in:
parent
770f388c45
commit
3a767ed38a
|
@ -13,6 +13,7 @@ import { Arena, ArenaBase } from "#app/field/arena";
|
|||
import { GameData } from "#app/system/game-data";
|
||||
import { addTextObject, getTextColor, TextStyle } from "#app/ui/text";
|
||||
import { allMoves } from "#app/data/move";
|
||||
import { MusicPreference } from "#app/system/settings/settings";
|
||||
import { getDefaultModifierTypeForTier, getEnemyModifierTypesForWave, getLuckString, getLuckTextTint, getModifierPoolForType, getModifierType, getPartyLuckValue, ModifierPoolType, modifierTypes, PokemonHeldItemModifierType } from "#app/modifier/modifier-type";
|
||||
import AbilityBar from "#app/ui/ability-bar";
|
||||
import { allAbilities, applyAbAttrs, applyPostBattleInitAbAttrs, applyPostItemLostAbAttrs, BlockItemTheftAbAttr, DoubleBattleChanceAbAttr, PostBattleInitAbAttr, PostItemLostAbAttr } from "#app/data/ability";
|
||||
|
@ -169,7 +170,7 @@ export default class BattleScene extends SceneBase {
|
|||
public uiTheme: UiTheme = UiTheme.DEFAULT;
|
||||
public windowType: integer = 0;
|
||||
public experimentalSprites: boolean = false;
|
||||
public musicPreference: integer = 0;
|
||||
public musicPreference: number = MusicPreference.MIXED;
|
||||
public moveAnimations: boolean = true;
|
||||
public expGainsSpeed: ExpGainsSpeed = ExpGainsSpeed.DEFAULT;
|
||||
public skipSeenDialogues: boolean = false;
|
||||
|
@ -2998,22 +2999,16 @@ export default class BattleScene extends SceneBase {
|
|||
*/
|
||||
getActiveKeys(): string[] {
|
||||
const keys: string[] = [];
|
||||
const playerParty = this.getPlayerParty();
|
||||
playerParty.forEach(p => {
|
||||
let activePokemon: (PlayerPokemon | EnemyPokemon)[] = this.getPlayerParty();
|
||||
activePokemon = activePokemon.concat(this.getEnemyParty());
|
||||
activePokemon.forEach((p) => {
|
||||
keys.push(p.getSpriteKey(true));
|
||||
keys.push(p.getBattleSpriteKey(true, true));
|
||||
keys.push("cry/" + p.species.getCryKey(p.formIndex));
|
||||
if (p.fusionSpecies) {
|
||||
keys.push("cry/" + p.fusionSpecies.getCryKey(p.fusionFormIndex));
|
||||
if (p instanceof PlayerPokemon) {
|
||||
keys.push(p.getBattleSpriteKey(true, true));
|
||||
}
|
||||
});
|
||||
// enemyParty has to be operated on separately from playerParty because playerPokemon =/= enemyPokemon
|
||||
const enemyParty = this.getEnemyParty();
|
||||
enemyParty.forEach(p => {
|
||||
keys.push(p.getSpriteKey(true));
|
||||
keys.push("cry/" + p.species.getCryKey(p.formIndex));
|
||||
keys.push(p.species.getCryKey(p.formIndex));
|
||||
if (p.fusionSpecies) {
|
||||
keys.push("cry/" + p.fusionSpecies.getCryKey(p.fusionFormIndex));
|
||||
keys.push(p.fusionSpecies.getCryKey(p.fusionFormIndex));
|
||||
}
|
||||
});
|
||||
return keys;
|
||||
|
|
286
src/battle.ts
286
src/battle.ts
|
@ -6,11 +6,13 @@ import { GameMode } from "./game-mode";
|
|||
import { MoneyMultiplierModifier, PokemonHeldItemModifier } from "./modifier/modifier";
|
||||
import { PokeballType } from "./data/pokeball";
|
||||
import { trainerConfigs } from "#app/data/trainer-config";
|
||||
import { SpeciesFormKey } from "#enums/species-form-key";
|
||||
import Pokemon, { EnemyPokemon, PlayerPokemon, QueuedMove } from "#app/field/pokemon";
|
||||
import { ArenaTagType } from "#enums/arena-tag-type";
|
||||
import { BattleSpec } from "#enums/battle-spec";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { PlayerGender } from "#enums/player-gender";
|
||||
import { MusicPreference } from "#app/system/settings/settings";
|
||||
import { Species } from "#enums/species";
|
||||
import { TrainerType } from "#enums/trainer-type";
|
||||
import i18next from "#app/plugins/i18n";
|
||||
|
@ -212,7 +214,6 @@ export default class Battle {
|
|||
}
|
||||
|
||||
getBgmOverride(scene: BattleScene): string | null {
|
||||
const battlers = this.enemyParty.slice(0, this.getBattlerCount());
|
||||
if (this.isBattleMysteryEncounter() && this.mysteryEncounter?.encounterMode === MysteryEncounterMode.DEFAULT) {
|
||||
// Music is overridden for MEs during ME onInit()
|
||||
// Should not use any BGM overrides before swapping from DEFAULT mode
|
||||
|
@ -221,7 +222,7 @@ export default class Battle {
|
|||
if (!this.started && this.trainer?.config.encounterBgm && this.trainer?.getEncounterMessages()?.length) {
|
||||
return `encounter_${this.trainer?.getEncounterBgm()}`;
|
||||
}
|
||||
if (scene.musicPreference === 0) {
|
||||
if (scene.musicPreference === MusicPreference.CONSISTENT) {
|
||||
return this.trainer?.getBattleBgm() ?? null;
|
||||
} else {
|
||||
return this.trainer?.getMixedBattleBgm() ?? null;
|
||||
|
@ -229,147 +230,168 @@ export default class Battle {
|
|||
} else if (this.gameMode.isClassic && this.waveIndex > 195 && this.battleSpec !== BattleSpec.FINAL_BOSS) {
|
||||
return "end_summit";
|
||||
}
|
||||
for (const pokemon of battlers) {
|
||||
const wildOpponents = scene.getEnemyParty();
|
||||
for (const pokemon of wildOpponents) {
|
||||
if (this.battleSpec === BattleSpec.FINAL_BOSS) {
|
||||
if (pokemon.formIndex) {
|
||||
if (pokemon.species.getFormSpriteKey(pokemon.formIndex) === SpeciesFormKey.ETERNAMAX) {
|
||||
return "battle_final";
|
||||
}
|
||||
return "battle_final_encounter";
|
||||
}
|
||||
if (pokemon.species.legendary || pokemon.species.subLegendary || pokemon.species.mythical) {
|
||||
if (scene.musicPreference === 0) {
|
||||
if (pokemon.species.speciesId === Species.REGIROCK || pokemon.species.speciesId === Species.REGICE || pokemon.species.speciesId === Species.REGISTEEL || pokemon.species.speciesId === Species.REGIGIGAS || pokemon.species.speciesId === Species.REGIELEKI || pokemon.species.speciesId === Species.REGIDRAGO) {
|
||||
return "battle_legendary_regis_g5";
|
||||
if (scene.musicPreference === MusicPreference.CONSISTENT) {
|
||||
switch (pokemon.species.speciesId) {
|
||||
case Species.REGIROCK:
|
||||
case Species.REGICE:
|
||||
case Species.REGISTEEL:
|
||||
case Species.REGIGIGAS:
|
||||
case Species.REGIDRAGO:
|
||||
case Species.REGIELEKI:
|
||||
return "battle_legendary_regis_g5";
|
||||
case Species.KYUREM:
|
||||
return "battle_legendary_kyurem";
|
||||
default:
|
||||
if (pokemon.species.legendary) {
|
||||
return "battle_legendary_res_zek";
|
||||
}
|
||||
return "battle_legendary_unova";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.COBALION || pokemon.species.speciesId === Species.TERRAKION || pokemon.species.speciesId === Species.VIRIZION || pokemon.species.speciesId === Species.TORNADUS || pokemon.species.speciesId === Species.THUNDURUS || pokemon.species.speciesId === Species.LANDORUS || pokemon.species.speciesId === Species.KELDEO || pokemon.species.speciesId === Species.MELOETTA || pokemon.species.speciesId === Species.GENESECT) {
|
||||
return "battle_legendary_unova";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.KYUREM) {
|
||||
return "battle_legendary_kyurem";
|
||||
}
|
||||
if (pokemon.species.legendary) {
|
||||
return "battle_legendary_res_zek";
|
||||
}
|
||||
return "battle_legendary_unova";
|
||||
} else {
|
||||
if (pokemon.species.speciesId === Species.ARTICUNO || pokemon.species.speciesId === Species.ZAPDOS || pokemon.species.speciesId === Species.MOLTRES || pokemon.species.speciesId === Species.MEWTWO || pokemon.species.speciesId === Species.MEW) {
|
||||
return "battle_legendary_kanto";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.RAIKOU) {
|
||||
return "battle_legendary_raikou";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.ENTEI) {
|
||||
return "battle_legendary_entei";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.SUICUNE) {
|
||||
return "battle_legendary_suicune";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.LUGIA) {
|
||||
return "battle_legendary_lugia";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.HO_OH) {
|
||||
return "battle_legendary_ho_oh";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.REGIROCK || pokemon.species.speciesId === Species.REGICE || pokemon.species.speciesId === Species.REGISTEEL || pokemon.species.speciesId === Species.REGIGIGAS || pokemon.species.speciesId === Species.REGIELEKI || pokemon.species.speciesId === Species.REGIDRAGO) {
|
||||
return "battle_legendary_regis_g6";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.GROUDON || pokemon.species.speciesId === Species.KYOGRE) {
|
||||
return "battle_legendary_gro_kyo";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.RAYQUAZA) {
|
||||
return "battle_legendary_rayquaza";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.DEOXYS) {
|
||||
return "battle_legendary_deoxys";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.UXIE || pokemon.species.speciesId === Species.MESPRIT || pokemon.species.speciesId === Species.AZELF) {
|
||||
return "battle_legendary_lake_trio";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.HEATRAN || pokemon.species.speciesId === Species.CRESSELIA || pokemon.species.speciesId === Species.DARKRAI || pokemon.species.speciesId === Species.SHAYMIN) {
|
||||
return "battle_legendary_sinnoh";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.DIALGA || pokemon.species.speciesId === Species.PALKIA) {
|
||||
if (pokemon.getFormKey() === "") {
|
||||
} else if (scene.musicPreference === MusicPreference.MIXED) {
|
||||
switch (pokemon.species.speciesId) {
|
||||
case Species.ARTICUNO:
|
||||
case Species.ZAPDOS:
|
||||
case Species.MOLTRES:
|
||||
case Species.MEWTWO:
|
||||
case Species.MEW:
|
||||
return "battle_legendary_kanto";
|
||||
case Species.RAIKOU:
|
||||
return "battle_legendary_raikou";
|
||||
case Species.ENTEI:
|
||||
return "battle_legendary_entei";
|
||||
case Species.SUICUNE:
|
||||
return "battle_legendary_suicune";
|
||||
case Species.LUGIA:
|
||||
return "battle_legendary_lugia";
|
||||
case Species.HO_OH:
|
||||
return "battle_legendary_ho_oh";
|
||||
case Species.REGIROCK:
|
||||
case Species.REGICE:
|
||||
case Species.REGISTEEL:
|
||||
case Species.REGIGIGAS:
|
||||
case Species.REGIDRAGO:
|
||||
case Species.REGIELEKI:
|
||||
return "battle_legendary_regis_g6";
|
||||
case Species.GROUDON:
|
||||
case Species.KYOGRE:
|
||||
return "battle_legendary_gro_kyo";
|
||||
case Species.RAYQUAZA:
|
||||
return "battle_legendary_rayquaza";
|
||||
case Species.DEOXYS:
|
||||
return "battle_legendary_deoxys";
|
||||
case Species.UXIE:
|
||||
case Species.MESPRIT:
|
||||
case Species.AZELF:
|
||||
return "battle_legendary_lake_trio";
|
||||
case Species.HEATRAN:
|
||||
case Species.CRESSELIA:
|
||||
case Species.DARKRAI:
|
||||
case Species.SHAYMIN:
|
||||
return "battle_legendary_sinnoh";
|
||||
case Species.DIALGA:
|
||||
case Species.PALKIA:
|
||||
if (pokemon.species.getFormSpriteKey(pokemon.formIndex) === SpeciesFormKey.ORIGIN) {
|
||||
return "battle_legendary_origin_forme";
|
||||
}
|
||||
return "battle_legendary_dia_pal";
|
||||
}
|
||||
if (pokemon.getFormKey() === "origin") {
|
||||
return "battle_legendary_origin_forme";
|
||||
}
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.GIRATINA) {
|
||||
return "battle_legendary_giratina";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.ARCEUS) {
|
||||
return "battle_legendary_arceus";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.COBALION || pokemon.species.speciesId === Species.TERRAKION || pokemon.species.speciesId === Species.VIRIZION || pokemon.species.speciesId === Species.TORNADUS || pokemon.species.speciesId === Species.THUNDURUS || pokemon.species.speciesId === Species.LANDORUS || pokemon.species.speciesId === Species.KELDEO || pokemon.species.speciesId === Species.MELOETTA || pokemon.species.speciesId === Species.GENESECT) {
|
||||
return "battle_legendary_unova";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.KYUREM) {
|
||||
return "battle_legendary_kyurem";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.XERNEAS || pokemon.species.speciesId === Species.YVELTAL || pokemon.species.speciesId === Species.ZYGARDE) {
|
||||
return "battle_legendary_xern_yvel";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.TAPU_KOKO || pokemon.species.speciesId === Species.TAPU_LELE || pokemon.species.speciesId === Species.TAPU_BULU || pokemon.species.speciesId === Species.TAPU_FINI) {
|
||||
return "battle_legendary_tapu";
|
||||
}
|
||||
if ([ Species.COSMOG, Species.COSMOEM, Species.SOLGALEO, Species.LUNALA ].includes(pokemon.species.speciesId)) {
|
||||
return "battle_legendary_sol_lun";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.NECROZMA) {
|
||||
if (pokemon.getFormKey() === "") {
|
||||
case Species.GIRATINA:
|
||||
return "battle_legendary_giratina";
|
||||
case Species.ARCEUS:
|
||||
return "battle_legendary_arceus";
|
||||
case Species.COBALION:
|
||||
case Species.TERRAKION:
|
||||
case Species.VIRIZION:
|
||||
case Species.KELDEO:
|
||||
case Species.TORNADUS:
|
||||
case Species.LANDORUS:
|
||||
case Species.THUNDURUS:
|
||||
case Species.MELOETTA:
|
||||
case Species.GENESECT:
|
||||
return "battle_legendary_unova";
|
||||
case Species.KYUREM:
|
||||
return "battle_legendary_kyurem";
|
||||
case Species.XERNEAS:
|
||||
case Species.YVELTAL:
|
||||
case Species.ZYGARDE:
|
||||
return "battle_legendary_xern_yvel";
|
||||
case Species.TAPU_KOKO:
|
||||
case Species.TAPU_LELE:
|
||||
case Species.TAPU_BULU:
|
||||
case Species.TAPU_FINI:
|
||||
return "battle_legendary_tapu";
|
||||
case Species.SOLGALEO:
|
||||
case Species.LUNALA:
|
||||
return "battle_legendary_sol_lun";
|
||||
}
|
||||
if (pokemon.getFormKey() === "dusk-mane" || pokemon.getFormKey() === "dawn-wings") {
|
||||
return "battle_legendary_dusk_dawn";
|
||||
}
|
||||
if (pokemon.getFormKey() === "ultra") {
|
||||
return "battle_legendary_ultra_nec";
|
||||
}
|
||||
}
|
||||
if ([ Species.NIHILEGO, Species.BUZZWOLE, Species.PHEROMOSA, Species.XURKITREE, Species.CELESTEELA, Species.KARTANA, Species.GUZZLORD, Species.POIPOLE, Species.NAGANADEL, Species.STAKATAKA, Species.BLACEPHALON ].includes(pokemon.species.speciesId)) {
|
||||
return "battle_legendary_ub";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.ZACIAN || pokemon.species.speciesId === Species.ZAMAZENTA) {
|
||||
return "battle_legendary_zac_zam";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.GLASTRIER || pokemon.species.speciesId === Species.SPECTRIER) {
|
||||
return "battle_legendary_glas_spec";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.CALYREX) {
|
||||
if (pokemon.getFormKey() === "") {
|
||||
case Species.NECROZMA:
|
||||
switch (pokemon.getFormKey()) {
|
||||
case "dusk-mane":
|
||||
case "dawn-wings":
|
||||
return "battle_legendary_dusk_dawn";
|
||||
case "ultra":
|
||||
return "battle_legendary_ultra_nec";
|
||||
default:
|
||||
return "battle_legendary_sol_lun";
|
||||
}
|
||||
case Species.NIHILEGO:
|
||||
case Species.PHEROMOSA:
|
||||
case Species.BUZZWOLE:
|
||||
case Species.XURKITREE:
|
||||
case Species.CELESTEELA:
|
||||
case Species.KARTANA:
|
||||
case Species.GUZZLORD:
|
||||
case Species.POIPOLE:
|
||||
case Species.NAGANADEL:
|
||||
case Species.STAKATAKA:
|
||||
case Species.BLACEPHALON:
|
||||
return "battle_legendary_ub";
|
||||
case Species.ZACIAN:
|
||||
case Species.ZAMAZENTA:
|
||||
return "battle_legendary_zac_zam";
|
||||
case Species.GLASTRIER:
|
||||
case Species.SPECTRIER:
|
||||
return "battle_legendary_glas_spec";
|
||||
case Species.CALYREX:
|
||||
if (pokemon.getFormKey() === "ice" || pokemon.getFormKey() === "shadow") {
|
||||
return "battle_legendary_riders";
|
||||
}
|
||||
return "battle_legendary_calyrex";
|
||||
}
|
||||
if (pokemon.getFormKey() === "ice" || pokemon.getFormKey() === "shadow") {
|
||||
return "battle_legendary_riders";
|
||||
}
|
||||
case Species.GALAR_ARTICUNO:
|
||||
case Species.GALAR_ZAPDOS:
|
||||
case Species.GALAR_MOLTRES:
|
||||
return "battle_legendary_birds_galar";
|
||||
case Species.WO_CHIEN:
|
||||
case Species.CHIEN_PAO:
|
||||
case Species.TING_LU:
|
||||
case Species.CHI_YU:
|
||||
return "battle_legendary_ruinous";
|
||||
case Species.KORAIDON:
|
||||
case Species.MIRAIDON:
|
||||
return "battle_legendary_kor_mir";
|
||||
case Species.OKIDOGI:
|
||||
case Species.MUNKIDORI:
|
||||
case Species.FEZANDIPITI:
|
||||
return "battle_legendary_loyal_three";
|
||||
case Species.OGERPON:
|
||||
return "battle_legendary_ogerpon";
|
||||
case Species.TERAPAGOS:
|
||||
return "battle_legendary_terapagos";
|
||||
case Species.PECHARUNT:
|
||||
return "battle_legendary_pecharunt";
|
||||
default:
|
||||
if (pokemon.species.legendary) {
|
||||
return "battle_legendary_res_zek";
|
||||
}
|
||||
return "battle_legendary_unova";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.GALAR_ARTICUNO || pokemon.species.speciesId === Species.GALAR_ZAPDOS || pokemon.species.speciesId === Species.GALAR_MOLTRES) {
|
||||
return "battle_legendary_birds_galar";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.WO_CHIEN || pokemon.species.speciesId === Species.CHIEN_PAO || pokemon.species.speciesId === Species.TING_LU || pokemon.species.speciesId === Species.CHI_YU) {
|
||||
return "battle_legendary_ruinous";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.KORAIDON || pokemon.species.speciesId === Species.MIRAIDON) {
|
||||
return "battle_legendary_kor_mir";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.OKIDOGI || pokemon.species.speciesId === Species.MUNKIDORI || pokemon.species.speciesId === Species.FEZANDIPITI) {
|
||||
return "battle_legendary_loyal_three";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.OGERPON) {
|
||||
return "battle_legendary_ogerpon";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.TERAPAGOS) {
|
||||
return "battle_legendary_terapagos";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.PECHARUNT) {
|
||||
return "battle_legendary_pecharunt";
|
||||
}
|
||||
if (pokemon.species.legendary) {
|
||||
return "battle_legendary_res_zek";
|
||||
}
|
||||
return "battle_legendary_unova";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { leaveEncounterWithoutBattle, selectPokemonForOption, setEncounterRewards } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||
import { TrainerSlot, } from "#app/data/trainer-config";
|
||||
import { ModifierTier } from "#app/modifier/modifier-tier";
|
||||
import { MusicPreference } from "#app/system/settings/settings";
|
||||
import { getPlayerModifierTypeOptions, ModifierPoolType, ModifierTypeOption, regenerateModifierPoolThresholds } from "#app/modifier/modifier-type";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import BattleScene from "#app/battle-scene";
|
||||
|
@ -105,7 +106,7 @@ export const GlobalTradeSystemEncounter: MysteryEncounter =
|
|||
|
||||
// Load bgm
|
||||
let bgmKey: string;
|
||||
if (scene.musicPreference === 0) {
|
||||
if (scene.musicPreference === MusicPreference.CONSISTENT) {
|
||||
bgmKey = "mystery_encounter_gen_5_gts";
|
||||
scene.loadBgm(bgmKey, `${bgmKey}.mp3`);
|
||||
} else {
|
||||
|
|
|
@ -460,7 +460,7 @@ export abstract class PokemonSpeciesForm {
|
|||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
return `cry/${ret}`;
|
||||
}
|
||||
|
||||
validateStarterMoveset(moveset: StarterMoveset, eggMoves: number): boolean {
|
||||
|
@ -488,7 +488,7 @@ export abstract class PokemonSpeciesForm {
|
|||
return new Promise(resolve => {
|
||||
const spriteKey = this.getSpriteKey(female, formIndex, shiny, variant);
|
||||
scene.loadPokemonAtlas(spriteKey, this.getSpriteAtlasPath(female, formIndex, shiny, variant));
|
||||
scene.load.audio(`cry/${this.getCryKey(formIndex)}`, `audio/cry/${this.getCryKey(formIndex)}.m4a`);
|
||||
scene.load.audio(`${this.getCryKey(formIndex)}`, `audio/${this.getCryKey(formIndex)}.m4a`);
|
||||
scene.load.once(Phaser.Loader.Events.COMPLETE, () => {
|
||||
const originalWarn = console.warn;
|
||||
// Ignore warnings for missing frames, because there will be a lot
|
||||
|
@ -546,7 +546,7 @@ export abstract class PokemonSpeciesForm {
|
|||
if (cry?.pendingRemove) {
|
||||
cry = null;
|
||||
}
|
||||
cry = scene.playSound(`cry/${(cry ?? cryKey)}`, soundConfig);
|
||||
cry = scene.playSound(cry ?? cryKey, soundConfig);
|
||||
if (ignorePlay) {
|
||||
cry.stop();
|
||||
}
|
||||
|
|
|
@ -3266,7 +3266,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
try {
|
||||
SoundFade.fadeOut(scene, cry, Utils.fixedInt(Math.ceil(duration * 0.2)));
|
||||
fusionCry = this.getFusionSpeciesForm().cry(scene, Object.assign({ seek: Math.max(fusionCry.totalDuration * 0.4, 0) }, soundConfig));
|
||||
SoundFade.fadeIn(scene, fusionCry, Utils.fixedInt(Math.ceil(duration * 0.2)), scene.masterVolume * scene.seVolume, 0);
|
||||
SoundFade.fadeIn(scene, fusionCry, Utils.fixedInt(Math.ceil(duration * 0.2)), scene.masterVolume * scene.fieldVolume, 0);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
|
@ -3281,11 +3281,12 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
return this.fusionFaintCry(callback);
|
||||
}
|
||||
|
||||
const key = `cry/${this.species.getCryKey(this.formIndex)}`;
|
||||
//eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
let i = 0;
|
||||
const key = this.species.getCryKey(this.formIndex);
|
||||
let rate = 0.85;
|
||||
const cry = this.scene.playSound(key, { rate: rate }) as AnySound;
|
||||
if (!cry || this.scene.fieldVolume === 0) {
|
||||
return callback();
|
||||
}
|
||||
const sprite = this.getSprite();
|
||||
const tintSprite = this.getTintSprite();
|
||||
const delay = Math.max(this.scene.sound.get(key).totalDuration * 50, 25);
|
||||
|
@ -3300,7 +3301,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
delay: Utils.fixedInt(delay),
|
||||
repeat: -1,
|
||||
callback: () => {
|
||||
++i;
|
||||
frameThreshold = sprite.anims.msPerFrame / rate;
|
||||
frameProgress += delay;
|
||||
while (frameProgress > frameThreshold) {
|
||||
|
@ -3339,7 +3339,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
}
|
||||
|
||||
private fusionFaintCry(callback: Function): void {
|
||||
const key = `cry/${this.species.getCryKey(this.formIndex)}`;
|
||||
const key = this.species.getCryKey(this.formIndex);
|
||||
let i = 0;
|
||||
let rate = 0.85;
|
||||
const cry = this.scene.playSound(key, { rate: rate }) as AnySound;
|
||||
|
@ -3347,12 +3347,14 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
const tintSprite = this.getTintSprite();
|
||||
let duration = cry.totalDuration * 1000;
|
||||
|
||||
const fusionCryKey = `cry/${this.fusionSpecies?.getCryKey(this.fusionFormIndex)}`;
|
||||
const fusionCryKey = this.fusionSpecies!.getCryKey(this.fusionFormIndex);
|
||||
let fusionCry = this.scene.playSound(fusionCryKey, { rate: rate }) as AnySound;
|
||||
if (!cry || !fusionCry || this.scene.fieldVolume === 0) {
|
||||
return callback();
|
||||
}
|
||||
fusionCry.stop();
|
||||
duration = Math.min(duration, fusionCry.totalDuration * 1000);
|
||||
fusionCry.destroy();
|
||||
|
||||
const delay = Math.max(duration * 0.05, 25);
|
||||
|
||||
let transitionIndex = 0;
|
||||
|
@ -3390,10 +3392,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
}
|
||||
frameProgress -= frameThreshold;
|
||||
}
|
||||
if (i === transitionIndex) {
|
||||
if (i === transitionIndex && fusionCryKey) {
|
||||
SoundFade.fadeOut(this.scene, cry, Utils.fixedInt(Math.ceil((duration / rate) * 0.2)));
|
||||
fusionCry = this.scene.playSound(fusionCryKey, Object.assign({ seek: Math.max(fusionCry.totalDuration * 0.4, 0), rate: rate }));
|
||||
SoundFade.fadeIn(this.scene, fusionCry, Utils.fixedInt(Math.ceil((duration / rate) * 0.2)), this.scene.masterVolume * this.scene.seVolume, 0);
|
||||
SoundFade.fadeIn(this.scene, fusionCry, Utils.fixedInt(Math.ceil((duration / rate) * 0.2)), this.scene.masterVolume * this.scene.fieldVolume, 0);
|
||||
}
|
||||
rate *= 0.99;
|
||||
if (cry && !cry.pendingRemove) {
|
||||
|
|
|
@ -163,6 +163,11 @@ export const SettingKeys = {
|
|||
Shop_Overlay_Opacity: "SHOP_OVERLAY_OPACITY"
|
||||
};
|
||||
|
||||
export enum MusicPreference {
|
||||
CONSISTENT,
|
||||
MIXED
|
||||
}
|
||||
|
||||
/**
|
||||
* All Settings not related to controls
|
||||
*/
|
||||
|
@ -634,7 +639,7 @@ export const Setting: Array<Setting> = [
|
|||
label: i18next.t("settings:mixed")
|
||||
}
|
||||
],
|
||||
default: 0,
|
||||
default: MusicPreference.MIXED,
|
||||
type: SettingType.AUDIO,
|
||||
requireReload: true
|
||||
},
|
||||
|
|
|
@ -156,6 +156,7 @@ export default class GameManager {
|
|||
this.scene.enableTutorials = false;
|
||||
this.scene.gameData.gender = PlayerGender.MALE; // set initial player gender
|
||||
this.scene.battleStyle = this.settings.battleStyle;
|
||||
this.scene.fieldVolume = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue