示例#1
0
        public static void DisplayLeaveMessage(float score, Faction faction, int visitorCount, Map currentMap, bool sentAway)
        {
            int   targetGoodwill    = Mathf.RoundToInt(Mathf.Lerp(-100, 100, score));
            float goodwillChangeMax = Mathf.Lerp(20, 40, Mathf.InverseLerp(1, 8, visitorCount));
            float currentGoodwill   = faction.GoodwillWith(Faction.OfPlayer);
            float offset            = targetGoodwill - currentGoodwill;
            int   goodwillChange    = Mathf.RoundToInt(Mathf.Clamp(offset, -goodwillChangeMax, goodwillChangeMax));

            faction.AffectGoodwillWith(Faction.OfPlayer, goodwillChange);



            var days = PlanRevisit(faction, targetGoodwill, currentMap, sentAway);

            string messageReturn = " ";

            if (days < 5)
            {
                messageReturn += "VisitorsReturnSoon".Translate();
            }
            else if (days < 11)
            {
                messageReturn += "VisitorsReturnWhile".Translate();
            }
            else if (days < 30)
            {
                messageReturn += "VisitorsReturnNotSoon".Translate();
            }
            else
            {
                messageReturn += "VisitorsReturnNot".Translate();
            }

            if (sentAway)
            {
                Messages.Message("VisitorsSentAway".Translate(faction.Name, targetGoodwill) + messageReturn, MessageSound.Standard);
            }
            else if (targetGoodwill >= 90)
            {
                Messages.Message("VisitorsLeavingGreat".Translate(faction.Name, targetGoodwill) + messageReturn, MessageSound.Benefit);
            }
            else if (targetGoodwill >= 50)
            {
                Messages.Message("VisitorsLeavingGood".Translate(faction.Name, targetGoodwill) + messageReturn, MessageSound.Benefit);
            }
            else if (targetGoodwill <= -25)
            {
                Messages.Message("VisitorsLeavingAwful".Translate(faction.Name, targetGoodwill) + messageReturn, MessageSound.Negative);
            }
            else if (targetGoodwill <= 5)
            {
                Messages.Message("VisitorsLeavingBad".Translate(faction.Name, targetGoodwill) + messageReturn, MessageSound.Negative);
            }
            else
            {
                Messages.Message("VisitorsLeavingNormal".Translate(faction.Name, targetGoodwill) + messageReturn, MessageSound.Standard);
            }
        }
        public override void DoAction()
        {
            var penalty = pawnValue;

            if (penalty < 1)
            {
                return;
            }
            faction.AffectGoodwillWith(Faction.OfPlayer, -penalty);

            var message = string.Format(txtMessageKilledPawnFactionAnger, faction.Name, pawnName,
                                        (-penalty).ToStringByStyle(ToStringStyle.Integer, ToStringNumberSense.Offset));

            Find.LetterStack.ReceiveLetter(labelMissingPawnsFactionAnger, message, LetterType.BadNonUrgent);
        }