2023-10-07 16:08:33 -04:00
|
|
|
import BattleScene from "../battle-scene";
|
2024-01-13 12:24:24 -05:00
|
|
|
import { TrainerType } from "../data/enums/trainer-type";
|
2024-03-21 00:57:28 -04:00
|
|
|
import Trainer, { TrainerVariant } from "../field/trainer";
|
2023-10-07 16:08:33 -04:00
|
|
|
|
|
|
|
export default class TrainerData {
|
|
|
|
public trainerType: TrainerType;
|
2024-03-21 00:57:28 -04:00
|
|
|
public variant: TrainerVariant;
|
2023-10-18 18:01:15 -04:00
|
|
|
public partyTemplateIndex: integer;
|
2024-03-21 00:57:28 -04:00
|
|
|
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;
|
2024-03-21 00:57:28 -04:00
|
|
|
this.variant = source.hasOwnProperty('variant') ? source.variant : source.female ? TrainerVariant.FEMALE : TrainerVariant.DEFAULT;
|
2023-10-18 18:01:15 -04:00
|
|
|
this.partyTemplateIndex = source.partyMemberTemplateIndex;
|
2024-03-21 00:57:28 -04:00
|
|
|
this.name = source.name;
|
|
|
|
this.partnerName = source.partnerName;
|
2023-10-07 16:08:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
toTrainer(scene: BattleScene): Trainer {
|
2024-03-26 21:21:27 -04:00
|
|
|
return new Trainer(scene, this.trainerType, this.variant, this.partyTemplateIndex, this.name, this.partnerName);
|
2023-10-07 16:08:33 -04:00
|
|
|
}
|
|
|
|
}
|