pokerogue/src/system/trainer-data.ts

25 lines
1005 B
TypeScript
Raw Normal View History

2023-10-07 16:08:33 -04:00
import BattleScene from "../battle-scene";
import { TrainerType } from "#enums/trainer-type";
import Trainer, { TrainerVariant } from "../field/trainer";
2023-10-07 16:08:33 -04:00
export default class TrainerData {
public trainerType: TrainerType;
public variant: TrainerVariant;
public partyTemplateIndex: integer;
public name: string;
public partnerName: string;
2023-10-07 16:08:33 -04:00
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;
2023-10-07 16:08:33 -04:00
}
toTrainer(scene: BattleScene): Trainer {
return new Trainer(scene, this.trainerType, this.variant, this.partyTemplateIndex, this.name, this.partnerName);
2023-10-07 16:08:33 -04:00
}
}