From fbd863a25c64725dbafc9cc113b2e4b87558eee0 Mon Sep 17 00:00:00 2001 From: td76099 <85713900+td76099@users.noreply.github.com> Date: Tue, 21 May 2024 23:11:42 -0400 Subject: [PATCH] Feature: Finish implementing Mind's Eye (#1060) * Adds in the accuracy and evasion bypass for Mind's Eye * Added comment to new IgnoreOpponentEvasionAbAttr class * Added docs to apply so that it is actually complete --- src/data/ability.ts | 27 +++++++++++++++++++++++++-- src/phases.ts | 3 ++- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/data/ability.ts b/src/data/ability.ts index c236aa85805..c49d25ed4a8 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -1356,6 +1356,28 @@ export class IgnoreOpponentStatChangesAbAttr extends AbAttr { return true; } } +/** + * Ignores opponent's evasion stat changes when determining if a move hits or not + * @extends AbAttr + * @see {@linkcode apply} + */ +export class IgnoreOpponentEvasionAbAttr extends AbAttr { + constructor() { + super(false); + } + /** + * Checks if enemy Pokemon is trapped by an Arena Trap-esque ability + * @param pokemon N/A + * @param passive N/A + * @param cancelled N/A + * @param args [0] {@linkcode Utils.IntegerHolder} of BattleStat.EVA + * @returns if evasion level was successfully considered as 0 + */ + apply(pokemon: Pokemon, passive: boolean, cancelled: Utils.BooleanHolder, args: any[]) { + (args[0] as Utils.IntegerHolder).value = 0; + return true; + } +} export class IntimidateImmunityAbAttr extends AbAttr { constructor() { @@ -3916,8 +3938,9 @@ export function initAbilities() { .partial(), new Ability(Abilities.MINDS_EYE, 9) .attr(IgnoreTypeImmunityAbAttr, Type.GHOST, [Type.NORMAL, Type.FIGHTING]) - .ignorable() // TODO: evasiveness bypass should not be ignored, but accuracy immunity should - .partial(), + .attr(ProtectStatAbAttr, BattleStat.ACC) + .attr(IgnoreOpponentEvasionAbAttr) + .ignorable(), new Ability(Abilities.SUPERSWEET_SYRUP, 9) .attr(PostSummonStatChangeAbAttr, BattleStat.EVA, -1) .condition(getOncePerBattleCondition(Abilities.SUPERSWEET_SYRUP)), diff --git a/src/phases.ts b/src/phases.ts index b861c82f0e8..1d56261d10e 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -30,7 +30,7 @@ import { Weather, WeatherType, getRandomWeatherType, getTerrainBlockMessage, get import { TempBattleStat } from "./data/temp-battle-stat"; import { ArenaTagSide, ArenaTrapTag, MistTag, TrickRoomTag } from "./data/arena-tag"; import { ArenaTagType } from "./data/enums/arena-tag-type"; -import { CheckTrappedAbAttr, IgnoreOpponentStatChangesAbAttr, PostAttackAbAttr, PostBattleAbAttr, PostDefendAbAttr, PostSummonAbAttr, PostTurnAbAttr, PostWeatherLapseAbAttr, PreSwitchOutAbAttr, PreWeatherDamageAbAttr, ProtectStatAbAttr, RedirectMoveAbAttr, BlockRedirectAbAttr, RunSuccessAbAttr, StatChangeMultiplierAbAttr, SuppressWeatherEffectAbAttr, SyncEncounterNatureAbAttr, applyAbAttrs, applyCheckTrappedAbAttrs, applyPostAttackAbAttrs, applyPostBattleAbAttrs, applyPostDefendAbAttrs, applyPostSummonAbAttrs, applyPostTurnAbAttrs, applyPostWeatherLapseAbAttrs, applyPreStatChangeAbAttrs, applyPreSwitchOutAbAttrs, applyPreWeatherEffectAbAttrs, BattleStatMultiplierAbAttr, applyBattleStatMultiplierAbAttrs, IncrementMovePriorityAbAttr, applyPostVictoryAbAttrs, PostVictoryAbAttr, applyPostBattleInitAbAttrs, PostBattleInitAbAttr, BlockNonDirectDamageAbAttr as BlockNonDirectDamageAbAttr, applyPostKnockOutAbAttrs, PostKnockOutAbAttr, PostBiomeChangeAbAttr, applyPostFaintAbAttrs, PostFaintAbAttr, IncreasePpAbAttr, PostStatChangeAbAttr, applyPostStatChangeAbAttrs, AlwaysHitAbAttr, PreventBerryUseAbAttr, StatChangeCopyAbAttr } from "./data/ability"; +import { CheckTrappedAbAttr, IgnoreOpponentStatChangesAbAttr, IgnoreOpponentEvasionAbAttr, PostAttackAbAttr, PostBattleAbAttr, PostDefendAbAttr, PostSummonAbAttr, PostTurnAbAttr, PostWeatherLapseAbAttr, PreSwitchOutAbAttr, PreWeatherDamageAbAttr, ProtectStatAbAttr, RedirectMoveAbAttr, BlockRedirectAbAttr, RunSuccessAbAttr, StatChangeMultiplierAbAttr, SuppressWeatherEffectAbAttr, SyncEncounterNatureAbAttr, applyAbAttrs, applyCheckTrappedAbAttrs, applyPostAttackAbAttrs, applyPostBattleAbAttrs, applyPostDefendAbAttrs, applyPostSummonAbAttrs, applyPostTurnAbAttrs, applyPostWeatherLapseAbAttrs, applyPreStatChangeAbAttrs, applyPreSwitchOutAbAttrs, applyPreWeatherEffectAbAttrs, BattleStatMultiplierAbAttr, applyBattleStatMultiplierAbAttrs, IncrementMovePriorityAbAttr, applyPostVictoryAbAttrs, PostVictoryAbAttr, applyPostBattleInitAbAttrs, PostBattleInitAbAttr, BlockNonDirectDamageAbAttr as BlockNonDirectDamageAbAttr, applyPostKnockOutAbAttrs, PostKnockOutAbAttr, PostBiomeChangeAbAttr, applyPostFaintAbAttrs, PostFaintAbAttr, IncreasePpAbAttr, PostStatChangeAbAttr, applyPostStatChangeAbAttrs, AlwaysHitAbAttr, PreventBerryUseAbAttr, StatChangeCopyAbAttr } from "./data/ability"; import { Unlockables, getUnlockableName } from "./system/unlockables"; import { getBiomeKey } from "./field/arena"; import { BattleType, BattlerIndex, TurnCommand } from "./battle"; @@ -2650,6 +2650,7 @@ export class MoveEffectPhase extends PokemonPhase { const targetEvasionLevel = new Utils.IntegerHolder(target.summonData.battleStats[BattleStat.EVA]); applyAbAttrs(IgnoreOpponentStatChangesAbAttr, target, null, userAccuracyLevel); applyAbAttrs(IgnoreOpponentStatChangesAbAttr, user, null, targetEvasionLevel); + applyAbAttrs(IgnoreOpponentEvasionAbAttr, user, null, targetEvasionLevel); applyMoveAttrs(IgnoreOpponentStatChangesAttr, user, target, this.move.getMove(), targetEvasionLevel); this.scene.applyModifiers(TempBattleStatBoosterModifier, this.player, TempBattleStat.ACC, userAccuracyLevel);