fix nit
This commit is contained in:
parent
1e9a2a749d
commit
cf8f778dd3
|
@ -4562,7 +4562,7 @@ export class IllusionPreSummonAbAttr extends PreSummonAbAttr {
|
||||||
*/
|
*/
|
||||||
applyPreSummon(pokemon: Pokemon, passive: boolean, args: any[]): boolean {
|
applyPreSummon(pokemon: Pokemon, passive: boolean, args: any[]): boolean {
|
||||||
let suppressed = false;
|
let suppressed = false;
|
||||||
console.log("PRESUMMONILLUSION : ", pokemon.name)
|
console.log("PRESUMMONILLUSION : ", pokemon.name);
|
||||||
pokemon.scene.getField(true).filter(p => p !== pokemon).map(p => {
|
pokemon.scene.getField(true).filter(p => p !== pokemon).map(p => {
|
||||||
if ((p.getAbility().hasAttr(SuppressFieldAbilitiesAbAttr) && p.canApplyAbility()) || (p.getPassiveAbility().hasAttr(SuppressFieldAbilitiesAbAttr) && p.canApplyAbility(true))) {
|
if ((p.getAbility().hasAttr(SuppressFieldAbilitiesAbAttr) && p.canApplyAbility()) || (p.getPassiveAbility().hasAttr(SuppressFieldAbilitiesAbAttr) && p.canApplyAbility(true))) {
|
||||||
suppressed = true;
|
suppressed = true;
|
||||||
|
|
|
@ -399,10 +399,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||||
*/
|
*/
|
||||||
generateIllusion(): boolean {
|
generateIllusion(): boolean {
|
||||||
if (this.hasTrainer()) {
|
if (this.hasTrainer()) {
|
||||||
console.log("GENERATEILLUSION() : ", this.name)
|
console.log("GENERATEILLUSION() : ", this.name);
|
||||||
const party: Pokemon[] = (this.isPlayer() ? this.scene.getParty() : this.scene.getEnemyParty()).filter(p => p.isAllowedInBattle());
|
const party: Pokemon[] = (this.isPlayer() ? this.scene.getParty() : this.scene.getEnemyParty()).filter(p => p.isAllowedInBattle());
|
||||||
const lastPokemon: Pokemon = party.filter(p => p !== this).at(-1) || this;
|
const lastPokemon: Pokemon = party.filter(p => p !== this).at(-1) || this;
|
||||||
console.log(lastPokemon.name)
|
console.log(lastPokemon.name);
|
||||||
const speciesId = lastPokemon.species.speciesId;
|
const speciesId = lastPokemon.species.speciesId;
|
||||||
|
|
||||||
if ( lastPokemon === this || this.illusion.active ||
|
if ( lastPokemon === this || this.illusion.active ||
|
||||||
|
@ -475,12 +475,12 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||||
this.name = randomIllusion.name;
|
this.name = randomIllusion.name;
|
||||||
this.loadAssets(false, true).then(() => this.playAnim());
|
this.loadAssets(false, true).then(() => this.playAnim());
|
||||||
}
|
}
|
||||||
console.log("L'ILLUSION : ", this.illusion)
|
console.log("L'ILLUSION : ", this.illusion);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
breakIllusion(): boolean {
|
breakIllusion(): boolean {
|
||||||
console.log("BREAKILLUSION")
|
console.log("BREAKILLUSION");
|
||||||
if (!this.illusion.active) {
|
if (!this.illusion.active) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,40 +5,40 @@ import overrides from "#app/overrides";
|
||||||
import { Species } from "#enums/species";
|
import { Species } from "#enums/species";
|
||||||
import { Gender } from "../../data/gender";
|
import { Gender } from "../../data/gender";
|
||||||
import { PokeballType } from "../../data/pokeball";
|
import { PokeballType } from "../../data/pokeball";
|
||||||
import {
|
import {
|
||||||
TurnEndPhase,
|
TurnEndPhase,
|
||||||
} from "#app/phases/turn-end-phase";
|
} from "#app/phases/turn-end-phase";
|
||||||
import { Moves } from "#enums/moves";
|
import { Moves } from "#enums/moves";
|
||||||
import { Abilities } from "#enums/abilities";
|
import { Abilities } from "#enums/abilities";
|
||||||
|
|
||||||
describe("Abilities - Illusion", () => {
|
describe("Abilities - Illusion", () => {
|
||||||
let phaserGame: Phaser.Game;
|
let phaserGame: Phaser.Game;
|
||||||
let game: GameManager;
|
let game: GameManager;
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
phaserGame = new Phaser.Game({
|
phaserGame = new Phaser.Game({
|
||||||
type: Phaser.HEADLESS,
|
type: Phaser.HEADLESS,
|
||||||
});
|
} );
|
||||||
});
|
} );
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
game.phaseInterceptor.restoreOg();
|
game.phaseInterceptor.restoreOg();
|
||||||
});
|
} );
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
game = new GameManager(phaserGame);
|
game = new GameManager(phaserGame);
|
||||||
game.override.battleType("single");
|
game.override.battleType("single");
|
||||||
game.override.enemySpecies(Species.ZORUA);
|
game.override.enemySpecies(Species.ZORUA);
|
||||||
game.override.enemyAbility(Abilities.ILLUSION);
|
game.override.enemyAbility(Abilities.ILLUSION);
|
||||||
game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]);
|
game.override.enemyMoveset([ Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE ] );
|
||||||
game.override.enemyHeldItems([{name: "WIDE_LENS", count: 3}]);
|
game.override.enemyHeldItems([ { name: "WIDE_LENS", count: 3 } ] );
|
||||||
|
|
||||||
game.override.moveset([Moves.WORRY_SEED, Moves.SOAK, Moves.TACKLE, Moves.TACKLE]);
|
game.override.moveset([ Moves.WORRY_SEED, Moves.SOAK, Moves.TACKLE, Moves.TACKLE ] );
|
||||||
game.override.startingHeldItems([{name: "WIDE_LENS", count: 3}]);
|
game.override.startingHeldItems([ { name: "WIDE_LENS", count: 3 } ] );
|
||||||
});
|
} );
|
||||||
|
|
||||||
it("creates illusion at the start", async () => {
|
it("creates illusion at the start", async () => {
|
||||||
await game.startBattle([Species.ZOROARK, Species.AXEW]);
|
await game.startBattle([ Species.ZOROARK, Species.AXEW ] );
|
||||||
|
|
||||||
const zoroark = game.scene.getPlayerPokemon()!;
|
const zoroark = game.scene.getPlayerPokemon()!;
|
||||||
const zorua = game.scene.getEnemyPokemon()!;
|
const zorua = game.scene.getEnemyPokemon()!;
|
||||||
|
@ -46,10 +46,10 @@ describe("Abilities - Illusion", () => {
|
||||||
expect(zoroark.illusion.active).equals(true);
|
expect(zoroark.illusion.active).equals(true);
|
||||||
expect(zorua.illusion.active).equals(true);
|
expect(zorua.illusion.active).equals(true);
|
||||||
expect(zoroark.illusion.available).equals(false);
|
expect(zoroark.illusion.available).equals(false);
|
||||||
});
|
} );
|
||||||
|
|
||||||
it("break after receiving damaging move", async () => {
|
it("break after receiving damaging move", async () => {
|
||||||
await game.startBattle([Species.AXEW]);
|
await game.startBattle([ Species.AXEW ] );
|
||||||
game.move.select(Moves.TACKLE);
|
game.move.select(Moves.TACKLE);
|
||||||
|
|
||||||
await game.phaseInterceptor.to(TurnEndPhase);
|
await game.phaseInterceptor.to(TurnEndPhase);
|
||||||
|
@ -57,10 +57,10 @@ describe("Abilities - Illusion", () => {
|
||||||
const zorua = game.scene.getEnemyPokemon()!;
|
const zorua = game.scene.getEnemyPokemon()!;
|
||||||
|
|
||||||
expect(zorua.illusion.active).equals(false);
|
expect(zorua.illusion.active).equals(false);
|
||||||
});
|
} );
|
||||||
|
|
||||||
it("break after getting ability changed", async () => {
|
it("break after getting ability changed", async () => {
|
||||||
await game.startBattle([Species.AXEW]);
|
await game.startBattle([ Species.AXEW ] );
|
||||||
game.move.select(Moves.WORRY_SEED);
|
game.move.select(Moves.WORRY_SEED);
|
||||||
|
|
||||||
await game.phaseInterceptor.to(TurnEndPhase);
|
await game.phaseInterceptor.to(TurnEndPhase);
|
||||||
|
@ -68,38 +68,38 @@ describe("Abilities - Illusion", () => {
|
||||||
const zorua = game.scene.getEnemyPokemon()!;
|
const zorua = game.scene.getEnemyPokemon()!;
|
||||||
|
|
||||||
expect(zorua.illusion.active).equals(false);
|
expect(zorua.illusion.active).equals(false);
|
||||||
});
|
} );
|
||||||
|
|
||||||
it("break if the ability is suppressed", async () => {
|
it("break if the ability is suppressed", async () => {
|
||||||
game.override.enemyAbility(Abilities.NEUTRALIZING_GAS);
|
game.override.enemyAbility(Abilities.NEUTRALIZING_GAS);
|
||||||
await game.startBattle([Species.KOFFING]);
|
await game.startBattle([ Species.KOFFING ] );
|
||||||
|
|
||||||
const zorua = game.scene.getEnemyPokemon()!;
|
const zorua = game.scene.getEnemyPokemon()!;
|
||||||
|
|
||||||
expect(zorua.illusion.active).equals(false);
|
expect(zorua.illusion.active).equals(false);
|
||||||
});
|
} );
|
||||||
|
|
||||||
it("trick the enemy AI for moves effectiveness using ILLUSION type instead of actual type", async () => {
|
it("trick the enemy AI for moves effectiveness using ILLUSION type instead of actual type", async () => {
|
||||||
game.override.enemyMoveset([Moves.FLAMETHROWER, Moves.PSYCHIC, Moves.TACKLE, Moves.TACKLE]);
|
game.override.enemyMoveset([ Moves.FLAMETHROWER, Moves.PSYCHIC, Moves.TACKLE, Moves.TACKLE ] );
|
||||||
await game.startBattle([Species.ZOROARK, Species.AXEW]);
|
await game.startBattle([ Species.ZOROARK, Species.AXEW ] );
|
||||||
|
|
||||||
const enemy = game.scene.getEnemyPokemon()!;
|
const enemy = game.scene.getEnemyPokemon()!;
|
||||||
const zoroark = game.scene.getPlayerPokemon()!;
|
const zoroark = game.scene.getPlayerPokemon()!;
|
||||||
|
|
||||||
const flameThrower = enemy.getMoveset()[0]!.getMove();
|
const flameThrower = enemy.getMoveset()[ 0] !.getMove();
|
||||||
const psychic = enemy.getMoveset()[1]!.getMove();
|
const psychic = enemy.getMoveset()[ 1] !.getMove();
|
||||||
const flameThrowerEffectiveness = zoroark.getAttackTypeEffectiveness(flameThrower.type, enemy, undefined, undefined, true);
|
const flameThrowerEffectiveness = zoroark.getAttackTypeEffectiveness(flameThrower.type, enemy, undefined, undefined, true);
|
||||||
const psychicEffectiveness = zoroark.getAttackTypeEffectiveness(psychic.type, enemy, undefined, undefined, true);
|
const psychicEffectiveness = zoroark.getAttackTypeEffectiveness(psychic.type, enemy, undefined, undefined, true);
|
||||||
expect(psychicEffectiveness).above(flameThrowerEffectiveness);
|
expect(psychicEffectiveness).above(flameThrowerEffectiveness);
|
||||||
});
|
} );
|
||||||
|
|
||||||
it("do not breaks if the pokemon takes indirect damages", async () => {
|
it("do not breaks if the pokemon takes indirect damages", async () => {
|
||||||
game.override.enemySpecies(Species.GIGALITH);
|
game.override.enemySpecies(Species.GIGALITH);
|
||||||
game.override.enemyAbility(Abilities.SAND_STREAM);
|
game.override.enemyAbility(Abilities.SAND_STREAM);
|
||||||
game.override.enemyMoveset([Moves.WILL_O_WISP, Moves.WILL_O_WISP, Moves.WILL_O_WISP, Moves.WILL_O_WISP]);
|
game.override.enemyMoveset([ Moves.WILL_O_WISP, Moves.WILL_O_WISP, Moves.WILL_O_WISP, Moves.WILL_O_WISP ] );
|
||||||
game.override.moveset([Moves.FLARE_BLITZ]);
|
game.override.moveset([ Moves.FLARE_BLITZ ] );
|
||||||
|
|
||||||
await game.startBattle([Species.ZOROARK, Species.AZUMARILL]);
|
await game.startBattle([ Species.ZOROARK, Species.AZUMARILL ] );
|
||||||
|
|
||||||
game.move.select(Moves.FLARE_BLITZ);
|
game.move.select(Moves.FLARE_BLITZ);
|
||||||
|
|
||||||
|
@ -108,12 +108,12 @@ describe("Abilities - Illusion", () => {
|
||||||
const zoroark = game.scene.getPlayerPokemon()!;
|
const zoroark = game.scene.getPlayerPokemon()!;
|
||||||
|
|
||||||
expect(zoroark.illusion.active).equals(true);
|
expect(zoroark.illusion.active).equals(true);
|
||||||
});
|
} );
|
||||||
|
|
||||||
it("copy the the name, the nickname, the gender, the shininess and the pokeball of the pokemon", async () => {
|
it("copy the the name, the nickname, the gender, the shininess and the pokeball of the pokemon", async () => {
|
||||||
vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SCARY_FACE, Moves.SCARY_FACE, Moves.SCARY_FACE, Moves.SCARY_FACE]);
|
vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.SCARY_FACE, Moves.SCARY_FACE, Moves.SCARY_FACE, Moves.SCARY_FACE ] );
|
||||||
|
|
||||||
await game.startBattle([Species.ABRA, Species.ZOROARK, Species.AXEW]);
|
await game.startBattle([ Species.ABRA, Species.ZOROARK, Species.AXEW ] );
|
||||||
|
|
||||||
const axew = game.scene.getParty().at(2)!;
|
const axew = game.scene.getParty().at(2)!;
|
||||||
axew.shiny = true;
|
axew.shiny = true;
|
||||||
|
@ -126,11 +126,11 @@ describe("Abilities - Illusion", () => {
|
||||||
await game.phaseInterceptor.to(TurnEndPhase);
|
await game.phaseInterceptor.to(TurnEndPhase);
|
||||||
|
|
||||||
const zoroark = game.scene.getPlayerPokemon()!;
|
const zoroark = game.scene.getPlayerPokemon()!;
|
||||||
console.log(zoroark.illusion)
|
console.log(zoroark.illusion);
|
||||||
expect(zoroark.name).equals("Axew");
|
expect(zoroark.name).equals("Axew");
|
||||||
expect(zoroark.getNameToRender()).equals("axew nickname");
|
expect(zoroark.getNameToRender()).equals("axew nickname");
|
||||||
expect(zoroark.getGender(false, true)).equals(Gender.FEMALE);
|
expect(zoroark.getGender(false, true)).equals(Gender.FEMALE);
|
||||||
expect(zoroark.isShiny(true)).equals(true);
|
expect(zoroark.isShiny(true)).equals(true);
|
||||||
expect(zoroark.illusion.pokeball).equals(PokeballType.GREAT_BALL);
|
expect(zoroark.illusion.pokeball).equals(PokeballType.GREAT_BALL);
|
||||||
});
|
} );
|
||||||
});
|
} );
|
||||||
|
|
Loading…
Reference in New Issue