diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 90e2a1eaa17..c910be18c8e 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -3014,7 +3014,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { } const surviveDamage = new Utils.BooleanHolder(false); - if (!preventEndure && this.hp - damage <= 0) { + if (!preventEndure && this.hp - damage <= 0 && this.turnData?.damageSources?.at(0) !== HitResult.OTHER) { if (this.hp >= 1 && this.getTag(BattlerTagType.ENDURING)) { surviveDamage.value = this.lapseTag(BattlerTagType.ENDURING); } else if (this.hp > 1 && this.getTag(BattlerTagType.STURDY)) { @@ -3041,7 +3041,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { * Once the MoveEffectPhase is over (and calls it's .end() function, shiftPhase() will reset the PhaseQueueSplice via clearPhaseQueueSplice() ) */ globalScene.setPhaseQueueSplice(); - globalScene.unshiftPhase(new FaintPhase(this.getBattlerIndex(), preventEndure)); + globalScene.unshiftPhase(new FaintPhase(this.getBattlerIndex())); this.destroySubstitute(); this.lapseTag(BattlerTagType.COMMANDED); this.resetSummonData(); diff --git a/src/phases/weather-effect-phase.ts b/src/phases/weather-effect-phase.ts index aa09f8a850d..ae5fd07b56a 100644 --- a/src/phases/weather-effect-phase.ts +++ b/src/phases/weather-effect-phase.ts @@ -49,7 +49,7 @@ export class WeatherEffectPhase extends CommonAnimPhase { const damage = Utils.toDmgValue(pokemon.getMaxHp() / 16); globalScene.queueMessage(getWeatherDamageMessage(this.weather?.weatherType!, pokemon)!); // TODO: are those bangs correct? - pokemon.damageAndUpdate(damage, HitResult.EFFECTIVE, false, false, true); + pokemon.damageAndUpdate(damage, HitResult.OTHER, false, false, true); }; this.executeForAll((pokemon: Pokemon) => { diff --git a/src/test/items/reviver_seed.test.ts b/src/test/items/reviver_seed.test.ts index da32799132e..651cd07c3ab 100644 --- a/src/test/items/reviver_seed.test.ts +++ b/src/test/items/reviver_seed.test.ts @@ -87,21 +87,20 @@ describe("Items - Reviver Seed", () => { expect(player.isFainted()).toBeFalsy(); }); - - //Need to fix some of tests, something wrong with the enemy fainting, wrong phase being chosen.. not sure + // Damaging opponents tests it.each([ - //{ moveType: "Damaging Move Chip Damage", move: Moves.SALT_CURE }, - //{ moveType: "Chip Damage", move: Moves.LEECH_SEED }, - //{ moveType: "Trapping Chip Damage", move: Moves.WHIRLPOOL }, + { moveType: "Damaging Move Chip Damage", move: Moves.SALT_CURE }, + { moveType: "Chip Damage", move: Moves.LEECH_SEED }, + { moveType: "Trapping Chip Damage", move: Moves.WHIRLPOOL }, { moveType: "Status Effect Damage", move: Moves.WILL_O_WISP }, - { moveType: "Weather", move: Moves.SANDSTORM } + { moveType: "Weather", move: Moves.SANDSTORM }, ])("should not activate the holder's reviver seed from $moveType", async ({ move }) => { game.override .enemyLevel(1) .startingLevel(100) .enemySpecies(Species.MAGIKARP) .moveset(move) - .enemyMoveset(Moves.SPLASH); + .enemyMoveset(Moves.ENDURE); await game.classicMode.startBattle([ Species.MAGIKARP, Species.FEEBAS ]); const enemy = game.scene.getEnemyPokemon()!; enemy.damageAndUpdate(enemy.hp - 1); @@ -110,8 +109,36 @@ describe("Items - Reviver Seed", () => { vi.spyOn(enemySeed, "apply"); game.move.select(move); - await game.phaseInterceptor.to("BerryPhase"); + await game.phaseInterceptor.to("TurnEndPhase"); expect(enemy.isFainted()).toBeTruthy(); }); + + // Self-damage tests + it.each([ + { moveType: "Recoil", move: Moves.DOUBLE_EDGE }, + { moveType: "Self-KO", move: Moves.EXPLOSION }, + { moveType: "Self-Deduction", move: Moves.CURSE }, + { moveType: "Liquid Ooze", move: Moves.GIGA_DRAIN }, + ])("should not activate the holder's reviver seed from $moveType", async ({ move }) => { + game.override + .enemyLevel(100) + .startingLevel(1) + .enemySpecies(Species.MAGIKARP) + .moveset(move) + .enemyAbility(Abilities.LIQUID_OOZE) + .enemyMoveset(Moves.SPLASH); + await game.classicMode.startBattle([ Species.GASTLY, Species.FEEBAS ]); + const player = game.scene.getPlayerPokemon()!; + player.damageAndUpdate(player.hp - 1); + + const playerSeed = player.getHeldItems()[0] as PokemonInstantReviveModifier; + vi.spyOn(playerSeed, "apply"); + + game.move.select(move); + await game.phaseInterceptor.to("TurnEndPhase"); + + expect(playerSeed.apply).toHaveReturnedWith(false); // Reviver Seed triggers + expect(player.isFainted()).toBeTruthy(); + }); });