Apply Own Review Suggestions

This commit is contained in:
Amani H. 2024-08-18 02:22:43 -04:00 committed by GitHub
parent 24338efe63
commit d0216229c0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 25 additions and 26 deletions

View File

@ -24,7 +24,7 @@ import { ArenaTagType } from "#enums/arena-tag-type";
import { BattlerTagType } from "#enums/battler-tag-type"; import { BattlerTagType } from "#enums/battler-tag-type";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import { Stat, BattleStat, getStatKey, BATTLE_STATS, EFFECTIVE_STATS, EffectiveStat } from "#app/enums/stat.js"; import { Stat, type BattleStat, type EffectiveStat, BATTLE_STATS, EFFECTIVE_STATS, getStatKey } from "#app/enums/stat";
export class Ability implements Localizable { export class Ability implements Localizable {
public id: Abilities; public id: Abilities;

View File

@ -16,7 +16,7 @@ import { BattlerTagType } from "#enums/battler-tag-type";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import i18next from "#app/plugins/i18n.js"; import i18next from "#app/plugins/i18n.js";
import { Stat, BattleStat, EFFECTIVE_STATS, EffectiveStat, getStatKey } from "#app/enums/stat"; import { Stat, type BattleStat, type EffectiveStat, EFFECTIVE_STATS, getStatKey } from "#app/enums/stat";
export enum BattlerTagLapseType { export enum BattlerTagLapseType {
FAINT, FAINT,
@ -1302,7 +1302,7 @@ export class HighestStatBoostTag extends AbilityBattlerTag {
break; break;
} }
pokemon.scene.queueMessage(i18next.t("battle:battlerTagsHighestStatBoostOnAdd", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), statName: getStatKey(highestStat) }), null, false, null, true); pokemon.scene.queueMessage(i18next.t("battle:battlerTagsHighestStatBoostOnAdd", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), statName: i18next.t(getStatKey(highestStat)) }), null, false, null, true);
} }
onRemove(pokemon: Pokemon): void { onRemove(pokemon: Pokemon): void {

View File

@ -7,7 +7,7 @@ import { DoubleBerryEffectAbAttr, ReduceBerryUseThresholdAbAttr, applyAbAttrs }
import i18next from "i18next"; import i18next from "i18next";
import { BattlerTagType } from "#enums/battler-tag-type"; import { BattlerTagType } from "#enums/battler-tag-type";
import { BerryType } from "#enums/berry-type"; import { BerryType } from "#enums/berry-type";
import { BattleStat, Stat } from "#app/enums/stat"; import { Stat, type BattleStat } from "#app/enums/stat";
export function getBerryName(berryType: BerryType): string { export function getBerryName(berryType: BerryType): string {
return i18next.t(`berry:${BerryType[berryType]}.name`); return i18next.t(`berry:${BerryType[berryType]}.name`);

View File

@ -26,7 +26,7 @@ import { Biome } from "#enums/biome";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import { MoveUsedEvent } from "#app/events/battle-scene.js"; import { MoveUsedEvent } from "#app/events/battle-scene.js";
import { Stat, BATTLE_STATS, BattleStat, EFFECTIVE_STATS, EffectiveStat, getStatKey } from "#app/enums/stat"; import { Stat, type BattleStat, type EffectiveStat, BATTLE_STATS, EFFECTIVE_STATS, getStatKey } from "#app/enums/stat";
export enum MoveCategory { export enum MoveCategory {
PHYSICAL, PHYSICAL,
@ -4969,8 +4969,8 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
} }
let ret = this.user ? Math.floor((1 - user.getHpRatio()) * 20) : super.getUserBenefitScore(user, target, move); let ret = this.user ? Math.floor((1 - user.getHpRatio()) * 20) : super.getUserBenefitScore(user, target, move);
if (this.user && this.batonPass) { if (this.user && this.batonPass) {
const battleStatTotal = user.getStatStages().reduce((bs: integer, total: integer) => total += bs, 0); const statStageTotal = user.getStatStages().reduce((s: integer, total: integer) => total += s, 0);
ret = ret / 2 + (Phaser.Tweens.Builders.GetEaseFunction("Sine.easeOut")(Math.min(Math.abs(battleStatTotal), 10) / 10) * (battleStatTotal >= 0 ? 10 : -10)); ret = ret / 2 + (Phaser.Tweens.Builders.GetEaseFunction("Sine.easeOut")(Math.min(Math.abs(statStageTotal), 10) / 10) * (statStageTotal >= 0 ? 10 : -10));
} }
return ret; return ret;
} }

View File

@ -3,7 +3,7 @@ import { TextStyle, getBBCodeFrag } from "../ui/text";
import { Nature } from "#enums/nature"; import { Nature } from "#enums/nature";
import { UiTheme } from "#enums/ui-theme"; import { UiTheme } from "#enums/ui-theme";
import i18next from "i18next"; import i18next from "i18next";
import { Stat, EFFECTIVE_STATS, getShortenedStatKey } from "#app/enums/stat.js"; import { Stat, EFFECTIVE_STATS, getShortenedStatKey } from "#app/enums/stat";
export { Nature }; export { Nature };
@ -27,7 +27,7 @@ export function getNatureName(nature: Nature, includeStatEffects: boolean = fals
const textStyle = forStarterSelect ? TextStyle.SUMMARY_ALT : TextStyle.WINDOW; const textStyle = forStarterSelect ? TextStyle.SUMMARY_ALT : TextStyle.WINDOW;
const getTextFrag = !ignoreBBCode ? (text: string, style: TextStyle) => getBBCodeFrag(text, style, uiTheme) : (text: string, style: TextStyle) => text; const getTextFrag = !ignoreBBCode ? (text: string, style: TextStyle) => getBBCodeFrag(text, style, uiTheme) : (text: string, style: TextStyle) => text;
if (increasedStat && decreasedStat) { if (increasedStat && decreasedStat) {
ret = `${getTextFrag(`${ret}${!forStarterSelect ? "\n" : " "}(`, textStyle)}${getTextFrag(`+${i18next.t(getShortenedStatKey(increasedStat))}`, TextStyle.SUMMARY_PINK)}${getTextFrag("/", textStyle)}${getTextFrag(`-${getShortenedStatKey(decreasedStat)}`, TextStyle.SUMMARY_BLUE)}${getTextFrag(")", textStyle)}`; ret = `${getTextFrag(`${ret}${!forStarterSelect ? "\n" : " "}(`, textStyle)}${getTextFrag(`+${i18next.t(getShortenedStatKey(increasedStat))}`, TextStyle.SUMMARY_PINK)}${getTextFrag("/", textStyle)}${getTextFrag(`-${i18next.t(getShortenedStatKey(decreasedStat))}`, TextStyle.SUMMARY_BLUE)}${getTextFrag(")", textStyle)}`;
} else { } else {
ret = getTextFrag(`${ret}${!forStarterSelect ? "\n" : " "}(-)`, textStyle); ret = getTextFrag(`${ret}${!forStarterSelect ? "\n" : " "}(-)`, textStyle);
} }

View File

@ -9,7 +9,7 @@ import { Constructor } from "#app/utils";
import * as Utils from "../utils"; import * as Utils from "../utils";
import { Type, TypeDamageMultiplier, getTypeDamageMultiplier, getTypeRgb } from "../data/type"; import { Type, TypeDamageMultiplier, getTypeDamageMultiplier, getTypeRgb } from "../data/type";
import { getLevelTotalExp } from "../data/exp"; import { getLevelTotalExp } from "../data/exp";
import { BATTLE_STATS, EFFECTIVE_STATS, Stat } from "#enums/stat"; import { Stat, type PermanentStat, type BattleStat, type EffectiveStat, PERMANENT_STATS, BATTLE_STATS, EFFECTIVE_STATS } from "#enums/stat";
import { DamageMoneyRewardModifier, EnemyDamageBoosterModifier, EnemyDamageReducerModifier, EnemyEndureChanceModifier, EnemyFusionChanceModifier, HiddenAbilityRateBoosterModifier, BaseStatModifier, PokemonFriendshipBoosterModifier, PokemonHeldItemModifier, PokemonNatureWeightModifier, ShinyRateBoosterModifier, SurviveDamageModifier, TempStatStageBoosterModifier, TempCritBoosterModifier, StatBoosterModifier, CritBoosterModifier, TerastallizeModifier } from "../modifier/modifier"; import { DamageMoneyRewardModifier, EnemyDamageBoosterModifier, EnemyDamageReducerModifier, EnemyEndureChanceModifier, EnemyFusionChanceModifier, HiddenAbilityRateBoosterModifier, BaseStatModifier, PokemonFriendshipBoosterModifier, PokemonHeldItemModifier, PokemonNatureWeightModifier, ShinyRateBoosterModifier, SurviveDamageModifier, TempStatStageBoosterModifier, TempCritBoosterModifier, StatBoosterModifier, CritBoosterModifier, TerastallizeModifier } from "../modifier/modifier";
import { PokeballType } from "../data/pokeball"; import { PokeballType } from "../data/pokeball";
import { Gender } from "../data/gender"; import { Gender } from "../data/gender";
@ -49,7 +49,6 @@ import { Biome } from "#enums/biome";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import { getPokemonNameWithAffix } from "#app/messages.js"; import { getPokemonNameWithAffix } from "#app/messages.js";
import { PermanentStat, BattleStat, PERMANENT_STATS, EffectiveStat } from "#app/enums/stat"; // TODO: Add type
export enum FieldPosition { export enum FieldPosition {
CENTER, CENTER,

View File

@ -23,7 +23,7 @@ import Overrides from "#app/overrides";
import { ModifierType, modifierTypes } from "./modifier-type"; import { ModifierType, modifierTypes } from "./modifier-type";
import { Command } from "#app/ui/command-ui-handler.js"; import { Command } from "#app/ui/command-ui-handler.js";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import { BATTLE_STATS, PermanentStat, TEMP_BATTLE_STATS, TempBattleStat } from "#app/enums/stat"; // TODO: Add Type import { type PermanentStat, type TempBattleStat, BATTLE_STATS, TEMP_BATTLE_STATS } from "#app/enums/stat";
import i18next from "i18next"; import i18next from "i18next";
import { allMoves } from "#app/data/move.js"; import { allMoves } from "#app/data/move.js";

View File

@ -64,7 +64,7 @@ import { Species } from "#enums/species";
import { TrainerType } from "#enums/trainer-type"; import { TrainerType } from "#enums/trainer-type";
import { applyChallenges, ChallengeType } from "./data/challenge"; import { applyChallenges, ChallengeType } from "./data/challenge";
import { pokemonEvolutions } from "./data/pokemon-evolutions"; import { pokemonEvolutions } from "./data/pokemon-evolutions";
import { Stat, BattleStat, getStatKey, getStatStageChangeDescriptionKey } from "#enums/stat"; import { Stat, type BattleStat, getStatKey, getStatStageChangeDescriptionKey } from "#enums/stat";
const { t } = i18next; const { t } = i18next;

View File

@ -8,7 +8,7 @@ import { PlayerGender } from "#enums/player-gender";
import { ParseKeys } from "i18next"; import { ParseKeys } from "i18next";
import { Challenge, FreshStartChallenge, SingleGenerationChallenge, SingleTypeChallenge } from "#app/data/challenge.js"; import { Challenge, FreshStartChallenge, SingleGenerationChallenge, SingleTypeChallenge } from "#app/data/challenge.js";
import { ConditionFn } from "#app/@types/common.js"; import { ConditionFn } from "#app/@types/common.js";
import { getShortenedStatKey, Stat } from "#app/enums/stat.js"; import { Stat, getShortenedStatKey } from "#app/enums/stat";
export enum AchvTier { export enum AchvTier {
COMMON, COMMON,

View File

@ -53,7 +53,7 @@ describe("Abilities - Moxie", () => {
expect(playerPokemon.getStatStage(Stat.ATK)).toBe(1); expect(playerPokemon.getStatStage(Stat.ATK)).toBe(1);
}, 20000); }, 20000);
// TODO: Activate this test when MOXIE is corrected to work faint and not battle victory // TODO: Activate this test when MOXIE is corrected to work on faint and not on battle victory
it.todo("should raise ATK stat stage by 1 when defeating an ally Pokemon", async() => { it.todo("should raise ATK stat stage by 1 when defeating an ally Pokemon", async() => {
game.override.battleType("double"); game.override.battleType("double");
const moveToUse = Moves.AERIAL_ACE; const moveToUse = Moves.AERIAL_ACE;

View File

@ -37,7 +37,7 @@ describe("Items - Eviolite", () => {
const partyMember = game.scene.getParty()[0]; const partyMember = game.scene.getParty()[0];
// Checking consoe log to make sure Eviolite is applied when getEffectiveStat (with the appropriate stat) is called // Checking console log to make sure Eviolite is applied when getEffectiveStat (with the appropriate stat) is called
partyMember.getEffectiveStat(Stat.DEF); partyMember.getEffectiveStat(Stat.DEF);
expect(consoleSpy).toHaveBeenLastCalledWith("Applied", i18next.t("modifierType:ModifierType.EVIOLITE.name"), ""); expect(consoleSpy).toHaveBeenLastCalledWith("Applied", i18next.t("modifierType:ModifierType.EVIOLITE.name"), "");

View File

@ -37,7 +37,7 @@ describe("Items - Light Ball", () => {
const partyMember = game.scene.getParty()[0]; const partyMember = game.scene.getParty()[0];
// Checking consoe log to make sure Light Ball is applied when getEffectiveStat (with the appropriate stat) is called // Checking console log to make sure Light Ball is applied when getEffectiveStat (with the appropriate stat) is called
partyMember.getEffectiveStat(Stat.DEF); partyMember.getEffectiveStat(Stat.DEF);
expect(consoleSpy).not.toHaveBeenLastCalledWith("Applied", i18next.t("modifierType:SpeciesBoosterItem.LIGHT_BALL.name"), ""); expect(consoleSpy).not.toHaveBeenLastCalledWith("Applied", i18next.t("modifierType:SpeciesBoosterItem.LIGHT_BALL.name"), "");

View File

@ -37,7 +37,7 @@ describe("Items - Metal Powder", () => {
const partyMember = game.scene.getParty()[0]; const partyMember = game.scene.getParty()[0];
// Checking consoe log to make sure Metal Powder is applied when getEffectiveStat (with the appropriate stat) is called // Checking console log to make sure Metal Powder is applied when getEffectiveStat (with the appropriate stat) is called
partyMember.getEffectiveStat(Stat.DEF); partyMember.getEffectiveStat(Stat.DEF);
expect(consoleSpy).toHaveBeenLastCalledWith("Applied", i18next.t("modifierType:SpeciesBoosterItem.METAL_POWDER.name"), ""); expect(consoleSpy).toHaveBeenLastCalledWith("Applied", i18next.t("modifierType:SpeciesBoosterItem.METAL_POWDER.name"), "");

View File

@ -37,7 +37,7 @@ describe("Items - Quick Powder", () => {
const partyMember = game.scene.getParty()[0]; const partyMember = game.scene.getParty()[0];
// Checking consoe log to make sure Quick Powder is applied when getEffectiveStat (with the appropriate stat) is called // Checking console log to make sure Quick Powder is applied when getEffectiveStat (with the appropriate stat) is called
partyMember.getEffectiveStat(Stat.DEF); partyMember.getEffectiveStat(Stat.DEF);
expect(consoleSpy).not.toHaveBeenLastCalledWith("Applied", i18next.t("modifierType:SpeciesBoosterItem.QUICK_POWDER.name"), ""); expect(consoleSpy).not.toHaveBeenLastCalledWith("Applied", i18next.t("modifierType:SpeciesBoosterItem.QUICK_POWDER.name"), "");

View File

@ -37,7 +37,7 @@ describe("Items - Thick Club", () => {
const partyMember = game.scene.getParty()[0]; const partyMember = game.scene.getParty()[0];
// Checking consoe log to make sure Thick Club is applied when getEffectiveStat (with the appropriate stat) is called // Checking console log to make sure Thick Club is applied when getEffectiveStat (with the appropriate stat) is called
partyMember.getEffectiveStat(Stat.DEF); partyMember.getEffectiveStat(Stat.DEF);
expect(consoleSpy).not.toHaveBeenLastCalledWith("Applied", i18next.t("modifierType:SpeciesBoosterItem.THICK_CLUB.name"), ""); expect(consoleSpy).not.toHaveBeenLastCalledWith("Applied", i18next.t("modifierType:SpeciesBoosterItem.THICK_CLUB.name"), "");

View File

@ -65,7 +65,7 @@ describe("Moves - Baton Pass", () => {
// arrange // arrange
game.override game.override
.startingWave(5) .startingWave(5)
.enemyMoveset([ Moves.NASTY_PLOT, Moves.NASTY_PLOT, Moves.NASTY_PLOT, Moves.NASTY_PLOT ]); .enemyMoveset(new Array(4).fill([Moves.NASTY_PLOT]);
await game.startBattle([ await game.startBattle([
Species.RAICHU, Species.RAICHU,
Species.SHUCKLE Species.SHUCKLE
@ -77,7 +77,7 @@ describe("Moves - Baton Pass", () => {
// round 2 - baton pass // round 2 - baton pass
game.scene.getEnemyPokemon()!.hp = 100; game.scene.getEnemyPokemon()!.hp = 100;
game.override.enemyMoveset([ Moves.BATON_PASS, Moves.BATON_PASS, Moves.BATON_PASS, Moves.BATON_PASS ]); game.override.enemyMoveset(new Array(4).fill(Moves.BATON_PASS));
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH)); game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
await game.phaseInterceptor.to(PostSummonPhase, false); await game.phaseInterceptor.to(PostSummonPhase, false);

View File

@ -36,7 +36,7 @@ describe("Moves - Spit Up", () => {
game.override.enemyAbility(Abilities.NONE); game.override.enemyAbility(Abilities.NONE);
game.override.enemyLevel(2000); game.override.enemyLevel(2000);
game.override.moveset([ spitUp.id, spitUp.id, spitUp.id, spitUp.id ]); game.override.moveset(new Array(4).fill(spitUp.id));
game.override.ability(Abilities.NONE); game.override.ability(Abilities.NONE);
vi.spyOn(spitUp, "calculateBattlePower"); vi.spyOn(spitUp, "calculateBattlePower");

View File

@ -6,7 +6,7 @@ import { addWindow } from "./ui-theme";
import BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext"; import BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext";
import {Button} from "#enums/buttons"; import {Button} from "#enums/buttons";
import i18next from "i18next"; import i18next from "i18next";
import { Stat, PERMANENT_STATS, getStatKey } from "#app/enums/stat.js"; import { Stat, PERMANENT_STATS, getStatKey } from "#app/enums/stat";
export default class BattleMessageUiHandler extends MessageUiHandler { export default class BattleMessageUiHandler extends MessageUiHandler {
private levelUpStatsContainer: Phaser.GameObjects.Container; private levelUpStatsContainer: Phaser.GameObjects.Container;

View File

@ -1,7 +1,7 @@
import BBCodeText from "phaser3-rex-plugins/plugins/gameobjects/tagtext/bbcodetext/BBCodeText"; import BBCodeText from "phaser3-rex-plugins/plugins/gameobjects/tagtext/bbcodetext/BBCodeText";
import BattleScene from "../battle-scene"; import BattleScene from "../battle-scene";
import { TextStyle, addBBCodeTextObject, addTextObject, getTextColor } from "./text"; import { TextStyle, addBBCodeTextObject, addTextObject, getTextColor } from "./text";
import { getStatKey, PERMANENT_STATS } from "#app/enums/stat.js"; import { PERMANENT_STATS, getStatKey } from "#app/enums/stat.js";
import i18next from "i18next"; import i18next from "i18next";
const ivChartSize = 24; const ivChartSize = 24;

View File

@ -22,7 +22,7 @@ import { Ability } from "../data/ability.js";
import i18next from "i18next"; import i18next from "i18next";
import {modifierSortFunc} from "../modifier/modifier"; import {modifierSortFunc} from "../modifier/modifier";
import { PlayerGender } from "#enums/player-gender"; import { PlayerGender } from "#enums/player-gender";
import { Stat, getStatKey, PERMANENT_STATS } from "#app/enums/stat.js"; import { Stat, PERMANENT_STATS, getStatKey } from "#app/enums/stat.js";
enum Page { enum Page {
PROFILE, PROFILE,