pokerogue/src/system/trainer-data.ts
Matthew dc30dd33b2
[QoL] Reorganize Enum Locations (#2185)
* moving enums

* import updates

* fix tsconfig paths importing (#2184)

* reverse index.ts addition

---------

Co-authored-by: Devin Korb <meepdarknessmeep@gmail.com>
2024-06-13 18:44:23 -04:00

25 lines
1005 B
TypeScript

import BattleScene from "../battle-scene";
import { TrainerType } from "#enums/trainer-type";
import Trainer, { TrainerVariant } from "../field/trainer";
export default class TrainerData {
public trainerType: TrainerType;
public variant: TrainerVariant;
public partyTemplateIndex: integer;
public name: string;
public partnerName: string;
constructor(source: Trainer | any) {
const sourceTrainer = source instanceof Trainer ? source as Trainer : null;
this.trainerType = sourceTrainer ? sourceTrainer.config.trainerType : source.trainerType;
this.variant = source.hasOwnProperty("variant") ? source.variant : source.female ? TrainerVariant.FEMALE : TrainerVariant.DEFAULT;
this.partyTemplateIndex = source.partyMemberTemplateIndex;
this.name = source.name;
this.partnerName = source.partnerName;
}
toTrainer(scene: BattleScene): Trainer {
return new Trainer(scene, this.trainerType, this.variant, this.partyTemplateIndex, this.name, this.partnerName);
}
}