Pokemon movesets no longer allow `null` values
This commit is contained in:
parent
6442b8345f
commit
8fabcba235
|
@ -96,7 +96,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||||
public stats: integer[];
|
public stats: integer[];
|
||||||
public ivs: integer[];
|
public ivs: integer[];
|
||||||
public nature: Nature;
|
public nature: Nature;
|
||||||
public moveset: (PokemonMove | null)[];
|
public moveset: (PokemonMove)[];
|
||||||
public status: Status | null;
|
public status: Status | null;
|
||||||
public friendship: integer;
|
public friendship: integer;
|
||||||
public metLevel: integer;
|
public metLevel: integer;
|
||||||
|
@ -138,7 +138,21 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||||
|
|
||||||
private shinySparkle: Phaser.GameObjects.Sprite;
|
private shinySparkle: Phaser.GameObjects.Sprite;
|
||||||
|
|
||||||
constructor(scene: BattleScene, x: number, y: number, species: PokemonSpecies, level: integer, abilityIndex?: integer, formIndex?: integer, gender?: Gender, shiny?: boolean, variant?: Variant, ivs?: integer[], nature?: Nature, dataSource?: Pokemon | PokemonData) {
|
constructor(
|
||||||
|
scene: BattleScene,
|
||||||
|
x: number,
|
||||||
|
y: number,
|
||||||
|
species: PokemonSpecies,
|
||||||
|
level: integer,
|
||||||
|
abilityIndex?: integer,
|
||||||
|
formIndex?: integer,
|
||||||
|
gender?: Gender,
|
||||||
|
shiny?: boolean,
|
||||||
|
variant?: Variant,
|
||||||
|
ivs?: integer[],
|
||||||
|
nature?: Nature,
|
||||||
|
dataSource?: Pokemon | PokemonData
|
||||||
|
) {
|
||||||
super(scene, x, y);
|
super(scene, x, y);
|
||||||
|
|
||||||
if (!species.isObtainable() && this.isPlayer()) {
|
if (!species.isObtainable() && this.isPlayer()) {
|
||||||
|
@ -1157,7 +1171,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||||
|
|
||||||
abstract isBoss(): boolean;
|
abstract isBoss(): boolean;
|
||||||
|
|
||||||
getMoveset(ignoreOverride?: boolean): (PokemonMove | null)[] {
|
getMoveset(ignoreOverride?: boolean): (PokemonMove)[] {
|
||||||
const ret = !ignoreOverride && this.summonData?.moveset
|
const ret = !ignoreOverride && this.summonData?.moveset
|
||||||
? this.summonData.moveset
|
? this.summonData.moveset
|
||||||
: this.moveset;
|
: this.moveset;
|
||||||
|
@ -1914,7 +1928,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||||
}
|
}
|
||||||
|
|
||||||
setMove(moveIndex: integer, moveId: Moves): void {
|
setMove(moveIndex: integer, moveId: Moves): void {
|
||||||
const move = moveId ? new PokemonMove(moveId) : null;
|
if (moveId === Moves.NONE) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const move = new PokemonMove(moveId);
|
||||||
this.moveset[moveIndex] = move;
|
this.moveset[moveIndex] = move;
|
||||||
if (this.summonData?.moveset) {
|
if (this.summonData?.moveset) {
|
||||||
this.summonData.moveset[moveIndex] = move;
|
this.summonData.moveset[moveIndex] = move;
|
||||||
|
@ -5235,7 +5252,7 @@ export class PokemonSummonData {
|
||||||
public gender: Gender;
|
public gender: Gender;
|
||||||
public fusionGender: Gender;
|
public fusionGender: Gender;
|
||||||
public stats: number[] = [ 0, 0, 0, 0, 0, 0 ];
|
public stats: number[] = [ 0, 0, 0, 0, 0, 0 ];
|
||||||
public moveset: (PokemonMove | null)[];
|
public moveset: (PokemonMove)[];
|
||||||
// If not initialized this value will not be populated from save data.
|
// If not initialized this value will not be populated from save data.
|
||||||
public types: Type[] = [];
|
public types: Type[] = [];
|
||||||
public addedType: Type | null = null;
|
public addedType: Type | null = null;
|
||||||
|
|
|
@ -33,7 +33,7 @@ export default class PokemonData {
|
||||||
public stats: integer[];
|
public stats: integer[];
|
||||||
public ivs: integer[];
|
public ivs: integer[];
|
||||||
public nature: Nature;
|
public nature: Nature;
|
||||||
public moveset: (PokemonMove | null)[];
|
public moveset: (PokemonMove)[];
|
||||||
public status: Status | null;
|
public status: Status | null;
|
||||||
public friendship: integer;
|
public friendship: integer;
|
||||||
public metLevel: integer;
|
public metLevel: integer;
|
||||||
|
|
Loading…
Reference in New Issue