mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-06 00:12:16 +02:00
Update Second Change Form Function and Fix Form Change on Refresh
This commit is contained in:
parent
0b9392f21b
commit
db4373ab4a
@ -115,7 +115,10 @@ export class SpeciesFormChange {
|
||||
formIndexes.push(pokemon.fusionFormIndex);
|
||||
}
|
||||
|
||||
const formMatch = [true, true];
|
||||
const formMatch = [true];
|
||||
if (pokemon.isFusion())
|
||||
formMatch.push(true);
|
||||
|
||||
for (let i = 0; i < speciesArray.length; ++i) {
|
||||
const species = speciesArray[i];
|
||||
const formIndex = formIndexes[i];
|
||||
|
@ -1660,8 +1660,15 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
}
|
||||
|
||||
changeForm(formChange: SpeciesFormChange): Promise<void> {
|
||||
const matchesBase = this.species.speciesId == formChange.speciesId;
|
||||
|
||||
return new Promise(resolve => {
|
||||
this.formIndex = Math.max(this.species.forms.findIndex(f => f.formKey === formChange.formKey), 0);
|
||||
const newFormIndex = Math.max((matchesBase ? this.species : this.fusionSpecies).forms.findIndex(f => f.formKey === formChange.formKey), 0);
|
||||
if (matchesBase)
|
||||
this.formIndex = newFormIndex;
|
||||
else
|
||||
this.fusionFormIndex = newFormIndex;
|
||||
|
||||
this.generateName();
|
||||
const abilityCount = this.getSpeciesForm().getAbilityCount();
|
||||
if (this.abilityIndex >= abilityCount) // Shouldn't happen
|
||||
|
Loading…
Reference in New Issue
Block a user