[Misc] Remove | null from user param of PokemonAttackCondition

https://github.com/pagefaultgames/pokerogue/pull/6859
This commit is contained in:
NightKev 2025-12-18 15:54:38 -06:00 committed by GitHub
parent e6de0fb95d
commit 4545f9aae3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 12 deletions

View File

@ -8,7 +8,7 @@ import type { Move } from "#moves/move";
export type * from "#abilities/ability";
export type AbAttrCondition = (pokemon: Pokemon) => boolean;
export type PokemonAttackCondition = (user: Pokemon | null, target: Pokemon | null, move: Move) => boolean;
export type PokemonAttackCondition = (user: Pokemon, target: Pokemon | null, move: Move) => boolean;
export type PokemonDefendCondition = (target: Pokemon, user: Pokemon, move: Move) => boolean;
export type PokemonStatStageChangeCondition = (
target: Pokemon,

View File

@ -2352,7 +2352,7 @@ export class PostAttackApplyBattlerTagAbAttr extends PostAttackAbAttr {
override canApply(params: PostMoveInteractionAbAttrParams): boolean {
const { pokemon, move, opponent } = params;
/**Battler tags inflicted by abilities post attacking are also considered additional effects.*/
// Battler tags inflicted by abilities post attacking are also considered additional effects.
return (
super.canApply(params)
&& !opponent.hasAbilityWithAttr("IgnoreMoveEffectsAbAttr")
@ -5792,10 +5792,10 @@ export interface MoveAbilityBypassAbAttrParams extends AbAttrBaseParams {
export class MoveAbilityBypassAbAttr extends AbAttr {
private readonly moveIgnoreFunc: (pokemon: Pokemon, move: Move) => boolean;
constructor(moveIgnoreFunc?: (pokemon: Pokemon, move: Move) => boolean) {
constructor(moveIgnoreFunc: (pokemon: Pokemon, move: Move) => boolean = () => true) {
super(false);
this.moveIgnoreFunc = moveIgnoreFunc || ((_pokemon, _move) => true);
this.moveIgnoreFunc = moveIgnoreFunc;
}
override canApply({ pokemon, move, cancelled }: MoveAbilityBypassAbAttrParams): boolean {
@ -7133,8 +7133,8 @@ export function initAbilities() {
.ignorable()
.build(),
new AbBuilder(AbilityId.RIVALRY, 4)
.attr(MovePowerBoostAbAttr, (user, target, _move) => user?.gender !== Gender.GENDERLESS && target?.gender !== Gender.GENDERLESS && user?.gender === target?.gender, 1.25)
.attr(MovePowerBoostAbAttr, (user, target, _move) => user?.gender !== Gender.GENDERLESS && target?.gender !== Gender.GENDERLESS && user?.gender !== target?.gender, 0.75)
.attr(MovePowerBoostAbAttr, (user, target, _move) => user.gender !== Gender.GENDERLESS && target?.gender !== Gender.GENDERLESS && user.gender === target?.gender, 1.25)
.attr(MovePowerBoostAbAttr, (user, target, _move) => user.gender !== Gender.GENDERLESS && target?.gender !== Gender.GENDERLESS && user.gender !== target?.gender, 0.75)
.build(),
new AbBuilder(AbilityId.STEADFAST, 4)
.attr(FlinchStatStageChangeAbAttr, [ Stat.SPD ], 1)
@ -7367,10 +7367,10 @@ export function initAbilities() {
.ignorable()
.build(),
new AbBuilder(AbilityId.TOXIC_BOOST, 5)
.attr(MovePowerBoostAbAttr, (user, _target, move) => move.category === MoveCategory.PHYSICAL && (user?.status?.effect === StatusEffect.POISON || user?.status?.effect === StatusEffect.TOXIC), 1.5)
.attr(MovePowerBoostAbAttr, (user, _target, move) => move.category === MoveCategory.PHYSICAL && (user.status?.effect === StatusEffect.POISON || user.status?.effect === StatusEffect.TOXIC), 1.5)
.build(),
new AbBuilder(AbilityId.FLARE_BOOST, 5)
.attr(MovePowerBoostAbAttr, (user, _target, move) => move.category === MoveCategory.SPECIAL && user?.status?.effect === StatusEffect.BURN, 1.5)
.attr(MovePowerBoostAbAttr, (user, _target, move) => move.category === MoveCategory.SPECIAL && user.status?.effect === StatusEffect.BURN, 1.5)
.build(),
new AbBuilder(AbilityId.HARVEST, 5)
.attr(
@ -7414,7 +7414,7 @@ export function initAbilities() {
new AbBuilder(AbilityId.ANALYTIC, 5)
.attr(MovePowerBoostAbAttr, (user) =>
// Boost power if all other Pokemon have already moved (no other moves are slated to execute)
!globalScene.phaseManager.hasPhaseOfType("MovePhase", phase => phase.pokemon.id !== user?.id),
!globalScene.phaseManager.hasPhaseOfType("MovePhase", phase => phase.pokemon.id !== user.id),
1.3)
.build(),
new AbBuilder(AbilityId.ILLUSION, 5)
@ -7596,8 +7596,7 @@ export function initAbilities() {
.attr(AddSecondStrikeAbAttr)
// Only multiply damage on the last strike of multi-strike moves
.attr(MoveDamageBoostAbAttr, 0.25, (user, target, move) => (
!!user
&& user.turnData.hitCount > 1 // move was originally multi hit
user.turnData.hitCount > 1 // move was originally multi hit
&& user.turnData.hitsLeft === 1 // move is on its final strike
&& move.canBeMultiStrikeEnhanced(user, true, target)
)
@ -7857,7 +7856,7 @@ export function initAbilities() {
.attr(ReceivedMoveDamageMultiplierAbAttr, (target, user, move) => target.getMoveEffectiveness(user, move) >= 2, 0.75)
.build(),
new AbBuilder(AbilityId.NEUROFORCE, 7)
.attr(MovePowerBoostAbAttr, (user, target, move) => (target?.getMoveEffectiveness(user!, move) ?? 1) >= 2, 1.25)
.attr(MovePowerBoostAbAttr, (user, target, move) => (target?.getMoveEffectiveness(user, move) ?? 1) >= 2, 1.25)
.build(),
new AbBuilder(AbilityId.INTREPID_SWORD, 8)
.attr(PostSummonStatStageChangeAbAttr, [ Stat.ATK ], 1, true)