From 47a51c995856c8a1d4b9c7972398f0f2ee6bf12c Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Mon, 18 Mar 2024 17:15:20 -0400 Subject: [PATCH] Add first hit move effect and apply only to Make It Rain --- src/data/arena-tag.ts | 2 +- src/data/move.ts | 10 ++++++---- src/phases.ts | 8 ++++---- src/ui/daily-run-scoreboard.ts | 4 ++-- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/data/arena-tag.ts b/src/data/arena-tag.ts index e1620c767..8b5fc4612 100644 --- a/src/data/arena-tag.ts +++ b/src/data/arena-tag.ts @@ -208,7 +208,7 @@ class ToxicSpikesTag extends ArenaTrapTag { else if (pokemon.isOfType(Type.POISON)) { this.neutralized = true; if (pokemon.scene.arena.removeTag(this.tagType)) { - pokemon.scene.queueMessage(`The ${this.getMoveName()} were\nneutralized by ${pokemon.name}.`); + pokemon.scene.queueMessage(getPokemonMessage(pokemon, ` absorbed the ${this.getMoveName()}!`)); return true; } } diff --git a/src/data/move.ts b/src/data/move.ts index 1d14a9dad..ee1b9b076 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -362,10 +362,12 @@ export enum MoveEffectTrigger { export class MoveEffectAttr extends MoveAttr { public trigger: MoveEffectTrigger; + public firstHitOnly: boolean; - constructor(selfTarget?: boolean, trigger?: MoveEffectTrigger) { + constructor(selfTarget?: boolean, trigger?: MoveEffectTrigger, firstHitOnly: boolean = false) { super(selfTarget); this.trigger = trigger !== undefined ? trigger : MoveEffectTrigger.POST_APPLY; + this.firstHitOnly = firstHitOnly; } canApply(user: Pokemon, target: Pokemon, move: Move, args: any[]) { @@ -1156,8 +1158,8 @@ export class StatChangeAttr extends MoveEffectAttr { private condition: MoveConditionFunc; private showMessage: boolean; - constructor(stats: BattleStat | BattleStat[], levels: integer, selfTarget?: boolean, condition?: MoveConditionFunc, showMessage: boolean = true) { - super(selfTarget, MoveEffectTrigger.HIT); + constructor(stats: BattleStat | BattleStat[], levels: integer, selfTarget?: boolean, condition?: MoveConditionFunc, showMessage: boolean = true, firstHitOnly: boolean = false) { + super(selfTarget, MoveEffectTrigger.HIT, firstHitOnly); this.stats = typeof(stats) === 'number' ? [ stats as BattleStat ] : stats as BattleStat[]; @@ -4616,7 +4618,7 @@ export function initMoves() { .danceMove(), new AttackMove(Moves.RAGING_BULL, "Raging Bull (P)", Type.NORMAL, MoveCategory.PHYSICAL, 90, 100, 10, "The user performs a tackle like a raging bull. This move's type depends on the user's form. It can also break barriers, such as Light Screen and Reflect.", -1, 0, 9), new AttackMove(Moves.MAKE_IT_RAIN, "Make It Rain (P)", Type.STEEL, MoveCategory.SPECIAL, 120, 100, 5, "The user attacks by throwing out a mass of coins. This also lowers the user's Sp. Atk stat. Money is earned after the battle.", -1, 0, 9) - .attr(StatChangeAttr, BattleStat.SPATK, -1, true) + .attr(StatChangeAttr, BattleStat.SPATK, -1, true, null, true, true) .target(MoveTarget.ALL_NEAR_ENEMIES), new AttackMove(Moves.PSYBLADE, "Psyblade (P)", Type.PSYCHIC, MoveCategory.PHYSICAL, 80, 100, 15, "The user rends the target with an ethereal blade. This move's power is boosted by 50 percent if the user is on Electric Terrain.", -1, 0, 9) .slicingMove(), diff --git a/src/phases.ts b/src/phases.ts index e2a79ef56..54b74264a 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -2203,23 +2203,23 @@ export class MoveEffectPhase extends PokemonPhase { this.scene.triggerPokemonFormChange(user, SpeciesFormChangeMoveUsedTrigger); applyAttrs.push(new Promise(resolve => { - applyFilteredMoveAttrs((attr: MoveAttr) => attr instanceof MoveEffectAttr && (attr as MoveEffectAttr).trigger === MoveEffectTrigger.PRE_APPLY && (!attr.selfTarget || firstHit), + applyFilteredMoveAttrs((attr: MoveAttr) => attr instanceof MoveEffectAttr && (attr as MoveEffectAttr).trigger === MoveEffectTrigger.PRE_APPLY && (!attr.firstHitOnly || firstHit), user, target, this.move.getMove()).then(() => { if (hitResult !== HitResult.FAIL) { const chargeEffect = !!this.move.getMove().getAttrs(ChargeAttr).find(ca => (ca as ChargeAttr).usedChargeEffect(user, this.getTarget(), this.move.getMove())); // Charge attribute with charge effect takes all effect attributes and applies them to charge stage, so ignore them if this is present Utils.executeIf(!chargeEffect, () => applyFilteredMoveAttrs((attr: MoveAttr) => attr instanceof MoveEffectAttr && (attr as MoveEffectAttr).trigger === MoveEffectTrigger.POST_APPLY - && (attr as MoveEffectAttr).selfTarget && firstHit, user, target, this.move.getMove())).then(() => { + && (attr as MoveEffectAttr).selfTarget && (!attr.firstHitOnly || firstHit), user, target, this.move.getMove())).then(() => { if (hitResult !== HitResult.NO_EFFECT) { applyFilteredMoveAttrs((attr: MoveAttr) => attr instanceof MoveEffectAttr && (attr as MoveEffectAttr).trigger === MoveEffectTrigger.POST_APPLY - && !(attr as MoveEffectAttr).selfTarget, user, target, this.move.getMove()).then(() => { + && !(attr as MoveEffectAttr).selfTarget && (!attr.firstHitOnly || firstHit), user, target, this.move.getMove()).then(() => { if (hitResult < HitResult.NO_EFFECT) { const flinched = new Utils.BooleanHolder(false); user.scene.applyModifiers(FlinchChanceModifier, user.isPlayer(), user, flinched); if (flinched.value) target.addTag(BattlerTagType.FLINCHED, undefined, this.move.moveId, user.id); } - Utils.executeIf(!isProtected && !chargeEffect, () => applyFilteredMoveAttrs((attr: MoveAttr) => attr instanceof MoveEffectAttr && (attr as MoveEffectAttr).trigger === MoveEffectTrigger.HIT && (!attr.selfTarget || firstHit), + Utils.executeIf(!isProtected && !chargeEffect, () => applyFilteredMoveAttrs((attr: MoveAttr) => attr instanceof MoveEffectAttr && (attr as MoveEffectAttr).trigger === MoveEffectTrigger.HIT && (!attr.firstHitOnly || firstHit), user, target, this.move.getMove()).then(() => { return Utils.executeIf(!target.isFainted(), () => applyPostDefendAbAttrs(PostDefendAbAttr, target, user, this.move, hitResult).then(() => { if (!user.isPlayer() && this.move.getMove() instanceof AttackMove) diff --git a/src/ui/daily-run-scoreboard.ts b/src/ui/daily-run-scoreboard.ts index 924fc9cf7..ada896e1c 100644 --- a/src/ui/daily-run-scoreboard.ts +++ b/src/ui/daily-run-scoreboard.ts @@ -54,10 +54,10 @@ export class DailyRunScoreboard extends Phaser.GameObjects.Container { const usernameLabel = addTextObject(this.scene, 12, 0, username, TextStyle.WINDOW, { fontSize: '54px' }); entryContainer.add(usernameLabel); - const scoreLabel = addTextObject(this.scene, 68, 0, score, TextStyle.WINDOW, { fontSize: '54px' }); + const scoreLabel = addTextObject(this.scene, 84, 0, score, TextStyle.WINDOW, { fontSize: '54px' }); entryContainer.add(scoreLabel); - const waveLabel = addTextObject(this.scene, 90, 0, wave, TextStyle.WINDOW, { fontSize: '54px' }); + const waveLabel = addTextObject(this.scene, 68, 0, wave, TextStyle.WINDOW, { fontSize: '54px' }); entryContainer.add(waveLabel); return entryContainer;