Fix seed not resetting every run

This commit is contained in:
Flashfyre 2023-10-19 22:19:14 -04:00
parent e54632007d
commit 245d07b307
2 changed files with 3 additions and 5 deletions

View File

@ -317,9 +317,6 @@ export default class BattleScene extends Phaser.Scene {
} }
create() { create() {
this.seed = this.game.config.seed[0];
console.log('Seed:', this.seed);
initGameSpeed.apply(this); initGameSpeed.apply(this);
this.setupControls(); this.setupControls();
@ -535,6 +532,9 @@ export default class BattleScene extends Phaser.Scene {
} }
reset(): void { reset(): void {
this.seed = Utils.randomString(16);
console.log('Seed:', this.seed);
this.pokeballCounts = Object.fromEntries(Utils.getEnumValues(PokeballType).filter(p => p <= PokeballType.MASTER_BALL).map(t => [ t, 0 ])); this.pokeballCounts = Object.fromEntries(Utils.getEnumValues(PokeballType).filter(p => p <= PokeballType.MASTER_BALL).map(t => [ t, 0 ]));
this.pokeballCounts[PokeballType.POKEBALL] += 5; this.pokeballCounts[PokeballType.POKEBALL] += 5;

View File

@ -1,11 +1,9 @@
import Phaser from 'phaser'; import Phaser from 'phaser';
import BattleScene from './battle-scene'; import BattleScene from './battle-scene';
import * as Utils from './utils';
const config: Phaser.Types.Core.GameConfig = { const config: Phaser.Types.Core.GameConfig = {
type: Phaser.WEBGL, type: Phaser.WEBGL,
parent: 'app', parent: 'app',
seed: [ Utils.randomString(16) ],
scale: { scale: {
width: 1920, width: 1920,
height: 1080, height: 1080,