From 01a4d64392a6cc5924d6ebdde6a8914cdec7a79a Mon Sep 17 00:00:00 2001 From: AJ Fontaine Date: Mon, 4 Nov 2024 17:04:19 -0500 Subject: [PATCH] Use less insane catch formula --- src/data/pokeball.ts | 6 +++--- src/phases/attempt-capture-phase.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/data/pokeball.ts b/src/data/pokeball.ts index f5181e81882..1198ced580b 100644 --- a/src/data/pokeball.ts +++ b/src/data/pokeball.ts @@ -85,7 +85,7 @@ export function getPokeballTintColor(type: PokeballType): number { /** * Gets the critical capture chance based on number of mons registered in Dex and modified {@link https://bulbapedia.bulbagarden.net/wiki/Catch_rate Catch rate} - * Formula from {@link https://bulbapedia.bulbagarden.net/wiki/Catch_rate#Critical_capture Bulbapedia "Catch Rate" page} + * Formula from {@link https://www.dragonflycave.com/mechanics/gen-vi-vii-capturing Dragonfly Cave Gen 6 Capture Mechanics page} * @param scene {@linkcode BattleScene} current BattleScene * @param modifiedCatchRate the modified catch rate as calculated in {@linkcode AttemptCapturePhase} * @returns the chance of getting a critical capture, out of 256 @@ -96,14 +96,14 @@ export function getCriticalCaptureChance(scene: BattleScene, modifiedCatchRate: } const dexCount = scene.gameData.getSpeciesCount(d => !!d.caughtAttr); const catchingCharmMultiplier = new NumberHolder(1); - //scene.findModifier(m => m instanceof CriticalCaptureBoostModifier)?.apply(catchingCharmMultiplier); + //scene.findModifier(m => m instanceof CriticalCatchChanceBoosterModifier)?.apply(catchingCharmMultiplier); const dexMultiplier = dexCount > 800 ? 2.5 : dexCount > 600 ? 2 : dexCount > 400 ? 1.5 : dexCount > 200 ? 1 : dexCount > 100 ? 0.5 : 0; - return Math.floor(catchingCharmMultiplier.value * dexMultiplier * modifiedCatchRate / 6); + return Math.floor(catchingCharmMultiplier.value * dexMultiplier * Math.min(255, modifiedCatchRate) / 6); } export function doPokeballBounceAnim(scene: BattleScene, pokeball: Phaser.GameObjects.Sprite, y1: number, y2: number, baseBounceDuration: integer, callback: Function, isCritical: boolean = false) { diff --git a/src/phases/attempt-capture-phase.ts b/src/phases/attempt-capture-phase.ts index 546ea3bfca5..1788e3c6e84 100644 --- a/src/phases/attempt-capture-phase.ts +++ b/src/phases/attempt-capture-phase.ts @@ -53,7 +53,7 @@ export class AttemptCapturePhase extends PokemonPhase { const pokeballMultiplier = getPokeballCatchMultiplier(this.pokeballType); const statusMultiplier = pokemon.status ? getStatusEffectCatchRateMultiplier(pokemon.status.effect) : 1; const modifiedCatchRate = Math.round((((_3m - _2h) * catchRate * pokeballMultiplier) / _3m) * statusMultiplier); - const shakeProbability = Math.round(65536 * Math.pow((modifiedCatchRate / 1044480), 0.1875)); // Formula taken from gen 6 + const shakeProbability = Math.round(65536 / Math.pow((255 / modifiedCatchRate), 0.1875)); // Formula taken from gen 6 const criticalCaptureChance = getCriticalCaptureChance(this.scene, modifiedCatchRate); const isCritical = pokemon.randSeedInt(256) < criticalCaptureChance; const fpOffset = pokemon.getFieldPositionOffset(); @@ -122,8 +122,8 @@ export class AttemptCapturePhase extends PokemonPhase { shakeCounter.stop(); this.failCatch(shakeCount); } else if (shakeCount++ < (isCritical ? 1 : 3)) { - // Shake check (skip check for critical captures, but still play the sound) - if (pokeballMultiplier === -1 || isCritical || pokemon.randSeedInt(65536) < shakeProbability) { + // Shake check (skip check for critical or guaranteed captures, but still play the sound) + if (pokeballMultiplier === -1 || isCritical || modifiedCatchRate >= 255 || pokemon.randSeedInt(65536) < shakeProbability) { this.scene.playSound("se/pb_move"); } else { shakeCounter.stop();