[Bug] Pokemon with illusion imitate the cry of the illusion (#5675)

This commit is contained in:
Lylian BALL 2025-04-18 11:33:28 +02:00 committed by GitHub
parent b8b101119c
commit 82cd492117
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View File

@ -1107,7 +1107,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
*/
getSpeciesForm(ignoreOverride?: boolean, useIllusion: boolean = false): PokemonSpeciesForm {
const species: PokemonSpecies = useIllusion && !!this.summonData?.illusion ? getPokemonSpecies(this.summonData?.illusion.species) : this.species;
const formIndex: integer = useIllusion && !!this.summonData?.illusion ? this.summonData?.illusion.formIndex : this.formIndex;
if (!ignoreOverride && this.summonData?.speciesForm) {
@ -5282,13 +5281,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
sceneOverride?: BattleScene,
): AnySound {
const scene = sceneOverride ?? globalScene; // TODO: is `sceneOverride` needed?
const cry = this.getSpeciesForm().cry(soundConfig);
const cry = this.getSpeciesForm(undefined, true).cry(soundConfig);
let duration = cry.totalDuration * 1000;
if (
this.fusionSpecies &&
this.getSpeciesForm() !== this.getFusionSpeciesForm()
this.getSpeciesForm(undefined, true) !== this.getFusionSpeciesForm(undefined, true)
) {
let fusionCry = this.getFusionSpeciesForm().cry(soundConfig, true);
let fusionCry = this.getFusionSpeciesForm(undefined, true).cry(soundConfig, true);
duration = Math.min(duration, fusionCry.totalDuration * 1000);
fusionCry.destroy();
scene.time.delayedCall(fixedInt(Math.ceil(duration * 0.4)), () => {
@ -5298,7 +5297,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
cry,
fixedInt(Math.ceil(duration * 0.2)),
);
fusionCry = this.getFusionSpeciesForm().cry(
fusionCry = this.getFusionSpeciesForm(undefined, true).cry(
Object.assign(
{ seek: Math.max(fusionCry.totalDuration * 0.4, 0) },
soundConfig,

View File

@ -7,6 +7,7 @@ import { Moves } from "#enums/moves";
import { Abilities } from "#enums/abilities";
import { PokeballType } from "#app/enums/pokeball";
import { Gender } from "#app/data/gender";
import { BerryPhase } from "#app/phases/berry-phase";
describe("Abilities - Illusion", () => {
let phaserGame: Phaser.Game;
@ -66,7 +67,7 @@ describe("Abilities - Illusion", () => {
expect(!!zorua.summonData?.illusion).equals(false);
});
it("break if the ability is suppressed", async () => {
it("break with neutralizing gas", async () => {
game.override.enemyAbility(Abilities.NEUTRALIZING_GAS);
await game.classicMode.startBattle([Species.KOFFING]);