public void UpdateFormation(BattleFormation formation)
 {
     UnitData.Clear();
     foreach (FormationUnit unit in formation.Party.Units)
     {
         var newFormationUnitData = new FormationUnitSaveData();
         newFormationUnitData.UpdateFromUnit(unit);
         UnitData.Add(newFormationUnitData);
     }
 }
示例#2
0
 public void UpdateFormation(BattleFormation formation)
 {
     unitData.Clear();
     for (int i = 0; i < formation.party.Units.Count; i++)
     {
         var newFormationUnitData = new FormationUnitSaveData();
         newFormationUnitData.UpdateFromUnit(formation.party.Units[i]);
         unitData.Add(newFormationUnitData);
     }
 }
    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);
    }