From 4f62dec998b522ec400dc1f8ffb4c74ead96eb54 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Fri, 29 Mar 2024 10:07:04 -0400 Subject: [PATCH] Implement Helping Hand move --- src/data/battler-tags.ts | 19 ++++++++++++++++--- src/data/enums/battler-tag-type.ts | 1 + src/data/move.ts | 5 +++-- src/field/pokemon.ts | 4 +++- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index 71b891ed5c5..c0df2a6ebbd 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -340,8 +340,8 @@ export class FrenzyTag extends BattlerTag { export class EncoreTag extends BattlerTag { public moveId: Moves; - constructor(sourceMove: Moves, sourceId: integer) { - super(BattlerTagType.ENCORE, BattlerTagLapseType.AFTER_MOVE, 3, sourceMove, sourceId); + constructor(sourceId: integer) { + super(BattlerTagType.ENCORE, BattlerTagLapseType.AFTER_MOVE, 3, Moves.ENCORE, sourceId); } canAdd(pokemon: Pokemon): boolean { @@ -396,6 +396,16 @@ export class EncoreTag extends BattlerTag { } } +export class HelpingHandTag extends BattlerTag { + constructor(sourceId: integer) { + super(BattlerTagType.HELPING_HAND, BattlerTagLapseType.TURN_END, 1, Moves.HELPING_HAND, sourceId); + } + + onAdd(pokemon: Pokemon): void { + pokemon.scene.queueMessage(getPokemonMessage(pokemon.scene.getPokemonById(this.sourceId), ` is ready to\nhelp ${pokemon.name}!`)); + } +} + export class IngrainTag extends TrappedTag { constructor(sourceId: integer) { super(BattlerTagType.INGRAIN, BattlerTagLapseType.TURN_END, 1, Moves.INGRAIN, sourceId); @@ -880,7 +890,9 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: integer, sourc case BattlerTagType.FRENZY: return new FrenzyTag(sourceMove, sourceId); case BattlerTagType.ENCORE: - return new EncoreTag(sourceMove, sourceId); + return new EncoreTag(sourceId); + case BattlerTagType.HELPING_HAND: + return new HelpingHandTag(sourceId); case BattlerTagType.INGRAIN: return new IngrainTag(sourceId); case BattlerTagType.AQUA_RING: @@ -939,6 +951,7 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: integer, sourc return new BattlerTag(BattlerTagType.BYPASS_SLEEP, BattlerTagLapseType.TURN_END, turnCount, sourceMove); case BattlerTagType.IGNORE_FLYING: return new BattlerTag(tagType, BattlerTagLapseType.TURN_END, turnCount, sourceMove); + case BattlerTagType.NONE: default: return new BattlerTag(tagType, BattlerTagLapseType.CUSTOM, turnCount, sourceMove, sourceId); } diff --git a/src/data/enums/battler-tag-type.ts b/src/data/enums/battler-tag-type.ts index f02d1ea3420..c517d4c1542 100644 --- a/src/data/enums/battler-tag-type.ts +++ b/src/data/enums/battler-tag-type.ts @@ -9,6 +9,7 @@ export enum BattlerTagType { NIGHTMARE = "NIGHTMARE", FRENZY = "FRENZY", ENCORE = "ENCORE", + HELPING_HAND = "HELPING_HAND", INGRAIN = "INGRAIN", AQUA_RING = "AQUA_RING", DROWSY = "DROWSY", diff --git a/src/data/move.ts b/src/data/move.ts index 9ba591bc493..04a6fe01c56 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -3205,7 +3205,7 @@ export function initMoves() { .hidesUser(), new StatusMove(Moves.ENCORE, "Encore", Type.NORMAL, 100, 5, "The user compels the target to keep using the move it encored for three turns.", -1, 0, 2) .attr(AddBattlerTagAttr, BattlerTagType.ENCORE, false, true) - .condition((user, target, move) => new EncoreTag(move.id, user.id).canAdd(target)), + .condition((user, target, move) => new EncoreTag(user.id).canAdd(target)), new AttackMove(Moves.PURSUIT, "Pursuit (P)", Type.DARK, MoveCategory.PHYSICAL, 40, 100, 20, "The power of this attack move is doubled if it's used on a target that's switching out of battle.", -1, 0, 2), new AttackMove(Moves.RAPID_SPIN, "Rapid Spin", Type.NORMAL, MoveCategory.PHYSICAL, 50, 100, 40, "A spin attack that can also eliminate such moves as Bind, Wrap, and Leech Seed. This also raises the user's Speed stat.", 100, 0, 2) .attr(StatChangeAttr, BattleStat.SPD, 1, true) @@ -3300,7 +3300,8 @@ export function initMoves() { new SelfStatusMove(Moves.CHARGE, "Charge (P)", Type.ELECTRIC, -1, 20, "The user boosts the power of the Electric move it uses on the next turn. This also raises the user's Sp. Def stat.", -1, 0, 3) .attr(StatChangeAttr, BattleStat.SPDEF, 1, true), new StatusMove(Moves.TAUNT, "Taunt (N)", Type.DARK, 100, 20, "The target is taunted into a rage that allows it to use only attack moves for three turns.", -1, 0, 3), - new StatusMove(Moves.HELPING_HAND, "Helping Hand (N)", Type.NORMAL, -1, 20, "The user assists an ally by boosting the power of that ally's attack.", -1, 5, 3) + new StatusMove(Moves.HELPING_HAND, "Helping Hand", Type.NORMAL, -1, 20, "The user assists an ally by boosting the power of that ally's attack.", -1, 5, 3) + .attr(AddBattlerTagAttr, BattlerTagType.HELPING_HAND) .target(MoveTarget.NEAR_ALLY), new StatusMove(Moves.TRICK, "Trick (N)", Type.PSYCHIC, 100, 10, "The user catches the target off guard and swaps its held item with its own.", -1, 0, 3), new StatusMove(Moves.ROLE_PLAY, "Role Play (N)", Type.PSYCHIC, -1, 10, "The user mimics the target completely, copying the target's Ability.", -1, 0, 3), diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 86bdd280d78..ebae355f814 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -17,7 +17,7 @@ import { pokemonEvolutions, pokemonPrevolutions, SpeciesFormEvolution, SpeciesEv import { reverseCompatibleTms, tmSpecies } from '../data/tms'; import { DamagePhase, FaintPhase, LearnMovePhase, ObtainStatusEffectPhase, StatChangePhase, SwitchSummonPhase } from '../phases'; import { BattleStat } from '../data/battle-stat'; -import { BattlerTag, BattlerTagLapseType, EncoreTag, TypeBoostTag, getBattlerTag } from '../data/battler-tags'; +import { BattlerTag, BattlerTagLapseType, EncoreTag, HelpingHandTag, TypeBoostTag, getBattlerTag } from '../data/battler-tags'; import { BattlerTagType } from "../data/enums/battler-tag-type"; import { Species } from '../data/enums/species'; import { WeatherType } from '../data/weather'; @@ -1076,6 +1076,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { this.scene.arena.applyTags(WeakenMoveTypeTag, move.type, power); this.scene.applyModifiers(AttackTypeBoosterModifier, source.isPlayer(), source, power); } + if (source.getTag(HelpingHandTag)) + power.value *= 1.5; let isCritical: boolean; const critOnly = new Utils.BooleanHolder(false); applyMoveAttrs(CritOnlyAttr, source, this, move, critOnly);