mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-21 15:52:18 +02:00
Undo evolution reroll optimization extraneous to PR
This commit is contained in:
parent
a5f54447c5
commit
b3fff775e4
@ -779,8 +779,8 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
|
|||||||
return this.getSpeciesForLevel(level, allowEvolving, false, (isBoss ? PartyMemberStrength.WEAKER : PartyMemberStrength.AVERAGE) + (gameMode?.isEndless ? 1 : 0));
|
return this.getSpeciesForLevel(level, allowEvolving, false, (isBoss ? PartyMemberStrength.WEAKER : PartyMemberStrength.AVERAGE) + (gameMode?.isEndless ? 1 : 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
getTrainerSpeciesForLevel(level: number, allowEvolving: boolean = false, strength: PartyMemberStrength, currentWave: number = 0, type: Type = Type.UNKNOWN): Species {
|
getTrainerSpeciesForLevel(level: number, allowEvolving: boolean = false, strength: PartyMemberStrength, currentWave: number = 0): Species {
|
||||||
return this.getSpeciesForLevel(level, allowEvolving, true, strength, currentWave, type);
|
return this.getSpeciesForLevel(level, allowEvolving, true, strength, currentWave);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -818,7 +818,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getSpeciesForLevel(level: number, allowEvolving: boolean = false, forTrainer: boolean = false, strength: PartyMemberStrength = PartyMemberStrength.WEAKER, currentWave: number = 0, type: Type = Type.UNKNOWN): Species {
|
getSpeciesForLevel(level: number, allowEvolving: boolean = false, forTrainer: boolean = false, strength: PartyMemberStrength = PartyMemberStrength.WEAKER, currentWave: number = 0): Species {
|
||||||
const prevolutionLevels = this.getPrevolutionLevels();
|
const prevolutionLevels = this.getPrevolutionLevels();
|
||||||
|
|
||||||
if (prevolutionLevels.length) {
|
if (prevolutionLevels.length) {
|
||||||
@ -834,9 +834,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
|
|||||||
return this.speciesId;
|
return this.speciesId;
|
||||||
}
|
}
|
||||||
|
|
||||||
const evolutions = forTrainer && type !== Type.UNKNOWN && pokemonEvolutions[this.speciesId].some(e => getPokemonSpecies(e.speciesId).isOfType(type)) // If this is for a trainer with specialty type and an evo exists with that type
|
const evolutions = pokemonEvolutions[this.speciesId];
|
||||||
? pokemonEvolutions[this.speciesId].filter(e => getPokemonSpecies(e.speciesId).isOfType(type)) // Filter out mistyped evos
|
|
||||||
: pokemonEvolutions[this.speciesId];
|
|
||||||
|
|
||||||
const easeInFunc = Phaser.Tweens.Builders.GetEaseFunction("Sine.easeIn");
|
const easeInFunc = Phaser.Tweens.Builders.GetEaseFunction("Sine.easeIn");
|
||||||
const easeOutFunc = Phaser.Tweens.Builders.GetEaseFunction("Sine.easeOut");
|
const easeOutFunc = Phaser.Tweens.Builders.GetEaseFunction("Sine.easeOut");
|
||||||
@ -912,7 +910,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
|
|||||||
|
|
||||||
for (const weight of evolutionPool.keys()) {
|
for (const weight of evolutionPool.keys()) {
|
||||||
if (randValue < weight) {
|
if (randValue < weight) {
|
||||||
return getPokemonSpecies(evolutionPool.get(weight)).getSpeciesForLevel(level, true, forTrainer, strength, currentWave, type);
|
return getPokemonSpecies(evolutionPool.get(weight)).getSpeciesForLevel(level, true, forTrainer, strength, currentWave);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -421,7 +421,7 @@ export default class Trainer extends Phaser.GameObjects.Container {
|
|||||||
baseSpecies = globalScene.randomSpecies(battle.waveIndex, level, false, this.config.speciesFilter);
|
baseSpecies = globalScene.randomSpecies(battle.waveIndex, level, false, this.config.speciesFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
let ret = getPokemonSpecies(baseSpecies.getTrainerSpeciesForLevel(level, true, strength, globalScene.currentBattle.waveIndex, this.config.specialtyType));
|
let ret = getPokemonSpecies(baseSpecies.getTrainerSpeciesForLevel(level, true, strength, globalScene.currentBattle.waveIndex));
|
||||||
let retry = false;
|
let retry = false;
|
||||||
|
|
||||||
console.log(ret.getName());
|
console.log(ret.getName());
|
||||||
@ -435,6 +435,21 @@ export default class Trainer extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prompts reroll of party member species if doesn't fit specialty type.
|
||||||
|
// Can be removed by adding a type parameter to getTrainerSpeciesForLevel and filtering the list of evolutions for that type.
|
||||||
|
if (!retry && this.config.specialtyType > Type.UNKNOWN && !ret.isOfType(this.config.specialtyType)) {
|
||||||
|
retry = true;
|
||||||
|
console.log("Attempting reroll of species evolution to fit specialty type...");
|
||||||
|
let evoAttempt = 0;
|
||||||
|
while (retry && evoAttempt++ < 10) {
|
||||||
|
ret = getPokemonSpecies(baseSpecies.getTrainerSpeciesForLevel(level, true, strength, globalScene.currentBattle.waveIndex));
|
||||||
|
console.log(ret.name);
|
||||||
|
if (!ret.isOfType(this.config.specialtyType)) {
|
||||||
|
retry = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Prompts reroll of party member species if species already present in the enemy party
|
// Prompts reroll of party member species if species already present in the enemy party
|
||||||
if (this.checkDuplicateSpecies(baseSpecies.speciesId)) {
|
if (this.checkDuplicateSpecies(baseSpecies.speciesId)) {
|
||||||
console.log("Duplicate species detected, prompting reroll...");
|
console.log("Duplicate species detected, prompting reroll...");
|
||||||
|
Loading…
Reference in New Issue
Block a user