public void UpdateFromBattleGround(BattleGround battleGround)
    {
        RoundNumber = battleGround.Round.RoundNumber;
        RoundStatus = battleGround.RoundStatus;
        TurnType    = battleGround.Round.TurnType;
        TurnStatus  = battleGround.TurnStatus;

        HeroAction       = battleGround.Round.HeroAction;
        SelectedUnitId   = battleGround.Round.SelectedUnit == null ? -1 : battleGround.Round.SelectedUnit.CombatInfo.CombatId;
        SelectedTargetId = battleGround.Round.SelectedTarget == null ? -1 : battleGround.Round.SelectedTarget.CombatInfo.CombatId;

        BattleStatus   = battleGround.BattleStatus;
        SurpriseStatus = battleGround.SurpriseStatus;

        StallingRoundNumber = battleGround.StallingRoundNumber;

        OrderedUnitsCombatIds.Clear();
        for (int i = 0; i < battleGround.Round.OrderedUnits.Count; i++)
        {
            OrderedUnitsCombatIds.Add(battleGround.Round.OrderedUnits[i].CombatInfo.CombatId);
        }

        CombatIds.Clear();
        CombatIds.AddRange(battleGround.CombatIds);
        Companions.Clear();
        for (int i = 0; i < battleGround.Companions.Count; i++)
        {
            Companions.Add(battleGround.Companions[i].GetHashCode());
        }

        Captures.Clear();
        RemovedUnits.Clear();
        for (int i = 0; i < battleGround.Captures.Count; i++)
        {
            Captures.Add(battleGround.Captures[i].GetHashCode());
            if (battleGround.Captures[i].RemoveFromParty)
            {
                var newRemovedUnitData = new FormationUnitSaveData();
                newRemovedUnitData.UpdateFromUnit(battleGround.Captures[i].PrisonerUnit);
                RemovedUnits.Add(newRemovedUnitData);
            }
        }

        Controls.Clear();
        for (int i = 0; i < battleGround.Controls.Count; i++)
        {
            Controls.Add(battleGround.Controls[i].GetHashCode());
        }

        BattleLoot    = battleGround.BattleLoot;
        LastDamaged   = battleGround.LastDamaged;
        LastSkillUsed = battleGround.LastSkillUsed == null ? "" : battleGround.LastSkillUsed;

        MonsterFormation.UpdateFormation(battleGround.MonsterFormation);
    }
    public void ReadBattlegroundData(BinaryReader br)
    {
        RoundNumber = br.ReadInt32();

        RoundStatus    = (RoundStatus)br.ReadInt32();
        TurnType       = (TurnType)br.ReadInt32();
        TurnStatus     = (TurnStatus)br.ReadInt32();
        HeroAction     = (HeroTurnAction)br.ReadInt32();
        BattleStatus   = (BattleStatus)br.ReadInt32();
        SurpriseStatus = (SurpriseStatus)br.ReadInt32();

        StallingRoundNumber = br.ReadInt32();
        SelectedUnitId      = br.ReadInt32();
        SelectedTargetId    = br.ReadInt32();
        LastSkillUsed       = br.ReadString();

        int orderedUnitsCount = br.ReadInt32();

        OrderedUnitsCombatIds.Clear();
        for (int i = 0; i < orderedUnitsCount; i++)
        {
            OrderedUnitsCombatIds.Add(br.ReadInt32());
        }

        int combatIdsCount = br.ReadInt32();

        CombatIds.Clear();
        for (int i = 0; i < combatIdsCount; i++)
        {
            CombatIds.Add(br.ReadInt32());
        }

        int companionsCount = br.ReadInt32();

        Companions.Clear();
        for (int i = 0; i < companionsCount; i++)
        {
            Companions.Add(br.ReadInt32());
        }

        int capturesCount = br.ReadInt32();

        Captures.Clear();
        for (int i = 0; i < capturesCount; i++)
        {
            Captures.Add(br.ReadInt32());
        }

        int controlsCount = br.ReadInt32();

        Controls.Clear();
        for (int i = 0; i < controlsCount; i++)
        {
            Controls.Add(br.ReadInt32());
        }

        int lastDamagedCount = br.ReadInt32();

        LastDamaged.Clear();
        for (int i = 0; i < lastDamagedCount; i++)
        {
            LastDamaged.Add(br.ReadString());
        }

        int battleLootCount = br.ReadInt32();

        BattleLoot.Clear();
        for (int i = 0; i < battleLootCount; i++)
        {
            var newBattleLoot = new LootDefinition()
            {
                Code  = br.ReadString(),
                Count = br.ReadInt32(),
            };
            BattleLoot.Add(newBattleLoot);
        }

        int removedUnitsCount = br.ReadInt32();

        RemovedUnits.Clear();
        for (int i = 0; i < removedUnitsCount; i++)
        {
            var newFormationUnitData = new FormationUnitSaveData();
            newFormationUnitData.ReadFormationUnitData(br);
            RemovedUnits.Add(newFormationUnitData);
        }

        MonsterFormation.ReadFormationData(br);
    }