Merge branch 'beta' into Incorrect-labeling-in-exp-sprite.json

This commit is contained in:
NightKev 2025-03-20 12:11:41 -07:00 committed by GitHub
commit 53eba3bcfb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 125 additions and 70 deletions

1
.gitattributes vendored
View File

@ -1,2 +1,3 @@
# Auto detect text files and perform LF normalization
* text=auto
* -crlf

View File

@ -64,7 +64,7 @@ export abstract class ArenaTag {
}
}
onOverlap(_arena: Arena): void {}
onOverlap(_arena: Arena, _source: Pokemon | null): void {}
lapse(_arena: Arena): boolean {
return this.turnCount < 1 || !!--this.turnCount;
@ -706,7 +706,7 @@ export class ArenaTrapTag extends ArenaTag {
this.maxLayers = maxLayers;
}
onOverlap(arena: Arena): void {
onOverlap(arena: Arena, _source: Pokemon | null): void {
if (this.layers < this.maxLayers) {
this.layers++;
@ -1427,11 +1427,7 @@ export class SuppressAbilitiesTag extends ArenaTag {
public override onAdd(_arena: Arena): void {
const pokemon = this.getSourcePokemon();
if (pokemon) {
globalScene.queueMessage(
i18next.t("arenaTag:neutralizingGasOnAdd", {
pokemonNameWithAffix: getPokemonNameWithAffix(pokemon),
}),
);
this.playActivationMessage(pokemon);
for (const fieldPokemon of globalScene.getField(true)) {
if (fieldPokemon && fieldPokemon.id !== pokemon.id) {
@ -1441,8 +1437,9 @@ export class SuppressAbilitiesTag extends ArenaTag {
}
}
public override onOverlap(_arena: Arena): void {
public override onOverlap(_arena: Arena, source: Pokemon | null): void {
this.sourceCount++;
this.playActivationMessage(source);
}
public onSourceLeave(arena: Arena): void {
@ -1481,6 +1478,16 @@ export class SuppressAbilitiesTag extends ArenaTag {
public isBeingRemoved() {
return this.beingRemoved;
}
private playActivationMessage(pokemon: Pokemon | null) {
if (pokemon) {
globalScene.queueMessage(
i18next.t("arenaTag:neutralizingGasOnAdd", {
pokemonNameWithAffix: getPokemonNameWithAffix(pokemon),
}),
);
}
}
}
// TODO: swap `sourceMove` and `sourceId` and make `sourceMove` an optional parameter

View File

@ -5542,6 +5542,31 @@ export class LeechSeedAttr extends AddBattlerTagAttr {
}
}
/**
* Adds the appropriate battler tag for Smack Down and Thousand arrows
* @extends AddBattlerTagAttr
*/
export class FallDownAttr extends AddBattlerTagAttr {
constructor() {
super(BattlerTagType.IGNORE_FLYING, false, false, 1, 1, true);
}
/**
* Adds Grounded Tag to the target and checks if fallDown message should be displayed
* @param user the {@linkcode Pokemon} using the move
* @param target the {@linkcode Pokemon} targeted by the move
* @param move the {@linkcode Move} invoking this effect
* @param args n/a
* @returns `true` if the effect successfully applies; `false` otherwise
*/
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
if (!target.isGrounded()) {
globalScene.queueMessage(i18next.t("moveTriggers:fallDown", { targetPokemonName: getPokemonNameWithAffix(target) }));
}
return super.apply(user, target, move, args);
}
}
/**
* Adds the appropriate battler tag for Gulp Missile when Surf or Dive is used.
* @extends MoveEffectAttr
@ -9646,7 +9671,7 @@ export function initMoves() {
.target(MoveTarget.BOTH_SIDES)
.unimplemented(),
new AttackMove(Moves.SMACK_DOWN, PokemonType.ROCK, MoveCategory.PHYSICAL, 50, 100, 15, 100, 0, 5)
.attr(AddBattlerTagAttr, BattlerTagType.IGNORE_FLYING, false, false, 1, 1, true)
.attr(FallDownAttr)
.attr(AddBattlerTagAttr, BattlerTagType.INTERRUPTED)
.attr(RemoveBattlerTagAttr, [ BattlerTagType.FLYING, BattlerTagType.FLOATING, BattlerTagType.TELEKINESIS ])
.attr(HitsTagAttr, BattlerTagType.FLYING)
@ -10097,7 +10122,7 @@ export function initMoves() {
.triageMove(),
new AttackMove(Moves.THOUSAND_ARROWS, PokemonType.GROUND, MoveCategory.PHYSICAL, 90, 100, 10, -1, 0, 6)
.attr(NeutralDamageAgainstFlyingTypeMultiplierAttr)
.attr(AddBattlerTagAttr, BattlerTagType.IGNORE_FLYING, false, false, 1, 1, true)
.attr(FallDownAttr)
.attr(HitsTagAttr, BattlerTagType.FLYING)
.attr(HitsTagAttr, BattlerTagType.FLOATING)
.attr(AddBattlerTagAttr, BattlerTagType.INTERRUPTED)

View File

@ -2987,11 +2987,11 @@ export function initSpecies() {
new PokemonSpecies(Species.VAROOM, 9, false, false, false, "Single-Cyl Pokémon", PokemonType.STEEL, PokemonType.POISON, 1, 35, Abilities.OVERCOAT, Abilities.NONE, Abilities.SLOW_START, 300, 45, 70, 63, 30, 45, 47, 190, 50, 60, GrowthRate.MEDIUM_FAST, 50, false),
new PokemonSpecies(Species.REVAVROOM, 9, false, false, false, "Multi-Cyl Pokémon", PokemonType.STEEL, PokemonType.POISON, 1.8, 120, Abilities.OVERCOAT, Abilities.NONE, Abilities.FILTER, 500, 80, 119, 90, 54, 67, 90, 75, 50, 175, GrowthRate.MEDIUM_FAST, 50, false, false,
new PokemonForm("Normal", "", PokemonType.STEEL, PokemonType.POISON, 1.8, 120, Abilities.OVERCOAT, Abilities.NONE, Abilities.FILTER, 500, 80, 119, 90, 54, 67, 90, 75, 50, 175, false, null, true),
new PokemonForm("Segin Starmobile", "segin-starmobile", PokemonType.STEEL, PokemonType.DARK, 1.8, 240, Abilities.INTIMIDATE, Abilities.NONE, Abilities.INTIMIDATE, 600, 110, 129, 100, 77, 79, 105, 75, 50, 175),
new PokemonForm("Schedar Starmobile", "schedar-starmobile", PokemonType.STEEL, PokemonType.FIRE, 1.8, 240, Abilities.SPEED_BOOST, Abilities.NONE, Abilities.SPEED_BOOST, 600, 110, 129, 100, 77, 79, 105, 75, 50, 175),
new PokemonForm("Navi Starmobile", "navi-starmobile", PokemonType.STEEL, PokemonType.POISON, 1.8, 240, Abilities.TOXIC_DEBRIS, Abilities.NONE, Abilities.TOXIC_DEBRIS, 600, 110, 129, 100, 77, 79, 105, 75, 50, 175),
new PokemonForm("Ruchbah Starmobile", "ruchbah-starmobile", PokemonType.STEEL, PokemonType.FAIRY, 1.8, 240, Abilities.MISTY_SURGE, Abilities.NONE, Abilities.MISTY_SURGE, 600, 110, 129, 100, 77, 79, 105, 75, 50, 175),
new PokemonForm("Caph Starmobile", "caph-starmobile", PokemonType.STEEL, PokemonType.FIGHTING, 1.8, 240, Abilities.STAMINA, Abilities.NONE, Abilities.STAMINA, 600, 110, 129, 100, 77, 79, 105, 75, 50, 175),
new PokemonForm("Segin Starmobile", "segin-starmobile", PokemonType.STEEL, PokemonType.DARK, 1.8, 240, Abilities.INTIMIDATE, Abilities.NONE, Abilities.INTIMIDATE, 600, 110, 129, 100, 77, 79, 105, 75, 50, 175, false, null, false, true),
new PokemonForm("Schedar Starmobile", "schedar-starmobile", PokemonType.STEEL, PokemonType.FIRE, 1.8, 240, Abilities.SPEED_BOOST, Abilities.NONE, Abilities.SPEED_BOOST, 600, 110, 129, 100, 77, 79, 105, 75, 50, 175, false, null, false, true),
new PokemonForm("Navi Starmobile", "navi-starmobile", PokemonType.STEEL, PokemonType.POISON, 1.8, 240, Abilities.TOXIC_DEBRIS, Abilities.NONE, Abilities.TOXIC_DEBRIS, 600, 110, 129, 100, 77, 79, 105, 75, 50, 175, false, null, false, true),
new PokemonForm("Ruchbah Starmobile", "ruchbah-starmobile", PokemonType.STEEL, PokemonType.FAIRY, 1.8, 240, Abilities.MISTY_SURGE, Abilities.NONE, Abilities.MISTY_SURGE, 600, 110, 129, 100, 77, 79, 105, 75, 50, 175, false, null, false, true),
new PokemonForm("Caph Starmobile", "caph-starmobile", PokemonType.STEEL, PokemonType.FIGHTING, 1.8, 240, Abilities.STAMINA, Abilities.NONE, Abilities.STAMINA, 600, 110, 129, 100, 77, 79, 105, 75, 50, 175, false, null, false, true),
),
new PokemonSpecies(Species.CYCLIZAR, 9, false, false, false, "Mount Pokémon", PokemonType.DRAGON, PokemonType.NORMAL, 1.6, 63, Abilities.SHED_SKIN, Abilities.NONE, Abilities.REGENERATOR, 501, 70, 95, 65, 85, 65, 121, 190, 50, 175, GrowthRate.MEDIUM_SLOW, 50, false),
new PokemonSpecies(Species.ORTHWORM, 9, false, false, false, "Earthworm Pokémon", PokemonType.STEEL, null, 2.5, 310, Abilities.EARTH_EATER, Abilities.NONE, Abilities.SAND_VEIL, 480, 70, 85, 145, 60, 55, 65, 25, 50, 240, GrowthRate.SLOW, 50, false),

View File

@ -673,7 +673,7 @@ export class Arena {
): boolean {
const existingTag = this.getTagOnSide(tagType, side);
if (existingTag) {
existingTag.onOverlap(this);
existingTag.onOverlap(this, globalScene.getPokemonById(sourceId));
if (existingTag instanceof ArenaTrapTag) {
const { tagType, side, turnCount, layers, maxLayers } = existingTag as ArenaTrapTag;

View File

@ -28,17 +28,28 @@ export class MessagePhase extends Phase {
super.start();
if (this.text.indexOf("$") > -1) {
const pokename: string[] = [];
const repname = [ "#POKEMON1", "#POKEMON2" ];
for (let p = 0; p < globalScene.getPlayerField().length; p++) {
pokename.push(globalScene.getPlayerField()[p].getNameToRender());
this.text = this.text.split(pokename[p]).join(repname[p]);
}
const pageIndex = this.text.indexOf("$");
globalScene.unshiftPhase(
new MessagePhase(
this.text.slice(pageIndex + 1),
this.callbackDelay,
this.prompt,
this.promptDelay,
this.speaker,
),
);
this.text = this.text.slice(0, pageIndex).trim();
for (let p = 0; p < globalScene.getPlayerField().length; p++) {
this.text = this.text.split(repname[p]).join(pokename[p]);
}
if (pageIndex !== -1) {
globalScene.unshiftPhase(
new MessagePhase(
this.text.slice(pageIndex + 1),
this.callbackDelay,
this.prompt,
this.promptDelay,
this.speaker,
),
);
this.text = this.text.slice(0, pageIndex).trim();
}
}
if (this.speaker) {

View File

@ -76,6 +76,12 @@ export default abstract class MessageUiHandler extends AwaitableUiHandler {
const fadeMap = new Map<number, number>();
const actionPattern = /@(c|d|s|f)\{(.*?)\}/;
let actionMatch: RegExpExecArray | null;
const pokename: string[] = [];
const repname = [ "#POKEMON1", "#POKEMON2" ];
for (let p = 0; p < globalScene.getPlayerField().length; p++) {
pokename.push(globalScene.getPlayerField()[p].getNameToRender());
text = text.split(pokename[p]).join(repname[p]);
}
while ((actionMatch = actionPattern.exec(text))) {
switch (actionMatch[1]) {
case "c":
@ -94,6 +100,9 @@ export default abstract class MessageUiHandler extends AwaitableUiHandler {
text = text.slice(0, actionMatch.index) + text.slice(actionMatch.index + actionMatch[2].length + 4);
}
for (let p = 0; p < globalScene.getPlayerField().length; p++) {
text = text.split(repname[p]).join(pokename[p]);
}
if (text) {
// Predetermine overflow line breaks to avoid words breaking while displaying
const textWords = text.split(" ");

View File

@ -1742,36 +1742,26 @@ export default class PokedexUiHandler extends MessageUiHandler {
container.icon.setTint(0);
}
if (data.eggMove1) {
container.eggMove1Icon.setVisible(true);
} else {
container.eggMove1Icon.setVisible(false);
}
if (data.eggMove2) {
container.eggMove2Icon.setVisible(true);
} else {
container.eggMove2Icon.setVisible(false);
}
if (data.tmMove1) {
container.tmMove1Icon.setVisible(true);
} else {
container.tmMove1Icon.setVisible(false);
}
if (data.tmMove2) {
container.tmMove2Icon.setVisible(true);
} else {
container.tmMove2Icon.setVisible(false);
}
if (data.passive1) {
container.passive1Icon.setVisible(true);
} else {
container.passive1Icon.setVisible(false);
}
if (data.passive2) {
container.passive2Icon.setVisible(true);
} else {
container.passive2Icon.setVisible(false);
}
const pairs: [boolean | undefined, Phaser.GameObjects.Image][] = [
[data.eggMove1, container.eggMove1Icon],
[data.eggMove2, container.eggMove2Icon],
[data.tmMove1, container.tmMove1Icon],
[data.tmMove2, container.tmMove2Icon],
[data.passive1, container.passive1Icon],
[data.passive2, container.passive2Icon],
];
pairs.forEach(([unlocked, icon]) => {
if (unlocked) {
icon.setVisible(true);
icon.clearTint();
} else if (unlocked === false) {
icon.setVisible(true);
icon.setTint(0x808080);
} else {
icon.setVisible(false);
}
});
if (this.showDecorations) {
if (this.pokerusSpecies.includes(data.species)) {

View File

@ -328,17 +328,28 @@ export default class UI extends Phaser.GameObjects.Container {
prompt?: boolean | null,
promptDelay?: number | null,
): void {
const pokename: string[] = [];
const repname = [ "#POKEMON1", "#POKEMON2" ];
for (let p = 0; p < globalScene.getPlayerField().length; p++) {
pokename.push(globalScene.getPlayerField()[p].getNameToRender());
text = text.split(pokename[p]).join(repname[p]);
}
if (prompt && text.indexOf("$") > -1) {
const messagePages = text.split(/\$/g).map(m => m.trim());
// biome-ignore lint/complexity/useOptionalChain: optional chain would change this to be null instead of undefined.
let showMessageAndCallback = () => callback && callback();
for (let p = messagePages.length - 1; p >= 0; p--) {
const originalFunc = showMessageAndCallback;
messagePages[p] = messagePages[p].split(repname[0]).join(pokename[0]);
messagePages[p] = messagePages[p].split(repname[1]).join(pokename[1]);
showMessageAndCallback = () => this.showText(messagePages[p], null, originalFunc, null, true);
}
showMessageAndCallback();
} else {
const handler = this.getHandler();
for (let p = 0; p < globalScene.getPlayerField().length; p++) {
text = text.split(repname[p]).join(pokename[p]);
}
if (handler instanceof MessageUiHandler) {
(handler as MessageUiHandler).showText(text, delay, callback, callbackDelay, prompt, promptDelay);
} else {

View File

@ -27,8 +27,8 @@ describe("Moves - Chilly Reception", () => {
.battleType("single")
.moveset([Moves.CHILLY_RECEPTION, Moves.SNOWSCAPE])
.enemyMoveset(Array(4).fill(Moves.SPLASH))
.enemyAbility(Abilities.NONE)
.ability(Abilities.NONE);
.enemyAbility(Abilities.BALL_FETCH)
.ability(Abilities.BALL_FETCH);
});
it("should still change the weather if user can't switch out", async () => {
@ -72,7 +72,6 @@ describe("Moves - Chilly Reception", () => {
game.override
.battleType("single")
.enemyMoveset([Moves.CHILLY_RECEPTION, Moves.TACKLE])
.enemyAbility(Abilities.NONE)
.moveset(Array(4).fill(Moves.SPLASH));
await game.classicMode.startBattle([Species.SLOWKING, Species.MEOWTH]);
@ -89,7 +88,6 @@ describe("Moves - Chilly Reception", () => {
.battleType("single")
.startingWave(8)
.enemyMoveset(Array(4).fill(Moves.CHILLY_RECEPTION))
.enemyAbility(Abilities.NONE)
.enemySpecies(Species.MAGIKARP)
.moveset([Moves.SPLASH, Moves.THUNDERBOLT]);

View File

@ -1,9 +1,9 @@
import { Stat } from "#enums/stat";
import { ArenaTagSide } from "#app/data/arena-tag";
import { ArenaTagType } from "#app/enums/arena-tag-type";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import { Stat } from "#enums/stat";
import GameManager from "#test/testUtils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
@ -24,13 +24,16 @@ describe("Moves - Tailwind", () => {
beforeEach(() => {
game = new GameManager(phaserGame);
game.override.battleType("double");
game.override.moveset([Moves.TAILWIND, Moves.SPLASH, Moves.PETAL_BLIZZARD, Moves.SANDSTORM]);
game.override.enemyMoveset(Moves.SPLASH);
game.override
.battleType("double")
.moveset([Moves.TAILWIND, Moves.SPLASH])
.enemyMoveset(Moves.SPLASH)
.enemyAbility(Abilities.BALL_FETCH)
.ability(Abilities.BALL_FETCH);
});
it("doubles the Speed stat of the Pokemons on its side", async () => {
await game.startBattle([Species.MAGIKARP, Species.MEOWTH]);
await game.classicMode.startBattle([Species.MAGIKARP, Species.MEOWTH]);
const magikarp = game.scene.getPlayerField()[0];
const meowth = game.scene.getPlayerField()[1];
@ -43,7 +46,7 @@ describe("Moves - Tailwind", () => {
game.move.select(Moves.TAILWIND);
game.move.select(Moves.SPLASH, 1);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(magikarp.getEffectiveStat(Stat.SPD)).toBe(magikarpSpd * 2);
expect(meowth.getEffectiveStat(Stat.SPD)).toBe(meowthSpd * 2);
@ -53,7 +56,7 @@ describe("Moves - Tailwind", () => {
it("lasts for 4 turns", async () => {
game.override.battleType("single");
await game.startBattle([Species.MAGIKARP]);
await game.classicMode.startBattle([Species.MAGIKARP]);
game.move.select(Moves.TAILWIND);
await game.toNextTurn();
@ -76,7 +79,7 @@ describe("Moves - Tailwind", () => {
it("does not affect the opposing side", async () => {
game.override.battleType("single");
await game.startBattle([Species.MAGIKARP]);
await game.classicMode.startBattle([Species.MAGIKARP]);
const ally = game.scene.getPlayerPokemon()!;
const enemy = game.scene.getEnemyPokemon()!;
@ -91,7 +94,7 @@ describe("Moves - Tailwind", () => {
game.move.select(Moves.TAILWIND);
await game.phaseInterceptor.to(TurnEndPhase);
await game.phaseInterceptor.to("TurnEndPhase");
expect(ally.getEffectiveStat(Stat.SPD)).toBe(allySpd * 2);
expect(enemy.getEffectiveStat(Stat.SPD)).equal(enemySpd);