mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-09-23 15:03:24 +02:00
make IVs use Uint8Array
This commit is contained in:
parent
cffbafe4bd
commit
0ebdc1b0ef
@ -866,7 +866,7 @@ export class BattleScene extends SceneBase {
|
||||
gender?: Gender,
|
||||
shiny?: boolean,
|
||||
variant?: Variant,
|
||||
ivs?: number[],
|
||||
ivs?: Uint8Array,
|
||||
nature?: Nature,
|
||||
dataSource?: Pokemon | PokemonData,
|
||||
postProcess?: (playerPokemon: PlayerPokemon) => void,
|
||||
@ -897,12 +897,12 @@ export class BattleScene extends SceneBase {
|
||||
if (Overrides.IVS_OVERRIDE.some(value => !isBetween(value, 0, 31))) {
|
||||
throw new Error("All IVs in the player IV override must be between 0 and 31!");
|
||||
}
|
||||
pokemon.ivs = Overrides.IVS_OVERRIDE;
|
||||
pokemon.ivs = new Uint8Array(Overrides.IVS_OVERRIDE);
|
||||
} else {
|
||||
if (!isBetween(Overrides.IVS_OVERRIDE, 0, 31)) {
|
||||
throw new Error("The Player IV override must be a value between 0 and 31!");
|
||||
}
|
||||
pokemon.ivs = new Array(6).fill(Overrides.IVS_OVERRIDE);
|
||||
pokemon.ivs = new Uint8Array(6).fill(Overrides.IVS_OVERRIDE);
|
||||
}
|
||||
|
||||
if (Overrides.NATURE_OVERRIDE !== null) {
|
||||
@ -962,12 +962,12 @@ export class BattleScene extends SceneBase {
|
||||
if (Overrides.ENEMY_IVS_OVERRIDE.some(value => !isBetween(value, 0, 31))) {
|
||||
throw new Error("All IVs in the enemy IV override must be between 0 and 31!");
|
||||
}
|
||||
pokemon.ivs = Overrides.ENEMY_IVS_OVERRIDE;
|
||||
pokemon.ivs = new Uint8Array(Overrides.ENEMY_IVS_OVERRIDE);
|
||||
} else {
|
||||
if (!isBetween(Overrides.ENEMY_IVS_OVERRIDE, 0, 31)) {
|
||||
throw new Error("The Enemy IV override must be a value between 0 and 31!");
|
||||
}
|
||||
pokemon.ivs = new Array(6).fill(Overrides.ENEMY_IVS_OVERRIDE);
|
||||
pokemon.ivs = new Uint8Array(6).fill(Overrides.ENEMY_IVS_OVERRIDE);
|
||||
}
|
||||
|
||||
if (Overrides.ENEMY_NATURE_OVERRIDE !== null) {
|
||||
|
@ -318,7 +318,7 @@ export async function initBattleWithEnemyConfig(partyConfig: EnemyPartyConfig):
|
||||
|
||||
// Set IVs
|
||||
if (config.ivs) {
|
||||
enemyPokemon.ivs = config.ivs;
|
||||
enemyPokemon.ivs = new Uint8Array(config.ivs);
|
||||
}
|
||||
|
||||
// Set Status
|
||||
|
@ -204,7 +204,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
public gender: Gender;
|
||||
public hp: number;
|
||||
public stats: number[];
|
||||
public ivs: number[];
|
||||
public ivs: Uint8Array;
|
||||
public nature: Nature;
|
||||
public moveset: PokemonMove[];
|
||||
/**
|
||||
@ -311,7 +311,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
gender?: Gender,
|
||||
shiny?: boolean,
|
||||
variant?: Variant,
|
||||
ivs?: number[],
|
||||
ivs?: Uint8Array,
|
||||
nature?: Nature,
|
||||
dataSource?: Pokemon | PokemonData,
|
||||
) {
|
||||
@ -346,7 +346,8 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
this.id = dataSource.id;
|
||||
this.hp = dataSource.hp;
|
||||
this.stats = dataSource.stats;
|
||||
this.ivs = dataSource.ivs;
|
||||
|
||||
this.ivs = new Uint8Array(dataSource.ivs);
|
||||
this.passive = !!dataSource.passive;
|
||||
if (this.variant === undefined) {
|
||||
this.variant = 0;
|
||||
@ -385,7 +386,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
this.stellarTypesBoosted = dataSource.stellarTypesBoosted ?? [];
|
||||
} else {
|
||||
this.id = randSeedInt(4294967296);
|
||||
this.ivs = ivs || getIvsFromId(this.id);
|
||||
this.ivs = new Uint8Array(ivs || getIvsFromId(this.id));
|
||||
|
||||
if (this.gender === undefined) {
|
||||
this.gender = this.species.generateGender();
|
||||
@ -5704,7 +5705,7 @@ export class PlayerPokemon extends Pokemon {
|
||||
gender?: Gender,
|
||||
shiny?: boolean,
|
||||
variant?: Variant,
|
||||
ivs?: number[],
|
||||
ivs?: Uint8Array,
|
||||
nature?: Nature,
|
||||
dataSource?: Pokemon | PokemonData,
|
||||
) {
|
||||
@ -6324,9 +6325,9 @@ export class EnemyPokemon extends Pokemon {
|
||||
|
||||
if (this.hasTrainer() && globalScene.currentBattle) {
|
||||
const { waveIndex } = globalScene.currentBattle;
|
||||
const ivs: number[] = [];
|
||||
while (ivs.length < 6) {
|
||||
ivs.push(randSeedIntRange(Math.floor(waveIndex / 10), 31));
|
||||
const ivs = new Uint8Array(6);
|
||||
for (let i = 0; i < 6; i++) {
|
||||
ivs[i] = this.randBattleSeedIntRange(Math.floor(waveIndex / 10), 31);
|
||||
}
|
||||
this.ivs = ivs;
|
||||
}
|
||||
|
@ -1914,7 +1914,7 @@ export class GameData {
|
||||
_unlockSpeciesNature(species.speciesId);
|
||||
}
|
||||
|
||||
updateSpeciesDexIvs(speciesId: SpeciesId, ivs: number[]): void {
|
||||
updateSpeciesDexIvs(speciesId: SpeciesId, ivs: Uint8Array): void {
|
||||
let dexEntry: DexEntry;
|
||||
do {
|
||||
dexEntry = globalScene.gameData.dexData[speciesId];
|
||||
|
Loading…
Reference in New Issue
Block a user