From 67fd6d4fff99df8ed0a2ff125f8d6acf3ecc3b11 Mon Sep 17 00:00:00 2001 From: Reldnahc Date: Mon, 6 May 2024 12:52:24 -0500 Subject: [PATCH] implement mycelium might. --- src/data/ability.ts | 17 ++++++++++++++--- src/phases.ts | 6 +++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/data/ability.ts b/src/data/ability.ts index 97e060052..5ee8c145b 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -2472,7 +2472,7 @@ export class NoFusionAbilityAbAttr extends AbAttr { } } -export class StallAbAttr extends AbAttr { +export class ActLastAbAttr extends AbAttr { constructor() { super(false); } @@ -2483,6 +2483,17 @@ export class StallAbAttr extends AbAttr { } } +export class MyceliumMightAbAttr extends ActLastAbAttr { + apply(pokemon: Pokemon, passive: boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean { + const command = pokemon.scene.currentBattle.turnCommands[pokemon.getBattlerIndex()]; + if (command.move && allMoves[command.move.move].category === MoveCategory.STATUS) { + args[0].value = true; + return true; + } + return false; + } +} + function applyAbAttrsInternal(attrType: { new(...args: any[]): TAttr }, pokemon: Pokemon, applyFunc: AbAttrApplyFunc, args: any[], isAsync: boolean = false, showAbilityInstant: boolean = false, quiet: boolean = false, passive: boolean = false): Promise { return new Promise(resolve => { @@ -2958,7 +2969,7 @@ export function initAbilities() { .attr(AlwaysHitAbAttr) .attr(DoubleBattleChanceAbAttr), new Ability(Abilities.STALL, 4) - .attr(StallAbAttr), + .attr(ActLastAbAttr), new Ability(Abilities.TECHNICIAN, 4) .attr(MovePowerBoostAbAttr, (user, target, move) => move.power <= 60, 1.5), new Ability(Abilities.LEAF_GUARD, 4) @@ -3574,7 +3585,7 @@ export function initAbilities() { .ignorable(), new Ability(Abilities.MYCELIUM_MIGHT, 9) .attr(MoveAbilityBypassAbAttr, (pokemon, move: Move) => move.category === MoveCategory.STATUS) - .partial(), + .attr(MyceliumMightAbAttr), new Ability(Abilities.MINDS_EYE, 9) .ignorable() .unimplemented(), diff --git a/src/phases.ts b/src/phases.ts index e393041f3..d3e395de2 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, 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, StallAbAttr } from "./data/ability"; +import { CheckTrappedAbAttr, IgnoreOpponentStatChangesAbAttr, PostAttackAbAttr, PostBattleAbAttr, PostDefendAbAttr, PostSummonAbAttr, PostTurnAbAttr, PostWeatherLapseAbAttr, PreSwitchOutAbAttr, PreWeatherDamageAbAttr, ProtectStatAbAttr, RedirectMoveAbAttr, 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, ActLastAbAttr } from "./data/ability"; import { Unlockables, getUnlockableName } from "./system/unlockables"; import { getBiomeKey } from "./field/arena"; import { BattleType, BattlerIndex, TurnCommand } from "./battle"; @@ -592,9 +592,9 @@ export abstract class FieldPhase extends BattlePhase { orderedTargets.sort((a: Pokemon, b: Pokemon) => { const aStall = new Utils.BooleanHolder(false); - applyAbAttrs(StallAbAttr, a, null, aStall); + applyAbAttrs(ActLastAbAttr, a, null, aStall); const bStall = new Utils.BooleanHolder(false); - applyAbAttrs(StallAbAttr, b, null, bStall); + applyAbAttrs(ActLastAbAttr, b, null, bStall); return aStall.value === bStall.value ? 0 : aStall.value ? 1 : -1; });