コード例 #1
0
        public RemoveHfHfLink(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 "hfid_target": HistoricalFigureTarget = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break;

                case "link_type":
                    HistoricalFigureLinkType linkType;
                    if (Enum.TryParse(Formatting.InitCaps(property.Value.Replace("_", " ")).Replace(" ", ""), out linkType))
                    {
                        LinkType = linkType;
                    }
                    else
                    {
                        world.ParsingErrors.Report("Unknown HF HF Link Type: " + property.Value);
                    }
                    break;
                }
            }

            //Fill in LinkType by looking at related historical figures.
            if (LinkType == HistoricalFigureLinkType.Unknown && HistoricalFigure != HistoricalFigure.Unknown && HistoricalFigureTarget != HistoricalFigure.Unknown)
            {
                List <HistoricalFigureLink> historicalFigureToTargetLinks = HistoricalFigure.RelatedHistoricalFigures.Where(link => link.Type != HistoricalFigureLinkType.Child).Where(link => link.HistoricalFigure == HistoricalFigureTarget).ToList();
                HistoricalFigureLink        historicalFigureToTargetLink  = null;
                if (historicalFigureToTargetLinks.Count <= 1)
                {
                    historicalFigureToTargetLink = historicalFigureToTargetLinks.FirstOrDefault();
                }

                HfAbducted abduction = HistoricalFigureTarget.Events.OfType <HfAbducted>().SingleOrDefault(abduction1 => abduction1.Snatcher == HistoricalFigure);
                if (historicalFigureToTargetLink != null && abduction == null)
                {
                    LinkType = historicalFigureToTargetLink.Type;
                }
                else if (abduction != null)
                {
                    LinkType = HistoricalFigureLinkType.Prisoner;
                }
            }

            HistoricalFigure.AddEvent(this);
            HistoricalFigureTarget.AddEvent(this);
        }
コード例 #2
0
        public override string Print(bool link = true, DwarfObject pov = null)
        {
            string eventString = GetYearTime();

            if (pov == HistoricalFigureTarget)
            {
                eventString += HistoricalFigureTarget?.ToLink(link, pov, this) ?? "an unknown creature";
            }
            else
            {
                eventString += HistoricalFigure?.ToLink(link, pov, this) ?? "an unknown creature";
            }

            switch (LinkType)
            {
            case HistoricalFigureLinkType.FormerApprentice:
                if (pov == HistoricalFigure)
                {
                    eventString += " ceased being the apprentice of ";
                }
                else
                {
                    eventString += " ceased being the master of ";
                }

                break;

            case HistoricalFigureLinkType.FormerMaster:
                if (pov == HistoricalFigure)
                {
                    eventString += " ceased being the master of ";
                }
                else
                {
                    eventString += " ceased being the apprentice of ";
                }

                break;

            case HistoricalFigureLinkType.FormerSpouse:
                eventString += " divorced ";
                break;

            default:
                eventString += " unlinked (" + LinkType + ") to ";
                break;
            }

            if (pov == HistoricalFigureTarget)
            {
                eventString += HistoricalFigure?.ToLink(link, pov, this) ?? "an unknown creature";
            }
            else
            {
                eventString += HistoricalFigureTarget?.ToLink(link, pov, this) ?? "an unknown creature";
            }

            eventString += PrintParentCollection(link, pov);
            eventString += ".";
            return(eventString);
        }
コード例 #3
0
        public override string Print(bool link = true, DwarfObject pov = null)
        {
            string eventString = GetYearTime();

            if (pov == HistoricalFigureTarget)
            {
                eventString += HistoricalFigureTarget?.ToLink(link, pov, this) ?? "an unknown creature";
            }
            else
            {
                eventString += HistoricalFigure.ToLink(link, pov, this);
            }

            switch (LinkType)
            {
            case HistoricalFigureLinkType.Apprentice:
                if (pov == HistoricalFigureTarget)
                {
                    eventString += " began an apprenticeship under ";
                }
                else
                {
                    eventString += " became the master of ";
                }

                break;

            case HistoricalFigureLinkType.Master:
                if (pov == HistoricalFigureTarget)
                {
                    eventString += " became the master of ";
                }
                else
                {
                    eventString += " began an apprenticeship under ";
                }

                break;

            case HistoricalFigureLinkType.FormerApprentice:
                if (pov == HistoricalFigure)
                {
                    eventString += " ceased being the apprentice of ";
                }
                else
                {
                    eventString += " ceased being the master of ";
                }

                break;

            case HistoricalFigureLinkType.FormerMaster:
                if (pov == HistoricalFigure)
                {
                    eventString += " ceased being the master of ";
                }
                else
                {
                    eventString += " ceased being the apprentice of ";
                }

                break;

            case HistoricalFigureLinkType.Deity:
                if (pov == HistoricalFigureTarget)
                {
                    eventString += " received the worship of ";
                }
                else
                {
                    eventString += " began worshipping ";
                }

                break;

            case HistoricalFigureLinkType.Lover:
                eventString += " became romantically involved with ";
                break;

            case HistoricalFigureLinkType.FormerSpouse:
            case HistoricalFigureLinkType.Spouse:
                eventString += " married ";
                break;

            case HistoricalFigureLinkType.Prisoner:
                if (pov == HistoricalFigureTarget)
                {
                    eventString += " was imprisoned by ";
                }
                else
                {
                    eventString += " imprisoned ";
                }

                break;

            case HistoricalFigureLinkType.PetOwner:
                if (pov == HistoricalFigureTarget)
                {
                    eventString += " became the owner of ";
                }
                else
                {
                    eventString += " became the pet of ";
                }
                break;

            default:
                eventString += " linked (" + LinkType + ") to ";
                break;
            }

            if (pov == HistoricalFigureTarget)
            {
                eventString += HistoricalFigure?.ToLink(link, pov, this) ?? "an unknown creature";
            }
            else
            {
                eventString += HistoricalFigureTarget.ToLink(link, pov, this);
            }

            eventString += PrintParentCollection(link, pov);
            eventString += ".";
            return(eventString);
        }