Tweak species evolution logic
This commit is contained in:
1 parent
cc5f15e00e
commit
ae42dac370
4 files changed
+12
-10
No files matched your search
@@ -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;
|
||||
|
||||
@@ -549,7 +549,7 @@ function getGymLeaderPartyTemplate(scene: BattleScene) {
|
||||
|
||||
function getRandomPartyMemberFunc(speciesPool: Species[], postProcess?: (enemyPokemon: EnemyPokemon) => void): PartyMemberFunc {
|
||||
return (scene: BattleScene, level: integer) => {
|
||||
const species = getPokemonSpecies(Phaser.Math.RND.pick(speciesPool)).getSpeciesForLevel(level, true, true);
|
||||
const species = getPokemonSpecies(Phaser.Math.RND.pick(speciesPool)).getSpeciesForLevel(level, true, true, scene.currentBattle.trainer.config.isBoss);
|
||||
const ret = new EnemyPokemon(scene, getPokemonSpecies(species), level, true);
|
||||
if (postProcess)
|
||||
postProcess(ret);
|
||||
@@ -561,7 +561,7 @@ function getSpeciesFilterRandomPartyMemberFunc(speciesFilter: PokemonSpeciesFilt
|
||||
const originalSpeciesFilter = speciesFilter;
|
||||
speciesFilter = (species: PokemonSpecies) => allowLegendaries || (!species.legendary && !species.pseudoLegendary && !species.mythical) && originalSpeciesFilter(species);
|
||||
return (scene: BattleScene, level: integer) => {
|
||||
const ret = new EnemyPokemon(scene, getPokemonSpecies(scene.randomSpecies(scene.currentBattle.waveIndex, level, false, speciesFilter).getSpeciesForLevel(level, true, true)), level, true);
|
||||
const ret = new EnemyPokemon(scene, getPokemonSpecies(scene.randomSpecies(scene.currentBattle.waveIndex, level, false, speciesFilter).getSpeciesForLevel(level, true, true, scene.currentBattle.trainer.config.isBoss)), level, true);
|
||||
if (postProcess)
|
||||
postProcess(ret);
|
||||
return ret;
|
||||
|
||||
Reference in new issue
Block a user