Merge branch 'beta' into allySwapImplementation

This commit is contained in:
Mumble 2024-11-07 20:13:16 -08:00 committed by GitHub
commit 2ed0e26b50
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 41 additions and 35 deletions

@ -1 +1 @@
Subproject commit fc4a1effd5170def3c8314208a52cd0d8e6913ef
Subproject commit d600913dbf1f8b47dae8dccbd8296df78f1c51b5

View File

@ -7666,7 +7666,7 @@ export function initBiomes() {
if (biome === Biome.END) {
const biomeList = Object.keys(Biome).filter(key => !isNaN(Number(key)));
biomeList.pop(); // Removes Biome.END from the list
const randIndex = Utils.randInt(biomeList.length, 1); // Will never be Biome.TOWN
const randIndex = Utils.randSeedInt(biomeList.length, 1); // Will never be Biome.TOWN
biome = Biome[biomeList[randIndex]];
}
const linkedBiomes: (Biome | [ Biome, integer ])[] = Array.isArray(biomeLinks[biome])

View File

@ -1005,8 +1005,8 @@ export const pokemonEvolutions: PokemonEvolutions = {
new SpeciesEvolution(Species.COSMOEM, 23, null, null)
],
[Species.COSMOEM]: [
new SpeciesEvolution(Species.SOLGALEO, 53, EvolutionItem.SUN_FLUTE, null, SpeciesWildEvolutionDelay.VERY_LONG),
new SpeciesEvolution(Species.LUNALA, 53, EvolutionItem.MOON_FLUTE, null, SpeciesWildEvolutionDelay.VERY_LONG)
new SpeciesEvolution(Species.SOLGALEO, 1, EvolutionItem.SUN_FLUTE, null, SpeciesWildEvolutionDelay.VERY_LONG),
new SpeciesEvolution(Species.LUNALA, 1, EvolutionItem.MOON_FLUTE, null, SpeciesWildEvolutionDelay.VERY_LONG)
],
[Species.MELTAN]: [
new SpeciesEvolution(Species.MELMETAL, 48, null, null)

View File

@ -5079,26 +5079,6 @@ export class EnemyPokemon extends Pokemon {
}
}
heal(amount: integer): integer {
if (this.isBoss()) {
const amountRatio = amount / this.getMaxHp();
const segmentBypassCount = Math.floor(amountRatio / (1 / this.bossSegments));
const segmentSize = this.getMaxHp() / this.bossSegments;
for (let s = 1; s < this.bossSegments; s++) {
const hpThreshold = segmentSize * s;
if (this.hp <= Math.round(hpThreshold)) {
const healAmount = Math.min(amount, this.getMaxHp() - this.hp, Math.round(hpThreshold + (segmentSize * segmentBypassCount) - this.hp));
this.hp += healAmount;
return healAmount;
} else if (s >= this.bossSegmentIndex) {
return super.heal(amount);
}
}
}
return super.heal(amount);
}
getFieldIndex(): integer {
return this.scene.getEnemyField().indexOf(this);
}

View File

@ -69,7 +69,9 @@ export abstract class ApiBase {
"Content-Type": config.headers?.["Content-Type"] ?? "application/json",
};
console.log(`Sending ${config.method ?? "GET"} request to: `, this.base + path, config);
if (import.meta.env.DEV) {
console.log(`Sending ${config.method ?? "GET"} request to: `, this.base + path, config);
}
return await fetch(this.base + path, config);
}

View File

@ -1,7 +1,7 @@
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import { MoveResult } from "#app/field/pokemon";
import { MoveResult, PokemonMove } from "#app/field/pokemon";
import GameManager from "#test/utils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
@ -34,23 +34,47 @@ describe("Moves - Sketch", () => {
});
it("Sketch should not fail even if a previous Sketch failed to retrieve a valid move and ran out of PP", async () => {
game.override.moveset([ Moves.SKETCH, Moves.SKETCH ]);
await game.classicMode.startBattle([ Species.REGIELEKI ]);
const playerPokemon = game.scene.getPlayerPokemon();
const playerPokemon = game.scene.getPlayerPokemon()!;
// can't use normal moveset override because we need to check moveset changes
playerPokemon.moveset = [ new PokemonMove(Moves.SKETCH), new PokemonMove(Moves.SKETCH) ];
game.move.select(Moves.SKETCH);
await game.phaseInterceptor.to("TurnEndPhase");
expect(playerPokemon?.getLastXMoves()[0].result).toBe(MoveResult.FAIL);
const moveSlot0 = playerPokemon?.getMoveset()[0];
expect(moveSlot0?.moveId).toBe(Moves.SKETCH);
expect(moveSlot0?.getPpRatio()).toBe(0);
expect(playerPokemon.getLastXMoves()[0].result).toBe(MoveResult.FAIL);
const moveSlot0 = playerPokemon.getMoveset()[0]!;
expect(moveSlot0.moveId).toBe(Moves.SKETCH);
expect(moveSlot0.getPpRatio()).toBe(0);
await game.toNextTurn();
game.move.select(Moves.SKETCH);
await game.phaseInterceptor.to("TurnEndPhase");
expect(playerPokemon?.getLastXMoves()[0].result).toBe(MoveResult.SUCCESS);
// Can't verify if the player Pokemon's moveset was successfully changed because of overrides.
expect(playerPokemon.getLastXMoves()[0].result).toBe(MoveResult.SUCCESS);
expect(playerPokemon.moveset[0]?.moveId).toBe(Moves.SPLASH);
expect(playerPokemon.moveset[1]?.moveId).toBe(Moves.SKETCH);
});
it("Sketch should retrieve the most recent valid move from its target history", async () => {
game.override.enemyStatusEffect(StatusEffect.PARALYSIS);
await game.classicMode.startBattle([ Species.REGIELEKI ]);
const playerPokemon = game.scene.getPlayerPokemon()!;
const enemyPokemon = game.scene.getEnemyPokemon()!;
playerPokemon.moveset = [ new PokemonMove(Moves.SKETCH), new PokemonMove(Moves.GROWL) ];
game.move.select(Moves.GROWL);
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
await game.move.forceStatusActivation(false);
await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyPokemon.getLastXMoves()[0].result).toBe(MoveResult.SUCCESS);
await game.toNextTurn();
game.move.select(Moves.SKETCH);
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
await game.move.forceStatusActivation(true);
await game.phaseInterceptor.to("TurnEndPhase");
expect(playerPokemon.getLastXMoves()[0].result).toBe(MoveResult.SUCCESS);
expect(playerPokemon.moveset[0]?.moveId).toBe(Moves.SPLASH);
expect(playerPokemon.moveset[1]?.moveId).toBe(Moves.GROWL);
});
it("Sketch should retrieve the most recent valid move from its target history", async () => {