From 3bcee779e296be330ba3c6168ff462d8f7f38d23 Mon Sep 17 00:00:00 2001 From: "Adrian T." <68144167+torranx@users.noreply.github.com> Date: Mon, 2 Sep 2024 10:39:12 +0800 Subject: [PATCH] [Move] Fully implement dragon cheer (#3959) --- src/data/battler-tags.ts | 21 +++++++++++++++++++++ src/data/move.ts | 5 ++--- src/enums/battler-tag-type.ts | 3 ++- src/field/pokemon.ts | 13 ++++++++++--- 4 files changed, 35 insertions(+), 7 deletions(-) diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index 8c05d296e76..38db36e86f6 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -1507,6 +1507,25 @@ export class CritBoostTag extends BattlerTag { } } +/** + * Tag for the effects of Dragon Cheer, which boosts the critical hit ratio of the user's allies. + * @extends {CritBoostTag} + */ +export class DragonCheerTag extends CritBoostTag { + /** The types of the user's ally when the tag is added */ + public typesOnAdd: Type[]; + + constructor() { + super(BattlerTagType.CRIT_BOOST, Moves.DRAGON_CHEER); + } + + onAdd(pokemon: Pokemon): void { + super.onAdd(pokemon); + + this.typesOnAdd = pokemon.getTypes(true); + } +} + export class SaltCuredTag extends BattlerTag { private sourceIndex: number; @@ -1923,6 +1942,8 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: number, source return new TypeBoostTag(tagType, sourceMove, Type.FIRE, 1.5, false); case BattlerTagType.CRIT_BOOST: return new CritBoostTag(tagType, sourceMove); + case BattlerTagType.DRAGON_CHEER: + return new DragonCheerTag(); case BattlerTagType.ALWAYS_CRIT: case BattlerTagType.IGNORE_ACCURACY: return new BattlerTag(tagType, BattlerTagLapseType.TURN_END, 2, sourceMove); diff --git a/src/data/move.ts b/src/data/move.ts index d50dc7e2074..bbc33241454 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -9143,9 +9143,8 @@ export function initMoves() { new AttackMove(Moves.HARD_PRESS, Type.STEEL, MoveCategory.PHYSICAL, -1, 100, 10, -1, 0, 9) .attr(OpponentHighHpPowerAttr, 100), new StatusMove(Moves.DRAGON_CHEER, Type.DRAGON, -1, 15, -1, 0, 9) - .attr(AddBattlerTagAttr, BattlerTagType.CRIT_BOOST, false, true) - .target(MoveTarget.NEAR_ALLY) - .partial(), + .attr(AddBattlerTagAttr, BattlerTagType.DRAGON_CHEER, false, true) + .target(MoveTarget.NEAR_ALLY), new AttackMove(Moves.ALLURING_VOICE, Type.FAIRY, MoveCategory.SPECIAL, 80, 100, 10, -1, 0, 9) .soundBased() .partial(), diff --git a/src/enums/battler-tag-type.ts b/src/enums/battler-tag-type.ts index b133b442801..73580a107b2 100644 --- a/src/enums/battler-tag-type.ts +++ b/src/enums/battler-tag-type.ts @@ -69,5 +69,6 @@ export enum BattlerTagType { GULP_MISSILE_ARROKUDA = "GULP_MISSILE_ARROKUDA", GULP_MISSILE_PIKACHU = "GULP_MISSILE_PIKACHU", BEAK_BLAST_CHARGING = "BEAK_BLAST_CHARGING", - SHELL_TRAP = "SHELL_TRAP" + SHELL_TRAP = "SHELL_TRAP", + DRAGON_CHEER = "DRAGON_CHEER", } diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 457ff874095..00d5f5d3dd2 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -18,7 +18,7 @@ import { Status, StatusEffect, getRandomStatus } from "../data/status-effect"; import { pokemonEvolutions, pokemonPrevolutions, SpeciesFormEvolution, SpeciesEvolutionCondition, FusionSpeciesFormEvolution } from "../data/pokemon-evolutions"; import { reverseCompatibleTms, tmSpecies, tmPoolTiers } from "../data/tms"; import { BattleStat } from "../data/battle-stat"; -import { BattlerTag, BattlerTagLapseType, EncoreTag, GroundedTag, HighestStatBoostTag, TypeImmuneTag, getBattlerTag, SemiInvulnerableTag, TypeBoostTag, ExposedTag } from "../data/battler-tags"; +import { BattlerTag, BattlerTagLapseType, EncoreTag, GroundedTag, HighestStatBoostTag, TypeImmuneTag, getBattlerTag, SemiInvulnerableTag, TypeBoostTag, ExposedTag, DragonCheerTag, CritBoostTag } from "../data/battler-tags"; import { WeatherType } from "../data/weather"; import { TempBattleStat } from "../data/temp-battle-stat"; import { ArenaTagSide, NoCritTag, WeakenMoveScreenTag } from "../data/arena-tag"; @@ -2069,9 +2069,16 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { critLevel.value += 1; } } - if (source.getTag(BattlerTagType.CRIT_BOOST)) { - critLevel.value += 2; + + const critBoostTag = source.getTag(CritBoostTag); + if (critBoostTag) { + if (critBoostTag instanceof DragonCheerTag) { + critLevel.value += critBoostTag.typesOnAdd.includes(Type.DRAGON) ? 2 : 1; + } else { + critLevel.value += 2; + } } + console.log(`crit stage: +${critLevel.value}`); const critChance = [24, 8, 2, 1][Math.max(0, Math.min(critLevel.value, 3))]; isCritical = critChance === 1 || !this.scene.randBattleSeedInt(critChance);