mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-15 12:52:20 +02:00
add illusion cry
This commit is contained in:
parent
b2bab46e1c
commit
474a9b5595
@ -699,6 +699,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
* Generate an illusion of the last pokemon in the party, as other wild pokemon in the area.
|
* Generate an illusion of the last pokemon in the party, as other wild pokemon in the area.
|
||||||
*/
|
*/
|
||||||
setIllusion(pokemon: Pokemon): boolean {
|
setIllusion(pokemon: Pokemon): boolean {
|
||||||
|
console.log("SET ILLUSION")
|
||||||
if(!!this.summonData?.illusion){
|
if(!!this.summonData?.illusion){
|
||||||
this.breakIllusion();
|
this.breakIllusion();
|
||||||
}
|
}
|
||||||
@ -1099,9 +1100,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
/**
|
/**
|
||||||
* @param {boolean} useIllusion - Whether we want the speciesForm of the illusion or not.
|
* @param {boolean} useIllusion - Whether we want the speciesForm of the illusion or not.
|
||||||
*/
|
*/
|
||||||
getSpeciesForm(ignoreOverride?: boolean, useIllusion: boolean = false): PokemonSpeciesForm {
|
getSpeciesForm(ignoreOverride?: boolean, useIllusion: boolean = false, cry: 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) {
|
||||||
@ -5277,13 +5277,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)), () => {
|
||||||
@ -5293,7 +5293,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,21 @@ describe("Abilities - Illusion", () => {
|
|||||||
expect(!!zorua.summonData?.illusion).equals(false);
|
expect(!!zorua.summonData?.illusion).equals(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("break if the ability is suppressed", async () => {
|
it("breaks when suppressed", async () => {
|
||||||
|
game.override.moveset(Moves.GASTRO_ACID);
|
||||||
|
await game.classicMode.startBattle([Species.MAGIKARP]);
|
||||||
|
const zorua = game.scene.getEnemyPokemon()!;
|
||||||
|
|
||||||
|
expect(!!zorua.summonData?.illusion).toBe(true);
|
||||||
|
|
||||||
|
game.move.select(Moves.GASTRO_ACID);
|
||||||
|
await game.phaseInterceptor.to(BerryPhase);
|
||||||
|
|
||||||
|
expect(zorua.isFullHp()).toBe(true);
|
||||||
|
expect(!!zorua.summonData?.illusion).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
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