[Bug] [Move] Synchronoise hitting Tera Type fix (#5779)

* synchronoize fix

* Add regression test for synchronoise

---------

Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
This commit is contained in:
itgalex24 2025-05-20 19:12:54 -04:00 committed by GitHub
parent 663c64fdb4
commit 288e4e7e7e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 50 additions and 3 deletions

View File

@ -8052,10 +8052,10 @@ export class UpperHandCondition extends MoveCondition {
}
}
export class hitsSameTypeAttr extends VariableMoveTypeMultiplierAttr {
export class HitsSameTypeAttr extends VariableMoveTypeMultiplierAttr {
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
const multiplier = args[0] as NumberHolder;
if (!user.getTypes().some(type => target.getTypes().includes(type))) {
if (!user.getTypes(true).some(type => target.getTypes(true).includes(type))) {
multiplier.value = 0;
return true;
}
@ -9756,7 +9756,7 @@ export function initMoves() {
new AttackMove(Moves.SYNCHRONOISE, PokemonType.PSYCHIC, MoveCategory.SPECIAL, 120, 100, 10, -1, 0, 5)
.target(MoveTarget.ALL_NEAR_OTHERS)
.condition(unknownTypeCondition)
.attr(hitsSameTypeAttr),
.attr(HitsSameTypeAttr),
new AttackMove(Moves.ELECTRO_BALL, PokemonType.ELECTRIC, MoveCategory.SPECIAL, -1, 100, 10, -1, 0, 5)
.attr(ElectroBallPowerAttr)
.ballBombMove(),

View File

@ -0,0 +1,47 @@
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { PokemonType } from "#enums/pokemon-type";
import { Species } from "#enums/species";
import GameManager from "#test/testUtils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Moves - Synchronoise", () => {
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.SYNCHRONOISE])
.ability(Abilities.BALL_FETCH)
.battleStyle("single")
.disableCrits()
.enemySpecies(Species.MAGIKARP)
.enemyAbility(Abilities.BALL_FETCH)
.enemyMoveset(Moves.SPLASH);
});
it("should consider the user's tera type if it is terastallized", async () => {
await game.classicMode.startBattle([Species.BIDOOF]);
const playerPokemon = game.scene.getPlayerPokemon()!;
const enemyPokemon = game.scene.getEnemyPokemon()!;
// force the player to be terastallized
playerPokemon.teraType = PokemonType.WATER;
playerPokemon.isTerastallized = true;
game.move.select(Moves.SYNCHRONOISE);
await game.phaseInterceptor.to("BerryPhase");
expect(enemyPokemon.hp).toBeLessThan(enemyPokemon.getMaxHp());
});
});