Merge branch 'beta' into refactor/api-requests
16
.github/workflows/deploy.yml
vendored
@ -1,8 +1,12 @@
|
|||||||
name: Deploy
|
name: Deploy Main
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push: {}
|
push:
|
||||||
pull_request: {}
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
@ -22,7 +26,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
NODE_ENV: production
|
NODE_ENV: production
|
||||||
- name: Set up SSH
|
- name: Set up SSH
|
||||||
if: github.event_name == 'push' && github.ref_name == github.event.repository.default_branch
|
if: github.event_name == 'push' && github.ref_name == 'main'
|
||||||
run: |
|
run: |
|
||||||
mkdir ~/.ssh
|
mkdir ~/.ssh
|
||||||
echo "${{ secrets.SSH_PUBLIC_KEY }}" > ~/.ssh/id_ed25519.pub
|
echo "${{ secrets.SSH_PUBLIC_KEY }}" > ~/.ssh/id_ed25519.pub
|
||||||
@ -30,12 +34,12 @@ jobs:
|
|||||||
chmod 600 ~/.ssh/*
|
chmod 600 ~/.ssh/*
|
||||||
ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
|
ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
|
||||||
- name: Deploy build on server
|
- name: Deploy build on server
|
||||||
if: github.event_name == 'push' && github.ref_name == github.event.repository.default_branch
|
if: github.event_name == 'push' && github.ref_name == 'main'
|
||||||
run: |
|
run: |
|
||||||
rsync --del --no-times --checksum -vrm dist/* ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:${{ secrets.DESTINATION_DIR }}
|
rsync --del --no-times --checksum -vrm dist/* ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:${{ secrets.DESTINATION_DIR }}
|
||||||
ssh -t ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "~/prmanifest --inpath ${{ secrets.DESTINATION_DIR }} --outpath ${{ secrets.DESTINATION_DIR }}/manifest.json"
|
ssh -t ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "~/prmanifest --inpath ${{ secrets.DESTINATION_DIR }} --outpath ${{ secrets.DESTINATION_DIR }}/manifest.json"
|
||||||
- name: Purge Cloudflare Cache
|
- name: Purge Cloudflare Cache
|
||||||
if: github.event_name == 'push' && github.ref_name == github.event.repository.default_branch
|
if: github.event_name == 'push' && github.ref_name == 'main'
|
||||||
id: purge-cache
|
id: purge-cache
|
||||||
uses: NathanVaughn/actions-cloudflare-purge@v3.1.0
|
uses: NathanVaughn/actions-cloudflare-purge@v3.1.0
|
||||||
with:
|
with:
|
||||||
|
@ -49,7 +49,7 @@ async function promptFileName(selectedType) {
|
|||||||
{
|
{
|
||||||
type: "input",
|
type: "input",
|
||||||
name: "userInput",
|
name: "userInput",
|
||||||
message: `Please provide a file name for the ${selectedType} test:`,
|
message: `Please provide the name of the ${selectedType}:`,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ import { Moves } from "#enums/moves";
|
|||||||
import { Species } from "#enums/species";
|
import { Species } from "#enums/species";
|
||||||
import GameManager from "#test/utils/gameManager";
|
import GameManager from "#test/utils/gameManager";
|
||||||
import Phaser from "phaser";
|
import Phaser from "phaser";
|
||||||
import { afterEach, beforeAll, beforeEach, describe, it, expect } from "vitest";
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||||
|
|
||||||
describe("${description}", () => {
|
describe("${description}", () => {
|
||||||
let phaserGame: Phaser.Game;
|
let phaserGame: Phaser.Game;
|
||||||
@ -129,15 +129,22 @@ describe("${description}", () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
game = new GameManager(phaserGame);
|
game = new GameManager(phaserGame);
|
||||||
game.override
|
game.override
|
||||||
.moveset([Moves.SPLASH])
|
.moveset([ Moves.SPLASH ])
|
||||||
|
.ability(Abilities.BALL_FETCH)
|
||||||
.battleType("single")
|
.battleType("single")
|
||||||
|
.disableCrits()
|
||||||
|
.enemySpecies(Species.MAGIKARP)
|
||||||
.enemyAbility(Abilities.BALL_FETCH)
|
.enemyAbility(Abilities.BALL_FETCH)
|
||||||
.enemyMoveset(Moves.SPLASH);
|
.enemyMoveset(Moves.SPLASH);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("test case", async () => {
|
it("should do X", async () => {
|
||||||
// await game.classicMode.startBattle([Species.MAGIKARP]);
|
await game.classicMode.startBattle([ Species.FEEBAS ]);
|
||||||
// game.move.select(Moves.SPLASH);
|
|
||||||
|
game.move.select(Moves.SPLASH);
|
||||||
|
await game.phaseInterceptor.to("BerryPhase");
|
||||||
|
|
||||||
|
expect(true).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
`;
|
`;
|
||||||
|
Before Width: | Height: | Size: 769 B After Width: | Height: | Size: 411 B |
Before Width: | Height: | Size: 637 B After Width: | Height: | Size: 399 B |
Before Width: | Height: | Size: 637 B After Width: | Height: | Size: 399 B |
Before Width: | Height: | Size: 769 B After Width: | Height: | Size: 411 B |
@ -1 +1 @@
|
|||||||
Subproject commit 3ccef8472dd7cc7c362538489954cb8fdad27e5f
|
Subproject commit b44ee2173788018ffd5dc6b7b7fa159be5b9d514
|
@ -4623,7 +4623,7 @@ async function applyAbAttrsInternal<TAttr extends AbAttr>(
|
|||||||
messages: string[] = [],
|
messages: string[] = [],
|
||||||
) {
|
) {
|
||||||
for (const passive of [ false, true ]) {
|
for (const passive of [ false, true ]) {
|
||||||
if (!pokemon?.canApplyAbility(passive)) {
|
if (!pokemon?.canApplyAbility(passive) || (passive && pokemon.getPassiveAbility().id === pokemon.getAbility().id)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1707,7 +1707,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
if (pokemonEvolutions.hasOwnProperty(this.species.speciesId)) {
|
if (pokemonEvolutions.hasOwnProperty(this.species.speciesId)) {
|
||||||
const evolutions = pokemonEvolutions[this.species.speciesId];
|
const evolutions = pokemonEvolutions[this.species.speciesId];
|
||||||
for (const e of evolutions) {
|
for (const e of evolutions) {
|
||||||
if (!e.item && this.level >= e.level && (!e.preFormKey || this.getFormKey() === e.preFormKey)) {
|
if (!e.item && this.level >= e.level && (isNullOrUndefined(e.preFormKey) || this.getFormKey() === e.preFormKey)) {
|
||||||
if (e.condition === null || (e.condition as SpeciesEvolutionCondition).predicate(this)) {
|
if (e.condition === null || (e.condition as SpeciesEvolutionCondition).predicate(this)) {
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@ -1718,7 +1718,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
if (this.isFusion() && this.fusionSpecies && pokemonEvolutions.hasOwnProperty(this.fusionSpecies.speciesId)) {
|
if (this.isFusion() && this.fusionSpecies && pokemonEvolutions.hasOwnProperty(this.fusionSpecies.speciesId)) {
|
||||||
const fusionEvolutions = pokemonEvolutions[this.fusionSpecies.speciesId].map(e => new FusionSpeciesFormEvolution(this.species.speciesId, e));
|
const fusionEvolutions = pokemonEvolutions[this.fusionSpecies.speciesId].map(e => new FusionSpeciesFormEvolution(this.species.speciesId, e));
|
||||||
for (const fe of fusionEvolutions) {
|
for (const fe of fusionEvolutions) {
|
||||||
if (!fe.item && this.level >= fe.level && (!fe.preFormKey || this.getFusionFormKey() === fe.preFormKey)) {
|
if (!fe.item && this.level >= fe.level && (isNullOrUndefined(fe.preFormKey) || this.getFusionFormKey() === fe.preFormKey)) {
|
||||||
if (fe.condition === null || (fe.condition as SpeciesEvolutionCondition).predicate(this)) {
|
if (fe.condition === null || (fe.condition as SpeciesEvolutionCondition).predicate(this)) {
|
||||||
return fe;
|
return fe;
|
||||||
}
|
}
|
||||||
|
@ -375,11 +375,7 @@ export class MovePhase extends BattlePhase {
|
|||||||
protected resolveCounterAttackTarget() {
|
protected resolveCounterAttackTarget() {
|
||||||
if (this.targets.length === 1 && this.targets[0] === BattlerIndex.ATTACKER) {
|
if (this.targets.length === 1 && this.targets[0] === BattlerIndex.ATTACKER) {
|
||||||
if (this.pokemon.turnData.attacksReceived.length) {
|
if (this.pokemon.turnData.attacksReceived.length) {
|
||||||
const attacker = this.pokemon.scene.getPokemonById(this.pokemon.turnData.attacksReceived[0].sourceId);
|
this.targets[0] = this.pokemon.turnData.attacksReceived[0].sourceBattlerIndex;
|
||||||
|
|
||||||
if (attacker?.isActive(true)) {
|
|
||||||
this.targets[0] = attacker.getBattlerIndex();
|
|
||||||
}
|
|
||||||
|
|
||||||
// account for metal burst and comeuppance hitting remaining targets in double battles
|
// account for metal burst and comeuppance hitting remaining targets in double battles
|
||||||
// counterattack will redirect to remaining ally if original attacker faints
|
// counterattack will redirect to remaining ally if original attacker faints
|
||||||
|
@ -100,6 +100,22 @@ async function initFonts(language: string | undefined) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* I18n money formatter with. (useful for BBCode coloring of text)\
|
||||||
|
* *If you don't want the BBCode tag applied, just use 'number' formatter*
|
||||||
|
* @example Input: `{{myMoneyValue, money}}`
|
||||||
|
* Output: `@[MONEY]{₽100,000,000}`
|
||||||
|
* @param amount the money amount
|
||||||
|
* @returns a money formatted string
|
||||||
|
*/
|
||||||
|
function i18nMoneyFormatter(amount: any): string {
|
||||||
|
if (isNaN(Number(amount))) {
|
||||||
|
console.warn(`i18nMoneyFormatter: value "${amount}" is not a number!`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return `@[MONEY]{${i18next.t("common:money", { amount })}}`;
|
||||||
|
}
|
||||||
|
|
||||||
//#region Exports
|
//#region Exports
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -249,24 +265,10 @@ export async function initI18n(): Promise<void> {
|
|||||||
postProcess: [ "korean-postposition" ],
|
postProcess: [ "korean-postposition" ],
|
||||||
});
|
});
|
||||||
|
|
||||||
// Input: {{myMoneyValue, money}}
|
|
||||||
// Output: @[MONEY]{₽100,000,000} (useful for BBCode coloring of text)
|
if (i18next.services.formatter) {
|
||||||
// If you don't want the BBCode tag applied, just use 'number' formatter
|
i18next.services.formatter.add("money", i18nMoneyFormatter);
|
||||||
i18next.services.formatter?.add("money", (value, lng, options) => {
|
}
|
||||||
const numberFormattedString = Intl.NumberFormat(lng, options).format(value);
|
|
||||||
switch (lng) {
|
|
||||||
case "ja":
|
|
||||||
return `@[MONEY]{${numberFormattedString}}円`;
|
|
||||||
case "de":
|
|
||||||
case "es":
|
|
||||||
case "fr":
|
|
||||||
case "it":
|
|
||||||
return `@[MONEY]{${numberFormattedString} ₽}`;
|
|
||||||
default:
|
|
||||||
// English and other languages that use same format
|
|
||||||
return `@[MONEY]{₽${numberFormattedString}}`;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
await initFonts(localStorage.getItem("prLang") ?? undefined);
|
await initFonts(localStorage.getItem("prLang") ?? undefined);
|
||||||
}
|
}
|
||||||
|
58
src/test/abilities/ability_duplication.test.ts
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
import { Stat } from "#app/enums/stat";
|
||||||
|
import { Abilities } from "#enums/abilities";
|
||||||
|
import { Moves } from "#enums/moves";
|
||||||
|
import { Species } from "#enums/species";
|
||||||
|
import GameManager from "#test/utils/gameManager";
|
||||||
|
import Phaser from "phaser";
|
||||||
|
import { afterEach, beforeAll, beforeEach, describe, it, expect } from "vitest";
|
||||||
|
|
||||||
|
describe("Ability Duplication", () => {
|
||||||
|
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
|
||||||
|
.moveset([ Moves.SPLASH ])
|
||||||
|
.battleType("single")
|
||||||
|
.ability(Abilities.HUGE_POWER)
|
||||||
|
.enemyAbility(Abilities.BALL_FETCH)
|
||||||
|
.enemyMoveset(Moves.SPLASH);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("huge power should only be applied once if both normal and passive", async () => {
|
||||||
|
game.override.passiveAbility(Abilities.HUGE_POWER);
|
||||||
|
|
||||||
|
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
||||||
|
|
||||||
|
const [ magikarp ] = game.scene.getPlayerField();
|
||||||
|
const magikarpAttack = magikarp.getEffectiveStat(Stat.ATK);
|
||||||
|
|
||||||
|
magikarp.summonData.abilitySuppressed = true;
|
||||||
|
|
||||||
|
expect(magikarp.getEffectiveStat(Stat.ATK)).toBe(magikarpAttack / 2);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("huge power should stack with pure power", async () => {
|
||||||
|
game.override.passiveAbility(Abilities.PURE_POWER);
|
||||||
|
|
||||||
|
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
||||||
|
|
||||||
|
const [ magikarp ] = game.scene.getPlayerField();
|
||||||
|
const magikarpAttack = magikarp.getEffectiveStat(Stat.ATK);
|
||||||
|
|
||||||
|
magikarp.summonData.abilitySuppressed = true;
|
||||||
|
|
||||||
|
expect(magikarp.getEffectiveStat(Stat.ATK)).toBe(magikarpAttack / 4);
|
||||||
|
});
|
||||||
|
});
|
80
src/test/moves/metal_burst.test.ts
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
import { BattlerIndex } from "#app/battle";
|
||||||
|
import { MoveResult } from "#app/field/pokemon";
|
||||||
|
import { Abilities } from "#enums/abilities";
|
||||||
|
import { Moves } from "#enums/moves";
|
||||||
|
import { Species } from "#enums/species";
|
||||||
|
import GameManager from "#test/utils/gameManager";
|
||||||
|
import Phaser from "phaser";
|
||||||
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||||
|
|
||||||
|
describe("Moves - Metal Burst", () => {
|
||||||
|
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
|
||||||
|
.moveset([ Moves.METAL_BURST, Moves.FISSURE, Moves.PRECIPICE_BLADES ])
|
||||||
|
.ability(Abilities.PURE_POWER)
|
||||||
|
.startingLevel(10)
|
||||||
|
.battleType("double")
|
||||||
|
.disableCrits()
|
||||||
|
.enemySpecies(Species.PICHU)
|
||||||
|
.enemyAbility(Abilities.BALL_FETCH)
|
||||||
|
.enemyMoveset(Moves.TACKLE);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should redirect target if intended target faints", async () => {
|
||||||
|
await game.classicMode.startBattle([ Species.FEEBAS, Species.FEEBAS ]);
|
||||||
|
|
||||||
|
const [ , enemy2 ] = game.scene.getEnemyField();
|
||||||
|
|
||||||
|
game.move.select(Moves.METAL_BURST);
|
||||||
|
game.move.select(Moves.FISSURE, 1, BattlerIndex.ENEMY);
|
||||||
|
|
||||||
|
await game.forceEnemyMove(Moves.TACKLE, BattlerIndex.PLAYER);
|
||||||
|
await game.forceEnemyMove(Moves.TACKLE, BattlerIndex.PLAYER_2);
|
||||||
|
|
||||||
|
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER_2, BattlerIndex.PLAYER, BattlerIndex.ENEMY_2 ]);
|
||||||
|
|
||||||
|
await game.phaseInterceptor.to("MoveEndPhase");
|
||||||
|
await game.move.forceHit();
|
||||||
|
await game.phaseInterceptor.to("MoveEndPhase");
|
||||||
|
await game.phaseInterceptor.to("MoveEndPhase");
|
||||||
|
|
||||||
|
expect(enemy2.isFullHp()).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should not crash if both opponents faint before the move is used", async () => {
|
||||||
|
await game.classicMode.startBattle([ Species.FEEBAS, Species.ARCEUS ]);
|
||||||
|
|
||||||
|
const [ enemy1, enemy2 ] = game.scene.getEnemyField();
|
||||||
|
|
||||||
|
game.move.select(Moves.METAL_BURST);
|
||||||
|
game.move.select(Moves.PRECIPICE_BLADES, 1);
|
||||||
|
|
||||||
|
await game.forceEnemyMove(Moves.TACKLE, BattlerIndex.PLAYER);
|
||||||
|
await game.forceEnemyMove(Moves.TACKLE, BattlerIndex.PLAYER_2);
|
||||||
|
|
||||||
|
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER_2, BattlerIndex.PLAYER, BattlerIndex.ENEMY_2 ]);
|
||||||
|
|
||||||
|
await game.phaseInterceptor.to("MoveEndPhase");
|
||||||
|
await game.move.forceHit();
|
||||||
|
await game.phaseInterceptor.to("MoveEndPhase");
|
||||||
|
await game.phaseInterceptor.to("BerryPhase");
|
||||||
|
|
||||||
|
expect(enemy1.isFainted()).toBe(true);
|
||||||
|
expect(enemy2.isFainted()).toBe(true);
|
||||||
|
expect(game.scene.getPlayerField()[0].getLastXMoves(1)[0].result).toBe(MoveResult.FAIL);
|
||||||
|
});
|
||||||
|
});
|
@ -1,3 +1,5 @@
|
|||||||
|
import { BattlerIndex } from "#app/battle";
|
||||||
|
import { allMoves } from "#app/data/move";
|
||||||
import { DamagePhase } from "#app/phases/damage-phase";
|
import { DamagePhase } from "#app/phases/damage-phase";
|
||||||
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
|
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
|
||||||
import { MoveEndPhase } from "#app/phases/move-end-phase";
|
import { MoveEndPhase } from "#app/phases/move-end-phase";
|
||||||
@ -8,7 +10,7 @@ import { Species } from "#enums/species";
|
|||||||
import { Stat } from "#enums/stat";
|
import { Stat } from "#enums/stat";
|
||||||
import GameManager from "#test/utils/gameManager";
|
import GameManager from "#test/utils/gameManager";
|
||||||
import Phaser from "phaser";
|
import Phaser from "phaser";
|
||||||
import { afterEach, beforeAll, beforeEach, describe, it, expect } from "vitest";
|
import { afterEach, beforeAll, beforeEach, describe, it, expect, vi } from "vitest";
|
||||||
|
|
||||||
describe("Moves - Scale Shot", () => {
|
describe("Moves - Scale Shot", () => {
|
||||||
let phaserGame: Phaser.Game;
|
let phaserGame: Phaser.Game;
|
||||||
@ -30,45 +32,54 @@ describe("Moves - Scale Shot", () => {
|
|||||||
.moveset([ Moves.SCALE_SHOT ])
|
.moveset([ Moves.SCALE_SHOT ])
|
||||||
.battleType("single")
|
.battleType("single")
|
||||||
.disableCrits()
|
.disableCrits()
|
||||||
.starterSpecies(Species.MINCCINO)
|
|
||||||
.ability(Abilities.NO_GUARD)
|
.ability(Abilities.NO_GUARD)
|
||||||
.passiveAbility(Abilities.SKILL_LINK)
|
.passiveAbility(Abilities.SKILL_LINK)
|
||||||
.enemyAbility(Abilities.SHEER_FORCE)
|
.enemyMoveset(Moves.SPLASH)
|
||||||
.enemyPassiveAbility(Abilities.STALL)
|
.enemyLevel(3);
|
||||||
.enemyMoveset(Moves.SKILL_SWAP)
|
|
||||||
.enemyLevel(5);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("applies stat changes after last hit", async () => {
|
it("applies stat changes after last hit", async () => {
|
||||||
await game.classicMode.startBattle([ Species.FORRETRESS ]);
|
game.override.enemySpecies(Species.FORRETRESS);
|
||||||
|
|
||||||
|
await game.classicMode.startBattle([ Species.MINCCINO ]);
|
||||||
const minccino = game.scene.getPlayerPokemon()!;
|
const minccino = game.scene.getPlayerPokemon()!;
|
||||||
game.move.select(Moves.SCALE_SHOT);
|
game.move.select(Moves.SCALE_SHOT);
|
||||||
|
|
||||||
|
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
|
||||||
|
|
||||||
await game.phaseInterceptor.to(MoveEffectPhase);
|
await game.phaseInterceptor.to(MoveEffectPhase);
|
||||||
await game.phaseInterceptor.to(DamagePhase);
|
await game.phaseInterceptor.to(DamagePhase);
|
||||||
|
|
||||||
|
//check that stats haven't changed after one or two hits have occurred
|
||||||
await game.phaseInterceptor.to(MoveEffectPhase);
|
await game.phaseInterceptor.to(MoveEffectPhase);
|
||||||
expect (minccino?.getStatStage(Stat.DEF)).toBe(0);
|
expect(minccino.getStatStage(Stat.DEF)).toBe(0);
|
||||||
expect (minccino?.getStatStage(Stat.SPD)).toBe(0);
|
expect(minccino.getStatStage(Stat.SPD)).toBe(0);
|
||||||
|
|
||||||
|
//check that stats changed on last hit
|
||||||
await game.phaseInterceptor.to(MoveEndPhase);
|
await game.phaseInterceptor.to(MoveEndPhase);
|
||||||
expect (minccino.getStatStage(Stat.DEF)).toBe(-1);
|
expect(minccino.getStatStage(Stat.DEF)).toBe(-1);
|
||||||
expect (minccino.getStatStage(Stat.SPD)).toBe(1);
|
expect(minccino.getStatStage(Stat.SPD)).toBe(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("unaffected by sheer force", async () => {
|
it("unaffected by sheer force", async () => {
|
||||||
await game.classicMode.startBattle([ Species.WOBBUFFET ]);
|
const moveToCheck = allMoves[Moves.SCALE_SHOT];
|
||||||
|
const basePower = moveToCheck.power;
|
||||||
|
|
||||||
|
game.override.enemySpecies(Species.WOBBUFFET);
|
||||||
|
|
||||||
|
vi.spyOn(moveToCheck, "calculateBattlePower");
|
||||||
|
|
||||||
|
await game.classicMode.startBattle([ Species.MINCCINO ]);
|
||||||
const minccino = game.scene.getPlayerPokemon()!;
|
const minccino = game.scene.getPlayerPokemon()!;
|
||||||
const wobbuffet = game.scene.getEnemyPokemon()!;
|
|
||||||
wobbuffet.setStat(Stat.HP, 100, true);
|
|
||||||
wobbuffet.hp = 100;
|
|
||||||
game.move.select(Moves.SCALE_SHOT);
|
game.move.select(Moves.SCALE_SHOT);
|
||||||
await game.phaseInterceptor.to(TurnEndPhase);
|
await game.phaseInterceptor.to(TurnEndPhase);
|
||||||
const hpafter1 = wobbuffet.hp;
|
|
||||||
//effect not nullified by sheer force
|
//effect not nullified by sheer force
|
||||||
expect (minccino.getStatStage(Stat.DEF)).toBe(-1);
|
expect(minccino.getStatStage(Stat.DEF)).toBe(-1);
|
||||||
expect (minccino.getStatStage(Stat.SPD)).toBe(1);
|
expect(minccino.getStatStage(Stat.SPD)).toBe(1);
|
||||||
game.move.select(Moves.SCALE_SHOT);
|
|
||||||
await game.phaseInterceptor.to(MoveEndPhase);
|
//power not boosted by sheer force
|
||||||
const hpafter2 = wobbuffet.hp;
|
expect(moveToCheck.calculateBattlePower).toHaveReturnedWith(basePower);
|
||||||
//check damage not boosted- make damage before sheer force a little lower than theoretical boosted sheer force damage
|
|
||||||
expect (100 - hpafter1).toBe(hpafter1 - hpafter2);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -13,8 +13,8 @@ import { GameManagerHelper } from "./gameManagerHelper";
|
|||||||
*/
|
*/
|
||||||
export class MoveHelper extends GameManagerHelper {
|
export class MoveHelper extends GameManagerHelper {
|
||||||
/**
|
/**
|
||||||
* Intercepts `MoveEffectPhase` and mocks the hitCheck's
|
* Intercepts {@linkcode MoveEffectPhase} and mocks the
|
||||||
* return value to `true` {@linkcode MoveEffectPhase.hitCheck}.
|
* {@linkcode MoveEffectPhase.hitCheck | hitCheck}'s return value to `true`.
|
||||||
* Used to force a move to hit.
|
* Used to force a move to hit.
|
||||||
*/
|
*/
|
||||||
async forceHit(): Promise<void> {
|
async forceHit(): Promise<void> {
|
||||||
@ -23,8 +23,8 @@ export class MoveHelper extends GameManagerHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Intercepts `MoveEffectPhase` and mocks the hitCheck's
|
* Intercepts {@linkcode MoveEffectPhase} and mocks the
|
||||||
* return value to `false` {@linkcode MoveEffectPhase.hitCheck}.
|
* {@linkcode MoveEffectPhase.hitCheck | hitCheck}'s return value to `false`.
|
||||||
* Used to force a move to miss.
|
* Used to force a move to miss.
|
||||||
* @param firstTargetOnly Whether the move should force miss on the first target only, in the case of multi-target moves.
|
* @param firstTargetOnly Whether the move should force miss on the first target only, in the case of multi-target moves.
|
||||||
*/
|
*/
|
||||||
|
@ -577,6 +577,10 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
|
|||||||
this.getUi().clearText();
|
this.getUi().clearText();
|
||||||
this.eraseCursor();
|
this.eraseCursor();
|
||||||
|
|
||||||
|
// Reset cursor positions
|
||||||
|
this.cursor = 0;
|
||||||
|
this.rowCursor = 0;
|
||||||
|
|
||||||
/* Multiplies the fade time duration by the speed parameter so that it is always constant, and avoids "flashbangs" at game speed x5 */
|
/* Multiplies the fade time duration by the speed parameter so that it is always constant, and avoids "flashbangs" at game speed x5 */
|
||||||
this.scene.hideShopOverlay(750 * this.scene.gameSpeed);
|
this.scene.hideShopOverlay(750 * this.scene.gameSpeed);
|
||||||
this.scene.hideLuckText(250);
|
this.scene.hideLuckText(250);
|
||||||
|
@ -46,6 +46,7 @@ import { StarterContainer } from "#app/ui/starter-container";
|
|||||||
import { DropDownColumn, FilterBar } from "#app/ui/filter-bar";
|
import { DropDownColumn, FilterBar } from "#app/ui/filter-bar";
|
||||||
import { ScrollBar } from "#app/ui/scroll-bar";
|
import { ScrollBar } from "#app/ui/scroll-bar";
|
||||||
import { SelectChallengePhase } from "#app/phases/select-challenge-phase";
|
import { SelectChallengePhase } from "#app/phases/select-challenge-phase";
|
||||||
|
import { EncounterPhase } from "#app/phases/encounter-phase";
|
||||||
import { TitlePhase } from "#app/phases/title-phase";
|
import { TitlePhase } from "#app/phases/title-phase";
|
||||||
import { Abilities } from "#enums/abilities";
|
import { Abilities } from "#enums/abilities";
|
||||||
import { getPassiveCandyCount, getValueReductionCandyCounts, getSameSpeciesEggCandyCounts } from "#app/data/balance/starters";
|
import { getPassiveCandyCount, getValueReductionCandyCounts, getSameSpeciesEggCandyCounts } from "#app/data/balance/starters";
|
||||||
@ -3468,6 +3469,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||||||
this.scene.clearPhaseQueue();
|
this.scene.clearPhaseQueue();
|
||||||
if (this.scene.gameMode.isChallenge) {
|
if (this.scene.gameMode.isChallenge) {
|
||||||
this.scene.pushPhase(new SelectChallengePhase(this.scene));
|
this.scene.pushPhase(new SelectChallengePhase(this.scene));
|
||||||
|
this.scene.pushPhase(new EncounterPhase(this.scene, false));
|
||||||
} else {
|
} else {
|
||||||
this.scene.pushPhase(new TitlePhase(this.scene));
|
this.scene.pushPhase(new TitlePhase(this.scene));
|
||||||
}
|
}
|
||||||
|