From 0f55640bd6ffec207a7f35a5db19235c99d239b5 Mon Sep 17 00:00:00 2001 From: Dread134 Date: Fri, 17 May 2024 14:02:15 -0400 Subject: [PATCH] Update pokemon.ts Moved where PRE_APPLY was being triggered so if the defender is Type immune, then it does not apply the move attribute. --- src/field/pokemon.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 58bf3a2d082..15f459c0ccf 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -1467,8 +1467,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { if (cancelled.value) result = HitResult.NO_EFFECT; else { - applyFilteredMoveAttrs((attr: MoveAttr) => attr instanceof MoveEffectAttr && (attr as MoveEffectAttr).trigger === MoveEffectTrigger.PRE_APPLY && (!attr.firstHitOnly || firstHit), source, this, moveEffectPhase.move.getMove()) - let typeBoost = source.findTag(t => t instanceof TypeBoostTag && (t as TypeBoostTag).boostedType === type) as TypeBoostTag; if (typeBoost) { power.value *= typeBoost.boostValue; @@ -1478,6 +1476,12 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { } const arenaAttackTypeMultiplier = new Utils.NumberHolder(this.scene.arena.getAttackTypeMultiplier(type, source.isGrounded())); applyMoveAttrs(IgnoreWeatherTypeDebuffAttr, source, this, move, arenaAttackTypeMultiplier); + const isTypeImmune = (typeMultiplier.value * arenaAttackTypeMultiplier.value) === 0; + + if (!isTypeImmune) { + applyFilteredMoveAttrs((attr: MoveAttr) => attr instanceof MoveEffectAttr && (attr as MoveEffectAttr).trigger === MoveEffectTrigger.PRE_APPLY && (!attr.firstHitOnly || firstHit), source, this, moveEffectPhase.move.getMove()); + } + if (this.scene.arena.getTerrainType() === TerrainType.GRASSY && this.isGrounded() && type === Type.GROUND && move.moveTarget === MoveTarget.ALL_NEAR_OTHERS) power.value /= 2; applyMoveAttrs(VariablePowerAttr, source, this, move, power); @@ -1522,7 +1526,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { if (!isCritical) { this.scene.arena.applyTagsForSide(WeakenMoveScreenTag, this.isPlayer() ? ArenaTagSide.PLAYER : ArenaTagSide.ENEMY, move.category, this.scene.currentBattle.double, screenMultiplier); } - const isTypeImmune = (typeMultiplier.value * arenaAttackTypeMultiplier.value) === 0; const sourceTypes = source.getTypes(); const matchesSourceType = sourceTypes[0] === type || (sourceTypes.length > 1 && sourceTypes[1] === type); let stabMultiplier = new Utils.NumberHolder(1);