mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-20 22:39:31 +02:00
Minor formatting changes
This commit is contained in:
parent
ba4915728f
commit
8db0d37a2a
@ -4841,13 +4841,13 @@ async function applyAbAttrsInternal<TAttr extends AbAttr>(
|
||||
|
||||
class ForceSwitchOutHelper {
|
||||
constructor(private switchType: SwitchType) {}
|
||||
|
||||
/**
|
||||
* Handles the logic for switching out a Pokémon based on battle conditions, HP, and the switch type.
|
||||
*
|
||||
* @param pokemon The {@linkcode Pokemon} attempting to switch out.
|
||||
* @returns `true` if the switch is successful
|
||||
*/
|
||||
|
||||
public switchOutLogic(pokemon: Pokemon): boolean {
|
||||
const switchOutTarget = pokemon;
|
||||
/**
|
||||
@ -4938,7 +4938,7 @@ class ForceSwitchOutHelper {
|
||||
}
|
||||
|
||||
const party = player ? pokemon.scene.getParty() : pokemon.scene.getEnemyParty();
|
||||
return (!player && !pokemon.scene.currentBattle.battleType)
|
||||
return (!player && pokemon.scene.currentBattle.battleType !== BattleType.WILD)
|
||||
|| party.filter(p => p.isAllowedInBattle()
|
||||
&& (player || (p as EnemyPokemon).trainerSlot === (switchOutTarget as EnemyPokemon).trainerSlot)).length > pokemon.scene.currentBattle.getBattlerCount();
|
||||
}
|
||||
@ -4989,16 +4989,18 @@ export class PostDamageAbAttr extends AbAttr {
|
||||
* This attribute checks various conditions related to the damage received, the moves used by the Pokémon
|
||||
* and its opponents, and determines whether a forced switch-out should occur.
|
||||
*
|
||||
* Used by Wimp Out and Emergency Exit
|
||||
*
|
||||
* @extends PostDamageAbAttr
|
||||
* @see {@linkcode applyPostDamage}
|
||||
*/
|
||||
export class PostDamageForceSwitchAbAttr extends PostDamageAbAttr {
|
||||
private helper: ForceSwitchOutHelper;
|
||||
private helper: ForceSwitchOutHelper = new ForceSwitchOutHelper(SwitchType.SWITCH);
|
||||
private hpRatio: number;
|
||||
|
||||
constructor(hpRatio: number = 0.5) {
|
||||
super();
|
||||
this.hpRatio = hpRatio;
|
||||
this.helper = new ForceSwitchOutHelper(SwitchType.SWITCH);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -5020,7 +5022,6 @@ export class PostDamageForceSwitchAbAttr extends PostDamageAbAttr {
|
||||
const fordbiddenAttackingMoves = [ Moves.BELLY_DRUM, Moves.SUBSTITUTE, Moves.CURSE, Moves.PAIN_SPLIT ];
|
||||
if (moveHistory.length > 0) {
|
||||
const lastMoveUsed = moveHistory[moveHistory.length - 1];
|
||||
// Will not activate if the Pokémon's HP falls below half while it is in the air during Sky Drop.
|
||||
if (fordbiddenAttackingMoves.includes(lastMoveUsed.move)) {
|
||||
return false;
|
||||
}
|
||||
@ -5032,6 +5033,7 @@ export class PostDamageForceSwitchAbAttr extends PostDamageAbAttr {
|
||||
const enemyMoveHistory = source.getMoveHistory();
|
||||
if (enemyMoveHistory.length > 0) {
|
||||
const enemyLastMoveUsed = enemyMoveHistory[enemyMoveHistory.length - 1];
|
||||
// Will not activate if the Pokémon's HP falls below half while it is in the air during Sky Drop.
|
||||
if (fordbiddenDefendingMoves.includes(enemyLastMoveUsed.move) || enemyLastMoveUsed.move === Moves.SKY_DROP && enemyLastMoveUsed.result === MoveResult.OTHER) {
|
||||
return false;
|
||||
// Will not activate if the Pokémon's HP falls below half by a move affected by Sheer Force.
|
||||
|
@ -5697,8 +5697,8 @@ export class RevivalBlessingAttr extends MoveEffectAttr {
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to check if the Pokémon's health is below half after taking damage
|
||||
* Used for an edge case interaction with Wimp Out/Emergency Exit
|
||||
* Helper function to check if the Pokémon's health is below half after taking damage.
|
||||
* Used for an edge case interaction with Wimp Out/Emergency Exit.
|
||||
* If the Ability activates due to being hit by U-turn or Volt Switch, the user of that move will not be switched out.
|
||||
*/
|
||||
function shouldPreventSwitchOut(target: Pokemon): boolean {
|
||||
@ -5729,11 +5729,11 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
|
||||
return false;
|
||||
}
|
||||
|
||||
const switchOutTarget = this.selfSwitch ? user : target;
|
||||
/**
|
||||
* Check if Wimp Out/Emergency Exit activates due to being hit by U-turn or Volt Switch
|
||||
* If it did, the user of U-turn or Volt Switch will not be switched out.
|
||||
*/
|
||||
const switchOutTarget = this.selfSwitch ? user : target;
|
||||
if (switchOutTarget instanceof PlayerPokemon) {
|
||||
if (target.getAbility().hasAttr(PostDamageForceSwitchAbAttr) &&
|
||||
(move.id === Moves.U_TURN || move.id === Moves.VOLT_SWITCH)) {
|
||||
|
@ -2919,11 +2919,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
damage = this.damage(damage, ignoreSegments, preventEndure, ignoreFaintPhase);
|
||||
// Damage amount may have changed, but needed to be queued before calling damage function
|
||||
damagePhase.updateAmount(damage);
|
||||
if (source) {
|
||||
applyPostDamageAbAttrs(PostDamageAbAttr, this, damage, this.hasPassive(), false, [], source);
|
||||
} else {
|
||||
applyPostDamageAbAttrs(PostDamageAbAttr, this, damage, this.hasPassive(), false, []);
|
||||
}
|
||||
return damage;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user