From f9ec792bd08ac71f06a0b88f802e80e34a192d77 Mon Sep 17 00:00:00 2001 From: AJ Fontaine Date: Sat, 18 May 2024 17:21:25 -0400 Subject: [PATCH] Consider technician and priority on trainer moves when weighing --- src/field/pokemon.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 0a5e0a6a991..379e3b249f2 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -1266,7 +1266,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { // Weight towards higher power moves, by reducing the power of moves below the highest power. // Caps max power at 90 to avoid something like hyper beam ruining the stats. // This is a pretty soft weighting factor, although it is scaled with the weight multiplier. - const maxPower = Math.min(movePool.reduce((v, m) => Math.max(allMoves[m[0]].power, v), 40), 90); + // Account for technician boost and priority + const hasTechnician = this.hasAbility(Abilities.TECHNICIAN); + const maxPower = Math.min(movePool.reduce((v, m) => Math.max(allMoves[m[0]].power * (hasTechnician && allMoves[m[0]].power <= 60 ? 1.5 : 1) * (allMoves[m[0]].priority > 1 ? 1.5 : 1), v), 40), 90); movePool = movePool.map(m => [m[0], m[1] * (allMoves[m[0]].category === MoveCategory.STATUS ? 1 : Math.max(Math.min(allMoves[m[0]].power/maxPower, 1), 0.5))]); // Weight damaging moves against the lower stat