mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-16 21:32:18 +02:00
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:
parent
e73cc310c0
commit
fa037810b8
@ -6374,7 +6374,7 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getCondition(): MoveConditionFunc {
|
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 {
|
getFailedText(_user: Pokemon, target: Pokemon, _move: Move): string | undefined {
|
||||||
@ -6386,12 +6386,7 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
getSwitchOutCondition(): MoveConditionFunc {
|
||||||
* 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 {
|
|
||||||
return (user, target, move) => {
|
return (user, target, move) => {
|
||||||
const switchOutTarget = (this.selfSwitch ? user : target);
|
const switchOutTarget = (this.selfSwitch ? user : target);
|
||||||
const player = switchOutTarget instanceof PlayerPokemon;
|
const player = switchOutTarget instanceof PlayerPokemon;
|
||||||
@ -6419,9 +6414,6 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preliminary) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!player && globalScene.currentBattle.battleType === BattleType.WILD) {
|
if (!player && globalScene.currentBattle.battleType === BattleType.WILD) {
|
||||||
// wild pokemon cannot switch out with baton pass.
|
// wild pokemon cannot switch out with baton pass.
|
||||||
|
@ -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}
|
* If you need to add Overrides values for local testing do that inside {@linkcode overrides}
|
||||||
|
@ -44,7 +44,8 @@ describe("Moves - Whirlwind", () => {
|
|||||||
{ move: Moves.SKY_DROP, name: "Sky Drop" },
|
{ move: Moves.SKY_DROP, name: "Sky Drop" },
|
||||||
])("should not hit a flying target: $name (=$move)", async ({ move }) => {
|
])("should not hit a flying target: $name (=$move)", async ({ move }) => {
|
||||||
game.override.moveset([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()!;
|
const staraptor = game.scene.getPlayerPokemon()!;
|
||||||
|
|
||||||
@ -160,7 +161,7 @@ describe("Moves - Whirlwind", () => {
|
|||||||
expect(eevee.isOnField()).toBe(false);
|
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
|
game.override
|
||||||
.battleType(BattleType.TRAINER)
|
.battleType(BattleType.TRAINER)
|
||||||
.randomTrainer({
|
.randomTrainer({
|
||||||
|
Loading…
Reference in New Issue
Block a user