From 69c58549bdefef9977a65c9ccaee1e101ec83b20 Mon Sep 17 00:00:00 2001 From: Waleed Hassan Date: Mon, 25 Sep 2023 11:26:06 +0300 Subject: [PATCH] Fix more multihit bugs --- calc/src/mechanics/gen789.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/calc/src/mechanics/gen789.ts b/calc/src/mechanics/gen789.ts index 353df05ae..d9712cb4a 100644 --- a/calc/src/mechanics/gen789.ts +++ b/calc/src/mechanics/gen789.ts @@ -645,6 +645,25 @@ export function calculateSMSSSV( if (isCritical) { newBaseDamage = Math.floor(OF32(newBaseDamage * 1.5)); } + // TODO probably move these to a common function + const isSpread = field.gameType !== 'Singles' && + ['allAdjacent', 'allAdjacentFoes'].includes(move.target); + if (isSpread) { + newBaseDamage = pokeRound(OF32(newBaseDamage * 3072) / 4096); + } + if (!defender.hasItem('Utility Umbrella')) { + if ( + (field.hasWeather('Sun', 'Harsh Sunshine') && move.hasType('Fire')) || + (field.hasWeather('Rain', 'Heavy Rain') && move.hasType('Water')) + ) { + newBaseDamage = pokeRound(OF32(newBaseDamage * 6144) / 4096); + } else if ( + (field.hasWeather('Sun') && move.hasType('Water')) || + (field.hasWeather('Rain') && move.hasType('Fire')) + ) { + newBaseDamage = pokeRound(OF32(newBaseDamage * 2048) / 4096); + } + } const newFinalDamage = getFinalDamage( newBaseDamage, damageMultiplier,