Fuxed constructor

This commit is contained in:
Bertie690 2025-05-01 13:28:54 -04:00
parent 811f617f5a
commit 0da02a60b5

View File

@ -5665,12 +5665,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} }
this.summonData = new PokemonSummonData(); this.summonData = new PokemonSummonData();
this.tempSummonData = new PokemonTempSummonData(); this.tempSummonData = new PokemonTempSummonData();
this.setSwitchOutStatus(false); this.setSwitchOutStatus(false);
// TODO: Why do we tick down leech seed on switch
if (this.getTag(BattlerTagType.SEEDED)) {
this.lapseTag(BattlerTagType.SEEDED);
}
if (globalScene) { if (globalScene) {
globalScene.triggerPokemonFormChange( globalScene.triggerPokemonFormChange(
this, this,
@ -7792,9 +7787,22 @@ export class PokemonSummonData {
public moveHistory: TurnMove[] = []; public moveHistory: TurnMove[] = [];
constructor(source?: PokemonSummonData | Partial<PokemonSummonData>) { constructor(source?: PokemonSummonData | Partial<PokemonSummonData>) {
if (!isNullOrUndefined(source)) { if (isNullOrUndefined(source)) {
Object.assign(this, source) return;
this.tags &&= this.tags.map(t => loadBattlerTag(t)) }
// TODO: Rework this into an actual generic function for use elsewhere
for (const [key, value] of Object.entries(source)) {
if (isNullOrUndefined(value) && this.hasOwnProperty(key)) {
continue;
}
if (key === "tags") {
// load battler tags
this.tags = value.map((t: BattlerTag) => loadBattlerTag(t));
continue;
}
this[key] = value;
} }
} }
} }