mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-24 18:42:42 +02:00
[Bug] Pokemon with illusion imitate the cry of the illusion (#5675)
This commit is contained in:
parent
b8b101119c
commit
82cd492117
@ -1107,7 +1107,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
*/
|
*/
|
||||||
getSpeciesForm(ignoreOverride?: boolean, useIllusion: boolean = false): PokemonSpeciesForm {
|
getSpeciesForm(ignoreOverride?: boolean, useIllusion: boolean = false): PokemonSpeciesForm {
|
||||||
const species: PokemonSpecies = useIllusion && !!this.summonData?.illusion ? getPokemonSpecies(this.summonData?.illusion.species) : this.species;
|
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;
|
const formIndex: integer = useIllusion && !!this.summonData?.illusion ? this.summonData?.illusion.formIndex : this.formIndex;
|
||||||
|
|
||||||
if (!ignoreOverride && this.summonData?.speciesForm) {
|
if (!ignoreOverride && this.summonData?.speciesForm) {
|
||||||
@ -5282,13 +5281,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
sceneOverride?: BattleScene,
|
sceneOverride?: BattleScene,
|
||||||
): AnySound {
|
): AnySound {
|
||||||
const scene = sceneOverride ?? globalScene; // TODO: is `sceneOverride` needed?
|
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;
|
let duration = cry.totalDuration * 1000;
|
||||||
if (
|
if (
|
||||||
this.fusionSpecies &&
|
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);
|
duration = Math.min(duration, fusionCry.totalDuration * 1000);
|
||||||
fusionCry.destroy();
|
fusionCry.destroy();
|
||||||
scene.time.delayedCall(fixedInt(Math.ceil(duration * 0.4)), () => {
|
scene.time.delayedCall(fixedInt(Math.ceil(duration * 0.4)), () => {
|
||||||
@ -5298,7 +5297,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
cry,
|
cry,
|
||||||
fixedInt(Math.ceil(duration * 0.2)),
|
fixedInt(Math.ceil(duration * 0.2)),
|
||||||
);
|
);
|
||||||
fusionCry = this.getFusionSpeciesForm().cry(
|
fusionCry = this.getFusionSpeciesForm(undefined, true).cry(
|
||||||
Object.assign(
|
Object.assign(
|
||||||
{ seek: Math.max(fusionCry.totalDuration * 0.4, 0) },
|
{ seek: Math.max(fusionCry.totalDuration * 0.4, 0) },
|
||||||
soundConfig,
|
soundConfig,
|
||||||
|
@ -7,6 +7,7 @@ import { Moves } from "#enums/moves";
|
|||||||
import { Abilities } from "#enums/abilities";
|
import { Abilities } from "#enums/abilities";
|
||||||
import { PokeballType } from "#app/enums/pokeball";
|
import { PokeballType } from "#app/enums/pokeball";
|
||||||
import { Gender } from "#app/data/gender";
|
import { Gender } from "#app/data/gender";
|
||||||
|
import { BerryPhase } from "#app/phases/berry-phase";
|
||||||
|
|
||||||
describe("Abilities - Illusion", () => {
|
describe("Abilities - Illusion", () => {
|
||||||
let phaserGame: Phaser.Game;
|
let phaserGame: Phaser.Game;
|
||||||
@ -66,7 +67,7 @@ describe("Abilities - Illusion", () => {
|
|||||||
expect(!!zorua.summonData?.illusion).equals(false);
|
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);
|
game.override.enemyAbility(Abilities.NEUTRALIZING_GAS);
|
||||||
await game.classicMode.startBattle([Species.KOFFING]);
|
await game.classicMode.startBattle([Species.KOFFING]);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user