mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-26 09:19:31 +02:00
Fix updateCatchRate
Move updateCatchRate to BattleScene so it can't not have itself
This commit is contained in:
parent
b1a2943ff6
commit
f345b56b36
@ -1,6 +1,6 @@
|
||||
import Phaser from "phaser";
|
||||
import UI from "./ui/ui";
|
||||
import { NextEncounterPhase, NewBiomeEncounterPhase, SelectBiomePhase, MessagePhase, TurnInitPhase, ReturnPhase, LevelCapPhase, ShowTrainerPhase, LoginPhase, MovePhase, TitlePhase, SwitchPhase, runShinyCheck } from "./phases";
|
||||
import { NextEncounterPhase, NewBiomeEncounterPhase, SelectBiomePhase, MessagePhase, TurnInitPhase, ReturnPhase, LevelCapPhase, ShowTrainerPhase, LoginPhase, MovePhase, TitlePhase, SwitchPhase, runShinyCheck, findBest } from "./phases";
|
||||
import Pokemon, { PlayerPokemon, EnemyPokemon } from "./field/pokemon";
|
||||
import PokemonSpecies, { PokemonSpeciesFilter, allSpecies, getPokemonSpecies } from "./data/pokemon-species";
|
||||
import { Constructor } from "#app/utils";
|
||||
@ -1298,6 +1298,22 @@ export default class BattleScene extends SceneBase {
|
||||
LoggerTools.logLuck(this)
|
||||
}
|
||||
|
||||
updateCatchRate() {
|
||||
var txt = ["Turn: " + this.currentBattle.turn]
|
||||
if (!this.getEnemyField()[0].hasTrainer()) {
|
||||
this.getEnemyField().forEach((pk, i) => {
|
||||
if (pk.isActive() && pk.hp > 0)
|
||||
txt = txt.concat(findBest(this, pk))
|
||||
})
|
||||
}
|
||||
if (txt.length > 2) {
|
||||
txt = ["Turn: " + this.currentBattle.turn]
|
||||
}
|
||||
this.arenaFlyout.updateFieldText()
|
||||
|
||||
this.setScoreText(txt.join(" / "))
|
||||
}
|
||||
|
||||
newBattle(waveIndex?: integer, battleType?: BattleType, trainerData?: TrainerData, double?: boolean): Battle {
|
||||
const _startingWave = Overrides.STARTING_WAVE_OVERRIDE || startingWave;
|
||||
const newWaveIndex = waveIndex || ((this.currentBattle?.waveIndex || (_startingWave - 1)) + 1);
|
||||
|
@ -128,7 +128,7 @@ function catchCalcRaw(pokemon: EnemyPokemon) {
|
||||
* @param override Show the best Poké Ball to use, even if you don't have any.
|
||||
* @returns The name and % rate of the best Poké Ball.
|
||||
*/
|
||||
function findBest(scene: BattleScene, pokemon: EnemyPokemon, override?: boolean) {
|
||||
export function findBest(scene: BattleScene, pokemon: EnemyPokemon, override?: boolean) {
|
||||
var rates = catchCalc(pokemon)
|
||||
var rates_raw = catchCalcRaw(pokemon)
|
||||
var rolls = []
|
||||
@ -2974,26 +2974,11 @@ export class TurnInitPhase extends FieldPhase {
|
||||
|
||||
this.scene.pushPhase(new TurnStartPhase(this.scene));
|
||||
|
||||
updateCatchRate()
|
||||
this.scene.updateCatchRate()
|
||||
|
||||
this.end();
|
||||
}
|
||||
}
|
||||
function updateCatchRate() {
|
||||
var txt = ["Turn: " + this.scene.currentBattle.turn]
|
||||
if (!this.scene.getEnemyField()[0].hasTrainer()) {
|
||||
this.scene.getEnemyField().forEach((pk, i) => {
|
||||
if (pk.isActive() && pk.hp > 0)
|
||||
txt = txt.concat(findBest(this.scene, pk))
|
||||
})
|
||||
}
|
||||
if (txt.length > 2) {
|
||||
txt = ["Turn: " + this.scene.currentBattle.turn]
|
||||
}
|
||||
this.scene.arenaFlyout.updateFieldText()
|
||||
|
||||
this.scene.setScoreText(txt.join(" / "))
|
||||
}
|
||||
//#endregion
|
||||
|
||||
|
||||
@ -3312,7 +3297,7 @@ export class EnemyCommandPhase extends FieldPhase {
|
||||
|
||||
enemyPokemon.flyout.setText()
|
||||
|
||||
updateCatchRate()
|
||||
this.scene.updateCatchRate()
|
||||
|
||||
return this.end();
|
||||
}
|
||||
@ -3353,11 +3338,20 @@ export class EnemyCommandPhase extends FieldPhase {
|
||||
//LoggerTools.enemyPlan[this.fieldIndex*2 + 1] = "→ " + nextMove.targets.map((m) => targetLabels[m + 1])
|
||||
this.scene.arenaFlyout.updateFieldText()
|
||||
|
||||
updateCatchRate()
|
||||
this.scene.updateCatchRate()
|
||||
|
||||
this.end();
|
||||
}
|
||||
}
|
||||
export function enemyTurnCalc(scene: BattleScene) {
|
||||
scene.getField().forEach(pokemon => {
|
||||
if (pokemon.isActive()) {
|
||||
if (!pokemon.isPlayer()) {
|
||||
var pk = pokemon as EnemyPokemon;
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
//#endregion
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user