mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-20 23:32:19 +02:00
Fixes endure to no longer block indirect damage, updates weather damage to be HitResult.OTHER, adds/fixes unit test
This commit is contained in:
parent
73538df5d0
commit
0ce30aad5f
@ -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();
|
||||
|
@ -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) => {
|
||||
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user