mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-20 06:19:29 +02:00
Use less insane catch formula
This commit is contained in:
parent
fd12027dc6
commit
01a4d64392
@ -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) {
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user