Adds updateInfo to transform move/ability, mirrors Transform functionality in Imposter

This commit is contained in:
Christopher Schmidt 2024-08-09 09:37:36 -04:00
parent b794662776
commit 3d738a57ca
2 changed files with 20 additions and 19 deletions

View File

@ -2297,7 +2297,7 @@ export class PostSummonTransformAbAttr extends PostSummonAbAttr {
super(true);
}
applyPostSummon(pokemon: Pokemon, passive: boolean, args: any[]): boolean {
applyPostSummon(pokemon: Pokemon, passive: boolean, args: any[]): boolean | Promise<boolean> {
const targets = pokemon.getOpponents();
if (!targets.length) {
return false;
@ -2309,25 +2309,25 @@ export class PostSummonTransformAbAttr extends PostSummonAbAttr {
} else {
target = targets[0];
}
return new Promise(resolve => {
pokemon.summonData.speciesForm = target.getSpeciesForm();
pokemon.summonData.fusionSpeciesForm = target.getFusionSpeciesForm();
pokemon.summonData.ability = target.getAbility().id;
pokemon.summonData.gender = target.getGender();
pokemon.summonData.fusionGender = target.getFusionGender();
pokemon.summonData.stats = [ pokemon.stats[Stat.HP] ].concat(target.stats.slice(1));
pokemon.summonData.battleStats = target.summonData.battleStats.slice(0);
pokemon.summonData.moveset = target.getMoveset().map(m => new PokemonMove(m?.moveId!, m?.ppUsed, m?.ppUp));
pokemon.summonData.types = target.getTypes();
pokemon.updateInfo();
target = target!; // compiler doesn't know its guranteed to be defined
pokemon.summonData.speciesForm = target.getSpeciesForm();
pokemon.summonData.fusionSpeciesForm = target.getFusionSpeciesForm();
pokemon.summonData.ability = target.getAbility().id;
pokemon.summonData.gender = target.getGender();
pokemon.summonData.fusionGender = target.getFusionGender();
pokemon.summonData.stats = [ pokemon.stats[Stat.HP] ].concat(target.stats.slice(1));
pokemon.summonData.battleStats = target.summonData.battleStats.slice(0);
pokemon.summonData.moveset = target.getMoveset().map(m => new PokemonMove(m!.moveId, m!.ppUsed, m!.ppUp)); // TODO: are those bangs correct?
pokemon.summonData.types = target.getTypes();
pokemon.scene.queueMessage(i18next.t("abilityTriggers:postSummonTransform", {pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), targetName: getPokemonNameWithAffix(target)}));
pokemon.scene.playSound("PRSFX- Transform");
pokemon.loadAssets(false).then(() => pokemon.playAnim());
pokemon.scene.queueMessage(i18next.t("abilityTriggers:postSummonTransform", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), targetName: target.name, }));
return true;
pokemon.loadAssets(false).then(() => {
pokemon.playAnim();
resolve(true);
});
});
}
}

View File

@ -5777,8 +5777,9 @@ export class TransformAttr extends MoveEffectAttr {
user.summonData.fusionGender = target.getFusionGender();
user.summonData.stats = [ user.stats[Stat.HP] ].concat(target.stats.slice(1));
user.summonData.battleStats = target.summonData.battleStats.slice(0);
user.summonData.moveset = target.getMoveset().map(m => new PokemonMove(m?.moveId!, m?.ppUsed, m?.ppUp)); // TODO: is this bang correct?
user.summonData.moveset = target.getMoveset().map(m => new PokemonMove(m?.moveId!, m?.ppUsed, m?.ppUp));
user.summonData.types = target.getTypes();
user.updateInfo();
user.scene.queueMessage(i18next.t("moveTriggers:transformedIntoTarget", {pokemonName: getPokemonNameWithAffix(user), targetName: getPokemonNameWithAffix(target)}));