Exemple #1
0
        public virtual HommSensorData GetNewSensorData()
        {
            var result = SensorData.DeepCopyByExpressionTree();

            result.Location = new LocationInfo(Target.Location.X, Target.Location.Y);
            for (var r = Resource.Gold; r <= Resource.Ebony; r++)
            {
                if (!result.MyTreasury.ContainsKey(r))
                {
                    continue;
                }
                result.MyTreasury[r] += Pathfinder.OwnedMines[r] * 10;
            }
            result.WorldCurrentTime += TimeToMake;
            result.MyArmy            = CombatResult?.AttackingArmy ?? result.MyArmy;
            var resultTarget = Target.DeepCopyByExpressionTree();

            if (EnemyArmy != null)
            {
                resultTarget.NeutralArmy = null;
                resultTarget.Garrison    = null;
                resultTarget.Hero        = null;
            }
            if (Target.Mine != null)
            {
                resultTarget.Mine.Owner = result.MyRespawnSide;
            }
            if (Target.ResourcePile != null)
            {
                result.MyTreasury[Target.ResourcePile.Resource] =
                    result.MyTreasury.GetOrDefault(Target.ResourcePile.Resource) + Target.ResourcePile.Amount;
                resultTarget.ResourcePile = null;
            }
            result.Map.Objects.RemoveAll(x => x.Location.IsEqualTo(Target.Location));
            result.Map.Objects.Add(resultTarget);
            return(result);
        }
Exemple #2
0
 public HommSensorData GetNewSensorData()
 {
     return(sensorData.DeepCopyByExpressionTree());
 }