From 049fa306b9e7a3d5bf69a3b2ab731b088e71ba02 Mon Sep 17 00:00:00 2001 From: Xavion3 Date: Wed, 24 Apr 2024 01:57:59 +1000 Subject: [PATCH] Add dynamax buffs --- src/data/battler-tags.ts | 7 +++++++ src/data/move.ts | 22 ++++++++++++++++------ src/field/pokemon.ts | 5 +++++ 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index 25ff41ec3e2..d4fc6da2196 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -145,6 +145,10 @@ export class FlinchedTag extends BattlerTag { applyAbAttrs(FlinchEffectAbAttr, pokemon, null); } + canAdd(pokemon: Pokemon): boolean { + return !pokemon.isMax(); + } + lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean { super.lapse(pokemon, lapseType); @@ -368,6 +372,9 @@ export class EncoreTag extends BattlerTag { } canAdd(pokemon: Pokemon): boolean { + if (pokemon.isMax()) + return false; + const lastMoves = pokemon.getLastXMoves(1); if (!lastMoves.length) return false; diff --git a/src/data/move.ts b/src/data/move.ts index 79364fb41d0..f4a98ca8f8e 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -2390,7 +2390,7 @@ export class DisableMoveAttr extends MoveEffectAttr { getCondition(): MoveConditionFunc { return (user, target, move) => { - if (target.summonData.disabledMove) + if (target.summonData.disabledMove || target.isMax()) return false; const moveQueue = target.getLastXMoves(); @@ -2810,6 +2810,9 @@ export class ForceSwitchOutAttr extends MoveEffectAttr { apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): Promise { return new Promise(resolve => { + if (!this.user && target.isMax()) + return resolve(false); + // Check if the move category is not STATUS or if the switch out condition is not met if (move.category !== MoveCategory.STATUS && !this.getSwitchOutCondition()(user, target, move)) { //Apply effects before switch out i.e. poison point, flame body, etc @@ -3573,6 +3576,8 @@ const failOnGravityCondition: MoveConditionFunc = (user, target, move) => !user. const failOnBossCondition: MoveConditionFunc = (user, target, move) => !target.isBossImmune(); +const failOnMaxCondition: MoveConditionFunc = (user, target, move) => !target.isMax(); + export type MoveAttrFilter = (attr: MoveAttr) => boolean; function applyMoveAttrsInternal(attrFilter: MoveAttrFilter, user: Pokemon, target: Pokemon, move: Move, args: any[]): Promise { @@ -3808,7 +3813,8 @@ export function initMoves() { new AttackMove(Moves.SONIC_BOOM, Type.NORMAL, MoveCategory.SPECIAL, -1, 90, 20, -1, 0, 1) .attr(FixedDamageAttr, 20), new StatusMove(Moves.DISABLE, Type.NORMAL, 100, 20, -1, 0, 1) - .attr(DisableMoveAttr), + .attr(DisableMoveAttr) + .condition(failOnMaxCondition), new AttackMove(Moves.ACID, Type.POISON, MoveCategory.SPECIAL, 40, 100, 30, 10, 0, 1) .attr(StatChangeAttr, BattleStat.SPDEF, -1) .target(MoveTarget.ALL_NEAR_ENEMIES), @@ -3844,7 +3850,8 @@ export function initMoves() { new AttackMove(Moves.SUBMISSION, Type.FIGHTING, MoveCategory.PHYSICAL, 80, 80, 20, -1, 0, 1) .attr(RecoilAttr), new AttackMove(Moves.LOW_KICK, Type.FIGHTING, MoveCategory.PHYSICAL, -1, 100, 20, -1, 0, 1) - .attr(WeightPowerAttr), + .attr(WeightPowerAttr) + .condition(failOnMaxCondition), new AttackMove(Moves.COUNTER, Type.FIGHTING, MoveCategory.PHYSICAL, -1, 100, 20, -1, -5, 1) .attr(CounterDamageAttr, (move: Move) => move.category === MoveCategory.PHYSICAL, 2) .target(MoveTarget.ATTACKER), @@ -4900,7 +4907,8 @@ export function initMoves() { .target(MoveTarget.ENEMY_SIDE), new AttackMove(Moves.GRASS_KNOT, Type.GRASS, MoveCategory.SPECIAL, -1, 100, 20, -1, 0, 4) .attr(WeightPowerAttr) - .makesContact(), + .makesContact() + .condition(failOnMaxCondition), new AttackMove(Moves.CHATTER, Type.FLYING, MoveCategory.SPECIAL, 65, 100, 20, 100, 0, 4) .attr(ConfuseAttr) .soundBased(), @@ -4995,7 +5003,8 @@ export function initMoves() { .attr(StatChangeAttr, [ BattleStat.SPATK, BattleStat.SPDEF, BattleStat.SPD ], 1, true) .danceMove(), new AttackMove(Moves.HEAVY_SLAM, Type.STEEL, MoveCategory.PHYSICAL, -1, 100, 10, -1, 0, 5) - .attr(CompareWeightPowerAttr), + .attr(CompareWeightPowerAttr) + .condition(failOnMaxCondition), new AttackMove(Moves.SYNCHRONOISE, Type.PSYCHIC, MoveCategory.SPECIAL, 120, 100, 10, -1, 0, 5) .target(MoveTarget.ALL_NEAR_OTHERS) .partial(), @@ -5123,7 +5132,8 @@ export function initMoves() { .attr(StatChangeAttr, BattleStat.DEF, -1) .slicingMove(), new AttackMove(Moves.HEAT_CRASH, Type.FIRE, MoveCategory.PHYSICAL, -1, 100, 10, -1, 0, 5) - .attr(CompareWeightPowerAttr), + .attr(CompareWeightPowerAttr) + .condition(failOnMaxCondition), new AttackMove(Moves.LEAF_TORNADO, Type.GRASS, MoveCategory.SPECIAL, 65, 90, 10, 50, 0, 5) .attr(StatChangeAttr, BattleStat.ACC, -1), new AttackMove(Moves.STEAMROLLER, Type.BUG, MoveCategory.PHYSICAL, 65, 100, 20, 30, 0, 5) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index ffde68f8d9e..0989c769f0f 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -1488,6 +1488,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { return this.isBoss(); } + isMax(): boolean { + const maxForms = [SpeciesFormKey.GIGANTAMAX, SpeciesFormKey.GIGANTAMAX_RAPID, SpeciesFormKey.GIGANTAMAX_SINGLE, SpeciesFormKey.ETERNAMAX] as string[]; + return maxForms.includes(this.getFormKey()) || maxForms.includes(this.getFusionFormKey()); + } + addTag(tagType: BattlerTagType, turnCount: integer = 0, sourceMove?: Moves, sourceId?: integer): boolean { const existingTag = this.getTag(tagType); if (existingTag) {