mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-21 07:42:25 +02:00
Move queueAbilityDisplay to battlescene
This commit is contained in:
parent
5413332818
commit
165c5fa7bc
@ -175,6 +175,8 @@ import { BattlerTagType } from "#enums/battler-tag-type";
|
|||||||
import { FRIENDSHIP_GAIN_FROM_BATTLE } from "#app/data/balance/starters";
|
import { FRIENDSHIP_GAIN_FROM_BATTLE } from "#app/data/balance/starters";
|
||||||
import { StatusEffect } from "#enums/status-effect";
|
import { StatusEffect } from "#enums/status-effect";
|
||||||
import { initGlobalScene } from "#app/global-scene";
|
import { initGlobalScene } from "#app/global-scene";
|
||||||
|
import { ShowAbilityPhase } from "#app/phases/show-ability-phase";
|
||||||
|
import { HideAbilityPhase } from "#app/phases/hide-ability-phase";
|
||||||
|
|
||||||
export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1";
|
export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1";
|
||||||
|
|
||||||
@ -3138,6 +3140,17 @@ export default class BattleScene extends SceneBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Queues an ability bar flyout phase
|
||||||
|
* @param pokemon The pokemon who has the ability
|
||||||
|
* @param passive Whether the ability is a passive
|
||||||
|
* @param show Whether to show or hide the bar
|
||||||
|
*/
|
||||||
|
public queueAbilityDisplay(pokemon: Pokemon, passive: boolean, show: boolean): void {
|
||||||
|
this.unshiftPhase((show) ? new ShowAbilityPhase(pokemon.id, passive) : new HideAbilityPhase(pokemon.id, passive));
|
||||||
|
this.clearPhaseQueueSplice();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Moves everything from nextCommandPhaseQueue to phaseQueue (keeping order)
|
* Moves everything from nextCommandPhaseQueue to phaseQueue (keeping order)
|
||||||
*/
|
*/
|
||||||
|
@ -32,7 +32,6 @@ import { Species } from "#enums/species";
|
|||||||
import { Stat, type BattleStat, type EffectiveStat, BATTLE_STATS, EFFECTIVE_STATS, getStatKey } from "#app/enums/stat";
|
import { Stat, type BattleStat, type EffectiveStat, BATTLE_STATS, EFFECTIVE_STATS, getStatKey } from "#app/enums/stat";
|
||||||
import { MovePhase } from "#app/phases/move-phase";
|
import { MovePhase } from "#app/phases/move-phase";
|
||||||
import { PokemonHealPhase } from "#app/phases/pokemon-heal-phase";
|
import { PokemonHealPhase } from "#app/phases/pokemon-heal-phase";
|
||||||
import { ShowAbilityPhase } from "#app/phases/show-ability-phase";
|
|
||||||
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
|
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
|
||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
import { SwitchType } from "#app/enums/switch-type";
|
import { SwitchType } from "#app/enums/switch-type";
|
||||||
@ -45,7 +44,6 @@ import { PokemonAnimType } from "#enums/pokemon-anim-type";
|
|||||||
import { StatusEffect } from "#enums/status-effect";
|
import { StatusEffect } from "#enums/status-effect";
|
||||||
import { WeatherType } from "#enums/weather-type";
|
import { WeatherType } from "#enums/weather-type";
|
||||||
import { PokemonTransformPhase } from "#app/phases/pokemon-transform-phase";
|
import { PokemonTransformPhase } from "#app/phases/pokemon-transform-phase";
|
||||||
import { HideAbilityPhase } from "#app/phases/hide-ability-phase";
|
|
||||||
|
|
||||||
export class Ability implements Localizable {
|
export class Ability implements Localizable {
|
||||||
public id: Abilities;
|
public id: Abilities;
|
||||||
@ -1250,7 +1248,7 @@ export class IgnoreMoveEffectsAbAttr extends PreDefendAbAttr {
|
|||||||
|
|
||||||
export class VariableMovePowerAbAttr extends PreAttackAbAttr {
|
export class VariableMovePowerAbAttr extends PreAttackAbAttr {
|
||||||
override canApplyPreAttack(pokemon: Pokemon, passive: boolean, simulated: boolean, defender: Pokemon, move: Move, args: any[]): boolean {
|
override canApplyPreAttack(pokemon: Pokemon, passive: boolean, simulated: boolean, defender: Pokemon, move: Move, args: any[]): boolean {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2692,7 +2690,7 @@ export class PostSummonFormChangeByWeatherAbAttr extends PostSummonAbAttr {
|
|||||||
if (!simulated) {
|
if (!simulated) {
|
||||||
globalScene.triggerPokemonFormChange(pokemon, SpeciesFormChangeWeatherTrigger);
|
globalScene.triggerPokemonFormChange(pokemon, SpeciesFormChangeWeatherTrigger);
|
||||||
globalScene.triggerPokemonFormChange(pokemon, SpeciesFormChangeRevertWeatherFormTrigger);
|
globalScene.triggerPokemonFormChange(pokemon, SpeciesFormChangeRevertWeatherFormTrigger);
|
||||||
queueShowAbility(pokemon, passive);
|
globalScene.queueAbilityDisplay(pokemon, passive, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5104,7 +5102,7 @@ function applySingleAbAttrs<TAttr extends AbAttr>(
|
|||||||
globalScene.setPhaseQueueSplice();
|
globalScene.setPhaseQueueSplice();
|
||||||
|
|
||||||
if (attr.showAbility && !simulated) {
|
if (attr.showAbility && !simulated) {
|
||||||
queueShowAbility(pokemon, passive);
|
globalScene.queueAbilityDisplay(pokemon, passive, true);
|
||||||
abShown = true;
|
abShown = true;
|
||||||
}
|
}
|
||||||
const message = attr.getTriggerMessage(pokemon, ability.name, args);
|
const message = attr.getTriggerMessage(pokemon, ability.name, args);
|
||||||
@ -5118,7 +5116,7 @@ function applySingleAbAttrs<TAttr extends AbAttr>(
|
|||||||
applyFunc(attr, passive);
|
applyFunc(attr, passive);
|
||||||
|
|
||||||
if (abShown) {
|
if (abShown) {
|
||||||
queueHideAbility(pokemon, passive);
|
globalScene.queueAbilityDisplay(pokemon, passive, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pokemon.summonData && !pokemon.summonData.abilitiesApplied.includes(ability.id)) {
|
if (pokemon.summonData && !pokemon.summonData.abilitiesApplied.includes(ability.id)) {
|
||||||
@ -5951,15 +5949,6 @@ export function applyOnLoseClearWeatherAbAttrs(
|
|||||||
simulated,
|
simulated,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
function queueShowAbility(pokemon: Pokemon, passive: boolean): void {
|
|
||||||
globalScene.unshiftPhase(new ShowAbilityPhase(pokemon.id, passive));
|
|
||||||
globalScene.clearPhaseQueueSplice();
|
|
||||||
}
|
|
||||||
|
|
||||||
function queueHideAbility(pokemon: Pokemon, passive: boolean): void {
|
|
||||||
globalScene.unshiftPhase(new HideAbilityPhase(pokemon.id, passive));
|
|
||||||
globalScene.clearPhaseQueueSplice();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the ability of a Pokémon as revealed.
|
* Sets the ability of a Pokémon as revealed.
|
||||||
|
Loading…
Reference in New Issue
Block a user