Bosses generate with higher IVs
This commit is contained in:
parent
8915b2acec
commit
23e3bdc960
|
@ -758,6 +758,12 @@ export default class BattleScene extends Phaser.Scene {
|
|||
|
||||
addEnemyPokemon(species: PokemonSpecies, level: integer, trainerSlot: TrainerSlot, boss: boolean = false, dataSource?: PokemonData, postProcess?: (enemyPokemon: EnemyPokemon) => void): EnemyPokemon {
|
||||
const pokemon = new EnemyPokemon(this, species, level, trainerSlot, boss, dataSource);
|
||||
if (boss) {
|
||||
const secondaryIvs = Utils.getIvsFromId(Utils.randSeedInt(4294967295));
|
||||
|
||||
for (let s = 0; s < pokemon.ivs.length; s++)
|
||||
pokemon.ivs[s] = Math.round(Phaser.Math.Linear(Math.min(pokemon.ivs[s], secondaryIvs[s]), Math.max(pokemon.ivs[s], secondaryIvs[s]), 0.75));
|
||||
}
|
||||
if (postProcess)
|
||||
postProcess(pokemon);
|
||||
pokemon.init();
|
||||
|
|
|
@ -382,15 +382,7 @@ export class EggHatchPhase extends Phase {
|
|||
|
||||
ret.trySetShiny(this.egg.gachaType === GachaType.SHINY ? 1024 : 512);
|
||||
|
||||
const secondaryId = Utils.randSeedInt(4294967295);
|
||||
const secondaryIvs = [
|
||||
Utils.binToDec(Utils.decToBin(secondaryId).substring(0, 5)),
|
||||
Utils.binToDec(Utils.decToBin(secondaryId).substring(5, 10)),
|
||||
Utils.binToDec(Utils.decToBin(secondaryId).substring(10, 15)),
|
||||
Utils.binToDec(Utils.decToBin(secondaryId).substring(15, 20)),
|
||||
Utils.binToDec(Utils.decToBin(secondaryId).substring(20, 25)),
|
||||
Utils.binToDec(Utils.decToBin(secondaryId).substring(25, 30))
|
||||
];
|
||||
const secondaryIvs = Utils.getIvsFromId(Utils.randSeedInt(4294967295));
|
||||
|
||||
for (let s = 0; s < ret.ivs.length; s++)
|
||||
ret.ivs[s] = Math.max(ret.ivs[s], secondaryIvs[s]);
|
||||
|
|
|
@ -145,14 +145,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
this.fusionGender = dataSource.fusionGender;
|
||||
} else {
|
||||
this.id = Utils.randSeedInt(4294967296);
|
||||
this.ivs = ivs || [
|
||||
Utils.binToDec(Utils.decToBin(this.id).substring(0, 5)),
|
||||
Utils.binToDec(Utils.decToBin(this.id).substring(5, 10)),
|
||||
Utils.binToDec(Utils.decToBin(this.id).substring(10, 15)),
|
||||
Utils.binToDec(Utils.decToBin(this.id).substring(15, 20)),
|
||||
Utils.binToDec(Utils.decToBin(this.id).substring(20, 25)),
|
||||
Utils.binToDec(Utils.decToBin(this.id).substring(25, 30))
|
||||
];
|
||||
this.ivs = ivs || Utils.getIvsFromId(this.id);
|
||||
|
||||
if (this.gender === undefined) {
|
||||
if (this.species.malePercent === null)
|
||||
|
|
|
@ -645,7 +645,7 @@ export class EncounterPhase extends BattlePhase {
|
|||
this.scene.field.add(enemyPokemon);
|
||||
battle.seenEnemyPartyMemberIds.add(enemyPokemon.id);
|
||||
const playerPokemon = this.scene.getPlayerPokemon();
|
||||
if (playerPokemon.visible)
|
||||
if (playerPokemon?.visible)
|
||||
this.scene.field.moveBelow(enemyPokemon as Pokemon, playerPokemon);
|
||||
enemyPokemon.tint(0, 0.5);
|
||||
} else if (battle.battleType === BattleType.TRAINER) {
|
||||
|
|
11
src/utils.ts
11
src/utils.ts
|
@ -149,6 +149,17 @@ export function decToBin(input: integer): string {
|
|||
return bin;
|
||||
}
|
||||
|
||||
export function getIvsFromId(id: integer): integer[] {
|
||||
return [
|
||||
binToDec(decToBin(id).substring(0, 5)),
|
||||
binToDec(decToBin(id).substring(5, 10)),
|
||||
binToDec(decToBin(id).substring(10, 15)),
|
||||
binToDec(decToBin(id).substring(15, 20)),
|
||||
binToDec(decToBin(id).substring(20, 25)),
|
||||
binToDec(decToBin(id).substring(25, 30))
|
||||
];
|
||||
}
|
||||
|
||||
export function formatLargeNumber(count: integer, threshold: integer): string {
|
||||
if (count < threshold)
|
||||
return count.toString();
|
||||
|
|
Loading…
Reference in New Issue