mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-20 07:12:32 +02:00
Minor changes
This commit is contained in:
parent
63005359a8
commit
9008e3754b
@ -2913,7 +2913,11 @@ export default class BattleScene extends SceneBase {
|
||||
* @param show Whether to show or hide the bar
|
||||
*/
|
||||
public queueAbilityDisplay(pokemon: Pokemon, passive: boolean, show: boolean): void {
|
||||
this.unshiftPhase((show) ? new ShowAbilityPhase(pokemon.getBattlerIndex(), passive) : new HideAbilityPhase(pokemon.getBattlerIndex(), passive));
|
||||
this.unshiftPhase(
|
||||
show
|
||||
? new ShowAbilityPhase(pokemon.getBattlerIndex(), passive)
|
||||
: new HideAbilityPhase(pokemon.getBattlerIndex(), passive),
|
||||
);
|
||||
this.clearPhaseQueueSplice();
|
||||
}
|
||||
|
||||
@ -3146,11 +3150,7 @@ export default class BattleScene extends SceneBase {
|
||||
return false;
|
||||
}
|
||||
|
||||
canTransferHeldItemModifier(
|
||||
itemModifier: PokemonHeldItemModifier,
|
||||
target: Pokemon,
|
||||
transferQuantity: number = 1,
|
||||
): boolean {
|
||||
canTransferHeldItemModifier(itemModifier: PokemonHeldItemModifier, target: Pokemon, transferQuantity = 1): boolean {
|
||||
const mod = itemModifier.clone() as PokemonHeldItemModifier;
|
||||
const source = mod.pokemonId ? mod.getPokemon() : null;
|
||||
const cancelled = new Utils.BooleanHolder(false);
|
||||
@ -3164,10 +3164,7 @@ export default class BattleScene extends SceneBase {
|
||||
}
|
||||
|
||||
const matchingModifier = this.findModifier(
|
||||
(m) =>
|
||||
m instanceof PokemonHeldItemModifier
|
||||
&& m.matchType(mod)
|
||||
&& m.pokemonId === target.id,
|
||||
m => m instanceof PokemonHeldItemModifier && m.matchType(mod) && m.pokemonId === target.id,
|
||||
target.isPlayer(),
|
||||
) as PokemonHeldItemModifier;
|
||||
|
||||
@ -3176,11 +3173,7 @@ export default class BattleScene extends SceneBase {
|
||||
if (matchingModifier.stackCount >= maxStackCount) {
|
||||
return false;
|
||||
}
|
||||
const countTaken = Math.min(
|
||||
transferQuantity,
|
||||
mod.stackCount,
|
||||
maxStackCount - matchingModifier.stackCount,
|
||||
);
|
||||
const countTaken = Math.min(transferQuantity, mod.stackCount, maxStackCount - matchingModifier.stackCount);
|
||||
mod.stackCount -= countTaken;
|
||||
} else {
|
||||
const countTaken = Math.min(transferQuantity, mod.stackCount);
|
||||
@ -3349,7 +3342,7 @@ export default class BattleScene extends SceneBase {
|
||||
});
|
||||
}
|
||||
|
||||
hasModifier(modifier: PersistentModifier, enemy: boolean = false): boolean {
|
||||
hasModifier(modifier: PersistentModifier, enemy = false): boolean {
|
||||
const modifiers = !enemy ? this.modifiers : this.enemyModifiers;
|
||||
return modifiers.indexOf(modifier) > -1;
|
||||
}
|
||||
|
@ -165,10 +165,10 @@ export abstract class AbAttr {
|
||||
|
||||
/**
|
||||
* Applies ability effects without checking conditions
|
||||
* @param pokemon The pokemon to apply this ability to
|
||||
* @param passive Whether or not the ability is a passive
|
||||
* @param simulated Whether the call is simulated
|
||||
* @param args
|
||||
* @param pokemon - The pokemon to apply this ability to
|
||||
* @param passive - Whether or not the ability is a passive
|
||||
* @param simulated - Whether the call is simulated
|
||||
* @param args - Extra args passed to the function. Handled by child classes.
|
||||
* @see {@linkcode canApply}
|
||||
*/
|
||||
apply(pokemon: Pokemon, passive: boolean, simulated: boolean, cancelled: Utils.BooleanHolder | null, args: any[]): void {}
|
||||
@ -188,11 +188,11 @@ export abstract class AbAttr {
|
||||
|
||||
/**
|
||||
* Returns a boolean describing whether the ability can be applied under current conditions
|
||||
* @param pokemon The pokemon to apply this ability to
|
||||
* @param passive Whether or not the ability is a passive
|
||||
* @param simulated Whether the call is simulated
|
||||
* @param args
|
||||
* @returns True if the ability can be applied, false otherwise
|
||||
* @param pokemon - The pokemon to apply this ability to
|
||||
* @param passive - Whether or not the ability is a passive
|
||||
* @param simulated - Whether the call is simulated
|
||||
* @param args - Extra args passed to the function. Handled by child classes.
|
||||
* @returns `true` if the ability can be applied, `false` otherwise
|
||||
* @see {@linkcode apply}
|
||||
*/
|
||||
canApply(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean {
|
||||
|
@ -5,7 +5,7 @@ import { PokemonPhase } from "./pokemon-phase";
|
||||
export class HideAbilityPhase extends PokemonPhase {
|
||||
private passive: boolean;
|
||||
|
||||
constructor(battlerIndex: BattlerIndex, passive: boolean = false) {
|
||||
constructor(battlerIndex: BattlerIndex, passive = false) {
|
||||
super(battlerIndex);
|
||||
|
||||
this.passive = passive;
|
||||
|
@ -29,6 +29,10 @@ export class ShowAbilityPhase extends PokemonPhase {
|
||||
start() {
|
||||
super.start();
|
||||
|
||||
if (!this.pokemonOnField || !this.getPokemon()) {
|
||||
return this.end();
|
||||
}
|
||||
|
||||
// If the bar is already out, hide it before showing the new one
|
||||
if (globalScene.abilityBar.isVisible()) {
|
||||
globalScene.unshiftPhase(new HideAbilityPhase(this.battlerIndex, this.passive));
|
||||
@ -36,12 +40,8 @@ export class ShowAbilityPhase extends PokemonPhase {
|
||||
return this.end();
|
||||
}
|
||||
|
||||
if (!this.pokemonOnField) {
|
||||
return this.end();
|
||||
}
|
||||
const pokemon = this.getPokemon();
|
||||
|
||||
if (pokemon) {
|
||||
if (!pokemon.isPlayer()) {
|
||||
/** If its an enemy pokemon, list it as last enemy to use ability or move */
|
||||
globalScene.currentBattle.lastEnemyInvolved = pokemon.getBattlerIndex() % 2;
|
||||
@ -56,8 +56,5 @@ export class ShowAbilityPhase extends PokemonPhase {
|
||||
|
||||
this.end();
|
||||
});
|
||||
} else {
|
||||
this.end();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ export default class AbilityBar extends Phaser.GameObjects.Container {
|
||||
}
|
||||
|
||||
setup(): void {
|
||||
for (const key of [ "ability_bar_right", "ability_bar_left" ]) {
|
||||
for (const key of ["ability_bar_right", "ability_bar_left"]) {
|
||||
const bar = globalScene.add.image(0, 0, key);
|
||||
bar.setOrigin(0, 0);
|
||||
bar.setVisible(false);
|
||||
@ -52,7 +52,7 @@ export default class AbilityBar extends Phaser.GameObjects.Container {
|
||||
if (text) {
|
||||
this.abilityBarText.setText(text);
|
||||
}
|
||||
return new Promise((resolve) => {
|
||||
return new Promise(resolve => {
|
||||
globalScene.tweens.add({
|
||||
...config,
|
||||
onComplete: () => {
|
||||
@ -60,13 +60,13 @@ export default class AbilityBar extends Phaser.GameObjects.Container {
|
||||
config.onComplete();
|
||||
}
|
||||
resolve();
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public async showAbility(pokemonName: string, abilityName: string, passive: boolean = false, player: boolean = true): Promise<void> {
|
||||
const text = (`${i18next.t("fightUiHandler:abilityFlyInText", { pokemonName: pokemonName, passive: passive ? i18next.t("fightUiHandler:passive") : "", abilityName: abilityName })}`);
|
||||
public async showAbility(pokemonName: string, abilityName: string, passive = false, player = true): Promise<void> {
|
||||
const text = `${i18next.t("fightUiHandler:abilityFlyInText", { pokemonName: pokemonName, passive: passive ? i18next.t("fightUiHandler:passive") : "", abilityName: abilityName })}`;
|
||||
this.screenRight = globalScene.scaledCanvas.width;
|
||||
if (player !== this.player) {
|
||||
// Move the bar if it has changed from the player to enemy side (or vice versa)
|
||||
@ -77,20 +77,23 @@ export default class AbilityBar extends Phaser.GameObjects.Container {
|
||||
|
||||
let y = baseY;
|
||||
if (this.player) {
|
||||
y += (globalScene.currentBattle.double ? 14 : 0);
|
||||
y += globalScene.currentBattle.double ? 14 : 0;
|
||||
} else {
|
||||
y -= globalScene.currentBattle.double ? 28 : 14;
|
||||
}
|
||||
|
||||
this.setY(y);
|
||||
|
||||
return this.startTween({
|
||||
return this.startTween(
|
||||
{
|
||||
targets: this,
|
||||
x: this.player ? screenLeft : this.screenRight - barWidth,
|
||||
duration: 500,
|
||||
ease: "Sine.easeOut",
|
||||
hold: 1000,
|
||||
}, text);
|
||||
},
|
||||
text,
|
||||
);
|
||||
}
|
||||
|
||||
public async hide(): Promise<void> {
|
||||
@ -101,7 +104,7 @@ export default class AbilityBar extends Phaser.GameObjects.Container {
|
||||
ease: "Sine.easeIn",
|
||||
onComplete: () => {
|
||||
this.setVisible(false);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user