From 893c20fc16982cd7bc3736dcee30fded04868f5a Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Mon, 4 Mar 2024 20:28:55 -0500 Subject: [PATCH] Remove status effect move type immunity --- src/data/ability.ts | 4 ++-- src/data/move.ts | 11 ++++++++++- src/field/pokemon.ts | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/data/ability.ts b/src/data/ability.ts index 723b51fbb22..3b798fe918d 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -8,7 +8,7 @@ import { Weather, WeatherType } from "./weather"; import { BattlerTag } from "./battler-tags"; import { BattlerTagType } from "./enums/battler-tag-type"; import { StatusEffect, getStatusEffectDescriptor } from "./status-effect"; -import Move, { AttackMove, MoveCategory, MoveFlags, RecoilAttr, StatusEffectAttr } from "./move"; +import Move, { AttackMove, MoveCategory, MoveFlags, RecoilAttr, StatusMoveTypeImmunityAttr } from "./move"; import { ArenaTagType } from "./enums/arena-tag-type"; import { Stat } from "./pokemon-stat"; import { PokemonHeldItemModifier } from "../modifier/modifier"; @@ -191,7 +191,7 @@ export class TypeImmunityAbAttr extends PreDefendAbAttr { } applyPreDefend(pokemon: Pokemon, attacker: Pokemon, move: PokemonMove, cancelled: Utils.BooleanHolder, args: any[]): boolean { - if ((move.getMove() instanceof AttackMove || move.getMove().getAttrs(StatusEffectAttr).length) && move.getMove().type === this.immuneType) { + if ((move.getMove() instanceof AttackMove || move.getMove().getAttrs(StatusMoveTypeImmunityAttr).find(attr => (attr as StatusMoveTypeImmunityAttr).immuneType === this.immuneType)) && move.getMove().type === this.immuneType) { (args[0] as Utils.NumberHolder).value = 0; return true; } diff --git a/src/data/move.ts b/src/data/move.ts index e1aed5fa063..6471c89a6a0 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -375,6 +375,14 @@ export class MoveEffectAttr extends MoveAttr { } } +export class StatusMoveTypeImmunityAttr extends MoveAttr { + public immuneType: Type; + + constructor(immuneType: Type) { + super(false); + } +} + export class HighCritAttr extends MoveAttr { apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { (args[0] as Utils.IntegerHolder).value++; @@ -2450,7 +2458,8 @@ export function initMoves() { .attr(StatusEffectAttr, StatusEffect.PARALYSIS), new StatusMove(Moves.THUNDER_WAVE, "Thunder Wave", Type.ELECTRIC, 90, 20, 82, "The user launches a weak jolt of electricity that paralyzes the target.", -1, 0, 1) .attr(StatusEffectAttr, StatusEffect.PARALYSIS) - .attr(ThunderAccuracyAttr), + .attr(ThunderAccuracyAttr) + .attr(StatusMoveTypeImmunityAttr, Type.GROUND), new AttackMove(Moves.THUNDER, "Thunder", Type.ELECTRIC, MoveCategory.SPECIAL, 110, 70, 10, 166, "A wicked thunderbolt is dropped on the target to inflict damage. This may also leave the target with paralysis.", 30, 0, 1) .attr(StatusEffectAttr, StatusEffect.PARALYSIS), new AttackMove(Moves.ROCK_THROW, "Rock Throw", Type.ROCK, MoveCategory.PHYSICAL, 50, 90, 15, -1, "The user picks up and throws a small rock at the target to attack.", -1, 0, 1) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 2f0ed6b7332..e0078285d89 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -2,7 +2,7 @@ import Phaser from 'phaser'; import BattleScene, { AnySound } from '../battle-scene'; import BattleInfo, { PlayerBattleInfo, EnemyBattleInfo } from '../ui/battle-info'; import { Moves } from "../data/enums/moves"; -import Move, { HighCritAttr, HitsTagAttr, applyMoveAttrs, FixedDamageAttr, VariablePowerAttr, allMoves, MoveCategory, TypelessAttr, CritOnlyAttr, getMoveTargets, OneHitKOAttr, MultiHitAttr, StatusEffectAttr, AttackMove } from "../data/move"; +import Move, { HighCritAttr, HitsTagAttr, applyMoveAttrs, FixedDamageAttr, VariablePowerAttr, allMoves, MoveCategory, TypelessAttr, CritOnlyAttr, getMoveTargets, OneHitKOAttr, MultiHitAttr, StatusMoveTypeImmunityAttr } from "../data/move"; import { default as PokemonSpecies, PokemonSpeciesForm, SpeciesFormKey, getFusedSpeciesName, getPokemonSpecies } from '../data/pokemon-species'; import * as Utils from '../utils'; import { Type, TypeDamageMultiplier, getTypeDamageMultiplier, getTypeRgb } from '../data/type'; @@ -1012,7 +1012,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { const cancelled = new Utils.BooleanHolder(false); const typeless = !!move.getAttrs(TypelessAttr).length; const types = this.getTypes(true); - const typeMultiplier = new Utils.NumberHolder(!typeless && (moveCategory !== MoveCategory.STATUS || move.getAttrs(StatusEffectAttr).length) + const typeMultiplier = new Utils.NumberHolder(!typeless && (moveCategory !== MoveCategory.STATUS || move.getAttrs(StatusMoveTypeImmunityAttr).find(attr => (attr as StatusMoveTypeImmunityAttr).immuneType === move.type)) ? getTypeDamageMultiplier(move.type, types[0]) * (types.length > 1 ? getTypeDamageMultiplier(move.type, types[1]) : 1) : 1); if (typeless)