Apply Biome

This commit is contained in:
NightKev 2025-04-11 21:18:45 -07:00
parent 81f424dc71
commit 5b73e391e6

View File

@ -297,16 +297,16 @@ export class MoveEffectPhase extends PokemonPhase {
); );
} }
/** Is the target protected by Protect, etc. or a relevant conditional protection effect? */ /** Is the target protected by Protect, etc. or a relevant conditional protection effect? */
const isProtected = const isProtected =
![MoveTarget.ENEMY_SIDE, MoveTarget.BOTH_SIDES].includes(this.move.getMove().moveTarget) && ![MoveTarget.ENEMY_SIDE, MoveTarget.BOTH_SIDES].includes(this.move.getMove().moveTarget) &&
(bypassIgnoreProtect.value || (bypassIgnoreProtect.value ||
!this.move.getMove().doesFlagEffectApply({ flag: MoveFlags.IGNORE_PROTECT, user, target })) && !this.move.getMove().doesFlagEffectApply({ flag: MoveFlags.IGNORE_PROTECT, user, target })) &&
(hasConditionalProtectApplied.value || (hasConditionalProtectApplied.value ||
(!target.findTags(t => t instanceof DamageProtectedTag).length && (!target.findTags(t => t instanceof DamageProtectedTag).length &&
target.findTags(t => t instanceof ProtectedTag).find(t => target.lapseTag(t.tagType))) || target.findTags(t => t instanceof ProtectedTag).find(t => target.lapseTag(t.tagType))) ||
(this.move.getMove().category !== MoveCategory.STATUS && (this.move.getMove().category !== MoveCategory.STATUS &&
target.findTags(t => t instanceof DamageProtectedTag).find(t => target.lapseTag(t.tagType)))); target.findTags(t => t instanceof DamageProtectedTag).find(t => target.lapseTag(t.tagType))));
/** Is the target hidden by the effects of its Commander ability? */ /** Is the target hidden by the effects of its Commander ability? */
const isCommanding = const isCommanding =
@ -316,11 +316,11 @@ export class MoveEffectPhase extends PokemonPhase {
/** Is the target reflecting status moves from the magic coat move? */ /** Is the target reflecting status moves from the magic coat move? */
const isReflecting = !!target.getTag(BattlerTagType.MAGIC_COAT); const isReflecting = !!target.getTag(BattlerTagType.MAGIC_COAT);
/** Is the target's magic bounce ability not ignored and able to reflect this move? */ /** Is the target's magic bounce ability not ignored and able to reflect this move? */
const canMagicBounce = const canMagicBounce =
!isReflecting && !isReflecting &&
!move.doesFlagEffectApply({ flag: MoveFlags.IGNORE_ABILITIES, user, target }) && !move.doesFlagEffectApply({ flag: MoveFlags.IGNORE_ABILITIES, user, target }) &&
target.hasAbilityWithAttr(ReflectStatusMoveAbAttr); target.hasAbilityWithAttr(ReflectStatusMoveAbAttr);
const semiInvulnerableTag = target.getTag(SemiInvulnerableTag); const semiInvulnerableTag = target.getTag(SemiInvulnerableTag);
@ -333,21 +333,19 @@ export class MoveEffectPhase extends PokemonPhase {
(isReflecting || canMagicBounce) && (isReflecting || canMagicBounce) &&
!semiInvulnerableTag; !semiInvulnerableTag;
// If the move will bounce, then queue the bounce and move on to the next target // If the move will bounce, then queue the bounce and move on to the next target
if (!target.switchOutStatus && willBounce) { if (!target.switchOutStatus && willBounce) {
const newTargets = move.isMultiTarget() const newTargets = move.isMultiTarget() ? getMoveTargets(target, move.id).targets : [user.getBattlerIndex()];
? getMoveTargets(target, move.id).targets if (!isReflecting) {
: [user.getBattlerIndex()]; // TODO: Ability displays should be handled by the ability
if (!isReflecting) { queuedPhases.push(
// TODO: Ability displays should be handled by the ability new ShowAbilityPhase(
queuedPhases.push( target.getBattlerIndex(),
new ShowAbilityPhase( target.getPassiveAbility().hasAttr(ReflectStatusMoveAbAttr),
target.getBattlerIndex(), ),
target.getPassiveAbility().hasAttr(ReflectStatusMoveAbAttr), );
), queuedPhases.push(new HideAbilityPhase());
); }
queuedPhases.push(new HideAbilityPhase());
}
queuedPhases.push(new MovePhase(target, newTargets, new PokemonMove(move.id, 0, 0, true), true, true, true)); queuedPhases.push(new MovePhase(target, newTargets, new PokemonMove(move.id, 0, 0, true), true, true, true));
continue; continue;