mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-09 00:49:27 +02:00
Fixed import issues i think
This commit is contained in:
parent
6ee2f89182
commit
06290774c2
@ -1972,17 +1972,17 @@ export class HealAttr extends MoveEffectAttr {
|
||||
return Math.round(score / (1 - this.healRatio / 2));
|
||||
}
|
||||
|
||||
// TODO: Change post move failure rework
|
||||
override getCondition(): MoveConditionFunc {
|
||||
return (user, target) => {
|
||||
const healedPokemon = this.selfTarget ? user : target;
|
||||
if (healedPokemon.isFullHp()) {
|
||||
globalScene.phaseManager.queueMessage(i18next.t("battle:hpIsFull", {
|
||||
pokemonName: getPokemonNameWithAffix(healedPokemon),
|
||||
}))
|
||||
return false;
|
||||
return (user, target) => !(this.selfTarget ? user : target).isFullHp();
|
||||
}
|
||||
|
||||
override getFailedText(user: Pokemon, target: Pokemon): string | undefined {
|
||||
const healedPokemon = (this.selfTarget ? user : target);
|
||||
if (healedPokemon.isFullHp()) {
|
||||
return i18next.t("battle:hpIsFull", {
|
||||
pokemonName: getPokemonNameWithAffix(healedPokemon),
|
||||
})
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1990,7 +1990,11 @@ export class HealAttr extends MoveEffectAttr {
|
||||
* Attribute for moves with variable healing amounts.
|
||||
* Heals the target by an amount depending on the return value of {@linkcode healFunc}.
|
||||
*
|
||||
* Used for {@linkcode MoveId.MOONLIGHT}, {@linkcode MoveId.SHORE_UP}, {@linkcode MoveId.JUNGLE_HEALING}, {@linkcode MoveId.SWALLOW}
|
||||
* Used for:
|
||||
* - {@linkcode MoveId.MOONLIGHT} and variants
|
||||
* - {@linkcode MoveId.SHORE_UP}
|
||||
* - {@linkcode MoveId.JUNGLE_HEALING}
|
||||
* - {@linkcode MoveId.SWALLOW}
|
||||
*/
|
||||
export class VariableHealAttr extends HealAttr {
|
||||
constructor(
|
||||
@ -2005,7 +2009,7 @@ export class VariableHealAttr extends HealAttr {
|
||||
|
||||
apply(user: Pokemon, target: Pokemon, move: Move, _args: any[]): boolean {
|
||||
this.healRatio = this.healFunc(user, target, move)
|
||||
return super.apply(user, target, move, args);
|
||||
return super.apply(user, target, move, _args);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2023,8 +2027,8 @@ export class HealOnAllyAttr extends HealAttr {
|
||||
return false;
|
||||
}
|
||||
|
||||
override getCondition(user: Pokemon, target: Pokemon, _move: Move, _args?: any[]): boolean {
|
||||
return user.getAlly() !== target || super.getCondition()(user, target, _move);
|
||||
override getCondition(): MoveConditionFunc {
|
||||
return (user, target, _move) => user.getAlly() !== target || super.getCondition()(user, target, _move)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,12 @@
|
||||
import { getPokemonNameWithAffix } from "#app/messages";
|
||||
import { getEnumValues, toReadableString } from "#app/utils/common";
|
||||
import { AbilityId } from "#enums/ability-id";
|
||||
import { MoveId } from "#enums/move-id";
|
||||
import { MoveResult } from "#enums/move-result";
|
||||
import { SpeciesId } from "#enums/species-id";
|
||||
import { WeatherType } from "#enums/weather-type";
|
||||
import GameManager from "#test/testUtils/gameManager";
|
||||
import { GameManager } from "#test/testUtils/gameManager";
|
||||
import { toReadableString } from "#utils/common";
|
||||
import { getEnumValues } from "#utils/enums";
|
||||
import i18next from "i18next";
|
||||
import Phaser from "phaser";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||
@ -94,7 +95,7 @@ describe("Moves - Recovery Moves - ", () => {
|
||||
expect(blissey.getHpRatio()).toBeCloseTo(0.66, 1);
|
||||
});
|
||||
|
||||
const nonSunWTs = (getEnumValues(WeatherType) as WeatherType[])
|
||||
const nonSunWTs = getEnumValues(WeatherType)
|
||||
.filter(
|
||||
wt => ![WeatherType.SUNNY, WeatherType.HARSH_SUN, WeatherType.NONE, WeatherType.STRONG_WINDS].includes(wt),
|
||||
)
|
||||
|
@ -1,27 +1,28 @@
|
||||
import { Stat } from "#enums/stat";
|
||||
import { StockpilingTag } from "#app/data/battler-tags";
|
||||
import { BattlerTagType } from "#app/enums/battler-tag-type";
|
||||
import { MoveResult } from "#enums/move-result";
|
||||
import { AbilityId } from "#enums/ability-id";
|
||||
import { MoveId } from "#enums/move-id";
|
||||
import { SpeciesId } from "#enums/species-id";
|
||||
import GameManager from "#test/testUtils/gameManager";
|
||||
import Phaser from "phaser";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi, type MockInstance } from "vitest";
|
||||
import { BattlerIndex } from "#enums/battler-index";
|
||||
import { allMoves } from "#app/data/data-lists";
|
||||
import { BattlerTagType } from "#app/enums/battler-tag-type";
|
||||
import { getPokemonNameWithAffix } from "#app/messages";
|
||||
import { AbilityId } from "#enums/ability-id";
|
||||
import { BattlerIndex } from "#enums/battler-index";
|
||||
import { MoveId } from "#enums/move-id";
|
||||
import { MoveResult } from "#enums/move-result";
|
||||
import { SpeciesId } from "#enums/species-id";
|
||||
import { Stat } from "#enums/stat";
|
||||
import { GameManager } from "#test/testUtils/gameManager";
|
||||
import i18next from "i18next";
|
||||
import Phaser from "phaser";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, type MockInstance, vi } from "vitest";
|
||||
|
||||
describe("Swallow & Spit Up", () => {
|
||||
describe("Moves - Swallow & Spit Up - ", () => {
|
||||
let phaserGame: Phaser.Game;
|
||||
let game: GameManager;
|
||||
|
||||
beforeAll(() => {
|
||||
phaserGame = new Phaser.Game({ type: Phaser.HEADLESS });
|
||||
phaserGame = new Phaser.Game({
|
||||
type: Phaser.HEADLESS,
|
||||
});
|
||||
});
|
||||
|
||||
describe("Moves - Swallow", () => {
|
||||
afterEach(() => {
|
||||
game.phaseInterceptor.restoreOg();
|
||||
});
|
||||
@ -38,6 +39,7 @@ describe("Swallow & Spit Up", () => {
|
||||
.ability(AbilityId.BALL_FETCH);
|
||||
});
|
||||
|
||||
describe("Swallow", () => {
|
||||
it.each<{ stackCount: number; healPercent: number }>([
|
||||
{ stackCount: 1, healPercent: 25 },
|
||||
{ stackCount: 2, healPercent: 50 },
|
||||
@ -109,24 +111,10 @@ describe("Swallow & Spit Up", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("Moves - Spit Up", () => {
|
||||
describe("Spit Up", () => {
|
||||
let spitUpSpy: MockInstance;
|
||||
|
||||
afterEach(() => {
|
||||
game.phaseInterceptor.restoreOg();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
game = new GameManager(phaserGame);
|
||||
|
||||
game.override
|
||||
.battleStyle("single")
|
||||
.enemySpecies(SpeciesId.RATTATA)
|
||||
.enemyAbility(AbilityId.BALL_FETCH)
|
||||
.enemyLevel(2000)
|
||||
.enemyMoveset(MoveId.SPLASH)
|
||||
.ability(AbilityId.BALL_FETCH);
|
||||
|
||||
spitUpSpy = vi.spyOn(allMoves[MoveId.SPIT_UP], "calculateBattlePower");
|
||||
});
|
||||
|
||||
@ -173,23 +161,6 @@ describe("Swallow & Spit Up", () => {
|
||||
});
|
||||
|
||||
describe("Stockpile stack removal", () => {
|
||||
afterEach(() => {
|
||||
game.phaseInterceptor.restoreOg();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
game = new GameManager(phaserGame);
|
||||
|
||||
game.override
|
||||
.battleStyle("single")
|
||||
.enemySpecies(SpeciesId.RATTATA)
|
||||
.enemyMoveset(MoveId.SPLASH)
|
||||
.enemyAbility(AbilityId.BALL_FETCH)
|
||||
.enemyLevel(100)
|
||||
.startingLevel(100)
|
||||
.ability(AbilityId.BALL_FETCH);
|
||||
});
|
||||
|
||||
it("should undo stat boosts when losing stacks", async () => {
|
||||
await game.classicMode.startBattle([SpeciesId.ABOMASNOW]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user