added settings to manage how to display party experience at the end of fight

This commit is contained in:
Greenlamp 2024-05-05 14:13:26 +02:00
parent 92fb8b715e
commit af385fedf6
4 changed files with 29 additions and 9 deletions

View File

@ -119,6 +119,7 @@ export default class BattleScene extends SceneBase {
public experimentalSprites: boolean = false;
public moveAnimations: boolean = true;
public expGainsSpeed: integer = 0;
public expParty: integer = 0;
public hpBarSpeed: integer = 0;
public fusionPaletteSwaps: boolean = true;
public gamepadSupport: boolean = true;

View File

@ -3646,16 +3646,25 @@ export class ShowPartyExpBarPhase extends PlayerPartyMemberPokemonPhase {
let newLevel: integer;
pokemon.addExp(exp.value);
newLevel = pokemon.level;
if (newLevel > lastLevel)
this.scene.unshiftPhase(new LevelUpPhase(this.scene, this.partyMemberIndex, lastLevel, newLevel));
const isLevelUp = newLevel > lastLevel;
if (this.scene.expParty === 0 && isLevelUp) {
this.scene.unshiftPhase(new LevelUpPhase(this.scene, this.partyMemberIndex, lastLevel));
}
this.scene.unshiftPhase(new HidePartyExpBarPhase(this.scene));
pokemon.updateInfo();
if (this.scene.expGainsSpeed < 3) {
this.scene.partyExpBar.showPokemonExp(pokemon, exp.value).then(() => {
if (newLevel > lastLevel)
this.end();
else
if (this.scene.expParty === 2) {
this.end();
} else if (this.scene.expParty === 1) {
if (isLevelUp) {
this.scene.partyExpBar.showPokemonExp(pokemon, exp.value, isLevelUp, this.scene.expParty === 1).then(() => {
setTimeout(() => this.end(), 200 / Math.pow(2, this.scene.expGainsSpeed));
});
} else {
this.end();
}
} else if (this.scene.expGainsSpeed < 3) {
this.scene.partyExpBar.showPokemonExp(pokemon, exp.value, isLevelUp, this.scene.expParty === 1).then(() => {
setTimeout(() => this.end(), 500 / Math.pow(2, this.scene.expGainsSpeed));
});
} else {

View File

@ -21,6 +21,7 @@ export enum Setting {
Move_Animations = "MOVE_ANIMATIONS",
Show_Stats_on_Level_Up = "SHOW_LEVEL_UP_STATS",
EXP_Gains_Speed = "EXP_GAINS_SPEED",
EXP_Party = "EXP_PARTY",
HP_Bar_Speed = "HP_BAR_SPEED",
Fusion_Palette_Swaps = "FUSION_PALETTE_SWAPS",
Player_Gender = "PLAYER_GENDER",
@ -52,6 +53,7 @@ export const settingOptions: SettingOptions = {
[Setting.Move_Animations]: [ 'Off', 'On' ],
[Setting.Show_Stats_on_Level_Up]: [ 'Off', 'On' ],
[Setting.EXP_Gains_Speed]: [ 'Normal', 'Fast', 'Faster', 'Skip' ],
[Setting.EXP_Party]: [ 'Normal', 'Only Up', 'Skip' ],
[Setting.HP_Bar_Speed]: [ 'Normal', 'Fast', 'Faster', 'Instant' ],
[Setting.Fusion_Palette_Swaps]: [ 'Off', 'On' ],
[Setting.Player_Gender]: [ 'Boy', 'Girl' ],
@ -75,6 +77,7 @@ export const settingDefaults: SettingDefaults = {
[Setting.Move_Animations]: 1,
[Setting.Show_Stats_on_Level_Up]: 1,
[Setting.EXP_Gains_Speed]: 0,
[Setting.EXP_Party]: 0,
[Setting.HP_Bar_Speed]: 0,
[Setting.Fusion_Palette_Swaps]: 1,
[Setting.Player_Gender]: 0,
@ -131,6 +134,9 @@ export function setSetting(scene: BattleScene, setting: Setting, value: integer)
case Setting.EXP_Gains_Speed:
scene.expGainsSpeed = value;
break;
case Setting.EXP_Party:
scene.expParty = value;
break;
case Setting.HP_Bar_Speed:
scene.hpBarSpeed = value;
break;

View File

@ -29,7 +29,7 @@ export default class PartyExpBar extends Phaser.GameObjects.Container {
this.shown = false;
}
showPokemonExp(pokemon: Pokemon, expValue: integer): Promise<void> {
showPokemonExp(pokemon: Pokemon, expValue: integer, isLevelUp: boolean, showOnlyLevelUp: boolean): Promise<void> {
return new Promise<void>(resolve => {
if (this.shown)
return resolve();
@ -39,7 +39,11 @@ export default class PartyExpBar extends Phaser.GameObjects.Container {
this.add(this.pokemonIcon);
this.expText.setText(`+${expValue.toString()}`);
if (showOnlyLevelUp) {
this.expText.setText(`Lv. UP`);
} else {
this.expText.setText(`+${expValue.toString()}`);
}
this.bg.width = this.expText.displayWidth + 28;