Add 50% chance to offset gym leader wave by 10 in classic

pull/16/head
Flashfyre 2024-03-25 11:00:42 -04:00
parent a22d50caa7
commit 892d99a4f9
6 changed files with 26 additions and 14 deletions

View File

@ -153,6 +153,7 @@ export default class BattleScene extends Phaser.Scene {
public seed: string; public seed: string;
public waveSeed: string; public waveSeed: string;
public waveCycleOffset: integer; public waveCycleOffset: integer;
public offsetGym: boolean;
public damageNumberHandler: DamageNumberHandler public damageNumberHandler: DamageNumberHandler
private spriteSparkleHandler: PokemonSpriteSparkleHandler; private spriteSparkleHandler: PokemonSpriteSparkleHandler;
@ -764,15 +765,16 @@ export default class BattleScene extends Phaser.Scene {
setSeed(seed: string): void { setSeed(seed: string): void {
this.seed = seed; this.seed = seed;
this.waveCycleOffset = this.getGenerateWaveCycleOffset(); this.waveCycleOffset = this.getGeneratedWaveCycleOffset();
this.offsetGym = this.gameMode.isClassic && this.getGeneratedOffsetGym();
} }
reset(clearScene?: boolean): void { reset(clearScene?: boolean): void {
this.gameMode = gameModes[GameModes.CLASSIC];
this.setSeed(Utils.randomString(24)); this.setSeed(Utils.randomString(24));
console.log('Seed:', this.seed); console.log('Seed:', this.seed);
this.gameMode = gameModes[GameModes.CLASSIC];
this.score = 0; this.score = 0;
this.money = 0; this.money = 0;
@ -1021,7 +1023,15 @@ export default class BattleScene extends Phaser.Scene {
return this.arena.getSpeciesFormIndex(species); return this.arena.getSpeciesFormIndex(species);
} }
private getGenerateWaveCycleOffset(): integer { private getGeneratedOffsetGym(): boolean {
let ret = false;
this.executeWithSeedOffset(() => {
ret = !Utils.randSeedInt(2);
}, 0, this.seed.toString());
return ret;
}
private getGeneratedWaveCycleOffset(): integer {
let ret = 0; let ret = 0;
this.executeWithSeedOffset(() => { this.executeWithSeedOffset(() => {
ret = Utils.randSeedInt(8) * 5; ret = Utils.randSeedInt(8) * 5;

View File

@ -128,7 +128,7 @@ export class Arena {
randomTrainerType(waveIndex: integer): TrainerType { randomTrainerType(waveIndex: integer): TrainerType {
const isBoss = !!this.trainerPool[BiomePoolTier.BOSS].length const isBoss = !!this.trainerPool[BiomePoolTier.BOSS].length
&& this.scene.gameMode.isTrainerBoss(waveIndex, this.biomeType); && this.scene.gameMode.isTrainerBoss(waveIndex, this.biomeType, this.scene.offsetGym);
console.log(isBoss, this.trainerPool) console.log(isBoss, this.trainerPool)
const tierValue = Utils.randSeedInt(!isBoss ? 512 : 64); const tierValue = Utils.randSeedInt(!isBoss ? 512 : 64);
let tier = !isBoss let tier = !isBoss

View File

@ -78,7 +78,7 @@ export class GameMode implements GameModeConfig {
isWaveTrainer(waveIndex: integer, arena: Arena): boolean { isWaveTrainer(waveIndex: integer, arena: Arena): boolean {
if (this.isDaily) if (this.isDaily)
return waveIndex % 10 === 5 || (!(waveIndex % 10) && waveIndex > 10 && !this.isWaveFinal(waveIndex)); return waveIndex % 10 === 5 || (!(waveIndex % 10) && waveIndex > 10 && !this.isWaveFinal(waveIndex));
if ((waveIndex % 30) === 20 && !this.isWaveFinal(waveIndex)) if ((waveIndex % 30) === (arena.scene.offsetGym ? 0 : 20) && !this.isWaveFinal(waveIndex))
return true; return true;
else if (waveIndex % 10 !== 1 && waveIndex % 10) { else if (waveIndex % 10 !== 1 && waveIndex % 10) {
const trainerChance = arena.getTrainerChance(); const trainerChance = arena.getTrainerChance();
@ -88,7 +88,7 @@ export class GameMode implements GameModeConfig {
for (let w = Math.max(waveIndex - 3, waveBase + 2); w <= Math.min(waveIndex + 3, waveBase + 9); w++) { for (let w = Math.max(waveIndex - 3, waveBase + 2); w <= Math.min(waveIndex + 3, waveBase + 9); w++) {
if (w === waveIndex) if (w === waveIndex)
continue; continue;
if ((w % 30) === 20 || fixedBattles.hasOwnProperty(w)) { if ((w % 30) === (arena.scene.offsetGym ? 0 : 20) || fixedBattles.hasOwnProperty(w)) {
allowTrainerBattle = false; allowTrainerBattle = false;
break; break;
} else if (w < waveIndex) { } else if (w < waveIndex) {
@ -107,12 +107,12 @@ export class GameMode implements GameModeConfig {
return false; return false;
} }
isTrainerBoss(waveIndex: integer, biomeType: Biome): boolean { isTrainerBoss(waveIndex: integer, biomeType: Biome, offsetGym: boolean): boolean {
switch (this.modeId) { switch (this.modeId) {
case GameModes.DAILY: case GameModes.DAILY:
return waveIndex > 10 && waveIndex < 50 && !(waveIndex % 10); return waveIndex > 10 && waveIndex < 50 && !(waveIndex % 10);
default: default:
return (waveIndex % 30) === 20 && (biomeType !== Biome.END || this.isClassic || this.isWaveFinal(waveIndex)); return (waveIndex % 30) === (offsetGym ? 0 : 20) && (biomeType !== Biome.END || this.isClassic || this.isWaveFinal(waveIndex));
} }
} }

View File

@ -221,10 +221,11 @@ export class TitlePhase extends Phase {
this.scene.sessionSlotId = slotId; this.scene.sessionSlotId = slotId;
fetchDailyRunSeed().then(seed => { fetchDailyRunSeed().then(seed => {
this.scene.gameMode = gameModes[GameModes.DAILY];
this.scene.setSeed(seed); this.scene.setSeed(seed);
this.scene.resetSeed(1); this.scene.resetSeed(1);
this.scene.gameMode = gameModes[GameModes.DAILY];
this.scene.money = this.scene.gameMode.getStartingMoney(); this.scene.money = this.scene.gameMode.getStartingMoney();
const starters = getDailyRunStarters(this.scene, seed); const starters = getDailyRunStarters(this.scene, seed);
@ -2980,7 +2981,7 @@ export class VictoryPhase extends PokemonPhase {
if (this.scene.currentBattle.waveIndex > 10 && !this.scene.gameMode.isWaveFinal(this.scene.currentBattle.waveIndex)) if (this.scene.currentBattle.waveIndex > 10 && !this.scene.gameMode.isWaveFinal(this.scene.currentBattle.waveIndex))
this.scene.pushPhase(new ModifierRewardPhase(this.scene, modifierTypes.GOLDEN_POKEBALL)); this.scene.pushPhase(new ModifierRewardPhase(this.scene, modifierTypes.GOLDEN_POKEBALL));
} else { } else {
const superExpWave = !this.scene.gameMode.isEndless ? 20 : 10; const superExpWave = !this.scene.gameMode.isEndless ? (this.scene.offsetGym ? 0 : 20) : 10;
if (this.scene.gameMode.isEndless && this.scene.currentBattle.waveIndex === 10) if (this.scene.gameMode.isEndless && this.scene.currentBattle.waveIndex === 10)
this.scene.pushPhase(new ModifierRewardPhase(this.scene, modifierTypes.EXP_SHARE)); this.scene.pushPhase(new ModifierRewardPhase(this.scene, modifierTypes.EXP_SHARE));
if (this.scene.currentBattle.waveIndex <= 750 && (this.scene.currentBattle.waveIndex <= 500 || (this.scene.currentBattle.waveIndex % 30) === superExpWave)) if (this.scene.currentBattle.waveIndex <= 750 && (this.scene.currentBattle.waveIndex <= 500 || (this.scene.currentBattle.waveIndex % 30) === superExpWave))

View File

@ -543,13 +543,13 @@ export class GameData {
const initSessionFromData = async sessionData => { const initSessionFromData = async sessionData => {
console.debug(sessionData); console.debug(sessionData);
scene.gameMode = gameModes[sessionData.gameMode || GameModes.CLASSIC];
scene.setSeed(sessionData.seed || scene.game.config.seed[0]); scene.setSeed(sessionData.seed || scene.game.config.seed[0]);
scene.resetSeed(); scene.resetSeed();
scene.sessionPlayTime = sessionData.playTime || 0; scene.sessionPlayTime = sessionData.playTime || 0;
scene.gameMode = gameModes[sessionData.gameMode || GameModes.CLASSIC];
const loadPokemonAssets: Promise<void>[] = []; const loadPokemonAssets: Promise<void>[] = [];
const party = scene.getParty(); const party = scene.getParty();

View File

@ -114,7 +114,8 @@ export default class PokemonInfoContainer extends Phaser.GameObjects.Container {
this.pokemonGenderText.setShadowColor(getGenderColor(pokemon.gender, true)); this.pokemonGenderText.setShadowColor(getGenderColor(pokemon.gender, true));
this.pokemonGenderLabelText.setVisible(true); this.pokemonGenderLabelText.setVisible(true);
this.pokemonGenderText.setVisible(true); this.pokemonGenderText.setVisible(true);
} } else
this.pokemonGenderText.setVisible(false);
this.pokemonAbilityText.setText(pokemon.getAbility(true).name); this.pokemonAbilityText.setText(pokemon.getAbility(true).name);
this.pokemonNatureText.setText(getNatureName(pokemon.nature, true)); this.pokemonNatureText.setText(getNatureName(pokemon.nature, true));