From 7ca85e9933137305119c1d7f24a999c05c1a9516 Mon Sep 17 00:00:00 2001 From: LaukkaE Date: Mon, 1 Apr 2024 18:05:04 +0300 Subject: [PATCH] implement freezedry --- src/data/move.ts | 23 +++++++++++++++++++++-- src/field/pokemon.ts | 3 ++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/data/move.ts b/src/data/move.ts index 9cfdd274cd6..87c9f32a8ab 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -1768,6 +1768,24 @@ export class BlizzardAccuracyAttr extends VariableAccuracyAttr { } } +export class VariableMoveTypeMultiplierAttr extends MoveAttr { + apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { + return false; + } +} + +export class FreezeDryMultiplierAttr extends VariableMoveTypeMultiplierAttr { + apply(user:Pokemon,target:Pokemon, move:Move, args: any[]) : boolean { + const multiplier = args[0] as Utils.NumberHolder; + if (target.isOfType(Type.WATER)){ + //Increased twice because initial reduction against water + multiplier.value *=4; + } + console.log(multiplier.value); + return false; + } +} + export class OneHitKOAccuracyAttr extends MoveAttr { apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { const accuracy = args[0] as Utils.NumberHolder; @@ -4060,8 +4078,9 @@ export function initMoves() { new AttackMove(Moves.PETAL_BLIZZARD, "Petal Blizzard", Type.GRASS, MoveCategory.PHYSICAL, 90, 100, 15, "The user stirs up a violent petal blizzard and attacks everything around it.", -1, 0, 6) .windMove() .target(MoveTarget.ALL_NEAR_OTHERS), - new AttackMove(Moves.FREEZE_DRY, "Freeze-Dry (P)", Type.ICE, MoveCategory.SPECIAL, 70, 100, 20, "The user rapidly cools the target. This may also leave the target frozen. This move is super effective on Water types.", 10, 0, 6) - .attr(StatusEffectAttr, StatusEffect.FREEZE), + new AttackMove(Moves.FREEZE_DRY, "Freeze-Dry", Type.ICE, MoveCategory.SPECIAL, 70, 100, 20, "The user rapidly cools the target. This may also leave the target frozen. This move is super effective on Water types.", 10, 0, 6) + .attr(StatusEffectAttr, StatusEffect.FREEZE) + .attr(FreezeDryMultiplierAttr), new AttackMove(Moves.DISARMING_VOICE, "Disarming Voice", Type.FAIRY, MoveCategory.SPECIAL, 40, -1, 15, "Letting out a charming cry, the user does emotional damage to opposing Pokémon. This attack never misses.", -1, 0, 6) .soundBased() .target(MoveTarget.ALL_NEAR_ENEMIES), diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index e95cc3c65a2..9382e51ec4d 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -2,7 +2,7 @@ import Phaser from 'phaser'; import BattleScene, { AnySound } from '../battle-scene'; import BattleInfo, { PlayerBattleInfo, EnemyBattleInfo } from '../ui/battle-info'; import { Moves } from "../data/enums/moves"; -import Move, { HighCritAttr, HitsTagAttr, applyMoveAttrs, FixedDamageAttr, VariableAtkAttr, VariablePowerAttr, allMoves, MoveCategory, TypelessAttr, CritOnlyAttr, getMoveTargets, OneHitKOAttr, MultiHitAttr, StatusMoveTypeImmunityAttr, MoveTarget, VariableDefAttr, AttackMove, ModifiedDamageAttr } from "../data/move"; +import Move, { HighCritAttr, HitsTagAttr, applyMoveAttrs, FixedDamageAttr, VariableAtkAttr, VariablePowerAttr, allMoves, MoveCategory, TypelessAttr, CritOnlyAttr, getMoveTargets, OneHitKOAttr, MultiHitAttr, StatusMoveTypeImmunityAttr, MoveTarget, VariableDefAttr, AttackMove, ModifiedDamageAttr, VariableMoveTypeMultiplierAttr } from "../data/move"; import { default as PokemonSpecies, PokemonSpeciesForm, SpeciesFormKey, getFusedSpeciesName, getPokemonSpecies, getPokemonSpeciesForm } from '../data/pokemon-species'; import * as Utils from '../utils'; import { Type, TypeDamageMultiplier, getTypeDamageMultiplier, getTypeRgb } from '../data/type'; @@ -1042,6 +1042,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { const typeMultiplier = new Utils.NumberHolder(!typeless && (moveCategory !== MoveCategory.STATUS || move.getAttrs(StatusMoveTypeImmunityAttr).find(attr => (attr as StatusMoveTypeImmunityAttr).immuneType === move.type)) ? getTypeDamageMultiplier(move.type, types[0]) * (types.length > 1 ? getTypeDamageMultiplier(move.type, types[1]) : 1) : 1); + applyMoveAttrs(VariableMoveTypeMultiplierAttr, source, this, move, typeMultiplier); if (typeless) typeMultiplier.value = 1; if (this.getTypes(true, true).find(t => move.isTypeImmune(t)))