From 74e9b95e13620fba1fb4c7037bc11564bd754ea4 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Mon, 26 Feb 2024 12:34:45 -0500 Subject: [PATCH] Fix damage reduction abilities not working --- src/data/api.ts | 3 ++- src/phases.ts | 9 ++++++--- src/pipelines/sprite.ts | 2 +- src/pokemon.ts | 4 +++- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/data/api.ts b/src/data/api.ts index ab4dea554..24866e008 100644 --- a/src/data/api.ts +++ b/src/data/api.ts @@ -1,5 +1,5 @@ import { MainClient, NamedAPIResource } from 'pokenode-ts'; -import { MoveTarget, Moves, allMoves } from './move'; +import { MoveTarget, allMoves } from './move'; import * as Utils from '../utils'; import fs from 'vite-plugin-fs/browser'; import PokemonSpecies, { PokemonForm, SpeciesFormKey, allSpecies } from './pokemon-species'; @@ -9,6 +9,7 @@ import { Abilities, allAbilities } from './ability'; import { Species } from './enums/species'; import { pokemonFormLevelMoves } from './pokemon-level-moves'; import { tmSpecies } from './tms'; +import { Moves } from './enums/moves'; const targetMap = { 'specific-move': MoveTarget.ATTACKER, diff --git a/src/phases.ts b/src/phases.ts index 8422e4093..4f7a118a1 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -480,10 +480,13 @@ export class EncounterPhase extends BattlePhase { this.scene.gameData.setPokemonSeen(enemyPokemon); } - if (this.scene.gameMode === GameMode.CLASSIC && (battle.battleSpec === BattleSpec.FINAL_BOSS || !(battle.waveIndex % 250)) && enemyPokemon.species.speciesId === Species.ETERNATUS) { - if (battle.battleSpec !== BattleSpec.FINAL_BOSS) + if (enemyPokemon.species.speciesId === Species.ETERNATUS) { + if (this.scene.gameMode === GameMode.CLASSIC && (battle.battleSpec === BattleSpec.FINAL_BOSS || !(battle.waveIndex % 250))) { + if (battle.battleSpec !== BattleSpec.FINAL_BOSS) + enemyPokemon.formIndex = 1; + enemyPokemon.setBoss(); + } else if (!(battle.waveIndex % 1000)) enemyPokemon.formIndex = 1; - enemyPokemon.setBoss(); } loadEnemyAssets.push(enemyPokemon.loadAssets()); diff --git a/src/pipelines/sprite.ts b/src/pipelines/sprite.ts index 28697d66d..4cba0bcb9 100644 --- a/src/pipelines/sprite.ts +++ b/src/pipelines/sprite.ts @@ -376,7 +376,7 @@ export default class SpritePipeline extends FieldSpritePipeline { batchQuad(gameObject: Phaser.GameObjects.GameObject, x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, u0: number, v0: number, u1: number, v1: number, tintTL: number, tintTR: number, tintBL: number, tintBR: number, tintEffect: number | boolean, - texture?: WebGLTexture, unit?: number): boolean { + texture?: Phaser.Renderer.WebGL.Wrappers.WebGLTextureWrapper, unit?: number): boolean { const sprite = gameObject as Phaser.GameObjects.Sprite; this.set1f('vCutoff', v1); diff --git a/src/pokemon.ts b/src/pokemon.ts index 68a7ff909..e662376e9 100644 --- a/src/pokemon.ts +++ b/src/pokemon.ts @@ -25,7 +25,7 @@ import { TempBattleStat } from './data/temp-battle-stat'; import { WeakenMoveTypeTag } from './data/arena-tag'; import { ArenaTagType } from "./data/enums/arena-tag-type"; import { Biome } from "./data/enums/biome"; -import { Abilities, Ability, BattleStatMultiplierAbAttr, BlockCritAbAttr, IgnoreOpponentStatChangesAbAttr, MoveImmunityAbAttr, NonSuperEffectiveImmunityAbAttr, PreApplyBattlerTagAbAttr, ReduceStatusEffectDurationAbAttr, StabBoostAbAttr, StatusEffectImmunityAbAttr, TypeImmunityAbAttr, VariableMovePowerAbAttr, WeightMultiplierAbAttr, allAbilities, applyAbAttrs, applyBattleStatMultiplierAbAttrs, applyPostDefendAbAttrs, applyPreApplyBattlerTagAbAttrs, applyPreAttackAbAttrs, applyPreDefendAbAttrs, applyPreSetStatusAbAttrs } from './data/ability'; +import { Abilities, Ability, BattleStatMultiplierAbAttr, BlockCritAbAttr, IgnoreOpponentStatChangesAbAttr, MoveImmunityAbAttr, NonSuperEffectiveImmunityAbAttr, PreApplyBattlerTagAbAttr, ReceivedMoveDamageMultiplierAbAttr, ReduceStatusEffectDurationAbAttr, StabBoostAbAttr, StatusEffectImmunityAbAttr, TypeImmunityAbAttr, VariableMovePowerAbAttr, WeightMultiplierAbAttr, allAbilities, applyAbAttrs, applyBattleStatMultiplierAbAttrs, applyPostDefendAbAttrs, applyPreApplyBattlerTagAbAttrs, applyPreAttackAbAttrs, applyPreDefendAbAttrs, applyPreSetStatusAbAttrs } from './data/ability'; import PokemonData from './system/pokemon-data'; import { BattlerIndex } from './battle'; import { BattleSpec } from "./enums/battle-spec"; @@ -1014,6 +1014,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { power.value = 60; applyPreAttackAbAttrs(VariableMovePowerAbAttr, source, this, battlerMove, power); + applyPreDefendAbAttrs(ReceivedMoveDamageMultiplierAbAttr, this, source, battlerMove, cancelled, power); + if (!typeless) applyPreDefendAbAttrs(TypeImmunityAbAttr, this, source, battlerMove, cancelled, typeMultiplier); if (!cancelled.value)