Fix tags not being applied on session load
parent
d5681a6e03
commit
6d7e471a28
|
@ -496,7 +496,7 @@ class TailwindTag extends ArenaTag {
|
|||
}
|
||||
}
|
||||
|
||||
export function getArenaTag(tagType: ArenaTagType, turnCount: integer, sourceMove: Moves, sourceId: integer, targetIndex?: BattlerIndex, side: ArenaTagSide = ArenaTagSide.BOTH): ArenaTag {
|
||||
export function getArenaTag(tagType: ArenaTagType, turnCount: integer, sourceMove: Moves, sourceId: integer, side: ArenaTagSide = ArenaTagSide.BOTH, targetIndex?: BattlerIndex): ArenaTag {
|
||||
switch (tagType) {
|
||||
case ArenaTagType.MIST:
|
||||
return new MistTag(turnCount, sourceId, side);
|
||||
|
|
|
@ -498,7 +498,7 @@ export class Arena {
|
|||
return false;
|
||||
}
|
||||
|
||||
const newTag = getArenaTag(tagType, turnCount || 0, sourceMove, sourceId, targetIndex, side);
|
||||
const newTag = getArenaTag(tagType, turnCount || 0, sourceMove, sourceId, side, targetIndex);
|
||||
this.tags.push(newTag);
|
||||
newTag.onAdd(this);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Arena } from "../field/arena";
|
||||
import { ArenaTag } from "../data/arena-tag";
|
||||
import { ArenaTag, getArenaTag } from "../data/arena-tag";
|
||||
import { Biome } from "../data/enums/biome";
|
||||
import { Weather } from "../data/weather";
|
||||
|
||||
|
@ -12,6 +12,10 @@ export default class ArenaData {
|
|||
const sourceArena = source instanceof Arena ? source as Arena : null;
|
||||
this.biome = sourceArena ? sourceArena.biomeType : source.biome;
|
||||
this.weather = sourceArena ? sourceArena.weather : source.weather ? new Weather(source.weather.weatherType, source.weather.turnsLeft) : undefined;
|
||||
this.tags = sourceArena ? sourceArena.tags : [];
|
||||
const arenaTags: ArenaTag[] = sourceArena ? sourceArena.tags : source.tags;
|
||||
this.tags = [];
|
||||
for (let tag of arenaTags) {
|
||||
this.tags.push(getArenaTag(tag.tagType, tag.turnCount, tag.sourceMove, tag.sourceId, tag.side, tag?.targetIndex))
|
||||
}
|
||||
}
|
||||
}
|
|
@ -673,8 +673,7 @@ export class GameData {
|
|||
});
|
||||
|
||||
scene.arena.weather = sessionData.arena.weather;
|
||||
// TODO
|
||||
//scene.arena.tags = sessionData.arena.tags;
|
||||
scene.arena.tags = sessionData.arena.tags;
|
||||
|
||||
const modifiersModule = await import('../modifier/modifier');
|
||||
|
||||
|
|
Loading…
Reference in New Issue