Fix damage reduction abilities not working

This commit is contained in:
Flashfyre 2024-02-26 12:34:45 -05:00
parent 02e35aad83
commit 74e9b95e13
4 changed files with 12 additions and 6 deletions

View File

@ -1,5 +1,5 @@
import { MainClient, NamedAPIResource } from 'pokenode-ts'; import { MainClient, NamedAPIResource } from 'pokenode-ts';
import { MoveTarget, Moves, allMoves } from './move'; import { MoveTarget, allMoves } from './move';
import * as Utils from '../utils'; import * as Utils from '../utils';
import fs from 'vite-plugin-fs/browser'; import fs from 'vite-plugin-fs/browser';
import PokemonSpecies, { PokemonForm, SpeciesFormKey, allSpecies } from './pokemon-species'; import PokemonSpecies, { PokemonForm, SpeciesFormKey, allSpecies } from './pokemon-species';
@ -9,6 +9,7 @@ import { Abilities, allAbilities } from './ability';
import { Species } from './enums/species'; import { Species } from './enums/species';
import { pokemonFormLevelMoves } from './pokemon-level-moves'; import { pokemonFormLevelMoves } from './pokemon-level-moves';
import { tmSpecies } from './tms'; import { tmSpecies } from './tms';
import { Moves } from './enums/moves';
const targetMap = { const targetMap = {
'specific-move': MoveTarget.ATTACKER, 'specific-move': MoveTarget.ATTACKER,

View File

@ -480,10 +480,13 @@ export class EncounterPhase extends BattlePhase {
this.scene.gameData.setPokemonSeen(enemyPokemon); 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 (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) if (battle.battleSpec !== BattleSpec.FINAL_BOSS)
enemyPokemon.formIndex = 1; enemyPokemon.formIndex = 1;
enemyPokemon.setBoss(); enemyPokemon.setBoss();
} else if (!(battle.waveIndex % 1000))
enemyPokemon.formIndex = 1;
} }
loadEnemyAssets.push(enemyPokemon.loadAssets()); loadEnemyAssets.push(enemyPokemon.loadAssets());

View File

@ -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, 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, 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; const sprite = gameObject as Phaser.GameObjects.Sprite;
this.set1f('vCutoff', v1); this.set1f('vCutoff', v1);

View File

@ -25,7 +25,7 @@ import { TempBattleStat } from './data/temp-battle-stat';
import { WeakenMoveTypeTag } from './data/arena-tag'; import { WeakenMoveTypeTag } from './data/arena-tag';
import { ArenaTagType } from "./data/enums/arena-tag-type"; import { ArenaTagType } from "./data/enums/arena-tag-type";
import { Biome } from "./data/enums/biome"; 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 PokemonData from './system/pokemon-data';
import { BattlerIndex } from './battle'; import { BattlerIndex } from './battle';
import { BattleSpec } from "./enums/battle-spec"; import { BattleSpec } from "./enums/battle-spec";
@ -1014,6 +1014,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
power.value = 60; power.value = 60;
applyPreAttackAbAttrs(VariableMovePowerAbAttr, source, this, battlerMove, power); applyPreAttackAbAttrs(VariableMovePowerAbAttr, source, this, battlerMove, power);
applyPreDefendAbAttrs(ReceivedMoveDamageMultiplierAbAttr, this, source, battlerMove, cancelled, power);
if (!typeless) if (!typeless)
applyPreDefendAbAttrs(TypeImmunityAbAttr, this, source, battlerMove, cancelled, typeMultiplier); applyPreDefendAbAttrs(TypeImmunityAbAttr, this, source, battlerMove, cancelled, typeMultiplier);
if (!cancelled.value) if (!cancelled.value)