Tweak species evolution logic

This commit is contained in:
Flashfyre committed 2024-01-01 15:27:47 -05:00
1 parent cc5f15e00e
commit ae42dac370
4 files changed
+12 -10

No files matched your search

+6 -4
View File
@@ -344,7 +344,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm {
return this.name;
}
getSpeciesForLevel(level: integer, allowEvolving?: boolean, forTrainer?: boolean): Species {
getSpeciesForLevel(level: integer, allowEvolving: boolean = false, forTrainer: boolean = false, isBoss: boolean = false): Species {
const prevolutionLevels = this.getPrevolutionLevels();
if (prevolutionLevels.length) {
@@ -379,9 +379,11 @@ export default class PokemonSpecies extends PokemonSpeciesForm {
if (!forTrainer && isRegional)
evolutionChance = 0;
else if (ev.wildDelay === SpeciesWildEvolutionDelay.NONE) {
evolutionChance = Math.min(0.5 + easeInFunc(Math.min(level - ev.level, 40) / 40) / 2, 1);
const maxLevelDiff = forTrainer || isBoss ? forTrainer && isBoss ? 10 : 20 : 40;
const minChance = forTrainer ? 0.5 : 0.75;
evolutionChance = Math.min(minChance + easeInFunc(Math.min(level - ev.level, maxLevelDiff) / maxLevelDiff) * (1 - minChance), 1);
} else {
let preferredMinLevel = (ev.level - 1) + ev.wildDelay * 10;
let preferredMinLevel = (ev.level - 1) + ev.wildDelay * (forTrainer || isBoss ? forTrainer && isBoss ? 5 : 10 : 20);
let evolutionLevel = ev.level > 1 ? ev.level : Math.floor(preferredMinLevel / 2);
if (ev.level <= 1 && pokemonPrevolutions.hasOwnProperty(this.speciesId)) {
@@ -413,7 +415,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm {
for (let weight of evolutionPool.keys()) {
if (randValue < weight)
return getPokemonSpecies(evolutionPool.get(weight)).getSpeciesForLevel(level, true);
return getPokemonSpecies(evolutionPool.get(weight)).getSpeciesForLevel(level, true, forTrainer, isBoss);
}
return this.speciesId;