Merge branch 'beta' into feature/random-starter-selection

This commit is contained in:
NightKev 2025-01-10 16:38:19 -08:00 committed by GitHub
commit 5e87056dfa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 117 additions and 31 deletions

View File

@ -9220,7 +9220,8 @@ export function initMoves() {
.attr(ClearWeatherAttr, WeatherType.FOG)
.attr(ClearTerrainAttr)
.attr(RemoveScreensAttr, false)
.attr(RemoveArenaTrapAttr, true),
.attr(RemoveArenaTrapAttr, true)
.attr(RemoveArenaTagsAttr, [ ArenaTagType.MIST, ArenaTagType.SAFEGUARD ], false),
new StatusMove(Moves.TRICK_ROOM, Type.PSYCHIC, -1, 5, -1, -7, 4)
.attr(AddArenaTagAttr, ArenaTagType.TRICK_ROOM, 5)
.ignoresProtect()

View File

@ -1040,7 +1040,8 @@ class SpeciesStatBoosterModifierTypeGenerator extends ModifierTypeGenerator {
for (const p of party) {
const speciesId = p.getSpeciesForm(true).speciesId;
const fusionSpeciesId = p.isFusion() ? p.getFusionSpeciesForm(true).speciesId : null;
const hasFling = p.getMoveset(true).some(m => m?.moveId === Moves.FLING);
// TODO: Use commented boolean when Fling is implemented
const hasFling = false; /* p.getMoveset(true).some(m => m?.moveId === Moves.FLING) */
for (const i in values) {
const checkedSpecies = values[i].species;
@ -1755,56 +1756,69 @@ const modifierPool: ModifierPool = {
}, 12),
new WeightedModifierType(modifierTypes.TOXIC_ORB, (party: Pokemon[]) => {
return party.some(p => {
const moveset = p.getMoveset(true).filter(m => !isNullOrUndefined(m)).map(m => m.moveId);
const canSetStatus = p.canSetStatus(StatusEffect.TOXIC, true, true, null, true);
const isHoldingOrb = p.getHeldItems().some(i => i.type.id === "FLAME_ORB" || i.type.id === "TOXIC_ORB");
// Moves that take advantage of obtaining the actual status effect
const hasStatusMoves = [ Moves.FACADE, Moves.PSYCHO_SHIFT ]
.some(m => moveset.includes(m));
// Moves that take advantage of being able to give the target a status orb
// TODO: Take moves from comment they are implemented
const hasItemMoves = [ /* Moves.TRICK, Moves.FLING, Moves.SWITCHEROO */ ]
.some(m => moveset.includes(m));
// Abilities that take advantage of obtaining the actual status effect
const hasRelevantAbilities = [ Abilities.QUICK_FEET, Abilities.GUTS, Abilities.MARVEL_SCALE, Abilities.TOXIC_BOOST, Abilities.POISON_HEAL, Abilities.MAGIC_GUARD ]
.some(a => p.hasAbility(a, false, true));
if (!isHoldingOrb) {
const moveset = p.getMoveset(true).filter(m => !isNullOrUndefined(m)).map(m => m.moveId);
const canSetStatus = p.canSetStatus(StatusEffect.TOXIC, true, true, null, true);
// Moves that take advantage of obtaining the actual status effect
const hasStatusMoves = [ Moves.FACADE, Moves.PSYCHO_SHIFT ]
.some(m => moveset.includes(m));
// Moves that take advantage of being able to give the target a status orb
// TODO: Take moves (Trick, Fling, Switcheroo) from comment when they are implemented
const hasItemMoves = [ /* Moves.TRICK, Moves.FLING, Moves.SWITCHEROO */ ]
.some(m => moveset.includes(m));
if (canSetStatus) {
return hasRelevantAbilities || hasStatusMoves;
// Abilities that take advantage of obtaining the actual status effect, separated based on specificity to the orb
const hasGeneralAbility = [ Abilities.QUICK_FEET, Abilities.GUTS, Abilities.MARVEL_SCALE, Abilities.MAGIC_GUARD ]
.some(a => p.hasAbility(a, false, true));
const hasSpecificAbility = [ Abilities.TOXIC_BOOST, Abilities.POISON_HEAL ]
.some(a => p.hasAbility(a, false, true));
const hasOppositeAbility = [ Abilities.FLARE_BOOST ]
.some(a => p.hasAbility(a, false, true));
return hasSpecificAbility || (hasGeneralAbility && !hasOppositeAbility) || hasStatusMoves;
} else {
return hasItemMoves;
}
}
return false;
}) ? 10 : 0;
}, 10),
new WeightedModifierType(modifierTypes.FLAME_ORB, (party: Pokemon[]) => {
return party.some(p => {
const moveset = p.getMoveset(true).filter(m => !isNullOrUndefined(m)).map(m => m.moveId);
const canSetStatus = p.canSetStatus(StatusEffect.BURN, true, true, null, true);
const isHoldingOrb = p.getHeldItems().some(i => i.type.id === "FLAME_ORB" || i.type.id === "TOXIC_ORB");
// Moves that take advantage of obtaining the actual status effect
const hasStatusMoves = [ Moves.FACADE, Moves.PSYCHO_SHIFT ]
.some(m => moveset.includes(m));
// Moves that take advantage of being able to give the target a status orb
// TODO: Take moves from comment they are implemented
const hasItemMoves = [ /* Moves.TRICK, Moves.FLING, Moves.SWITCHEROO */ ]
.some(m => moveset.includes(m));
// Abilities that take advantage of obtaining the actual status effect
const hasRelevantAbilities = [ Abilities.QUICK_FEET, Abilities.GUTS, Abilities.MARVEL_SCALE, Abilities.FLARE_BOOST, Abilities.MAGIC_GUARD ]
.some(a => p.hasAbility(a, false, true));
if (!isHoldingOrb) {
const moveset = p.getMoveset(true).filter(m => !isNullOrUndefined(m)).map(m => m.moveId);
const canSetStatus = p.canSetStatus(StatusEffect.TOXIC, true, true, null, true);
// Moves that take advantage of obtaining the actual status effect
const hasStatusMoves = [ Moves.FACADE, Moves.PSYCHO_SHIFT ]
.some(m => moveset.includes(m));
// Moves that take advantage of being able to give the target a status orb
// TODO: Take moves (Trick, Fling, Switcheroo) from comment when they are implemented
const hasItemMoves = [ /* Moves.TRICK, Moves.FLING, Moves.SWITCHEROO */ ]
.some(m => moveset.includes(m));
if (canSetStatus) {
return hasRelevantAbilities || hasStatusMoves;
// Abilities that take advantage of obtaining the actual status effect, separated based on specificity to the orb
const hasGeneralAbility = [ Abilities.QUICK_FEET, Abilities.GUTS, Abilities.MARVEL_SCALE, Abilities.MAGIC_GUARD ]
.some(a => p.hasAbility(a, false, true));
const hasSpecificAbility = [ Abilities.FLARE_BOOST ]
.some(a => p.hasAbility(a, false, true));
const hasOppositeAbility = [ Abilities.TOXIC_BOOST, Abilities.POISON_HEAL ]
.some(a => p.hasAbility(a, false, true));
return hasSpecificAbility || (hasGeneralAbility && !hasOppositeAbility) || hasStatusMoves;
} else {
return hasItemMoves;
}
}
return false;
}) ? 10 : 0;
}, 10),

View File

@ -0,0 +1,71 @@
import { Stat } from "#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, expect, it } from "vitest";
describe("Moves - Defog", () => {
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.MIST, Moves.SAFEGUARD, Moves.SPLASH ])
.ability(Abilities.BALL_FETCH)
.battleType("single")
.disableCrits()
.enemySpecies(Species.SHUCKLE)
.enemyAbility(Abilities.BALL_FETCH)
.enemyMoveset([ Moves.DEFOG, Moves.GROWL ]);
});
it("should not allow Safeguard to be active", async () => {
await game.classicMode.startBattle([ Species.REGIELEKI ]);
const playerPokemon = game.scene.getPlayerField();
const enemyPokemon = game.scene.getEnemyField();
game.move.select(Moves.SAFEGUARD);
await game.forceEnemyMove(Moves.DEFOG);
await game.phaseInterceptor.to("BerryPhase");
expect(playerPokemon[0].isSafeguarded(enemyPokemon[0])).toBe(false);
expect(true).toBe(true);
});
it("should not allow Mist to be active", async () => {
await game.classicMode.startBattle([ Species.REGIELEKI ]);
const playerPokemon = game.scene.getPlayerField();
game.move.select(Moves.MIST);
await game.forceEnemyMove(Moves.DEFOG);
await game.toNextTurn();
game.move.select(Moves.SPLASH);
await game.forceEnemyMove(Moves.GROWL);
await game.phaseInterceptor.to("BerryPhase");
expect(playerPokemon[0].getStatStage(Stat.ATK)).toBe(-1);
expect(true).toBe(true);
});
});