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