review corrections

This commit is contained in:
Lylian 2025-03-31 15:04:37 +02:00
parent f9eb01d466
commit 377aafa85c
4 changed files with 21 additions and 15 deletions

View File

@ -5245,14 +5245,13 @@ export class IllusionBreakAbAttr extends PostDefendAbAttr {
* @param args - unused
* @returns - Whether the illusion was destroyed.
*/
applyPostDefend(pokemon: Pokemon, passive: boolean, simulated: boolean, attacker: Pokemon, move: Move, hitResult: HitResult, args: any[]): boolean {
const breakIllusion: HitResult[] = [ HitResult.EFFECTIVE, HitResult.SUPER_EFFECTIVE, HitResult.NOT_VERY_EFFECTIVE, HitResult.ONE_HIT_KO ];
if (!breakIllusion.includes(hitResult)) {
return false;
}
override applyPostDefend(pokemon: Pokemon, passive: boolean, simulated: boolean, attacker: Pokemon, move: Move, hitResult: HitResult, args: any[]): void {
pokemon.breakIllusion();
return true;
}
override canApplyPostDefend(pokemon: Pokemon, passive: boolean, simulated: boolean, attacker: Pokemon, move: Move, hitResult: HitResult, args: any[]): boolean {
const breakIllusion: HitResult[] = [ HitResult.EFFECTIVE, HitResult.SUPER_EFFECTIVE, HitResult.NOT_VERY_EFFECTIVE, HitResult.ONE_HIT_KO ];
return breakIllusion.includes(hitResult) && pokemon.battleData.illusion.active
}
}
@ -5265,10 +5264,9 @@ export class IllusionPostBattleAbAttr extends PostBattleAbAttr {
* @param {...any} args - N/A
* @returns {boolean} - Whether the illusion was applied.
*/
applyPostBattle(pokemon: Pokemon, passive: boolean, simulated:boolean, args: any[]): boolean {
override applyPostBattle(pokemon: Pokemon, passive: boolean, simulated:boolean, args: any[]): void {
pokemon.breakIllusion();
pokemon.battleData.illusion.available = true;
return true;
}
}

View File

@ -735,10 +735,12 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} else {
let availables: Species[] = [];
let randomIllusion: PokemonSpecies = globalScene.arena.randomSpecies(globalScene.currentBattle.waveIndex, this.level);
/*
if (this.isBoss()) {
availables = [ Species.ENTEI, Species.RAIKOU, Species.SUICUNE ];
randomIllusion = getPokemonSpecies(availables[this.randSeedInt(availables.length)]);
}
*/
this.battleData.illusion = {
active: true,
@ -1857,6 +1859,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
}
}
/**
*
* @param fakeShininess - Whether we want the fake or real shininess (illusion ability).
* @returns `true` if the {@linkcode Pokemon} is shiny and the fusion is shiny as well, `false` otherwise
*/
isDoubleShiny(fakeShininess: boolean = false): boolean {
if (!fakeShininess && this.battleData?.illusion.active) {
return this.isFusion(false) && this.battleData?.illusion.basePokemon!.shiny && this.battleData?.illusion.basePokemon.fusionShiny;

View File

@ -6,6 +6,7 @@ import i18next from "i18next";
/**
* Retrieves the Pokemon's name, potentially with an affix indicating its role (wild or foe) in the current battle context, translated
* @param pokemon {@linkcode Pokemon} name and battle context will be retrieved from this instance
* @param {boolean} useIllusion - Whether we want the name of the illusion or not. Default value : true
* @returns {string} ex: "Wild Gengar", "Ectoplasma sauvage"
*/
export function getPokemonNameWithAffix(pokemon: Pokemon | undefined, useIllusion = true): string {

View File

@ -28,10 +28,10 @@ describe("Abilities - Illusion", () => {
game.override.battleType("single");
game.override.enemySpecies(Species.ZORUA);
game.override.enemyAbility(Abilities.ILLUSION);
game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]);
game.override.enemyMoveset(Moves.TACKLE);
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]);
game.override.startingHeldItems([{ name: "WIDE_LENS", count: 3 }]);
});
@ -108,7 +108,7 @@ describe("Abilities - Illusion", () => {
it("does not break from indirect damage", async () => {
game.override.enemySpecies(Species.GIGALITH);
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);
game.override.moveset([Moves.FLARE_BLITZ]);
await game.classicMode.startBattle([Species.ZOROARK, Species.AZUMARILL]);
@ -122,9 +122,9 @@ describe("Abilities - Illusion", () => {
expect(zoroark.battleData.illusion.active).equals(true);
});
it("copy the the name, the nickname, the gender, the shininess and the pokeball of the pokemon", async () => {
await game.classicMode.startBattle([Species.ABRA, Species.ZOROARK, Species.AXEW]).enemyMoveset([Moves.SPLASH]);
it("copies the the name, nickname, gender, shininess, and pokeball from the illusion source", async () => {
game.override.enemyMoveset(Moves.SPLASH);
await game.classicMode.startBattle([Species.ABRA, Species.ZOROARK, Species.AXEW]);
const axew = game.scene.getPlayerParty().at(2)!;
axew.shiny = true;
axew.nickname = btoa(unescape(encodeURIComponent("axew nickname")));