Fix issue with battle continuing after enemy faint

pull/2/head
Flashfyre 2023-05-19 12:35:06 -04:00
parent b9f7ba173d
commit b0112c5acb
3 changed files with 4 additions and 3 deletions

View File

@ -2299,6 +2299,7 @@ export class AttemptCapturePhase extends PokemonPhase {
Promise.all(modifiers.map(m => this.scene.addModifier(m))).then(() => { Promise.all(modifiers.map(m => this.scene.addModifier(m))).then(() => {
this.scene.getPlayerField().forEach(playerPokemon => playerPokemon.removeTagsBySourceId(pokemon.id)); this.scene.getPlayerField().forEach(playerPokemon => playerPokemon.removeTagsBySourceId(pokemon.id));
pokemon.hp = 0; pokemon.hp = 0;
pokemon.trySetStatus(StatusEffect.FAINT);
this.scene.clearEnemyModifiers(); this.scene.clearEnemyModifiers();
this.scene.field.remove(pokemon, true); this.scene.field.remove(pokemon, true);
if (newPokemon) if (newPokemon)

View File

@ -23,7 +23,7 @@ import { WeatherType } from './data/weather';
import { TempBattleStat } from './data/temp-battle-stat'; import { TempBattleStat } from './data/temp-battle-stat';
import { ArenaTagType, WeakenMoveTypeTag } from './data/arena-tag'; import { ArenaTagType, WeakenMoveTypeTag } from './data/arena-tag';
import { Biome } from './data/biome'; import { Biome } from './data/biome';
import { Abilities, Ability, BattleStatMultiplierAbAttr, BattlerTagImmunityAbAttr, BlockCritAbAttr, PreApplyBattlerTagAbAttr, StatusEffectImmunityAbAttr, TypeImmunityAbAttr, VariableMovePowerAbAttr, abilities, applyBattleStatMultiplierAbAttrs, applyPreApplyBattlerTagAbAttrs, applyPreAttackAbAttrs, applyPreDefendAbAttrs, applyPreSetStatusAbAttrs } from './data/ability'; import { Abilities, Ability, BattleStatMultiplierAbAttr, BlockCritAbAttr, PreApplyBattlerTagAbAttr, StatusEffectImmunityAbAttr, TypeImmunityAbAttr, VariableMovePowerAbAttr, abilities, applyBattleStatMultiplierAbAttrs, applyPreApplyBattlerTagAbAttrs, applyPreAttackAbAttrs, applyPreDefendAbAttrs, applyPreSetStatusAbAttrs } from './data/ability';
import PokemonData from './system/pokemon-data'; import PokemonData from './system/pokemon-data';
import { BattlerIndex } from './battle'; import { BattlerIndex } from './battle';
@ -884,7 +884,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} }
trySetStatus(effect: StatusEffect): boolean { trySetStatus(effect: StatusEffect): boolean {
if (this.status) if (this.status && effect !== StatusEffect.FAINT)
return false; return false;
switch (effect) { switch (effect) {
case StatusEffect.POISON: case StatusEffect.POISON:

View File

@ -192,7 +192,7 @@ export class GameData {
scene.pokeballCounts[key] = sessionData.pokeballCounts[key] || 0; scene.pokeballCounts[key] = sessionData.pokeballCounts[key] || 0;
}); });
scene.newArena(sessionData.arena.biome, sessionData.enemyField.length > 1); scene.newArena(sessionData.arena.biome, true);
const battle = scene.newBattle(sessionData.waveIndex, sessionData.enemyField.length > 1); const battle = scene.newBattle(sessionData.waveIndex, sessionData.enemyField.length > 1);
sessionData.enemyField.forEach((enemyData, e) => { sessionData.enemyField.forEach((enemyData, e) => {