From 46227d65f2bbc10240703941dbccce16f0d91148 Mon Sep 17 00:00:00 2001 From: Xavion3 Date: Fri, 26 Apr 2024 21:44:25 +1000 Subject: [PATCH] Fix mind blown/explosion moves --- src/data/move.ts | 28 ++++++++++++---------------- src/field/pokemon.ts | 1 - 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/data/move.ts b/src/data/move.ts index 02b627ca9..c963b951c 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -738,7 +738,7 @@ export class HalfSacrificialAttr extends MoveEffectAttr { const cancelled = new Utils.BooleanHolder(false); applyAbAttrs(BlockNonDirectDamageAbAttr, user, cancelled); - if (!cancelled){ + if (!cancelled.value){ user.damageAndUpdate(Math.ceil(user.getMaxHp()/2), HitResult.OTHER, false, true, true); } return true; @@ -751,16 +751,6 @@ export class HalfSacrificialAttr extends MoveEffectAttr { } } -export class ExplosiveAttr extends MoveEffectAttr { - getCondition(): MoveCondition | MoveConditionFunc { - return (user, target, move) =>{ - const cancelled = new Utils.BooleanHolder(false); - user.scene.getField(true).map(p=>applyAbAttrs(FieldPreventExplosiveMovesAbAttr, p, cancelled)); - return !cancelled.value; - } - } -} - export enum MultiHitType { _2, _2_TO_5, @@ -3623,6 +3613,12 @@ const failOnBossCondition: MoveConditionFunc = (user, target, move) => !target.i const failOnMaxCondition: MoveConditionFunc = (user, target, move) => !target.isMax(); +const failIfDampCondition: MoveConditionFunc = (user, target, move) => { + const cancelled = new Utils.BooleanHolder(false); + user.scene.getField(true).map(p=>applyAbAttrs(FieldPreventExplosiveMovesAbAttr, p, cancelled)); + return !cancelled.value; +} + export type MoveAttrFilter = (attr: MoveAttr) => boolean; function applyMoveAttrsInternal(attrFilter: MoveAttrFilter, user: Pokemon, target: Pokemon, move: Move, args: any[]): Promise { @@ -4038,9 +4034,9 @@ export function initMoves() { .attr(CopyMoveAttr) .ignoresVirtual(), new AttackMove(Moves.SELF_DESTRUCT, Type.NORMAL, MoveCategory.PHYSICAL, 200, 100, 5, -1, 0, 1) - .attr(ExplosiveAttr) .attr(SacrificialAttr) .makesContact(false) + .condition(failIfDampCondition) .target(MoveTarget.ALL_NEAR_OTHERS), new AttackMove(Moves.EGG_BOMB, Type.NORMAL, MoveCategory.PHYSICAL, 100, 75, 10, -1, 0, 1) .makesContact(false) @@ -4129,7 +4125,7 @@ export function initMoves() { new AttackMove(Moves.CRABHAMMER, Type.WATER, MoveCategory.PHYSICAL, 100, 90, 10, -1, 0, 1) .attr(HighCritAttr), new AttackMove(Moves.EXPLOSION, Type.NORMAL, MoveCategory.PHYSICAL, 250, 100, 5, -1, 0, 1) - .attr(ExplosiveAttr) + .condition(failIfDampCondition) .attr(SacrificialAttr) .makesContact(false) .target(MoveTarget.ALL_NEAR_OTHERS), @@ -5662,7 +5658,7 @@ export function initMoves() { .partial(), /* End Unused */ new AttackMove(Moves.MIND_BLOWN, Type.FIRE, MoveCategory.SPECIAL, 150, 100, 5, -1, 0, 7) - .attr(ExplosiveAttr) + .condition(failIfDampCondition) .attr(HalfSacrificialAttr) .target(MoveTarget.ALL_NEAR_OTHERS), new AttackMove(Moves.PLASMA_FISTS, Type.ELECTRIC, MoveCategory.PHYSICAL, 100, 100, 15, -1, 0, 7) @@ -5899,10 +5895,10 @@ export function initMoves() { .attr(StatusEffectAttr, StatusEffect.POISON) .partial(), new AttackMove(Moves.MISTY_EXPLOSION, Type.FAIRY, MoveCategory.SPECIAL, 100, 100, 5, -1, 0, 8) - .attr(ExplosiveAttr) .attr(SacrificialAttr) .target(MoveTarget.ALL_NEAR_OTHERS) - .attr(MovePowerMultiplierAttr, (user, target, move) => user.scene.arena.getTerrainType() === TerrainType.MISTY && user.isGrounded() ? 1.5 : 1), + .attr(MovePowerMultiplierAttr, (user, target, move) => user.scene.arena.getTerrainType() === TerrainType.MISTY && user.isGrounded() ? 1.5 : 1) + .condition(failIfDampCondition), new AttackMove(Moves.GRASSY_GLIDE, Type.GRASS, MoveCategory.PHYSICAL, 55, 100, 20, -1, 0, 8) .partial(), new AttackMove(Moves.RISING_VOLTAGE, Type.ELECTRIC, MoveCategory.SPECIAL, 70, 100, 20, -1, 0, 8) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index a8fceb76b..cb2c3bccc 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -1230,7 +1230,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { if (types.find(t => move.isTypeImmune(t))) typeMultiplier.value = 0; - applyMoveAttrs(ExplosiveAttr, source, null, battlerMove.getMove()); switch (moveCategory) { case MoveCategory.PHYSICAL: case MoveCategory.SPECIAL: