fixing edge cases

This commit is contained in:
PrabbyDD 2024-11-07 11:34:40 -08:00
parent 622e133ab5
commit 21e3613039
3 changed files with 11 additions and 23 deletions

View File

@ -131,7 +131,7 @@ class DefaultOverrides {
*/ */
readonly OPP_FUSION_SPECIES_OVERRIDE: Species | integer = 0; readonly OPP_FUSION_SPECIES_OVERRIDE: Species | integer = 0;
readonly OPP_LEVEL_OVERRIDE: number = 0; readonly OPP_LEVEL_OVERRIDE: number = 0;
readonly OPP_ABILITY_OVERRIDE: Abilities = Abilities.NONE; readonly OPP_ABILITY_OVERRIDE: Abilities = Abilities.z;
readonly OPP_PASSIVE_ABILITY_OVERRIDE: Abilities = Abilities.NONE; readonly OPP_PASSIVE_ABILITY_OVERRIDE: Abilities = Abilities.NONE;
readonly OPP_STATUS_OVERRIDE: StatusEffect = StatusEffect.NONE; readonly OPP_STATUS_OVERRIDE: StatusEffect = StatusEffect.NONE;
readonly OPP_GENDER_OVERRIDE: Gender | null = null; readonly OPP_GENDER_OVERRIDE: Gender | null = null;

View File

@ -17,17 +17,17 @@ export class ShowAbilityPhase extends PokemonPhase {
const pokemon = this.getPokemon(); const pokemon = this.getPokemon();
if (pokemon) { if (pokemon) {
if (!pokemon.isPlayer()) {
/** If its an enemy pokemon, list it as last enemy to use ability or move */
this.scene.currentBattle.lastEnemyInvolved = pokemon.getBattlerIndex() % 2;
} else {
this.scene.currentBattle.lastPlayerInvolved = pokemon.getBattlerIndex() % 2;
}
this.scene.abilityBar.showAbility(pokemon, this.passive); this.scene.abilityBar.showAbility(pokemon, this.passive);
if (pokemon?.battleData) { if (pokemon?.battleData) {
if (!pokemon.isPlayer()) {
/** If its an enemy pokemon, list it as last enemy to use ability or move */
this.scene.currentBattle.lastEnemyInvolved = this.fieldIndex;
} else {
this.scene.currentBattle.lastPlayerInvolved = this.fieldIndex;
}
pokemon.battleData.abilityRevealed = true; pokemon.battleData.abilityRevealed = true;
} }
} }

View File

@ -61,18 +61,9 @@ export class StatStageChangePhase extends PokemonPhase {
// 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()) { if (pokemon.isPlayer()) {
if (this.scene.currentBattle.double && this.scene.getEnemyField().length === 2) { opponentPokemon = this.scene.getEnemyField()[this.scene.currentBattle.lastEnemyInvolved];
opponentPokemon = this.scene.getEnemyField()[this.scene.currentBattle.lastEnemyInvolved];
} else {
console.log("ENEMY POKEMANS", this.scene.getEnemyField());
opponentPokemon = this.scene.getEnemyPokemon();
}
} else { } else {
if (this.scene.currentBattle.double && this.scene.getPlayerField().length === 2) { opponentPokemon = this.scene.getPlayerField()[this.scene.currentBattle.lastPlayerInvolved];
opponentPokemon = this.scene.getPlayerField()[this.scene.currentBattle.lastPlayerInvolved];
} else {
opponentPokemon = this.scene.getPlayerPokemon();
}
} }
if (!pokemon.isActive(true)) { if (!pokemon.isActive(true)) {
@ -100,10 +91,7 @@ export class StatStageChangePhase extends PokemonPhase {
// TODO: CODE INTERACTION WITH MAGIC BOUNCE AS WELL // TODO: CODE INTERACTION WITH MAGIC BOUNCE AS WELL
// TODO: CODE INTERACTION WITH STICKY WEB // TODO: CODE INTERACTION WITH STICKY WEB
// TODO: FIX INTERACTION WITH MEMENTO, SHOULD LOWER OPPONENT STATS THEN DIE
/** Potential stat reflection due to Mirror Armor, does not apply to Octolock end of turn effect */ /** Potential stat reflection due to Mirror Armor, does not apply to Octolock end of turn effect */
console.log("I AM HEREE", opponentPokemon);
if (opponentPokemon !== undefined && !pokemon.findTag(t => t instanceof OctolockTag) && !this.comingFromMirrorArmorUser) { if (opponentPokemon !== undefined && !pokemon.findTag(t => t instanceof OctolockTag) && !this.comingFromMirrorArmorUser) {
applyPreStatStageChangeAbAttrs(ReflectStatStageChangeAbAttr, pokemon, stat, cancelled, simulate, opponentPokemon, this.stages); applyPreStatStageChangeAbAttrs(ReflectStatStageChangeAbAttr, pokemon, stat, cancelled, simulate, opponentPokemon, this.stages);
} }