Another linting

This commit is contained in:
Temps Ray 2024-09-17 23:21:55 -04:00
parent 7b74e021ad
commit bdd0850e6f
5 changed files with 36 additions and 3 deletions

View File

@ -2518,6 +2518,8 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: number, source
return new GorillaTacticsTag();
case BattlerTagType.SUBSTITUTE:
return new SubstituteTag(sourceMove, sourceId);
case BattlerTagType.AUTOTOMIZED:
return new AutotomizedTag();
case BattlerTagType.MYSTERY_ENCOUNTER_POST_SUMMON:
return new MysteryEncounterPostSummonTag();
case BattlerTagType.NONE:

View File

@ -1401,7 +1401,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
getWeight(): number {
const autotomizedTag = this.getTag(AutotomizedTag);
let weightRemoved = 0;
if (autotomizedTag !== null) {
if (autotomizedTag !== null && autotomizedTag !== undefined) {
weightRemoved = 100 * autotomizedTag.autotomizeCount;
}
const minWeight = 0.1;

View File

@ -9,6 +9,7 @@ import PartyUiHandler from "../ui/party-ui-handler";
import { getPokemonNameWithAffix } from "../messages";
import { EndEvolutionPhase } from "./end-evolution-phase";
import { EvolutionPhase } from "./evolution-phase";
import { BattlerTagType } from "#app/enums/battler-tag-type";
export class FormChangePhase extends EvolutionPhase {
private formChange: SpeciesFormChange;
@ -157,6 +158,7 @@ export class FormChangePhase extends EvolutionPhase {
}
end(): void {
this.pokemon.findAndRemoveTags(t => t.tagType === BattlerTagType.AUTOTOMIZED);
if (this.modal) {
this.scene.ui.revertMode().then(() => {
if (this.scene.ui.getMode() === Mode.PARTY) {

View File

@ -3,6 +3,7 @@ import { SemiInvulnerableTag } from "#app/data/battler-tags";
import { SpeciesFormChange, getSpeciesFormChangeMessage } from "#app/data/pokemon-forms";
import { getTypeRgb } from "#app/data/type";
import { BattleSpec } from "#app/enums/battle-spec";
import { BattlerTagType } from "#app/enums/battler-tag-type";
import Pokemon, { EnemyPokemon } from "#app/field/pokemon";
import { getPokemonNameWithAffix } from "#app/messages";
import { BattlePhase } from "./battle-phase";
@ -113,6 +114,7 @@ export class QuietFormChangePhase extends BattlePhase {
}
end(): void {
this.pokemon.findAndRemoveTags(t => t.tagType === BattlerTagType.AUTOTOMIZED);
if (this.pokemon.scene?.currentBattle.battleSpec === BattleSpec.FINAL_BOSS && this.pokemon instanceof EnemyPokemon) {
this.scene.playBgm();
this.scene.unshiftPhase(new PokemonHealPhase(this.scene, this.pokemon.getBattlerIndex(), this.pokemon.getMaxHp(), null, false, false, false, true));

View File

@ -23,7 +23,7 @@ describe("Moves - Autotomize", () => {
beforeEach(() => {
game = new GameManager(phaserGame);
game.override
.moveset([Moves.AUTOTOMIZE])
.moveset([Moves.AUTOTOMIZE, Moves.KINGS_SHIELD, Moves.FALSE_SWIPE])
.battleType("single")
.enemyAbility(Abilities.BALL_FETCH)
.enemyMoveset(Moves.SPLASH);
@ -34,9 +34,9 @@ describe("Moves - Autotomize", () => {
const oneAutotomizeDracozoltWeight = 90;
const twoAutotomizeDracozoltWeight = 0.1;
const threeAutotomizeDracozoltWeight = 0.1;
const playerPokemon = game.scene.getPlayerPokemon()!;
await game.classicMode.startBattle([Species.DRACOZOLT]);
const playerPokemon = game.scene.getPlayerPokemon()!;
expect(playerPokemon.getWeight()).toBe(baseDracozoltWeight);
game.move.select(Moves.AUTOTOMIZE);
// expect a queued message here
@ -52,4 +52,31 @@ describe("Moves - Autotomize", () => {
// expect no queued message here
expect(playerPokemon.getWeight()).toBe(threeAutotomizeDracozoltWeight);
}, TIMEOUT);
it("Changing forms should revert weight", async () => {
const baseAegislashWeight = 53;
const autotomizeAegislashWeight = 0.1;
await game.classicMode.startBattle([Species.AEGISLASH]);
const playerPokemon = game.scene.getPlayerPokemon()!;
expect(playerPokemon.getWeight()).toBe(baseAegislashWeight);
game.move.select(Moves.AUTOTOMIZE);
expect(playerPokemon.getWeight()).toBe(autotomizeAegislashWeight);
await game.toNextTurn();
game.move.select(Moves.KINGS_SHIELD);
expect(playerPokemon.getWeight()).toBe(baseAegislashWeight);
await game.toNextTurn();
game.move.select(Moves.AUTOTOMIZE);
expect(playerPokemon.getWeight()).toBe(autotomizeAegislashWeight);
game.move.select(Moves.FALSE_SWIPE);
expect(playerPokemon.getWeight()).toBe(baseAegislashWeight);
await game.toNextTurn();
game.move.select(Moves.AUTOTOMIZE);
expect(playerPokemon.getWeight()).toBe(autotomizeAegislashWeight);
}, TIMEOUT);
});