Make move fail override semi-invuln check

Bandaid fix because move effect phase does not allow for the move to fail if all of its conditions fail
This commit is contained in:
Sirz Benjie 2025-04-10 16:58:12 -05:00
parent 3a66e04171
commit 9baf6f166e
No known key found for this signature in database
GPG Key ID: 4A524B4D196C759E
3 changed files with 19 additions and 13 deletions

View File

@ -6377,7 +6377,7 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
}
getCondition(): MoveConditionFunc {
return (user, target, move) => (move.category !== MoveCategory.STATUS || this.getSwitchOutCondition(true)(user, target, move));
return (user, target, move) => (move.category !== MoveCategory.STATUS || this.getSwitchOutCondition()(user, target, move));
}
getFailedText(_user: Pokemon, target: Pokemon, _move: Move): string | undefined {
@ -6389,12 +6389,7 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
}
/**
* Check if the switch out conditions are met.
*
* @param preliminary - Whether to check for failure conditions that occur before the hit check (defaults to false)
*/
getSwitchOutCondition(preliminary = false): MoveConditionFunc {
getSwitchOutCondition(): MoveConditionFunc {
return (user, target, move) => {
const switchOutTarget = (this.selfSwitch ? user : target);
const player = switchOutTarget instanceof PlayerPokemon;
@ -6422,9 +6417,6 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
}
}
if (preliminary) {
return true;
}
if (!player && globalScene.currentBattle.battleType === BattleType.WILD) {
// wild pokemon cannot switch out with baton pass.

View File

@ -43,7 +43,20 @@ import { BattleType } from "#enums/battle-type";
* }
* ```
*/
const overrides = {} satisfies Partial<InstanceType<OverridesType>>;
const overrides = {
HAS_PASSIVE_ABILITY_OVERRIDE: false,
OPP_HAS_PASSIVE_ABILITY_OVERRIDE: false,
RANDOM_TRAINER_OVERRIDE: {
trainerType: TrainerType.BREEDER,
alwaysDouble: true
},
BATTLE_TYPE_OVERRIDE: BattleType.TRAINER,
ABILITY_OVERRIDE: Abilities.BALL_FETCH,
OPP_ABILITY_OVERRIDE: Abilities.BALL_FETCH,
STARTING_LEVEL_OVERRIDE: 100,
MOVESET_OVERRIDE: [ Moves.WHIRLWIND, Moves.SPLASH],
OPP_MOVESET_OVERRIDE: [ Moves.SPLASH]
} satisfies Partial<InstanceType<OverridesType>>;
/**
* If you need to add Overrides values for local testing do that inside {@linkcode overrides}

View File

@ -44,7 +44,8 @@ describe("Moves - Whirlwind", () => {
{ move: Moves.SKY_DROP, name: "Sky Drop" },
])("should not hit a flying target: $name (=$move)", async ({ move }) => {
game.override.moveset([move]);
await game.classicMode.startBattle([Species.STARAPTOR]);
// Must have a pokemon in the back so that the move misses instead of fails.
await game.classicMode.startBattle([Species.STARAPTOR, Species.MAGIKARP]);
const staraptor = game.scene.getPlayerPokemon()!;
@ -160,7 +161,7 @@ describe("Moves - Whirlwind", () => {
expect(eevee.isOnField()).toBe(false);
});
it("cannot pull in the other trainer's pokemon in a partner trainer battle", async () => {
it("should not pull in the other trainer's pokemon in a partner trainer battle", async () => {
game.override
.battleType(BattleType.TRAINER)
.randomTrainer({