chore: fix merge conflicts from Biome update

This commit is contained in:
Sirz Benjie 2025-09-08 12:08:52 -05:00
parent ec34c975bb
commit 2561b7ea67
No known key found for this signature in database
GPG Key ID: 4A524B4D196C759E
10 changed files with 78 additions and 78 deletions

View File

@ -1152,8 +1152,8 @@ export class PowderTag extends BattlerTag {
const move = currentPhase.move.getMove();
const weather = globalScene.arena.weather;
if (
pokemon.getMoveType(move) !== PokemonType.FIRE ||
(weather?.weatherType === WeatherType.HEAVY_RAIN && !weather.isEffectSuppressed()) // Since gen 7, Heavy rain takes priority over powder
pokemon.getMoveType(move) !== PokemonType.FIRE
|| (weather?.weatherType === WeatherType.HEAVY_RAIN && !weather.isEffectSuppressed()) // Since gen 7, Heavy rain takes priority over powder
) {
return true;
}

View File

@ -128,9 +128,9 @@ export const failIfTargetNotAttackingCondition = new MoveCondition((_user, targe
return false;
}
return (
turnCommand.command === Command.FIGHT &&
!target.turnData.acted &&
allMoves[turnCommand.move.move].category !== MoveCategory.STATUS
turnCommand.command === Command.FIGHT
&& !target.turnData.acted
&& allMoves[turnCommand.move.move].category !== MoveCategory.STATUS
);
});
@ -145,8 +145,8 @@ export const failAgainstFinalBossCondition = new MoveCondition((_user, target) =
const gameMode = globalScene.gameMode;
const currentWave = globalScene.currentBattle.waveIndex;
return !(
target.isEnemy() &&
(gameMode.isBattleClassicFinalBoss(currentWave) || gameMode.isEndlessMinorBoss(currentWave))
target.isEnemy()
&& (gameMode.isBattleClassicFinalBoss(currentWave) || gameMode.isEndlessMinorBoss(currentWave))
);
});
@ -159,11 +159,11 @@ export const failAgainstFinalBossCondition = new MoveCondition((_user, target) =
export const upperHandCondition = new MoveCondition((_user, target) => {
const targetCommand = globalScene.currentBattle.turnCommands[target.getBattlerIndex()];
return (
targetCommand?.command === Command.FIGHT &&
!target.turnData.acted &&
!!targetCommand.move?.move &&
allMoves[targetCommand.move.move].category !== MoveCategory.STATUS &&
allMoves[targetCommand.move.move].getPriority(target) > 0
targetCommand?.command === Command.FIGHT
&& !target.turnData.acted
&& !!targetCommand.move?.move
&& allMoves[targetCommand.move.move].category !== MoveCategory.STATUS
&& allMoves[targetCommand.move.move].getPriority(target) > 0
);
});
@ -180,7 +180,7 @@ export const upperHandCondition = new MoveCondition((_user, target) => {
*/
export const lastResortCondition = new MoveCondition((user, _target, move) => {
const otherMovesInMoveset = new Set<MoveId>(user.getMoveset().map(m => m.moveId));
if (!otherMovesInMoveset.delete(move.id) || !otherMovesInMoveset.size) {
if (!otherMovesInMoveset.delete(move.id) || otherMovesInMoveset.size === 0) {
return false; // Last resort fails if used when not in user's moveset or no other moves exist
}

View File

@ -148,9 +148,9 @@ export function getCounterAttackTarget(user: Pokemon, damageCategory?: MoveDamag
const moveCategory = allMoves[attackRecord.move].category;
const sourceBattlerIndex = attackRecord.sourceBattlerIndex;
if (
moveCategory !== MoveCategory.STATUS &&
!areAllies(sourceBattlerIndex, user.getBattlerIndex()) &&
(damageCategory === undefined || moveCategory === damageCategory)
moveCategory !== MoveCategory.STATUS
&& !areAllies(sourceBattlerIndex, user.getBattlerIndex())
&& (damageCategory === undefined || moveCategory === damageCategory)
) {
return sourceBattlerIndex;
}

View File

@ -51,11 +51,8 @@ import { MoveEffectTrigger } from "#enums/move-effect-trigger";
import { MoveFlags } from "#enums/move-flags";
import { MoveId } from "#enums/move-id";
import { MoveResult } from "#enums/move-result";
import { MoveId } from "#enums/move-id";
import { MoveResult } from "#enums/move-result";
import { MoveTarget } from "#enums/move-target";
import { isVirtual, MoveUseMode } from "#enums/move-use-mode";
import { isVirtual, MoveUseMode } from "#enums/move-use-mode";
import { MultiHitType } from "#enums/multi-hit-type";
import { PokemonType } from "#enums/pokemon-type";
import { PositionalTagType } from "#enums/positional-tag-type";
@ -92,7 +89,7 @@ import type { ChargingMove, MoveAttrMap, MoveAttrString, MoveClassMap, MoveKindS
import type { TurnMove } from "#types/turn-move";
import type { AbstractConstructor } from "#types/type-helpers";
import { applyChallenges } from "#utils/challenge-utils";
import { BooleanHolder, coerceArray, type Constructor, isNullOrUndefined, NumberHolder, randSeedFloat, randSeedInt, randSeedItem, toDmgValue } from "#utils/common";
import { BooleanHolder, coerceArray, type Constructor, NumberHolder, randSeedFloat, randSeedInt, randSeedItem, toDmgValue } from "#utils/common";
import { getEnumValues } from "#utils/enums";
import { areAllies } from "#utils/pokemon-utils";
import { toCamelCase, toTitleCase } from "#utils/strings";
@ -172,14 +169,9 @@ export abstract class Move implements Localizable {
* @see {@link https://www.smogon.com/forums/threads/sword-shield-battle-mechanics-research.3655528/page-54#post-8548957}
*/
private conditionsSeq3: MoveCondition[] = [];
<<<<<<< HEAD
/** Conditions that must be false for a move to be able to be selected.
*
=======
/**
* Conditions that must be false for a move to be able to be selected.
*
>>>>>>> 02f941b3a05 (PR review changes)
*
* @remarks Different from {@linkcode conditions}, which is checked when the move is invoked
*/
private restrictions: MoveRestriction[] = [];

View File

@ -21,7 +21,7 @@ export enum BattlerTagLapseType {
* Note tags with this lapse type will lapse immediately after the first failure check sequence,
* regardless of whether the move was successful or not, but is skipped if the move is a
* {@linkcode MoveUseMode.FOLLOW_UP | follow-up} move.
*
*
* To only lapse the tag between the first and second failure check sequences, use
* {@linkcode BattlerTagLapseType.MOVE} instead.
*/
@ -50,12 +50,12 @@ export enum BattlerTagLapseType {
* The tag has some other custom activation or removal condition.
* @remarks
* Tags can use this lapse type to prevent them from automatically lapsing during automatic lapse instances,
* such as before a move is used or at the end of a turn.
* such as before a move is used or at the end of a turn.
* Such tags will only trigger upon being specifically lapsed with the tag and lapse type via
* {@linkcode Pokemon.lapseTag}.
* */
*/
CUSTOM,
}
/** Same type as {@linkcode BattlerTagLapseType}, but excludes the {@linkcode BattlerTagLapseType.CUSTOM} type */
export type NonCustomBattlerTagLapseType = Exclude<BattlerTagLapseType, BattlerTagLapseType.CUSTOM>;
export type NonCustomBattlerTagLapseType = Exclude<BattlerTagLapseType, BattlerTagLapseType.CUSTOM>;

View File

@ -5,4 +5,4 @@ export enum MoveCategory {
}
/** Type of damage categories */
export type MoveDamageCategory = Exclude<MoveCategory, MoveCategory.STATUS>;
export type MoveDamageCategory = Exclude<MoveCategory, MoveCategory.STATUS>;

View File

@ -6523,8 +6523,8 @@ export class EnemyPokemon extends Pokemon {
move.category !== MoveCategory.STATUS
&& moveTargets.some(p => {
const doesNotFail =
move.applyConditions(this, p, -1) ||
[MoveId.SUCKER_PUNCH, MoveId.UPPER_HAND, MoveId.THUNDERCLAP].includes(move.id);
move.applyConditions(this, p, -1)
|| [MoveId.SUCKER_PUNCH, MoveId.UPPER_HAND, MoveId.THUNDERCLAP].includes(move.id);
return (
doesNotFail
&& p.getAttackDamage({
@ -6584,8 +6584,8 @@ export class EnemyPokemon extends Pokemon {
* target score to -20
*/
if (
(move.name.endsWith(" (N)") || !move.applyConditions(this, target, -1)) &&
![MoveId.SUCKER_PUNCH, MoveId.UPPER_HAND, MoveId.THUNDERCLAP].includes(move.id)
(move.name.endsWith(" (N)") || !move.applyConditions(this, target, -1))
&& ![MoveId.SUCKER_PUNCH, MoveId.UPPER_HAND, MoveId.THUNDERCLAP].includes(move.id)
) {
targetScore = -20;
} else if (move.is("AttackMove")) {

View File

@ -121,9 +121,9 @@ export class CommandPhase extends FieldPhase {
for (const queuedMove of moveQueue) {
const movesetQueuedMove = moveset.find(m => m.moveId === queuedMove.move);
if (
queuedMove.move !== MoveId.NONE &&
!isVirtual(queuedMove.useMode) &&
!movesetQueuedMove?.isUsable(playerPokemon, isIgnorePP(queuedMove.useMode), true)
queuedMove.move !== MoveId.NONE
&& !isVirtual(queuedMove.useMode)
&& !movesetQueuedMove?.isUsable(playerPokemon, isIgnorePP(queuedMove.useMode), true)
) {
entriesToDelete++;
} else {

View File

@ -3,7 +3,6 @@ import type { Move, PreUseInterruptAttr } from "#types/move-types";
// biome-ignore-end lint/correctness/noUnusedImports: Used in a tsdoc comment
import { applyAbAttrs } from "#abilities/apply-ab-attrs";
import { MOVE_COLOR } from "#app/constants/colors";
import { globalScene } from "#app/global-scene";
import { getPokemonNameWithAffix } from "#app/messages";
import Overrides from "#app/overrides";
@ -32,6 +31,7 @@ import type { Pokemon } from "#field/pokemon";
import { applyMoveAttrs } from "#moves/apply-attrs";
import { frenzyMissFunc } from "#moves/move-utils";
import type { PokemonMove } from "#moves/pokemon-move";
import type { TurnMove } from "#types/turn-move";
import { applyChallenges } from "#utils/challenge-utils";
import { BooleanHolder, NumberHolder } from "#utils/common";
import { enumValueToKey } from "#utils/enums";
@ -44,7 +44,7 @@ export class MovePhase extends PokemonPhase {
protected _targets: BattlerIndex[];
public readonly useMode: MoveUseMode; // Made public for quash
/** The timing modifier of the move (used by Quash and to force called moves to the front of their queue) */
public timingModifier: MovePhaseTimingModifier;
public readonly timingModifier: MovePhaseTimingModifier;
/** Whether the current move should fail but still use PP. */
protected failed = false;
/** Whether the current move should fail and retain PP. */
@ -53,6 +53,13 @@ export class MovePhase extends PokemonPhase {
/** Flag set to `true` during {@linkcode checkFreeze} that indicates that the pokemon will thaw if it passes the failure conditions */
private declare thaw?: boolean;
/** The move history entry object that is pushed to the pokemon's move history
*
* @remarks
* Can be edited _after_ being pushed to the history to adjust the result, targets, etc, for this move phase.
*/
protected readonly moveHistoryEntry: TurnMove;
public get pokemon(): Pokemon {
return this._pokemon;
}
@ -101,12 +108,14 @@ export class MovePhase extends PokemonPhase {
/** Signifies the current move should fail but still use PP */
public fail(): void {
this.moveHistoryEntry.result = MoveResult.FAIL;
this.failed = true;
}
/** Signifies the current move should cancel and retain PP */
public cancel(): void {
this.cancelled = true;
this.moveHistoryEntry.result = MoveResult.FAIL;
}
/**
@ -138,22 +147,22 @@ export class MovePhase extends PokemonPhase {
protected firstFailureCheck(): boolean {
// A big if statement will handle the checks (that each have side effects!) in the correct order
return (
this.checkSleep() ||
this.checkFreeze() ||
this.checkPP() ||
this.checkValidity() ||
this.checkTagCancel(BattlerTagType.TRUANT) ||
this.checkPreUseInterrupt() ||
this.checkTagCancel(BattlerTagType.FLINCHED) ||
this.checkTagCancel(BattlerTagType.DISABLED) ||
this.checkTagCancel(BattlerTagType.HEAL_BLOCK) ||
this.checkTagCancel(BattlerTagType.THROAT_CHOPPED) ||
this.checkGravity() ||
this.checkTagCancel(BattlerTagType.TAUNT) ||
this.checkTagCancel(BattlerTagType.IMPRISON) ||
this.checkTagCancel(BattlerTagType.CONFUSED) ||
this.checkPara() ||
this.checkTagCancel(BattlerTagType.INFATUATED)
this.checkSleep()
|| this.checkFreeze()
|| this.checkPP()
|| this.checkValidity()
|| this.checkTagCancel(BattlerTagType.TRUANT)
|| this.checkPreUseInterrupt()
|| this.checkTagCancel(BattlerTagType.FLINCHED)
|| this.checkTagCancel(BattlerTagType.DISABLED)
|| this.checkTagCancel(BattlerTagType.HEAL_BLOCK)
|| this.checkTagCancel(BattlerTagType.THROAT_CHOPPED)
|| this.checkGravity()
|| this.checkTagCancel(BattlerTagType.TAUNT)
|| this.checkTagCancel(BattlerTagType.IMPRISON)
|| this.checkTagCancel(BattlerTagType.CONFUSED)
|| this.checkPara()
|| this.checkTagCancel(BattlerTagType.INFATUATED)
);
}
@ -171,9 +180,9 @@ export class MovePhase extends PokemonPhase {
*/
protected followUpMoveFirstFailureCheck(): boolean {
return (
this.checkTagCancel(BattlerTagType.HEAL_BLOCK) ||
this.checkTagCancel(BattlerTagType.THROAT_CHOPPED) ||
this.checkGravity()
this.checkTagCancel(BattlerTagType.HEAL_BLOCK)
|| this.checkTagCancel(BattlerTagType.THROAT_CHOPPED)
|| this.checkGravity()
);
}
@ -419,11 +428,12 @@ export class MovePhase extends PokemonPhase {
const moveQueue = this.pokemon.getMoveQueue();
if (
(targets.length === 0 && !this.move.getMove().hasAttr("AddArenaTrapTagAttr")) ||
(moveQueue.length > 0 && moveQueue[0].move === MoveId.NONE)
(targets.length === 0 && !this.move.getMove().hasAttr("AddArenaTrapTagAttr"))
|| (moveQueue.length > 0 && moveQueue[0].move === MoveId.NONE)
) {
this.showFailedText();
this.fail();
this.pokemon.pushMoveHistory(this.moveHistoryEntry);
return true;
}
this.pokemon.lapseTags(BattlerTagLapseType.MOVE);
@ -536,20 +546,18 @@ export class MovePhase extends PokemonPhase {
// Check if the move will heal
const move = this.move.getMove();
if (
move.findAttr(
attr => attr.selfTarget && attr.is("HealStatusEffectAttr") && attr.isOfEffect(StatusEffect.FREEZE),
) &&
(move.id !== MoveId.BURN_UP || this.pokemon.isOfType(PokemonType.FIRE, true, true))
move.findAttr(attr => attr.selfTarget && attr.is("HealStatusEffectAttr") && attr.isOfEffect(StatusEffect.FREEZE))
&& (move.id !== MoveId.BURN_UP || this.pokemon.isOfType(PokemonType.FIRE, true, true))
) {
this.thaw = true;
return false;
}
if (
Overrides.STATUS_ACTIVATION_OVERRIDE === false ||
this.move
Overrides.STATUS_ACTIVATION_OVERRIDE === false
|| this.move
.getMove()
.findAttr(attr => attr.selfTarget && attr.is("HealStatusEffectAttr") && attr.isOfEffect(StatusEffect.FREEZE)) ||
(!this.pokemon.randBattleSeedInt(5) && Overrides.STATUS_ACTIVATION_OVERRIDE !== true)
.findAttr(attr => attr.selfTarget && attr.is("HealStatusEffectAttr") && attr.isOfEffect(StatusEffect.FREEZE))
|| (!this.pokemon.randBattleSeedInt(5) && Overrides.STATUS_ACTIVATION_OVERRIDE !== true)
) {
this.cureStatus(StatusEffect.FREEZE);
return false;
@ -606,10 +614,9 @@ export class MovePhase extends PokemonPhase {
return true;
} else if (
this.pokemon.isPlayer() &&
applyChallenges(ChallengeType.POKEMON_MOVE, moveId, usability) &&
// check the value inside of usability after calling applyChallenges
!usability.value
this.pokemon.isPlayer()
&& applyChallenges(ChallengeType.POKEMON_MOVE, moveId, usability) // check the value inside of usability after calling applyChallenges
&& !usability.value
) {
failedText = i18next.t("battle:moveCannotUseChallenge", { moveName });
} else {
@ -683,8 +690,8 @@ export class MovePhase extends PokemonPhase {
return false;
}
const proc =
(this.pokemon.randBattleSeedInt(4) === 0 || Overrides.STATUS_ACTIVATION_OVERRIDE === true) &&
Overrides.STATUS_ACTIVATION_OVERRIDE !== false;
(this.pokemon.randBattleSeedInt(4) === 0 || Overrides.STATUS_ACTIVATION_OVERRIDE === true)
&& Overrides.STATUS_ACTIVATION_OVERRIDE !== false;
if (!proc) {
return false;
}
@ -777,7 +784,7 @@ export class MovePhase extends PokemonPhase {
const dancerModes: MoveUseMode[] = [MoveUseMode.INDIRECT, MoveUseMode.REFLECTED] as const;
if (this.move.getMove().hasFlag(MoveFlags.DANCE_MOVE) && !dancerModes.includes(this.useMode)) {
globalScene.getField(true).forEach(pokemon => {
applyAbAttrs("PostMoveUsedAbAttr", { pokemon, move: this.move, source: user, targets: targets });
applyAbAttrs("PostMoveUsedAbAttr", { pokemon, move: this.move, source: user, targets });
});
}
}
@ -815,6 +822,7 @@ export class MovePhase extends PokemonPhase {
result: MoveResult.FAIL,
useMode: this.useMode,
});
console.log("==========PUSHING MOVE HISTORY WITH FAIL FOR %s=============", MoveId[this.move.moveId]);
// Use move-specific failure messages if present before checking terrain/weather blockage
// and falling back to the classic "But it failed!".

View File

@ -141,7 +141,7 @@ export function areAllies(a: BattlerIndex, b: BattlerIndex): boolean {
return false;
}
return (
(a === BattlerIndex.PLAYER || a === BattlerIndex.PLAYER_2) ===
(b === BattlerIndex.PLAYER || b === BattlerIndex.PLAYER_2)
(a === BattlerIndex.PLAYER || a === BattlerIndex.PLAYER_2)
=== (b === BattlerIndex.PLAYER || b === BattlerIndex.PLAYER_2)
);
}