Esempio n. 1
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;
                }
            }

            Attacker.AddEvent(this);
            Defender.AddEvent(this);
            AttackerGeneral.AddEvent(this);
            DefenderGeneral.AddEvent(this);
            Region.AddEvent(this);
            UndergroundRegion.AddEvent(this);
        }
Esempio n. 2
0
        public override string Print(bool link = true, DwarfObject pov = null)
        {
            string eventString = GetYearTime();

            eventString += Artifact != null?Artifact.ToLink(link, pov, this) : "UNKNOWN ARTIFACT";

            eventString += " was lost";
            if (SiteProperty != null)
            {
                eventString += " in ";
                eventString += SiteProperty.Print(link, pov);
            }
            if (Site != null)
            {
                eventString += " in ";
                eventString += Site.ToLink(link, pov, this);
            }
            else if (Region != null)
            {
                eventString += " in ";
                eventString += Region.ToLink(link, pov, this);
            }
            else if (UndergroundRegion != null)
            {
                eventString += " in ";
                eventString += UndergroundRegion.ToLink(link, pov, this);
            }

            eventString += PrintParentCollection(link, pov);
            eventString += ".";
            return(eventString);
        }
Esempio n. 3
0
        public HfsFormedReputationRelationship(List <Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "hfid1": HistoricalFigure1 = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

                case "hfid2": HistoricalFigure2 = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

                case "identity_id1": IdentityId1 = Convert.ToInt32(property.Value); break;

                case "identity_id2": IdentityId2 = Convert.ToInt32(property.Value); break;

                case "hf_rep_1_of_2":
                    switch (property.Value)
                    {
                    case "information source":
                        HfRep1Of2 = ReputationType.InformationSource;
                        break;

                    default:
                        property.Known = false;
                        break;
                    }

                    break;

                case "hf_rep_2_of_1":
                    switch (property.Value)
                    {
                    case "information source":
                        HfRep2Of1 = ReputationType.InformationSource;
                        break;

                    case "buddy":
                        HfRep2Of1 = ReputationType.Buddy;
                        break;

                    default:
                        property.Known = false;
                        break;
                    }

                    break;

                case "site_id": Site = world.GetSite(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;
                }
            }
            HistoricalFigure1.AddEvent(this);
            HistoricalFigure2.AddEvent(this);
            Site.AddEvent(this);
            Region.AddEvent(this);
            UndergroundRegion.AddEvent(this);
        }
Esempio n. 4
0
        public HfReunion(List <Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "group_1_hfid": HistoricalFigure1 = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

                case "group_2_hfid": HistoricalFigure2 = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

                case "site_id": Site = world.GetSite(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;
                }
            }

            HistoricalFigure1.AddEvent(this);
            HistoricalFigure2.AddEvent(this);
            Site.AddEvent(this);
            Region.AddEvent(this);
            UndergroundRegion.AddEvent(this);
        }
Esempio n. 5
0
        public EntityOverthrownCollection(List <Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "ordinal": Ordinal = String.Intern(property.Value); break;

                case "coords": Coordinates = Formatting.ConvertToLocation(property.Value); break;

                case "parent_eventcol": ParentCollection = world.GetEventCollection(Convert.ToInt32(property.Value)); break;

                case "site_id": Site = world.GetSite(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 "target_entity_id": TargetEntity = world.GetEntity(Convert.ToInt32(property.Value)); break;
                }
            }

            Region.AddEventCollection(this);
            UndergroundRegion.AddEventCollection(this);
            Site.AddEventCollection(this);
            TargetEntity.AddEventCollection(this);
        }
        public EntityIncorporated(List <Property> properties, World world) : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "site_id": Site = world.GetSite(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 "joiner_entity_id": JoinerEntity = world.GetEntity(Convert.ToInt32(property.Value)); break;

                case "joined_entity_id": JoinedEntity = world.GetEntity(Convert.ToInt32(property.Value)); break;

                case "leader_hfid": Leader = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

                case "partial_incorporation":
                    property.Known       = true;
                    PartialIncorporation = true;
                    break;
                }
            }

            Site.AddEvent(this);
            Region.AddEvent(this);
            UndergroundRegion.AddEvent(this);
            Leader.AddEvent(this);
            JoinerEntity.AddEvent(this);
            JoinedEntity.AddEvent(this);
        }
Esempio n. 7
0
        public HfPerformedHorribleExperiments(List <Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "group_hfid": GroupHistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

                case "site_id": Site = world.GetSite(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 "structure_id": StructureId = Convert.ToInt32(property.Value); break;
                }
            }
            if (Site != null)
            {
                Structure = Site.Structures.FirstOrDefault(structure => structure.Id == StructureId);
            }
            Site.AddEvent(this);
            Region.AddEvent(this);
            UndergroundRegion.AddEvent(this);
            Structure.AddEvent(this);
        }
Esempio n. 8
0
        public override string Print(bool link = true, DwarfObject pov = null)
        {
            string eventString = GetYearTime();

            eventString += GroupHistoricalFigure.ToLink(link, pov, this);
            eventString += " performed horrible experiments";
            if (Structure != null)
            {
                eventString += " in ";
                eventString += Structure.ToLink(link, pov, this);
            }
            if (Site != null)
            {
                eventString += " in ";
                eventString += Site.ToLink(link, pov, this);
            }
            else if (Region != null)
            {
                eventString += " in ";
                eventString += Region.ToLink(link, pov, this);
            }
            else if (UndergroundRegion != null)
            {
                eventString += " in ";
                eventString += UndergroundRegion.ToLink(link, pov, this);
            }
            eventString += PrintParentCollection(link, pov);
            eventString += ".";
            return(eventString);
        }
Esempio n. 9
0
        public override string Print(bool link = true, DwarfObject pov = null)
        {
            string eventString = GetYearTime();

            eventString += HistoricalFigure != null?HistoricalFigure.ToLink(link, pov, this) : "UNKNOWN HISTORICAL FIGURE";

            eventString += " reached the summit";
            if (Region != null)
            {
                eventString += ", which rises above ";
                eventString += Region.ToLink(link, pov, this);
            }
            else if (UndergroundRegion != null)
            {
                eventString += ", in the depths of ";
                eventString += UndergroundRegion.ToLink(link, pov, this);
            }
            if (Site != null)
            {
                eventString += " in ";
                eventString += Site.ToLink(link, pov, this);
            }
            eventString += ".";
            return(eventString);
        }
Esempio n. 10
0
        public Abduction(List <Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "ordinal": Ordinal = String.Intern(property.Value); break;

                case "coords": Coordinates = Formatting.ConvertToLocation(property.Value); break;

                case "parent_eventcol": ParentCollection = world.GetEventCollection(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 "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break;

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

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

            Abductee.AddEventCollection(this);
            Region.AddEventCollection(this);
            UndergroundRegion.AddEventCollection(this);
            Site.AddEventCollection(this);
            Attacker.AddEventCollection(this);
            Defender.AddEventCollection(this);
        }
Esempio n. 11
0
        public ArtifactLost(List <Property> properties, World world) : base(properties, world)
        {
            int sitePropertyId = -1;

            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "artifact_id": Artifact = world.GetArtifact(Convert.ToInt32(property.Value)); break;

                case "site_id": Site = world.GetSite(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 "site_property_id": sitePropertyId = Convert.ToInt32(property.Value); break;
                }
            }

            if (Site != null && sitePropertyId != -1)
            {
                SiteProperty = Site.SiteProperties.FirstOrDefault(sp => sp.Id == sitePropertyId);
            }
            Artifact.AddEvent(this);
            Site.AddEvent(this);
            Region.AddEvent(this);
            UndergroundRegion.AddEvent(this);
        }
Esempio n. 12
0
        public HfReachSummit(List <Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "group_hfid": HistoricalFigure = world.GetHistoricalFigure(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 "site": Site = world.GetSite(Convert.ToInt32(property.Value)); break;

                case "coords": Coordinates = Formatting.ConvertToLocation(property.Value); break;

                case "group": if (HistoricalFigure == null)
                    {
                        HistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value));
                    }
                    else
                    {
                        property.Known = true;
                    } break;
                }
            }
            HistoricalFigure.AddEvent(this);
            Region.AddEvent(this);
            UndergroundRegion.AddEvent(this);
            Site.AddEvent(this);
        }
Esempio n. 13
0
        public HfTravel(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 "escape": Escaped = true; property.Known = true; break;

                case "return": Returned = true; property.Known = true; break;

                case "group_hfid": HistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

                case "site_id": Site = world.GetSite(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;
                }
            }

            HistoricalFigure.AddEvent(this);
            Site.AddEvent(this);
            Region.AddEvent(this);
            UndergroundRegion.AddEvent(this);
        }
Esempio n. 14
0
        public HfAbducted(List <Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "target_hfid": Target = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

                case "snatcher_hfid": Snatcher = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

                case "site_id": Site = world.GetSite(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;
                }
            }

            Target.AddEvent(this);
            Snatcher.AddEvent(this);
            Site.AddEvent(this);
            Region.AddEvent(this);
            UndergroundRegion.AddEvent(this);
        }
Esempio n. 15
0
        public Gamble(List <Property> properties, World world) : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "site_id": Site = world.GetSite(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 "old_account": OldAccount = Convert.ToInt32(property.Value); break;

                case "new_account": NewAccount = Convert.ToInt32(property.Value); break;

                case "gambler_hfid": Gambler = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

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

            if (Site != null)
            {
                Structure = Site.Structures.FirstOrDefault(structure => structure.Id == StructureId);
            }

            Site.AddEvent(this);
            Region.AddEvent(this);
            UndergroundRegion.AddEvent(this);
            Gambler.AddEvent(this);
            Structure.AddEvent(this);
        }
Esempio n. 16
0
        public HfRevived(List <Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "ghost": _ghost = property.Value; break;

                case "hfid": HistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

                case "site_id": Site = world.GetSite(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 "raised_before": RaisedBefore = true; property.Known = true;  break;
                }
            }

            HistoricalFigure.AddEvent(this);
            Site.AddEvent(this);
            Region.AddEvent(this);
            UndergroundRegion.AddEvent(this);
        }
Esempio n. 17
0
        public override string Print(bool link = true, DwarfObject pov = null)
        {
            string eventString = GetYearTime() + Artifact.ToLink(link, pov, this);

            switch (ArtifactReason)
            {
            case ArtifactReason.ArtifactIsHeirloomOfFamilyHfid:
                eventString += " was acquired";
                break;

            case ArtifactReason.ArtifactIsSymbolOfEntityPosition:
                eventString += " was acquired";
                break;

            default:
                eventString += " was claimed";
                break;
            }
            if (Site != null)
            {
                eventString += " in ";
                eventString += Site.ToLink(link, pov, this);
            }
            else if (Region != null)
            {
                eventString += " in ";
                eventString += Region.ToLink(link, pov, this);
            }
            else if (UndergroundRegion != null)
            {
                eventString += " in ";
                eventString += UndergroundRegion.ToLink(link, pov, this);
            }

            eventString += " by " + HistoricalFigure.ToLink(link, pov, this);
            switch (ArtifactReason)
            {
            case ArtifactReason.ArtifactIsHeirloomOfFamilyHfid:
                eventString += " as an heirloom of the ";
                eventString += FamilyFigure?.ToLink(link, pov, this);
                eventString += " family";
                break;

            case ArtifactReason.ArtifactIsSymbolOfEntityPosition:
                eventString += " as a symbol of authority within ";
                eventString += SymbolEntity?.ToLink(link, pov, this);
                break;
            }
            switch (Circumstance)
            {
            case Circumstance.HfIsDead:
                eventString += " after the death of ";
                eventString += FormerHolder?.ToLink(link, pov, this);
                break;
            }
            eventString += PrintParentCollection(link, pov);
            eventString += ".";
            return(eventString);
        }
Esempio n. 18
0
        public Duel(List <Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "ordinal": Ordinal = String.Intern(property.Value); break;

                case "coords": Coordinates = Formatting.ConvertToLocation(property.Value); break;

                case "parent_eventcol": ParentCollection = world.GetEventCollection(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 "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break;

                case "attacking_hfid": Attacker = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

                case "defending_hfid": Defender = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;
                }
            }
            //foreach (WorldEvent collectionEvent in Collection) this.AddEvent(collectionEvent);
            if (ParentCollection != null && ParentCollection.GetType() == typeof(Battle))
            {
                foreach (HfDied death in Collection.OfType <HfDied>())
                {
                    Battle battle    = ParentCollection as Battle;
                    War    parentWar = battle.ParentCollection as War;
                    if (battle.NotableAttackers.Contains(death.HistoricalFigure))
                    {
                        battle.AttackerDeathCount++;
                        battle.Attackers.Single(squad => squad.Race == death.HistoricalFigure.Race).Deaths++;

                        if (parentWar != null)
                        {
                            parentWar.AttackerDeathCount++;
                        }
                    }
                    else if (battle.NotableDefenders.Contains(death.HistoricalFigure))
                    {
                        battle.DefenderDeathCount++;
                        battle.Defenders.Single(squad => squad.Race == death.HistoricalFigure.Race).Deaths++;
                        if (parentWar != null)
                        {
                            parentWar.DefenderDeathCount++;
                        }
                    }

                    if (parentWar != null)
                    {
                        (ParentCollection.ParentCollection as War).DeathCount++;
                    }
                }
            }
        }
Esempio n. 19
0
        public OccasionEvent(List <Property> properties, World world) : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "civ_id":
                    Civ = world.GetEntity(Convert.ToInt32(property.Value));
                    break;

                case "site_id":
                    Site = world.GetSite(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 "occasion_id":
                    OccasionId = Convert.ToInt32(property.Value);
                    break;

                case "schedule_id":
                    ScheduleId = Convert.ToInt32(property.Value);
                    break;
                }
            }

            if (Civ != null && Civ.Occassions.Any())
            {
                EntityOccasion = Civ.Occassions.ElementAt(OccasionId);
                if (EntityOccasion != null)
                {
                    Schedule = EntityOccasion.Schedules.ElementAt(ScheduleId);

                    // DEBUG

                    //if (Schedule.Reference != -1 && Schedule.Type == ScheduleType.Storytelling)
                    //{
                    //    WorldEvent worldEvent = World.GetEvent(Schedule.Reference) as WorldEvent;
                    //    if (!(worldEvent is IFeatured))
                    //    {
                    //        world.ParsingErrors.Report("Unknown Occasion Feature - worldEvent.Type: " + worldEvent.Type);
                    //    }
                    //}
                }
            }

            Civ.AddEvent(this);
            Site.AddEvent(this);
            Region.AddEvent(this);
            UndergroundRegion.AddEvent(this);
        }
Esempio n. 20
0
        public HfSimpleBattleEvent(List <Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "subtype":
                    switch (property.Value)
                    {
                    case "attacked": SubType = HfSimpleBattleType.Attacked; break;

                    case "scuffle": SubType = HfSimpleBattleType.Scuffle; break;

                    case "confront": SubType = HfSimpleBattleType.Confronted; break;

                    case "2 lost after receiving wounds": SubType = HfSimpleBattleType.Hf2LostAfterReceivingWounds; break;

                    case "2 lost after giving wounds": SubType = HfSimpleBattleType.Hf2LostAfterGivingWounds; break;

                    case "2 lost after mutual wounds": SubType = HfSimpleBattleType.Hf2LostAfterMutualWounds; break;

                    case "happen upon": SubType = HfSimpleBattleType.HappenedUpon; break;

                    case "ambushed": SubType = HfSimpleBattleType.Ambushed; break;

                    case "corner": SubType = HfSimpleBattleType.Cornered; break;

                    case "surprised": SubType = HfSimpleBattleType.Surprised; break;

                    case "got into a brawl": SubType = HfSimpleBattleType.GotIntoABrawl; break;

                    case "subdued": SubType = HfSimpleBattleType.Subdued; break;

                    default: SubType = HfSimpleBattleType.Unknown; UnknownSubType = property.Value; property.Known = false; break;
                    }
                    break;

                case "group_1_hfid": HistoricalFigure1 = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

                case "group_2_hfid": HistoricalFigure2 = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

                case "site_id": Site = world.GetSite(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;
                }
            }

            HistoricalFigure1.AddEvent(this);
            HistoricalFigure2.AddEvent(this);
            Site.AddEvent(this);
            Region.AddEvent(this);
            UndergroundRegion.AddEvent(this);
        }
Esempio n. 21
0
        public Theft(List <Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "ordinal": Ordinal = string.Intern(property.Value); break;

                case "coords": _coordinates = Formatting.ConvertToLocation(property.Value); break;

                case "parent_eventcol": ParentCollection = world.GetEventCollection(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 "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break;

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

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

            foreach (ItemStolen theft in Collection.OfType <ItemStolen>())
            {
                if (theft.Site == null)
                {
                    theft.Site = Site;
                }
                if (!Site.Events.Contains(theft))
                {
                    Site.AddEvent(theft);
                    Site.Events = Site.Events.OrderBy(ev => ev.Id).ToList();
                }
                if (Attacker.SiteHistory.Count == 1)
                {
                    if (theft.ReturnSite == null)
                    {
                        theft.ReturnSite = Attacker.SiteHistory.First().Site;
                    }
                    if (!theft.ReturnSite.Events.Contains(theft))
                    {
                        theft.ReturnSite.AddEvent(theft);
                        theft.ReturnSite.Events = theft.ReturnSite.Events.OrderBy(ev => ev.Id).ToList();
                    }
                }
            }
            Attacker.AddEventCollection(this);
            Defender.AddEventCollection(this);
            Region.AddEventCollection(this);
            UndergroundRegion.AddEventCollection(this);
            Site.AddEventCollection(this);
        }
Esempio n. 22
0
        public override string Print(bool link = true, DwarfObject pov = null)
        {
            string eventString = GetYearTime();

            eventString += HistoricalFigure.ToLink(link, pov, this);
            if (Disturbance)
            {
                eventString += " was disturbed from eternal rest";
            }
            else
            {
                eventString += Actor != null ? " was brought" : " came";
                eventString += " back from the dead";
            }

            if (RaisedBefore)
            {
                eventString += " once more";
            }

            if (Actor != null)
            {
                eventString += " by ";
                eventString += Actor.ToLink(link, pov, this);
            }


            if (!string.IsNullOrWhiteSpace(_ghost))
            {
                if (RaisedBefore)
                {
                    eventString += ", this time";
                }
                eventString += " as a " + _ghost;
            }

            if (Site != null)
            {
                eventString += " in ";
                eventString += Site.ToLink(link, pov, this);
            }
            else if (Region != null)
            {
                eventString += " in ";
                eventString += Region.ToLink(link, pov, this);
            }
            else if (UndergroundRegion != null)
            {
                eventString += " in ";
                eventString += UndergroundRegion.ToLink(link, pov, this);
            }
            eventString += PrintParentCollection(link, pov);
            eventString += ".";
            return(eventString);
        }
Esempio n. 23
0
        public override string Print(bool link = true, DwarfObject pov = null)
        {
            string eventString = GetYearTime();

            eventString += Gambler.ToLink(link, pov, this);
            // same ranges like in "trade" event
            var balance = NewAccount - OldAccount;

            if (balance >= 5000)
            {
                eventString += " made a fortune";
            }
            else if (balance >= 1000)
            {
                eventString += " did well";
            }
            else if (balance <= -1000)
            {
                eventString += " did poorly";
            }
            else if (balance <= -5000)
            {
                eventString += " lost a fortune";
            }
            else
            {
                eventString += " broke even";
            }
            eventString += " gambling";
            if (Site != null)
            {
                eventString += " in ";
                eventString += Site.ToLink(link, pov, this);
            }
            else if (Region != null)
            {
                eventString += " in ";
                eventString += Region.ToLink(link, pov, this);
            }
            else if (UndergroundRegion != null)
            {
                eventString += " in ";
                eventString += UndergroundRegion.ToLink(link, pov, this);
            }
            if (Structure != null)
            {
                eventString += " at ";
                eventString += Structure.ToLink(link, pov, this);
            }

            eventString += PrintParentCollection(link, pov);
            eventString += ".";
            return(eventString);
        }
Esempio n. 24
0
        public HfConfronted(List <Property> properties, World world)
            : base(properties, world)
        {
            Reasons         = new List <ConfrontReason>();
            _unknownReasons = new List <string>();
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "hfid": HistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

                case "situation":
                    switch (property.Value)
                    {
                    case "general suspicion": Situation = ConfrontSituation.GeneralSuspicion; break;

                    default:
                        Situation         = ConfrontSituation.Unknown;
                        _unknownSituation = property.Value;
                        world.ParsingErrors.Report("Unknown HF Confronted Situation: " + _unknownSituation);
                        break;
                    }
                    break;

                case "reason":
                    switch (property.Value)
                    {
                    case "murder": Reasons.Add(ConfrontReason.Murder); break;

                    case "ageless": Reasons.Add(ConfrontReason.Ageless); break;

                    default:
                        Reasons.Add(ConfrontReason.Unknown);
                        _unknownReasons.Add(property.Value);
                        world.ParsingErrors.Report("Unknown HF Confronted Reason: " + property.Value);
                        break;
                    }
                    break;

                case "site_id": Site = world.GetSite(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 "coords": Coordinates = Formatting.ConvertToLocation(property.Value); break;
                }
            }

            HistoricalFigure.AddEvent(this);
            Site.AddEvent(this);
            Region.AddEvent(this);
            UndergroundRegion.AddEvent(this);
        }
Esempio n. 25
0
        public ArtifactFound(List <Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "artifact_id":
                    Artifact = world.GetArtifact(Convert.ToInt32(property.Value));
                    break;

                case "hist_figure_id":
                    HistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value));
                    break;

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

                case "site_property_id":
                    SitePropertyId = Convert.ToInt32(property.Value);
                    break;

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

                case "unit_id":
                    UnitId = Convert.ToInt32(property.Value);
                    if (UnitId != -1)
                    {
                        property.Known = false;
                    }
                    break;

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

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

            if (Site != null)
            {
                Structure    = Site.Structures.FirstOrDefault(structure => structure.Id == StructureId);
                SiteProperty = Site.SiteProperties.FirstOrDefault(sp => sp.Id == SitePropertyId);
            }
            Artifact.AddEvent(this);
            HistoricalFigure.AddEvent(this);
            Site.AddEvent(this);
            Structure.AddEvent(this);
            Region.AddEvent(this);
            UndergroundRegion.AddEvent(this);
        }
Esempio n. 26
0
        public BodyAbused(List <Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break;

                case "coords": Coordinates = Formatting.ConvertToLocation(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 "site": if (Site == null)
                    {
                        Site = world.GetSite(Convert.ToInt32(property.Value));
                    }
                    else
                    {
                        property.Known = true;
                    } break;

                case "civ": Abuser = world.GetEntity(Convert.ToInt32(property.Value)); break;

                case "bodies": Body = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

                case "histfig": HistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

                case "props_item_type": ItemType = property.Value; break;

                case "props_item_subtype": ItemSubType = property.Value; break;

                case "props_item_mat": Material = property.Value; break;

                case "abuse_type": AbuseTypeId = Convert.ToInt32(property.Value); break;

                case "props_pile_type": PileTypeId = Convert.ToInt32(property.Value); break;

                case "props_item_mat_type": MaterialTypeId = Convert.ToInt32(property.Value); break;

                case "props_item_mat_index": MaterialIndex = Convert.ToInt32(property.Value); break;
                }
            }

            Site.AddEvent(this);
            Region.AddEvent(this);
            UndergroundRegion.AddEvent(this);
            Body.AddEvent(this);
            HistoricalFigure.AddEvent(this);
            Abuser.AddEvent(this);
        }
        public override string Print(bool link = true, DwarfObject pov = null)
        {
            string eventString = GetYearTime();

            eventString += GroupHistoricalFigure.ToLink(link, pov, this);
            eventString += " purchased ";
            if (Quality == 1)
            {
                eventString += "well-crafted ";
            }
            else if (Quality == 2)
            {
                eventString += "finely-crafted ";
            }
            else if (Quality == 3)
            {
                eventString += "superior quality ";
            }
            else if (Quality == 4)
            {
                eventString += "exceptional ";
            }
            else if (Quality == 5)
            {
                eventString += "masterwork ";
            }
            eventString += "equipment";
            if (Site != null)
            {
                eventString += " in ";
                eventString += Site.ToLink(link, pov, this);
            }
            else if (Region != null)
            {
                eventString += " in ";
                eventString += Region.ToLink(link, pov, this);
            }
            else if (UndergroundRegion != null)
            {
                eventString += " in ";
                eventString += UndergroundRegion.ToLink(link, pov, this);
            }
            if (Structure != null)
            {
                eventString += " at ";
                eventString += Structure.ToLink(link, pov, this);
            }

            eventString += PrintParentCollection(link, pov);
            eventString += ".";
            return(eventString);
        }
        public HfRelationShipDenied(List <Property> properties, World world) : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "site_id":
                    Site = world.GetSite(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 "seeker_hfid":
                    Seeker = world.GetHistoricalFigure(Convert.ToInt32(property.Value));
                    break;

                case "target_hfid":
                    Target = world.GetHistoricalFigure(Convert.ToInt32(property.Value));
                    break;

                case "relationship":
                    Relationship = property.Value;
                    break;

                case "reason":
                    Reason = property.Value;
                    break;

                case "reason_id":
                    ReasonHf = world.GetHistoricalFigure(Convert.ToInt32(property.Value));
                    break;
                }
            }

            Site.AddEvent(this);
            Region.AddEvent(this);
            UndergroundRegion.AddEvent(this);
            Seeker.AddEvent(this);
            Target.AddEvent(this);
            if (ReasonHf != null && !ReasonHf.Equals(Seeker) && !ReasonHf.Equals(Target))
            {
                ReasonHf.AddEvent(this);
            }
        }
Esempio n. 29
0
        public void UGRegionXML_Parses()
        {
            var world = LoadingWorld.GetTestWorld();
            var xdoc  = new XDocument(new XElement("underground_region",
                                                   new XElement("id", 0),
                                                   new XElement("type", "cavern"),
                                                   new XElement("depth", 1)
                                                   )
                                      );

            var ugregion = new UndergroundRegion(xdoc, world);


            Assert.AreEqual(ugregion.Id, 0);
            Assert.AreEqual(ugregion.Depth, 1);
            Assert.AreEqual(ugregion.Type, "Cavern");
        }
Esempio n. 30
0
        public ChangeHfBodyState(List <Property> properties, World world)
            : base(properties, world)
        {
            foreach (Property property in properties)
            {
                switch (property.Name)
                {
                case "hfid": HistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

                case "body_state":
                    switch (property.Value)
                    {
                    case "entombed at site": BodyState = BodyState.EntombedAtSite; break;

                    default:
                        BodyState         = BodyState.Unknown;
                        _unknownBodyState = property.Value;
                        world.ParsingErrors.Report("Unknown HF Body State: " + _unknownBodyState);
                        break;
                    }
                    break;

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

                case "structure_id":
                case "building_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 "coords": Coordinates = Formatting.ConvertToLocation(property.Value); break;
                }
            }
            if (Site != null)
            {
                Structure = Site.Structures.FirstOrDefault(structure => structure.Id == StructureId);
            }
            Structure.AddEvent(this);
            HistoricalFigure.AddEvent(this);
            Site.AddEvent(this);
            Region.AddEvent(this);
            UndergroundRegion.AddEvent(this);
        }