add: Toggling pokemon cries

This will only affect the cries played during fights. Starter select, evolutions etc. will not be affected y the setting
This commit is contained in:
flx-sta 2024-09-06 14:29:00 -07:00
parent e6a574c48f
commit c7cc935f26
7 changed files with 37 additions and 6 deletions

View File

@ -140,6 +140,8 @@ export default class BattleScene extends SceneBase {
public enableMoveInfo: boolean = true;
public enableRetries: boolean = false;
public hideIvs: boolean = false;
/** Toggle Pokemon cries */
public enablePokemonCries: boolean = true;
/**
* Determines the condition for a notification should be shown for Candy Upgrades
* - 0 = 'Off'

View File

@ -2767,6 +2767,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
}
faintCry(callback: Function): void {
if (!this.scene.enablePokemonCries) {
return callback();
} //skip cry and callback immediately
if (this.fusionSpecies && this.getSpeciesForm() !== this.getFusionSpeciesForm()) {
return this.fusionFaintCry(callback);
}

View File

@ -103,5 +103,6 @@
"rewards": "Rewards",
"reroll": "Reroll",
"shop": "Shop",
"checkTeam": "Check Team"
"checkTeam": "Check Team",
"pokemonCries": "Pokemon Cries"
}

View File

@ -232,7 +232,9 @@ export class EncounterPhase extends BattlePhase {
if (this.scene.currentBattle.battleType === BattleType.WILD) {
enemyField.forEach(enemyPokemon => {
enemyPokemon.untint(100, "Sine.easeOut");
enemyPokemon.cry();
if (this.scene.enablePokemonCries) {
enemyPokemon.cry();
}
enemyPokemon.showInfo();
if (enemyPokemon.isShiny()) {
this.scene.validateAchv(achvs.SEE_SHINY);

View File

@ -155,10 +155,12 @@ export class SummonPhase extends PartyMemberPokemonPhase {
ease: "Sine.easeIn",
scale: pokemon.getSpriteScale(),
onComplete: () => {
pokemon.cry(pokemon.getHpRatio() > 0.25 ? undefined : { rate: 0.85 });
if (this.scene.enablePokemonCries) {
pokemon.cry(pokemon.getHpRatio() > 0.25 ? undefined : { rate: 0.85 });
}
pokemon.getSprite().clearTint();
pokemon.resetSummonData();
this.scene.time.delayedCall(1000, () => this.end());
this.scene.time.delayedCall(this.scene.enablePokemonCries ? 1000 : 100, () => this.end());
}
});
}

View File

@ -159,7 +159,8 @@ export const SettingKeys = {
Music_Preference: "MUSIC_PREFERENCE",
Show_BGM_Bar: "SHOW_BGM_BAR",
Move_Touch_Controls: "MOVE_TOUCH_CONTROLS",
Shop_Overlay_Opacity: "SHOP_OVERLAY_OPACITY"
Shop_Overlay_Opacity: "SHOP_OVERLAY_OPACITY",
Pokemon_Cries: "POKEMON_CRIES",
};
/**
@ -617,6 +618,22 @@ export const Setting: Array<Setting> = [
type: SettingType.AUDIO,
requireReload: true
},
{
key: SettingKeys.Pokemon_Cries,
label: i18next.t("settings:pokemonCries"),
options: [
{
value: "On",
label: i18next.t("settings:on")
},
{
value: "Off",
label: i18next.t("settings:off")
}
],
default: 0,
type: SettingType.AUDIO,
},
{
key: SettingKeys.Move_Touch_Controls,
label: i18next.t("settings:moveTouchControls"),
@ -895,6 +912,9 @@ export function setSetting(scene: BattleScene, setting: string, value: integer):
case SettingKeys.Shop_Overlay_Opacity:
scene.updateShopOverlayOpacity(parseInt(Setting[index].options[value].value) * .01);
break;
case SettingKeys.Pokemon_Cries:
scene.enablePokemonCries = Setting[index].options[value].value === "On";
break;
}
return true;

View File

@ -15,6 +15,6 @@ export default class SettingsAudioUiHandler extends AbstractSettingsUiHandler {
super(scene, SettingType.AUDIO, mode);
this.title = "Audio";
this.localStorageKey = "settings";
this.rowsToDisplay = 6;
this.rowsToDisplay = 7;
}
}