mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-29 11:42:21 +02:00
squash
This commit is contained in:
parent
0fe57b44b5
commit
05fcf58139
@ -3343,6 +3343,7 @@ export class PostWeatherLapseDamageAbAttr extends PostWeatherLapseAbAttr {
|
||||
const abilityName = (!passive ? pokemon.getAbility() : pokemon.getPassiveAbility()).name;
|
||||
scene.queueMessage(i18next.t("abilityTriggers:postWeatherLapseDamage", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), abilityName }));
|
||||
pokemon.damageAndUpdate(Utils.toDmgValue(pokemon.getMaxHp() / (16 / this.damageFactor)), HitResult.OTHER);
|
||||
pokemon.turnData.lastDmgSrc = WeatherType.HARSH_SUN;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -1352,6 +1352,7 @@ export class RecoilAttr extends MoveEffectAttr {
|
||||
user.damageAndUpdate(recoilDamage, HitResult.OTHER, false, true, true);
|
||||
user.scene.queueMessage(i18next.t("moveTriggers:hitWithRecoil", { pokemonName: getPokemonNameWithAffix(user) }));
|
||||
user.turnData.damageTaken += recoilDamage;
|
||||
user.turnData.lastDmgSrc = user.id;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -2796,6 +2796,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
this.battleData.hitCount++;
|
||||
const attackResult = { move: move.id, result: result as DamageResult, damage: damage, critical: isCritical, sourceId: source.id, sourceBattlerIndex: source.getBattlerIndex() };
|
||||
this.turnData.attacksReceived.unshift(attackResult);
|
||||
this.turnData.lastDmgSrc = source;
|
||||
if (source.isPlayer() && !this.isPlayer()) {
|
||||
this.scene.applyModifiers(DamageMoneyRewardModifier, true, source, new Utils.NumberHolder(damage));
|
||||
}
|
||||
@ -5125,6 +5126,7 @@ export class PokemonTurnData {
|
||||
public statStagesDecreased: boolean = false;
|
||||
public moveEffectiveness: TypeDamageMultiplier | null = null;
|
||||
public combiningPledge?: Moves;
|
||||
public lastDmgSrc: Pokemon | WeatherType | StatusEffect;
|
||||
}
|
||||
|
||||
export enum AiType {
|
||||
|
@ -96,8 +96,9 @@ export class FaintPhase extends PokemonPhase {
|
||||
const alivePlayField = this.scene.getField(true);
|
||||
alivePlayField.forEach(p => applyPostKnockOutAbAttrs(PostKnockOutAbAttr, p, pokemon));
|
||||
if (pokemon.turnData?.attacksReceived?.length) {
|
||||
const defeatSource = this.scene.getPokemonById(pokemon.turnData.attacksReceived[0].sourceId);
|
||||
if (defeatSource?.isOnField()) {
|
||||
const defeatSource = pokemon.turnData.lastDmgSrc;
|
||||
|
||||
if (defeatSource instanceof Pokemon && defeatSource?.isOnField()) {
|
||||
applyPostVictoryAbAttrs(PostVictoryAbAttr, defeatSource);
|
||||
const pvmove = allMoves[pokemon.turnData.attacksReceived[0].move];
|
||||
const pvattrs = pvmove.getAttrs(PostVictoryStatStageChangeAttr);
|
||||
|
@ -28,13 +28,16 @@ export class PostTurnStatusEffectPhase extends PokemonPhase {
|
||||
switch (pokemon.status.effect) {
|
||||
case StatusEffect.POISON:
|
||||
damage.value = Math.max(pokemon.getMaxHp() >> 3, 1);
|
||||
pokemon.turnData.lastDmgSrc = StatusEffect.POISON;
|
||||
break;
|
||||
case StatusEffect.TOXIC:
|
||||
damage.value = Math.max(Math.floor((pokemon.getMaxHp() / 16) * pokemon.status.toxicTurnCount), 1);
|
||||
pokemon.turnData.lastDmgSrc = StatusEffect.TOXIC;
|
||||
break;
|
||||
case StatusEffect.BURN:
|
||||
damage.value = Math.max(pokemon.getMaxHp() >> 4, 1);
|
||||
applyAbAttrs(ReduceBurnDamageAbAttr, pokemon, null, false, damage);
|
||||
pokemon.turnData.lastDmgSrc = StatusEffect.BURN;
|
||||
break;
|
||||
}
|
||||
if (damage.value) {
|
||||
|
@ -54,6 +54,9 @@ export class WeatherEffectPhase extends CommonAnimPhase {
|
||||
const immune = !pokemon || !!pokemon.getTypes(true, true).filter(t => this.weather?.isTypeDamageImmune(t)).length;
|
||||
if (!immune) {
|
||||
inflictDamage(pokemon);
|
||||
if (this.weather?.weatherType) {
|
||||
pokemon.turnData.lastDmgSrc = this.weather.weatherType;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
121
src/test/moves/fell_stinger.test.ts
Normal file
121
src/test/moves/fell_stinger.test.ts
Normal file
@ -0,0 +1,121 @@
|
||||
import Phaser from "phaser";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||
import GameManager from "../utils/gameManager";
|
||||
import { Species } from "#enums/species";
|
||||
import { Abilities } from "#enums/abilities";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { Stat } from "#enums/stat";
|
||||
import { StatusEffect } from "#app/enums/status-effect";
|
||||
import { WeatherType } from "#app/enums/weather-type";
|
||||
|
||||
|
||||
describe("Moves - Fell Stinger", () => {
|
||||
let phaserGame: Phaser.Game;
|
||||
let game: GameManager;
|
||||
|
||||
beforeAll(() => {
|
||||
phaserGame = new Phaser.Game({
|
||||
type: Phaser.HEADLESS,
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
game.phaseInterceptor.restoreOg();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
game = new GameManager(phaserGame);
|
||||
|
||||
game.override.battleType("single")
|
||||
.moveset([ Moves.FELL_STINGER ])
|
||||
.startingLevel(50);
|
||||
|
||||
game.override.enemyAbility(Abilities.STURDY)
|
||||
.enemySpecies(Species.HYPNO)
|
||||
.enemyLevel(5)
|
||||
.enemyHeldItems([]);
|
||||
|
||||
game.override.weather(WeatherType.NONE);
|
||||
});
|
||||
|
||||
it("should not grant stat boost when opponent gets KO'd by recoil", async () => {
|
||||
game.override.enemyMoveset([ Moves.DOUBLE_EDGE ]);
|
||||
await game.classicMode.startBattle([ Species.LEAVANNY ]);
|
||||
|
||||
const leadPokemon = game.scene.getPlayerPokemon()!;
|
||||
game.move.select(Moves.FELL_STINGER);
|
||||
|
||||
await game.phaseInterceptor.to("VictoryPhase");
|
||||
|
||||
expect(leadPokemon.getStatStage(Stat.ATK) === 0); // Attack stage should still be at 0
|
||||
});
|
||||
|
||||
it("should not grant stat boost when enemy is KO'd by status effect", async () => {
|
||||
game.override
|
||||
.enemyMoveset(Moves.SPLASH)
|
||||
.enemyStatusEffect(StatusEffect.BURN);
|
||||
await game.classicMode.startBattle([ Species.LEAVANNY ]);
|
||||
|
||||
const leadPokemon = game.scene.getPlayerPokemon()!;
|
||||
game.move.select(Moves.FELL_STINGER);
|
||||
|
||||
await game.phaseInterceptor.to("VictoryPhase");
|
||||
|
||||
expect(leadPokemon.getStatStage(Stat.ATK) === 0); // Attack stage should still be at 0
|
||||
});
|
||||
|
||||
it("should not grant stat boost when enemy is KO'd by damaging weather", async () => {
|
||||
game.override.weather(WeatherType.HAIL);
|
||||
await game.classicMode.startBattle([ Species.LEAVANNY ]);
|
||||
|
||||
const leadPokemon = game.scene.getPlayerPokemon()!;
|
||||
|
||||
game.move.select(Moves.FELL_STINGER);
|
||||
|
||||
await game.phaseInterceptor.to("VictoryPhase");
|
||||
|
||||
expect(leadPokemon.getStatStage(Stat.ATK) === 0); // Attack stage should still be at 0
|
||||
});
|
||||
|
||||
it("should not grant stat boost when enemy is KO'd by Dry Skin + Harsh Sunlight", async () => {
|
||||
game.override
|
||||
.enemyPassiveAbility(Abilities.STURDY)
|
||||
.enemyAbility(Abilities.DRY_SKIN)
|
||||
.weather(WeatherType.HARSH_SUN);
|
||||
await game.challengeMode.startBattle([ Species.LEAVANNY ]);
|
||||
|
||||
const leadPokemon = game.scene.getPlayerPokemon()!;
|
||||
|
||||
game.move.select(Moves.FELL_STINGER);
|
||||
|
||||
await game.phaseInterceptor.to("VictoryPhase");
|
||||
|
||||
expect(leadPokemon.getStatStage(Stat.ATK) === 0); // Attack stage should still be at 0
|
||||
});
|
||||
|
||||
it("should not grant stat boost if enemy is saved by Reviver Seed", async () => {
|
||||
game.override
|
||||
.enemyAbility(Abilities.KLUTZ)
|
||||
.enemyHeldItems([{ name: "REVIVER_SEED" }]);
|
||||
|
||||
await game.classicMode.startBattle([ Species.LEAVANNY ]);
|
||||
|
||||
const leadPokemon = game.scene.getPlayerPokemon()!;
|
||||
game.move.select(Moves.FELL_STINGER);
|
||||
|
||||
await game.phaseInterceptor.to("TurnEndPhase");
|
||||
expect(leadPokemon.getStatStage(Stat.ATK) === 0); // Attack stage should still be at 0
|
||||
});
|
||||
|
||||
it("should grant stat boost when enemy dies directly to hit", async () => {
|
||||
game.override.enemyAbility(Abilities.KLUTZ);
|
||||
await game.challengeMode.startBattle([ Species.LEAVANNY ]);
|
||||
|
||||
const leadPokemon = game.scene.getPlayerPokemon()!;
|
||||
game.move.select(Moves.FELL_STINGER);
|
||||
|
||||
await game.phaseInterceptor.to("VictoryPhase");
|
||||
|
||||
expect(leadPokemon.getStatStage(Stat.ATK) === 3); // Attack stage should have risen to 3
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user