예제 #1
0
        public AttackedSite(List <Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "attacker_civ_id": Attacker = world.GetEntity(Convert.ToInt32(property.Value)); break;

                case "defender_civ_id": Defender = world.GetEntity(Convert.ToInt32(property.Value)); break;

                case "site_civ_id": SiteEntity = world.GetEntity(Convert.ToInt32(property.Value)); break;

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

                case "attacker_general_hfid": AttackerGeneral = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

                case "defender_general_hfid": DefenderGeneral = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

                case "attacker_merc_enid": AttackerMercenaries = world.GetEntity(Convert.ToInt32(property.Value)); break;

                case "defender_merc_enid": DefenderMercenaries = world.GetEntity(Convert.ToInt32(property.Value)); break;

                case "a_support_merc_enid": AttackerSupportMercenaries = world.GetEntity(Convert.ToInt32(property.Value)); break;

                case "d_support_merc_enid": DefenderSupportMercenaries = world.GetEntity(Convert.ToInt32(property.Value)); break;
                }
            }

            Attacker.AddEvent(this);
            if (Defender != Attacker)
            {
                Defender.AddEvent(this);
            }
            if (SiteEntity != Defender)
            {
                SiteEntity.AddEvent(this);
            }
            Site.AddEvent(this);
            if (AttackerGeneral != HistoricalFigure.Unknown)
            {
                AttackerGeneral.AddEvent(this);
            }
            if (DefenderGeneral != HistoricalFigure.Unknown)
            {
                DefenderGeneral.AddEvent(this);
            }
            if (AttackerMercenaries != Defender && AttackerMercenaries != Attacker)
            {
                AttackerMercenaries.AddEvent(this);
            }
            if (DefenderMercenaries != Defender && DefenderMercenaries != Attacker)
            {
                DefenderMercenaries.AddEvent(this);
            }
            AttackerSupportMercenaries.AddEvent(this);
            DefenderSupportMercenaries.AddEvent(this);
        }
예제 #2
0
        public FieldBattle(List <Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "coords": Coordinates = Formatting.ConvertToLocation(property.Value); break;

                case "attacker_civ_id": Attacker = world.GetEntity(Convert.ToInt32(property.Value)); break;

                case "defender_civ_id": Defender = world.GetEntity(Convert.ToInt32(property.Value)); break;

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

                case "attacker_general_hfid": AttackerGeneral = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

                case "defender_general_hfid": DefenderGeneral = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

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

                case "attacker_merc_enid": AttackerMercenaries = world.GetEntity(Convert.ToInt32(property.Value)); break;

                case "defender_merc_enid": DefenderMercenaries = world.GetEntity(Convert.ToInt32(property.Value)); break;

                case "a_support_merc_enid": AttackerSupportMercenaries = world.GetEntity(Convert.ToInt32(property.Value)); break;

                case "d_support_merc_enid": DefenderSupportMercenaries = world.GetEntity(Convert.ToInt32(property.Value)); break;
                }
            }

            Attacker.AddEvent(this);
            Defender.AddEvent(this);
            AttackerGeneral.AddEvent(this);
            DefenderGeneral.AddEvent(this);
            Region.AddEvent(this);
            UndergroundRegion.AddEvent(this);
            if (AttackerMercenaries != Defender && AttackerMercenaries != Attacker)
            {
                AttackerMercenaries.AddEvent(this);
            }
            if (DefenderMercenaries != Defender && DefenderMercenaries != Attacker)
            {
                DefenderMercenaries.AddEvent(this);
            }
            AttackerSupportMercenaries.AddEvent(this);
            DefenderSupportMercenaries.AddEvent(this);
        }