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

View File

@ -5777,8 +5777,9 @@ export class TransformAttr extends MoveEffectAttr {
user.summonData.fusionGender = target.getFusionGender(); user.summonData.fusionGender = target.getFusionGender();
user.summonData.stats = [ user.stats[Stat.HP] ].concat(target.stats.slice(1)); user.summonData.stats = [ user.stats[Stat.HP] ].concat(target.stats.slice(1));
user.summonData.battleStats = target.summonData.battleStats.slice(0); 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.summonData.types = target.getTypes();
user.updateInfo();
user.scene.queueMessage(i18next.t("moveTriggers:transformedIntoTarget", {pokemonName: getPokemonNameWithAffix(user), targetName: getPokemonNameWithAffix(target)})); user.scene.queueMessage(i18next.t("moveTriggers:transformedIntoTarget", {pokemonName: getPokemonNameWithAffix(user), targetName: getPokemonNameWithAffix(target)}));