mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-11 10:52:17 +02:00
Make onField default to true
This commit is contained in:
parent
a564413cc5
commit
50d4e6e180
@ -8183,7 +8183,7 @@ export type MoveTargetSet = {
|
|||||||
|
|
||||||
export function getMoveTargets(user: Pokemon, move: Moves, replaceTarget?: MoveTarget): MoveTargetSet {
|
export function getMoveTargets(user: Pokemon, move: Moves, replaceTarget?: MoveTarget): MoveTargetSet {
|
||||||
const variableTarget = new NumberHolder(0);
|
const variableTarget = new NumberHolder(0);
|
||||||
user.getOpponents().forEach(p => applyMoveAttrs(VariableTargetAttr, user, p, allMoves[move], variableTarget));
|
user.getOpponents(false).forEach(p => applyMoveAttrs(VariableTargetAttr, user, p, allMoves[move], variableTarget));
|
||||||
|
|
||||||
let moveTarget: MoveTarget | undefined;
|
let moveTarget: MoveTarget | undefined;
|
||||||
if (allMoves[move].hasAttr(VariableTargetAttr)) {
|
if (allMoves[move].hasAttr(VariableTargetAttr)) {
|
||||||
@ -8195,7 +8195,7 @@ export function getMoveTargets(user: Pokemon, move: Moves, replaceTarget?: MoveT
|
|||||||
} else if (move === undefined) {
|
} else if (move === undefined) {
|
||||||
moveTarget = MoveTarget.NEAR_ENEMY;
|
moveTarget = MoveTarget.NEAR_ENEMY;
|
||||||
}
|
}
|
||||||
const opponents = user.getOpponents();
|
const opponents = user.getOpponents(false);
|
||||||
|
|
||||||
let set: Pokemon[] = [];
|
let set: Pokemon[] = [];
|
||||||
let multiple = false;
|
let multiple = false;
|
||||||
|
@ -59,7 +59,7 @@ export class Terrain {
|
|||||||
// Cancels move if the move has positive priority and targets a Pokemon grounded on the Psychic Terrain
|
// Cancels move if the move has positive priority and targets a Pokemon grounded on the Psychic Terrain
|
||||||
return (
|
return (
|
||||||
move.getPriority(user) > 0 &&
|
move.getPriority(user) > 0 &&
|
||||||
user.getOpponents().some(o => targets.includes(o.getBattlerIndex()) && o.isGrounded())
|
user.getOpponents(true).some(o => targets.includes(o.getBattlerIndex()) && o.isGrounded())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3852,7 +3852,12 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
getOpponents(onField = false): Pokemon[] {
|
/**
|
||||||
|
* Returns the pokemon that oppose this one and are active
|
||||||
|
*
|
||||||
|
* @param onField - whether to also check if the pokemon is currently on the field (defaults to true)
|
||||||
|
*/
|
||||||
|
getOpponents(onField = true): Pokemon[] {
|
||||||
return (
|
return (
|
||||||
(this.isPlayer()
|
(this.isPlayer()
|
||||||
? globalScene.getEnemyField()
|
? globalScene.getEnemyField()
|
||||||
|
@ -654,7 +654,7 @@ export class MovePhase extends BattlePhase {
|
|||||||
}),
|
}),
|
||||||
500,
|
500,
|
||||||
);
|
);
|
||||||
applyMoveAttrs(PreMoveMessageAttr, this.pokemon, this.pokemon.getOpponents()[0], this.move.getMove());
|
applyMoveAttrs(PreMoveMessageAttr, this.pokemon, this.pokemon.getOpponents(false)[0], this.move.getMove());
|
||||||
}
|
}
|
||||||
|
|
||||||
public showFailedText(failedText: string = i18next.t("battle:attackFailed")): void {
|
public showFailedText(failedText: string = i18next.t("battle:attackFailed")): void {
|
||||||
|
@ -346,7 +346,7 @@ export default class FightUiHandler extends UiHandler implements InfoToggle {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
const opponents = pokemon.getOpponents(true);
|
const opponents = pokemon.getOpponents();
|
||||||
if (opponents.length <= 0) {
|
if (opponents.length <= 0) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user