mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-27 09:16:03 +00:00
dc30dd33b2
* moving enums * import updates * fix tsconfig paths importing (#2184) * reverse index.ts addition --------- Co-authored-by: Devin Korb <meepdarknessmeep@gmail.com>
25 lines
1005 B
TypeScript
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);
|
|
}
|
|
}
|