mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-22 16:22:31 +02:00
nit corrections
This commit is contained in:
parent
699de179e6
commit
41ca2cd9ef
@ -1896,11 +1896,14 @@ export class PostSummonMessageAbAttr extends PostSummonAbAttr {
|
||||
|
||||
applyPostSummon(pokemon: Pokemon, passive: boolean, args: any[]): boolean {
|
||||
pokemon.scene.queueMessage(this.messageFunc(pokemon));
|
||||
|
||||
pokemon.scene.getField(true).map(pokemon => {
|
||||
if (pokemon.breakIllusion()) {
|
||||
pokemon.scene.queueMessage(i18next.t("abilityTriggers:illusionBreak", { pokemonName: getPokemonNameWithAffix(pokemon) }));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
export class PostSummonRemoveIllusionAbAttr extends PostSummonAbAttr {
|
||||
applyPostSummon(pokemon: Pokemon, passive: boolean, args: any[]): boolean {
|
||||
pokemon.scene.getField(true).map(pokemon => {
|
||||
pokemon.breakIllusion();
|
||||
});
|
||||
return true;
|
||||
}
|
||||
@ -4049,6 +4052,11 @@ export class IceFaceBlockPhysicalAbAttr extends ReceivedMoveDamageMultiplierAbAt
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Base class for defining {@linkcode Ability} attributes before summon
|
||||
* (should use {@linkcode PostSummonAbAttr} for most ability)
|
||||
* @see {@linkcode applyPreSummon()}
|
||||
*/
|
||||
export class PreSummonAbAttr extends AbAttr {
|
||||
applyPreSummon(pokemon: Pokemon, passive: boolean, args: any[]): boolean {
|
||||
return false;
|
||||
@ -4097,17 +4105,16 @@ export class IllusionBreakAbAttr extends PostDefendAbAttr {
|
||||
*/
|
||||
applyPostDefend(pokemon: Pokemon, passive: 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];
|
||||
const breakIllusion: HitResult[] = [ HitResult.EFFECTIVE, HitResult.SUPER_EFFECTIVE, HitResult.NOT_VERY_EFFECTIVE, HitResult.ONE_HIT_KO ];
|
||||
if (!breakIllusion.includes(hitResult)) {
|
||||
return false;
|
||||
}
|
||||
pokemon.breakIllusion();
|
||||
pokemon.scene.queueMessage(i18next.t("abilityTriggers:illusionBreak", { pokemonName: getPokemonNameWithAffix(pokemon) }));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
export class IllusionAfterBattle extends PostBattleAbAttr {
|
||||
export class IllusionPostBattleAbAttr extends PostBattleAbAttr {
|
||||
/**
|
||||
* Illusion will be available again after a battle and apply the illusion of the pokemon is already on field
|
||||
*
|
||||
@ -4868,7 +4875,7 @@ export function initAbilities() {
|
||||
//The pokemon loses his illusion when he is damaged by a move
|
||||
.conditionalAttr((pokemon) => pokemon.illusion.active, IllusionBreakAbAttr, true)
|
||||
//Illusion is available again after a battle
|
||||
.conditionalAttr((pokemon) => pokemon.isAllowedInBattle(), IllusionAfterBattle, false)
|
||||
.conditionalAttr((pokemon) => pokemon.isAllowedInBattle(), IllusionPostBattleAbAttr, false)
|
||||
//Illusion is not available after summon
|
||||
.attr(IllusionDisableAbAttr, false)
|
||||
.bypassFaint(),
|
||||
@ -5246,6 +5253,7 @@ export function initAbilities() {
|
||||
.attr(UnswappableAbilityAbAttr)
|
||||
.attr(NoTransformAbilityAbAttr)
|
||||
.attr(PostSummonMessageAbAttr, (pokemon: Pokemon) => i18next.t("abilityTriggers:postSummonNeutralizingGas", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) }))
|
||||
.attr(PostSummonRemoveIllusionAbAttr)
|
||||
.partial(),
|
||||
new Ability(Abilities.PASTEL_VEIL, 8)
|
||||
.attr(PostSummonUserFieldRemoveStatusEffectAbAttr, StatusEffect.POISON, StatusEffect.TOXIC)
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { ability } from "./ability";
|
||||
import { abilityTriggers } from "./ability-trigger";
|
||||
import { arenaFlyout } from "./arena-flyout";
|
||||
import { PGFachv, PGMachv } from "./achv";
|
||||
import { arenaFlyout } from "./arena-flyout";
|
||||
import { arenaTag } from "./arena-tag";
|
||||
|
@ -28,17 +28,17 @@ describe("Abilities - Illusion", () => {
|
||||
|
||||
beforeEach(() => {
|
||||
game = new GameManager(phaserGame);
|
||||
vi.spyOn(overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single");
|
||||
vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.ZORUA);
|
||||
vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ILLUSION);
|
||||
vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]);
|
||||
vi.spyOn(overrides, "OPP_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "WIDE_LENS", count: 3}]);
|
||||
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.enemyHeldItems([{name: "WIDE_LENS", count: 3}]);
|
||||
|
||||
vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.WORRY_SEED, Moves.SOAK, Moves.TACKLE, Moves.TACKLE]);
|
||||
vi.spyOn(overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "WIDE_LENS", count: 3}]);
|
||||
game.override.moveset([Moves.WORRY_SEED, Moves.SOAK, Moves.TACKLE, Moves.TACKLE]);
|
||||
game.override.startingHeldItems([{name: "WIDE_LENS", count: 3}]);
|
||||
});
|
||||
|
||||
it("create illusion at the start", async () => {
|
||||
it("creates illusion at the start", async () => {
|
||||
await game.startBattle([Species.ZOROARK, Species.AXEW]);
|
||||
|
||||
const zoroark = game.scene.getPlayerPokemon();
|
||||
@ -47,24 +47,30 @@ describe("Abilities - Illusion", () => {
|
||||
expect(zoroark.illusion.active).equals(true);
|
||||
expect(zorua.illusion.active).equals(true);
|
||||
expect(zoroark.illusion.available).equals(false);
|
||||
|
||||
});
|
||||
|
||||
it("disappear after receiving damaging move and changing ability move", async () => {
|
||||
await game.startBattle([Species.ZOROARK, Species.AXEW]);
|
||||
game.doAttack(getMovePosition(game.scene, 0, Moves.WORRY_SEED));
|
||||
it("break after receiving damaging move", async () => {
|
||||
await game.startBattle([Species.AXEW]);
|
||||
game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE));
|
||||
|
||||
await game.phaseInterceptor.to(TurnEndPhase);
|
||||
|
||||
const zoroark = game.scene.getPlayerPokemon();
|
||||
const zorua = game.scene.getEnemyPokemon();
|
||||
|
||||
expect(zorua.illusion.active).equals(false);
|
||||
expect(zoroark.illusion.active).equals(false);
|
||||
});
|
||||
|
||||
it("disappear if the ability is suppressed", async () => {
|
||||
vi.spyOn(overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NEUTRALIZING_GAS);
|
||||
it("break after getting ability changed", async () => {
|
||||
await game.startBattle([Species.AXEW]);
|
||||
game.doAttack(getMovePosition(game.scene, 0, Moves.WORRY_SEED));
|
||||
|
||||
const zorua = game.scene.getEnemyPokemon();
|
||||
|
||||
expect(zorua.illusion.active).equals(false);
|
||||
});
|
||||
|
||||
it("break if the ability is suppressed", async () => {
|
||||
game.override.enemyAbility(Abilities.NEUTRALIZING_GAS);
|
||||
await game.startBattle([Species.KOFFING]);
|
||||
|
||||
const zorua = game.scene.getEnemyPokemon();
|
||||
@ -72,24 +78,24 @@ describe("Abilities - Illusion", () => {
|
||||
expect(zorua.illusion.active).equals(false);
|
||||
});
|
||||
|
||||
it("trick the enemy AI", async () => {
|
||||
vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.FLAMETHROWER, Moves.PSYCHIC, Moves.TACKLE, Moves.TACKLE]);
|
||||
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]);
|
||||
await game.startBattle([Species.ZOROARK, Species.AXEW]);
|
||||
|
||||
const enemy = game.scene.getEnemyPokemon();
|
||||
const zoroark = game.scene.getPlayerPokemon();
|
||||
|
||||
const flameThwowerEffectiveness = zoroark.getAttackMoveEffectiveness(enemy, enemy.getMoveset()[0], false, true);
|
||||
const flameThrowerEffectiveness = zoroark.getAttackMoveEffectiveness(enemy, enemy.getMoveset()[0], false, true);
|
||||
const psychicEffectiveness = zoroark.getAttackMoveEffectiveness(enemy, enemy.getMoveset()[1], false, true);
|
||||
|
||||
expect(psychicEffectiveness).above(flameThwowerEffectiveness);
|
||||
expect(psychicEffectiveness).above(flameThrowerEffectiveness);
|
||||
});
|
||||
|
||||
it("do not disappear if the pokemon takes indirect damages", async () => {
|
||||
vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.GIGALITH);
|
||||
vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.SAND_STREAM);
|
||||
vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.WILL_O_WISP, Moves.WILL_O_WISP, Moves.WILL_O_WISP, Moves.WILL_O_WISP]);
|
||||
vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.FLARE_BLITZ]);
|
||||
it("do not breaks if the pokemon takes indirect damages", 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.moveset([Moves.FLARE_BLITZ]);
|
||||
|
||||
await game.startBattle([Species.ZOROARK, Species.AZUMARILL]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user