Merge branch 'beta' into sheerForceImp

This commit is contained in:
Mumble 2024-11-17 16:22:09 -08:00 committed by GitHub
commit bc41e3e7c0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 29 additions and 3 deletions

View File

@ -4951,9 +4951,10 @@ class ForceSwitchOutHelper {
}
/**
* For wild Pokémon battles, the Pokémon will flee if the conditions are met (waveIndex and double battles).
* It will not flee if it is a Mystery Encounter with fleeing disabled (checked in `getSwitchOutCondition()`) or if it is a wave 10x wild boss
*/
} else {
if (!pokemon.scene.currentBattle.waveIndex && pokemon.scene.currentBattle.waveIndex % 10 === 0) {
if (!pokemon.scene.currentBattle.waveIndex || pokemon.scene.currentBattle.waveIndex % 10 === 0) {
return false;
}

View File

@ -3101,10 +3101,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
}
lapseTag(tagType: BattlerTagType): boolean {
const tags = this.summonData?.tags;
if (isNullOrUndefined(tags)) {
if (!this.summonData) {
return false;
}
const tags = this.summonData.tags;
const tag = tags.find(t => t.tagType === tagType);
if (tag && !(tag.lapse(this, BattlerTagLapseType.CUSTOM))) {
tag.onRemove(this);
@ -3114,6 +3114,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
}
lapseTags(lapseType: BattlerTagLapseType): void {
if (!this.summonData) {
return;
}
const tags = this.summonData.tags;
tags.filter(t => lapseType === BattlerTagLapseType.FAINT || ((t.lapseTypes.some(lType => lType === lapseType)) && !(t.lapse(this, lapseType)))).forEach(t => {
t.onRemove(this);
@ -3122,6 +3125,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
}
removeTag(tagType: BattlerTagType): boolean {
if (!this.summonData) {
return false;
}
const tags = this.summonData.tags;
const tag = tags.find(t => t.tagType === tagType);
if (tag) {

View File

@ -613,4 +613,23 @@ describe("Abilities - Wimp Out", () => {
confirmNoSwitch();
});
it("should not activate on wave X0 bosses", async () => {
game.override.enemyAbility(Abilities.WIMP_OUT)
.startingLevel(5850)
.startingWave(10);
await game.classicMode.startBattle([ Species.GOLISOPOD ]);
const enemyPokemon = game.scene.getEnemyPokemon()!;
// Use 2 turns of False Swipe due to opponent's health bar shield
game.move.select(Moves.FALSE_SWIPE);
await game.toNextTurn();
game.move.select(Moves.FALSE_SWIPE);
await game.toNextTurn();
const isVisible = enemyPokemon.visible;
const hasFled = enemyPokemon.switchOutStatus;
expect(isVisible && !hasFled).toBe(true);
});
});