Add canApply for imposter

This commit is contained in:
Dean 2025-02-05 02:09:17 -08:00
parent 8c0d4da740
commit 17232d73b0

View File

@ -2498,18 +2498,7 @@ export class PostSummonTransformAbAttr extends PostSummonAbAttr {
super(true); super(true);
} }
canApplyPostSummon(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean { getTarget(targets: Pokemon[]): Pokemon {
// SUCCESS CHECK
return true;
}
async applyPostSummon(pokemon: Pokemon, _passive: boolean, simulated: boolean, _args: any[]): Promise<boolean> {
const targets = pokemon.getOpponents();
if (simulated || !targets.length) {
return simulated;
}
const promises: Promise<void>[] = [];
let target: Pokemon; let target: Pokemon;
if (targets.length > 1) { if (targets.length > 1) {
globalScene.executeWithSeedOffset(() => { globalScene.executeWithSeedOffset(() => {
@ -2529,11 +2518,29 @@ export class PostSummonTransformAbAttr extends PostSummonAbAttr {
} }
target = target!; target = target!;
return target;
}
canApplyPostSummon(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean {
const targets = pokemon.getOpponents();
if (simulated || !targets.length) {
return simulated;
}
// transforming from or into fusion pokemon causes various problems (including crashes and save corruption) // transforming from or into fusion pokemon causes various problems (including crashes and save corruption)
if (target.fusionSpecies || pokemon.fusionSpecies) { if (this.getTarget(targets).fusionSpecies || pokemon.fusionSpecies) {
return false; return false;
} }
return true;
}
async applyPostSummon(pokemon: Pokemon, _passive: boolean, simulated: boolean, _args: any[]): Promise<boolean> {
const targets = pokemon.getOpponents();
const promises: Promise<void>[] = [];
const target = this.getTarget(targets);
pokemon.summonData.speciesForm = target.getSpeciesForm(); pokemon.summonData.speciesForm = target.getSpeciesForm();
pokemon.summonData.ability = target.getAbility().id; pokemon.summonData.ability = target.getAbility().id;
pokemon.summonData.gender = target.getGender(); pokemon.summonData.gender = target.getGender();
@ -2559,7 +2566,6 @@ export class PostSummonTransformAbAttr extends PostSummonAbAttr {
}); });
pokemon.summonData.types = target.getTypes(); pokemon.summonData.types = target.getTypes();
promises.push(pokemon.updateInfo()); promises.push(pokemon.updateInfo());
globalScene.queueMessage(i18next.t("abilityTriggers:postSummonTransform", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), targetName: target.name, })); globalScene.queueMessage(i18next.t("abilityTriggers:postSummonTransform", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), targetName: target.name, }));
globalScene.playSound("battle_anims/PRSFX- Transform"); globalScene.playSound("battle_anims/PRSFX- Transform");
promises.push(pokemon.loadAssets(false).then(() => { promises.push(pokemon.loadAssets(false).then(() => {