From 3a6b4de685f3d09b33a4275d2a27381669790228 Mon Sep 17 00:00:00 2001 From: takeyourt1me <144757710+takeyourt1me@users.noreply.github.com> Date: Tue, 30 Apr 2024 15:03:24 -0700 Subject: [PATCH] first try addinng PreAttackChangeType class, put it on protean --- src/data/ability.ts | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/data/ability.ts b/src/data/ability.ts index 2ac7d6be1ac..c74ffb0d772 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -840,6 +840,33 @@ export class VariableMovePowerAbAttr extends PreAttackAbAttr { } } +export class PreAttackChangeType extends PreAttackAbAttr{ + + // private originalType: Type[]; + // private MoveType : Type; + private condition: PokemonAttackCondition; + + constructor(condition:PokemonAttackCondition){ + super(true); + // this.originalType = originalType; + // this.MoveType= moveType; + this.condition = condition; + } + + applyPreAttack(pokemon: Pokemon, passive: boolean, defender: Pokemon, move: PokemonMove, args: any[]): boolean | Promise { + if (this.condition(pokemon,defender,move.getMove())){ + const MoveType = move.getMove().type; + const originalType = pokemon.getTypes(); + + if (originalType.length !==1 || originalType[0] !== MoveType){ + pokemon.summonData.types = [MoveType]; + } + return true; + } + return false; + } +} + export class VariableMoveTypeAbAttr extends AbAttr { apply(pokemon: Pokemon, passive: boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean { //const power = args[0] as Utils.IntegerHolder; @@ -2966,7 +2993,11 @@ export function initAbilities() { new Ability(Abilities.CHEEK_POUCH, 6) .unimplemented(), new Ability(Abilities.PROTEAN, 6) - .unimplemented(), + .attr(PostSummonMessageAbAttr,(pokemon: Pokemon) => getPokemonMessage(pokemon,' Testing out the text!')) + //.attr(,pokemon:Pokemon => getPokemonMessage(pokemon,' Testing out the text!')) + .attr(PreAttackChangeType, (target,user,move) => move.category !==MoveCategory.STATUS), + + //.unimplemented(), new Ability(Abilities.FUR_COAT, 6) .attr(ReceivedMoveDamageMultiplierAbAttr, (target, user, move) => move.category === MoveCategory.PHYSICAL, 0.5) .ignorable(),