From 24c254666b95b8d623107b6610e1bed6ce16f3c2 Mon Sep 17 00:00:00 2001 From: Alexander B <4866817+MathyFurret@users.noreply.github.com> Date: Sun, 22 Jan 2023 13:39:22 -0600 Subject: [PATCH] Fortemons: Fix base power and type modifiers (#9343) * Fortemons: Fix base power modifiers * Extract ModifyType and remove redundant checks --- config/formats.ts | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/config/formats.ts b/config/formats.ts index ee27150955..3b7dfa63eb 100644 --- a/config/formats.ts +++ b/config/formats.ts @@ -985,7 +985,6 @@ export const Formats: FormatList = [ } } forte.onModifyMove?.call(this, move, pokemon, target); - if (target) forte.onModifyType?.call(this, move, pokemon, target); } }, onModifyPriority(priority, source, target, move) { @@ -997,18 +996,25 @@ export const Formats: FormatList = [ return priority + forte.priority; } }, + onModifyTypePriority: 1, + onModifyType(move, pokemon, target) { + const forte = pokemon.m.forte; + if (move.category !== 'Status' && forte) { + this.singleEvent('ModifyType', forte, null, pokemon, target, move, move); + } + }, onHitPriority: 1, onHit(target, source, move) { const forte = source.m.forte; if (move?.category !== 'Status' && forte) { - if (forte.onHit) this.singleEvent('Hit', forte, {}, target, source, move); - if (forte.self?.onHit) this.singleEvent('Hit', forte.self, {}, source, source, move); - if (forte.onAfterHit) this.singleEvent('AfterHit', forte, {}, target, source, move); + this.singleEvent('Hit', forte, {}, target, source, move); + if (forte.self) this.singleEvent('Hit', forte.self, {}, source, source, move); + this.singleEvent('AfterHit', forte, {}, target, source, move); } }, onAfterSubDamage(damage, target, source, move) { const forte = source.m.forte; - if (move?.category !== 'Status' && forte?.onAfterSubDamage) { + if (move?.category !== 'Status' && forte) { this.singleEvent('AfterSubDamage', forte, null, target, source, move); } }, @@ -1018,7 +1024,7 @@ export const Formats: FormatList = [ onAfterMoveSecondaryPriority: 1, onAfterMoveSecondarySelf(source, target, move) { const forte = source.m.forte; - if (move?.category !== 'Status' && forte?.onAfterMoveSecondarySelf) { + if (move?.category !== 'Status' && forte) { this.singleEvent('AfterMoveSecondarySelf', forte, null, source, target, move); } }, @@ -1026,7 +1032,7 @@ export const Formats: FormatList = [ onBasePower(basePower, source, target, move) { const forte = source.m.forte; if (move.category !== 'Status' && forte?.onBasePower) { - this.singleEvent('BasePower', forte, null, source, target, move, basePower); + forte.onBasePower.call(this, basePower, source, target, move); } }, pokemon: {