Fix double battle named trainers having unevolved Pokemon (#1582)
This commit is contained in:
parent
7e1b383be2
commit
ac4e72c87a
|
@ -233,7 +233,8 @@ export class TrainerConfig {
|
|||
}
|
||||
// If a special double trainer class was set, set it as the sprite key
|
||||
if (this.trainerTypeDouble && female && isDouble) {
|
||||
ret = TrainerType[this.trainerTypeDouble].toString().toLowerCase();
|
||||
// Get the derived type for the double trainer since the sprite key is based on the derived type
|
||||
ret = TrainerType[this.getDerivedType(this.trainerTypeDouble)].toString().toLowerCase();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -271,9 +272,13 @@ export class TrainerConfig {
|
|||
}
|
||||
|
||||
|
||||
|
||||
getDerivedType(): TrainerType {
|
||||
let trainerType = this.trainerType;
|
||||
/**
|
||||
* Returns the derived trainer type for a given trainer type.
|
||||
* @param trainerTypeToDeriveFrom - The trainer type to derive from. (If null, the this.trainerType property will be used.)
|
||||
* @returns {TrainerType} - The derived trainer type.
|
||||
*/
|
||||
getDerivedType(trainerTypeToDeriveFrom: TrainerType = null): TrainerType {
|
||||
let trainerType = trainerTypeToDeriveFrom ? trainerTypeToDeriveFrom : this.trainerType;
|
||||
switch (trainerType) {
|
||||
case TrainerType.RIVAL_2:
|
||||
case TrainerType.RIVAL_3:
|
||||
|
|
|
@ -328,12 +328,17 @@ export default class Trainer extends Phaser.GameObjects.Container {
|
|||
}
|
||||
|
||||
// If useNewSpeciesPool is true, we need to generate a new species from the new species pool, otherwise we generate a random species
|
||||
const species = useNewSpeciesPool
|
||||
let species = useNewSpeciesPool
|
||||
? getPokemonSpecies(newSpeciesPool[Math.floor(Math.random() * newSpeciesPool.length)])
|
||||
: template.isSameSpecies(index) && index > offset
|
||||
? getPokemonSpecies(battle.enemyParty[offset].species.getTrainerSpeciesForLevel(level, false, template.getStrength(offset)))
|
||||
: this.genNewPartyMemberSpecies(level, strength);
|
||||
|
||||
// If the species is from newSpeciesPool, we need to adjust it based on the level and strength
|
||||
if (newSpeciesPool) {
|
||||
species = getPokemonSpecies(species.getSpeciesForLevel(level, true, true, strength));
|
||||
}
|
||||
|
||||
ret = this.scene.addEnemyPokemon(species, level, !this.isDouble() || !(index % 2) ? TrainerSlot.TRAINER : TrainerSlot.TRAINER_PARTNER);
|
||||
}, this.config.hasStaticParty ? this.config.getDerivedType() + ((index + 1) << 8) : this.scene.currentBattle.waveIndex + (this.config.getDerivedType() << 10) + (((!this.config.useSameSeedForAllMembers ? index : 0) + 1) << 8));
|
||||
|
||||
|
|
Loading…
Reference in New Issue