mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-28 03:02:24 +02:00
using arena tags source id variable
This commit is contained in:
parent
88e05756c4
commit
07cea3f09f
@ -86,9 +86,6 @@ export default class Battle {
|
||||
/** Primarily for double battles, keeps track of last enemy and player pokemon that triggered its ability or used a move */
|
||||
public lastEnemyInvolved: number;
|
||||
public lastPlayerInvolved: number;
|
||||
/* Specifically for mirror armor, keeps track of last enemy/player pokemon to sucessfully use sticky web */
|
||||
public lastEnemyIDUsingStickyWeb: integer;
|
||||
public lastPlayerIDUsingStickyWeb: integer;
|
||||
public lastUsedPokeball: PokeballType | null = null;
|
||||
/** The number of times a Pokemon on the player's side has fainted this battle */
|
||||
public playerFaints: number = 0;
|
||||
|
@ -58,7 +58,6 @@ import { BooleanHolder, executeIf, NumberHolder } from "#app/utils";
|
||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||
import { Moves } from "#enums/moves";
|
||||
import i18next from "i18next";
|
||||
import { ArenaTagType } from "#app/enums/arena-tag-type";
|
||||
|
||||
export class MoveEffectPhase extends PokemonPhase {
|
||||
public move: PokemonMove;
|
||||
@ -90,15 +89,8 @@ export class MoveEffectPhase extends PokemonPhase {
|
||||
|
||||
/** If an enemy used this move, set this as last enemy that used move or ability */
|
||||
if (!user?.isPlayer()) {
|
||||
/** If the move used was sticky web AND sticky web not already active, save the id of pokemon that used it */
|
||||
if (this.move.moveId === 564 && user !== null && !this.scene.arena.hasTag(ArenaTagType.STICKY_WEB)) {
|
||||
this.scene.currentBattle.lastEnemyIDUsingStickyWeb = user.id;
|
||||
}
|
||||
this.scene.currentBattle.lastEnemyInvolved = this.fieldIndex;
|
||||
} else {
|
||||
if (this.move.moveId === 564 && user !== null && !this.scene.arena.hasTag(ArenaTagType.STICKY_WEB)) {
|
||||
this.scene.currentBattle.lastPlayerIDUsingStickyWeb = user.id;
|
||||
}
|
||||
this.scene.currentBattle.lastPlayerInvolved = this.fieldIndex;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { BattlerIndex } from "#app/battle";
|
||||
import BattleScene from "#app/battle-scene";
|
||||
import { applyAbAttrs, applyPostStatStageChangeAbAttrs, applyPreStatStageChangeAbAttrs, PostStatStageChangeAbAttr, ProtectStatAbAttr, ReflectStatStageChangeAbAttr, StatStageChangeCopyAbAttr, StatStageChangeMultiplierAbAttr } from "#app/data/ability";
|
||||
import { ArenaTagSide, MistTag } from "#app/data/arena-tag";
|
||||
import { ArenaTag, ArenaTagSide, MistTag } from "#app/data/arena-tag";
|
||||
import Pokemon from "#app/field/pokemon";
|
||||
import { getPokemonNameWithAffix } from "#app/messages";
|
||||
import { ResetNegativeStatStageModifier } from "#app/modifier/modifier";
|
||||
@ -11,6 +11,7 @@ import i18next from "i18next";
|
||||
import { PokemonPhase } from "./pokemon-phase";
|
||||
import { Stat, type BattleStat, getStatKey, getStatStageChangeDescriptionKey } from "#enums/stat";
|
||||
import { OctolockTag } from "#app/data/battler-tags";
|
||||
import { ArenaTagType } from "#app/enums/arena-tag-type";
|
||||
|
||||
export type StatStageChangeCallback = (target: Pokemon | null, changed: BattleStat[], relativeChanges: number[]) => void;
|
||||
|
||||
@ -61,8 +62,11 @@ export class StatStageChangePhase extends PokemonPhase {
|
||||
opponentPokemon = this.scene.getEnemyField()[this.scene.currentBattle.lastEnemyInvolved];
|
||||
} else {
|
||||
/** If this SSCP is from sticky web, then check if pokemon that last sucessfully used sticky web is on field */
|
||||
const stickyTagID = this.scene.arena.findTagsOnSide(
|
||||
(t: ArenaTag) => t.tagType === ArenaTagType.STICKY_WEB,
|
||||
ArenaTagSide.PLAYER)[0].sourceId;
|
||||
this.scene.getEnemyField().forEach((e) => {
|
||||
if (e.id === this.scene.currentBattle.lastEnemyIDUsingStickyWeb) {
|
||||
if (e.id === stickyTagID) {
|
||||
opponentPokemon = e;
|
||||
}
|
||||
});
|
||||
@ -71,9 +75,12 @@ export class StatStageChangePhase extends PokemonPhase {
|
||||
if (!this.comingFromStickyWeb) {
|
||||
opponentPokemon = this.scene.getPlayerField()[this.scene.currentBattle.lastPlayerInvolved];
|
||||
} else {
|
||||
this.scene.getPlayerField().forEach((p) => {
|
||||
if (p.id === this.scene.currentBattle.lastPlayerIDUsingStickyWeb) {
|
||||
opponentPokemon = p;
|
||||
const stickyTagID = this.scene.arena.findTagsOnSide(
|
||||
(t: ArenaTag) => t.tagType === ArenaTagType.STICKY_WEB,
|
||||
ArenaTagSide.ENEMY)[0].sourceId;
|
||||
this.scene.getPlayerField().forEach((e) => {
|
||||
if (e.id === stickyTagID) {
|
||||
opponentPokemon = e;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user