示例#1
0
        public SquadVsSquad(List <Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "a_hfid": AttackerHistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

                case "d_hfid": DefenderHistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

                case "a_squad_id": AttackerSquadId = Convert.ToInt32(property.Value); break;

                case "d_squad_id": DefenderSquadId = Convert.ToInt32(property.Value); break;

                case "d_race": DefenderRaceId = Convert.ToInt32(property.Value); break;

                case "d_interaction":
                    // TODO last checked in version 0.44.10
                    property.Known = true;
                    break;

                case "d_effect":
                    // TODO last checked in version 0.44.10
                    property.Known = true;
                    break;

                case "d_number": DefenderNumber = Convert.ToInt32(property.Value); break;

                case "d_slain": DefenderSlain = Convert.ToInt32(property.Value); break;

                case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break;

                case "structure_id": StructureId = Convert.ToInt32(property.Value); break;

                case "subregion_id": Region = world.GetRegion(Convert.ToInt32(property.Value)); break;

                case "feature_layer_id": UndergroundRegion = world.GetUndergroundRegion(Convert.ToInt32(property.Value)); break;

                case "a_leader_hfid": AttackerLeader = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

                case "d_leader_hfid": DefenderLeader = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

                case "a_leadership_roll": AttackerLeadershipRoll = Convert.ToInt32(property.Value); break;

                case "d_leadership_roll": DefenderLeadershipRoll = Convert.ToInt32(property.Value); break;
                }
            }
            if (Site != null)
            {
                Structure = Site.Structures.FirstOrDefault(structure => structure.Id == StructureId);
            }
            AttackerHistoricalFigure.AddEvent(this);
            DefenderHistoricalFigure.AddEvent(this);
            Site.AddEvent(this);
            Structure.AddEvent(this);
            Region.AddEvent(this);
            UndergroundRegion.AddEvent(this);
            if (AttackerLeader != AttackerHistoricalFigure)
            {
                AttackerLeader.AddEvent(this);
            }

            if (DefenderLeader != DefenderHistoricalFigure)
            {
                DefenderLeader.AddEvent(this);
            }
        }