Add lower level limit to legendaries
parent
14c792506f
commit
ebff806dbd
28
src/arena.ts
28
src/arena.ts
|
@ -25,7 +25,7 @@ export class Arena {
|
||||||
this.pokemonPool = biomePools[biome];
|
this.pokemonPool = biomePools[biome];
|
||||||
}
|
}
|
||||||
|
|
||||||
randomSpecies(waveIndex: integer, level: integer): PokemonSpecies {
|
randomSpecies(waveIndex: integer, level: integer, attempt?: integer): PokemonSpecies {
|
||||||
const isBoss = (waveIndex >= 100 || waveIndex % 10 === 0) && !!this.pokemonPool[BiomePoolTier.BOSS].length;
|
const isBoss = (waveIndex >= 100 || waveIndex % 10 === 0) && !!this.pokemonPool[BiomePoolTier.BOSS].length;
|
||||||
const tierValue = Utils.randInt(!isBoss ? 512 : 64);
|
const tierValue = Utils.randInt(!isBoss ? 512 : 64);
|
||||||
let tier = !isBoss
|
let tier = !isBoss
|
||||||
|
@ -38,6 +38,7 @@ export class Arena {
|
||||||
}
|
}
|
||||||
const tierPool = this.pokemonPool[tier];
|
const tierPool = this.pokemonPool[tier];
|
||||||
let ret: PokemonSpecies;
|
let ret: PokemonSpecies;
|
||||||
|
let regen = false;
|
||||||
if (!tierPool.length)
|
if (!tierPool.length)
|
||||||
ret = this.scene.randomSpecies(waveIndex, level);
|
ret = this.scene.randomSpecies(waveIndex, level);
|
||||||
else {
|
else {
|
||||||
|
@ -61,7 +62,30 @@ export class Arena {
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = getPokemonSpecies(species);
|
ret = getPokemonSpecies(species);
|
||||||
|
|
||||||
|
if (ret.legendary || ret.pseudoLegendary || ret.mythical) {
|
||||||
|
switch (true) {
|
||||||
|
case (ret.baseTotal >= 720):
|
||||||
|
regen = level < 90;
|
||||||
|
break;
|
||||||
|
case (ret.baseTotal >= 670):
|
||||||
|
regen = level < 70;
|
||||||
|
break;
|
||||||
|
case (ret.baseTotal >= 580):
|
||||||
|
regen = level < 50;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
regen = level < 30;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (regen && (attempt || 0) < 10) {
|
||||||
|
console.log('Incompatible level: regenerating...');
|
||||||
|
return this.randomSpecies(waveIndex, level, (attempt || 0) + 1);
|
||||||
|
}
|
||||||
|
|
||||||
const newSpeciesId = ret.getSpeciesForLevel(level);
|
const newSpeciesId = ret.getSpeciesForLevel(level);
|
||||||
if (newSpeciesId !== ret.speciesId) {
|
if (newSpeciesId !== ret.speciesId) {
|
||||||
console.log('Replaced', Species[ret.speciesId], 'with', Species[newSpeciesId]);
|
console.log('Replaced', Species[ret.speciesId], 'with', Species[newSpeciesId]);
|
||||||
|
@ -102,8 +126,6 @@ export class Arena {
|
||||||
if (this.weather?.weatherType === (weather || undefined))
|
if (this.weather?.weatherType === (weather || undefined))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
console.log('set weather', WeatherType[weather]);
|
|
||||||
|
|
||||||
const oldWeatherType = this.weather?.weatherType || WeatherType.NONE;
|
const oldWeatherType = this.weather?.weatherType || WeatherType.NONE;
|
||||||
this.weather = weather ? new Weather(weather, viaMove ? 5 : 0) : null;
|
this.weather = weather ? new Weather(weather, viaMove ? 5 : 0) : null;
|
||||||
|
|
||||||
|
|
|
@ -239,6 +239,10 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
|
if (!this.scene) {
|
||||||
|
resolve();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (duration)
|
if (duration)
|
||||||
this.scene.sound.stopByKey('exp');
|
this.scene.sound.stopByKey('exp');
|
||||||
if (ratio === 1) {
|
if (ratio === 1) {
|
||||||
|
@ -270,7 +274,7 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
|
||||||
}
|
}
|
||||||
|
|
||||||
setHpNumbers(hp: integer, maxHp: integer) {
|
setHpNumbers(hp: integer, maxHp: integer) {
|
||||||
if (!this.player)
|
if (!this.player || !this.scene)
|
||||||
return;
|
return;
|
||||||
this.hpNumbersContainer.removeAll(true);
|
this.hpNumbersContainer.removeAll(true);
|
||||||
const hpStr = hp.toString();
|
const hpStr = hp.toString();
|
||||||
|
|
Loading…
Reference in New Issue