Make G-Max Pokemon larger scaled

This commit is contained in:
Flashfyre 2024-02-14 23:25:12 -05:00
parent 94b9f8116d
commit 58b000ae06
4 changed files with 20 additions and 4 deletions

View File

@ -543,6 +543,7 @@ export class EncounterPhase extends BattlePhase {
if (enemyPokemon.isShiny())
this.scene.validateAchv(achvs.SEE_SHINY);
});
this.scene.updateFieldScale();
if (showEncounterMessage)
this.scene.ui.showText(this.getEncounterMessage(), null, () => this.end(), 1500);
else
@ -945,6 +946,7 @@ export class SummonPhase extends PartyMemberPokemonPhase {
}
addPokeballOpenParticles(this.scene, pokemon.x, pokemon.y - 16, pokemon.pokeball);
this.scene.updateModifiers(this.player);
this.scene.updateFieldScale();
pokemon.showInfo();
pokemon.playAnim();
pokemon.setVisible(true);
@ -952,11 +954,12 @@ export class SummonPhase extends PartyMemberPokemonPhase {
pokemon.setScale(0.5);
pokemon.tint(getPokeballTintColor(pokemon.pokeball));
pokemon.untint(250, 'Sine.easeIn');
this.scene.updateFieldScale();
this.scene.tweens.add({
targets: pokemon,
duration: 250,
ease: 'Sine.easeIn',
scale: 1,
scale: pokemon.getSpriteScale(),
onComplete: () => {
pokemon.cry();
pokemon.getSprite().clearTint();
@ -1100,6 +1103,8 @@ export class ReturnPhase extends SwitchSummonPhase {
pokemon.resetTurnData();
pokemon.resetSummonData();
this.scene.updateFieldScale();
this.scene.triggerPokemonFormChange(pokemon, SpeciesFormChangeActiveTrigger);
}
}

View File

@ -884,6 +884,16 @@ export default class BattleScene extends Phaser.Scene {
return this.arena;
}
updateFieldScale(): Promise<void> {
return new Promise(resolve => {
const fieldScale = Math.floor(Math.pow(1 / this.getField().filter(p => p?.isActive())
.map(p => p.getSpriteScale())
.reduce((highestScale: number, scale: number) => highestScale = Math.max(scale, highestScale), 0), 0.7) * 40
) / 40;
this.setFieldScale(fieldScale).then(() => resolve());
});
}
setFieldScale(scale: number, instant: boolean = false): Promise<void> {
return new Promise(resolve => {
scale *= 6;

View File

@ -400,7 +400,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
}
getSpriteScale(): number {
if (this.species.speciesId === Species.ETERNATUS && this.formIndex)
const formKey = this.getFormKey();
if (formKey.indexOf(SpeciesFormKey.GIGANTAMAX) > -1 || formKey.indexOf(SpeciesFormKey.ETERNAMAX) > -1)
return 1.5;
return 1;
}
@ -1266,7 +1267,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
this.loadAssets().then(() => {
this.calculateStats();
this.scene.updateModifiers(this.isPlayer(), true);
this.updateInfo().then(() => resolve());
Promise.all([ this.updateInfo(), this.scene.updateFieldScale() ]).then(() => resolve());
});
});
}

View File

@ -324,7 +324,7 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
let nameSizeTest = addTextObject(this.scene, 0, 0, displayName, TextStyle.BATTLE_INFO);
nameTextWidth = nameSizeTest.displayWidth;
while (nameTextWidth > 60 - ((pokemon.gender !== Gender.GENDERLESS ? 6 : 0) + (pokemon.fusionSpecies ? 6 : 0) + (pokemon.isShiny() ? 8 : 0) + (Math.min(pokemon.level.toString().length, 3) - 3) * 8)) {
while (nameTextWidth > (this.player || !this.boss ? 60 : 98) - ((pokemon.gender !== Gender.GENDERLESS ? 6 : 0) + (pokemon.fusionSpecies ? 6 : 0) + (pokemon.isShiny() ? 8 : 0) + (Math.min(pokemon.level.toString().length, 3) - 3) * 8)) {
displayName = `${displayName.slice(0, displayName.endsWith('.') ? -2 : -1).trimEnd()}.`;
nameSizeTest.setText(displayName);
nameTextWidth = nameSizeTest.displayWidth;