Exemplo n.º 1
0
        public EntityPersecuted(List <Property> properties, World world) : base(properties, world)
        {
            ExpelledHfs                = new List <HistoricalFigure>();
            ExpelledCreatures          = new List <int>();
            ExpelledPopIds             = new List <int>();
            ExpelledNumbers            = new List <int>();
            PropertyConfiscatedFromHfs = new List <HistoricalFigure>();

            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "persecutor_hfid": PersecutorHf = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

                case "persecutor_enid": PersecutorEntity = world.GetEntity(Convert.ToInt32(property.Value)); break;

                case "target_enid": TargetEntity = world.GetEntity(Convert.ToInt32(property.Value)); break;

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

                case "shrine_amount_destroyed": ShrineAmountDestroyed = Convert.ToInt32(property.Value); break;

                case "destroyed_structure_id": DestroyedStructureId = Convert.ToInt32(property.Value); break;

                case "property_confiscated_from_hfid": PropertyConfiscatedFromHfs.Add(world.GetHistoricalFigure(Convert.ToInt32(property.Value))); break;

                case "expelled_hfid": ExpelledHfs.Add(world.GetHistoricalFigure(Convert.ToInt32(property.Value))); break;

                case "expelled_creature": ExpelledCreatures.Add(Convert.ToInt32(property.Value)); break;

                case "expelled_pop_id": ExpelledPopIds.Add(Convert.ToInt32(property.Value)); break;

                case "expelled_number": ExpelledNumbers.Add(Convert.ToInt32(property.Value)); break;
                }
            }
            if (Site != null)
            {
                DestroyedStructure = Site.Structures.FirstOrDefault(structure => structure.Id == DestroyedStructureId);
                DestroyedStructure.AddEvent(this);
            }
            PersecutorHf.AddEvent(this);
            PersecutorEntity.AddEvent(this);
            TargetEntity.AddEvent(this);
            Site.AddEvent(this);
            foreach (HistoricalFigure expelledHf in ExpelledHfs.Where(eHf => eHf != HistoricalFigure.Unknown))
            {
                expelledHf.AddEvent(this);
            }
        }