mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-28 11:12:24 +02:00
adding changes for sticky web and other features of mirror armor
This commit is contained in:
parent
21e3613039
commit
5e71f4b26a
@ -84,6 +84,9 @@ 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;
|
||||
|
@ -2705,8 +2705,8 @@ export class PreStatStageChangeAbAttr extends AbAttr {
|
||||
}
|
||||
|
||||
/**
|
||||
* Reflect one or all {@linkcode BattleStat} reductions caused by other Pokémon's moves and Abilities.
|
||||
* Currently only applies to Mirror Armor
|
||||
* Reflect all {@linkcode BattleStat} reductions caused by other Pokémon's moves and Abilities.
|
||||
* Currently only applies to Mirror Armor.
|
||||
*/
|
||||
// TODO: CODE INTERACTION WITH MAGIC BOUNCE AS WELL
|
||||
// TODO: CODE INTERACTION WITH STICKY WEB
|
||||
|
@ -910,7 +910,7 @@ class StickyWebTag extends ArenaTrapTag {
|
||||
if (!cancelled.value) {
|
||||
pokemon.scene.queueMessage(i18next.t("arenaTag:stickyWebActivateTrap", { pokemonName: pokemon.getNameToRender() }));
|
||||
const stages = new NumberHolder(-1);
|
||||
pokemon.scene.unshiftPhase(new StatStageChangePhase(pokemon.scene, pokemon.getBattlerIndex(), false, [ Stat.SPD ], stages.value));
|
||||
pokemon.scene.unshiftPhase(new StatStageChangePhase(pokemon.scene, pokemon.getBattlerIndex(), false, [ Stat.SPD ], stages.value, true, false, true, null, false, true));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ class DefaultOverrides {
|
||||
*/
|
||||
readonly OPP_FUSION_SPECIES_OVERRIDE: Species | integer = 0;
|
||||
readonly OPP_LEVEL_OVERRIDE: number = 0;
|
||||
readonly OPP_ABILITY_OVERRIDE: Abilities = Abilities.z;
|
||||
readonly OPP_ABILITY_OVERRIDE: Abilities = Abilities.NONE;
|
||||
readonly OPP_PASSIVE_ABILITY_OVERRIDE: Abilities = Abilities.NONE;
|
||||
readonly OPP_STATUS_OVERRIDE: StatusEffect = StatusEffect.NONE;
|
||||
readonly OPP_GENDER_OVERRIDE: Gender | null = null;
|
||||
|
@ -15,6 +15,7 @@ import i18next from "i18next";
|
||||
import * as Utils from "#app/utils";
|
||||
import { PokemonPhase } from "./pokemon-phase";
|
||||
import { Type } from "#app/data/type";
|
||||
import { ArenaTagType } from "#app/enums/arena-tag-type";
|
||||
|
||||
export class MoveEffectPhase extends PokemonPhase {
|
||||
public move: PokemonMove;
|
||||
@ -45,8 +46,15 @@ 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 it was successful, save the id of pokemon that used it */
|
||||
if (this.move.moveId === 564 && user !== undefined && !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 !== undefined && !this.scene.arena.hasTag(ArenaTagType.STICKY_WEB)) {
|
||||
this.scene.currentBattle.lastPlayerIDUsingStickyWeb = user.id;
|
||||
}
|
||||
this.scene.currentBattle.lastPlayerInvolved = this.fieldIndex;
|
||||
}
|
||||
|
||||
|
@ -23,9 +23,10 @@ export class StatStageChangePhase extends PokemonPhase {
|
||||
private canBeCopied: boolean;
|
||||
private onChange: StatStageChangeCallback | null;
|
||||
private comingFromMirrorArmorUser: boolean;
|
||||
private comingFromStickyWeb: boolean;
|
||||
|
||||
|
||||
constructor(scene: BattleScene, battlerIndex: BattlerIndex, selfTarget: boolean, stats: BattleStat[], stages: integer, showMessage: boolean = true, ignoreAbilities: boolean = false, canBeCopied: boolean = true, onChange: StatStageChangeCallback | null = null, comingFromMirrorArmorUser: boolean = false) {
|
||||
constructor(scene: BattleScene, battlerIndex: BattlerIndex, selfTarget: boolean, stats: BattleStat[], stages: integer, showMessage: boolean = true, ignoreAbilities: boolean = false, canBeCopied: boolean = true, onChange: StatStageChangeCallback | null = null, comingFromMirrorArmorUser: boolean = false, comingFromStickyWeb: boolean = false) {
|
||||
super(scene, battlerIndex);
|
||||
|
||||
this.selfTarget = selfTarget;
|
||||
@ -36,6 +37,7 @@ export class StatStageChangePhase extends PokemonPhase {
|
||||
this.canBeCopied = canBeCopied;
|
||||
this.onChange = onChange;
|
||||
this.comingFromMirrorArmorUser = comingFromMirrorArmorUser;
|
||||
this.comingFromStickyWeb = comingFromStickyWeb;
|
||||
}
|
||||
|
||||
start() {
|
||||
@ -52,18 +54,29 @@ export class StatStageChangePhase extends PokemonPhase {
|
||||
const pokemon = this.getPokemon();
|
||||
let opponentPokemon: Pokemon | undefined;
|
||||
|
||||
/** StickY web should be like
|
||||
* if (stat loss due to switching in on sticky web)
|
||||
* if (have mirror armor)
|
||||
* if (enemy that used sticky web is in)
|
||||
* apply -1 spd to that enemy
|
||||
*/
|
||||
|
||||
// Gets the position of last enemy or player pokemon that used ability or move, primarily for double battles involving Mirror Armor
|
||||
/** Gets the position of last enemy or player pokemon that used ability or move, primarily for double battles involving Mirror Armor */
|
||||
if (pokemon.isPlayer()) {
|
||||
opponentPokemon = this.scene.getEnemyField()[this.scene.currentBattle.lastEnemyInvolved];
|
||||
/** If this SSCP is not from sticky web, then we find the opponent pokemon that last did something */
|
||||
if (!this.comingFromStickyWeb) {
|
||||
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 */
|
||||
this.scene.getEnemyField().forEach((e) => {
|
||||
if (e.id === this.scene.currentBattle.lastEnemyIDUsingStickyWeb) {
|
||||
opponentPokemon = e;
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
opponentPokemon = this.scene.getPlayerField()[this.scene.currentBattle.lastPlayerInvolved];
|
||||
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;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (!pokemon.isActive(true)) {
|
||||
@ -90,7 +103,6 @@ export class StatStageChangePhase extends PokemonPhase {
|
||||
applyPreStatStageChangeAbAttrs(ProtectStatAbAttr, pokemon, stat, cancelled, simulate);
|
||||
|
||||
// TODO: CODE INTERACTION WITH MAGIC BOUNCE AS WELL
|
||||
// TODO: CODE INTERACTION WITH STICKY WEB
|
||||
/** Potential stat reflection due to Mirror Armor, does not apply to Octolock end of turn effect */
|
||||
if (opponentPokemon !== undefined && !pokemon.findTag(t => t instanceof OctolockTag) && !this.comingFromMirrorArmorUser) {
|
||||
applyPreStatStageChangeAbAttrs(ReflectStatStageChangeAbAttr, pokemon, stat, cancelled, simulate, opponentPokemon, this.stages);
|
||||
|
@ -266,8 +266,7 @@ describe("Ability - Mirror Armor", () => {
|
||||
// expect(enemyPokemon.findTag(t => t instanceof TrappedTag)).toBeDefined();
|
||||
// });
|
||||
|
||||
//TODO: Implement test for sticky web
|
||||
// TODO: IMPLEMENT TEST FOR MEMENTO
|
||||
// TODO: Implement test for sticky web
|
||||
// TODO: IMPLEMENT TEST FOR LOOPING MIRROR ARMORS BETWEEN OPPONENT AND PLAYER
|
||||
// TODO: IMPLEMENT MAGIC GUARD INTERACITON TEST
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user