예제 #1
0
        public static void AffectGoodwillWithSpacerFaction(Faction faction, Faction other, float goodwillChange)
        {
            if (goodwillChange > 0f && ((faction.IsPlayer && FactionBaseUtility.IsPlayerAttackingAnyFactionBaseOf(other)) || (other.IsPlayer && FactionBaseUtility.IsPlayerAttackingAnyFactionBaseOf(faction))))
            {
                return;
            }
            float           value           = other.GoodwillWith(faction) + goodwillChange;
            FactionRelation factionRelation = other.RelationWith(faction, false);

            factionRelation.goodwill = Mathf.Clamp(value, -100f, 100f);

            if (!faction.HostileTo(other) && faction.GoodwillWith(other) < -80f)
            {
                faction.SetHostileTo(other, true);
                if (Current.ProgramState == ProgramState.Playing && Find.TickManager.TicksGame > 100 && other == Faction.OfPlayer)
                {
                    Find.LetterStack.ReceiveLetter("LetterLabelRelationsChangeBad".Translate(), "RelationsBrokenDown".Translate(new object[]
                    {
                        faction.Name
                    }), LetterType.BadNonUrgent, null);
                }
            }
            if (faction.HostileTo(other) && faction.GoodwillWith(other) > 0f)
            {
                faction.SetHostileTo(other, false);
                if (Current.ProgramState == ProgramState.Playing && Find.TickManager.TicksGame > 100 && other == Faction.OfPlayer)
                {
                    Find.LetterStack.ReceiveLetter("LetterLabelRelationsChangeGood".Translate(), "RelationsWarmed".Translate(new object[]
                    {
                        faction.Name
                    }), LetterType.BadNonUrgent, null);
                }
            }
        }
예제 #2
0
        public static DiaNode FactionDialogFor(Pawn negotiator, Faction faction)
        {
            Map map = negotiator.Map;

            FactionDialogMaker_IoM.negotiator = negotiator;
            FactionDialogMaker_IoM.faction    = faction;
            string text = (faction.leader != null) ? faction.leader.Name.ToStringFull : faction.Name;

            if (faction.PlayerGoodwill < -70f)
            {
                FactionDialogMaker_IoM.root = new DiaNode("FactionGreetingHostile".Translate(new object[]
                {
                    text
                }));
            }
            else if (faction.PlayerGoodwill < 40f)
            {
                string text2 = "FactionGreetingWary".Translate(new object[]
                {
                    text,
                    negotiator.LabelShort
                });
                text2 = text2.AdjustedFor(negotiator);
                FactionDialogMaker_IoM.root = new DiaNode(text2);
                if (!FactionBaseUtility.IsPlayerAttackingAnyFactionBaseOf(faction))
                {
                    FactionDialogMaker_IoM.root.options.Add(FactionDialogMaker_IoM.OfferGiftOption(negotiator.Map));
                }
                if (!faction.HostileTo(Faction.OfPlayer) && negotiator.Spawned && negotiator.Map.IsPlayerHome)
                {
                    if (CorruptionStoryTrackerUtilities.currentStoryTracker.ImperialFactions.Contains(faction))
                    {
                        FactionDialogMaker_IoM.root.options.AddRange(FactionDialogMaker_IoM.FactionSpecificOptions(faction, map, negotiator));
                    }
                }
            }
            else
            {
                FactionDialogMaker_IoM.root = new DiaNode("FactionGreetingWarm".Translate(new object[]
                {
                    text,
                    negotiator.LabelShort
                }));
                if (!FactionBaseUtility.IsPlayerAttackingAnyFactionBaseOf(faction))
                {
                    FactionDialogMaker_IoM.root.options.Add(FactionDialogMaker_IoM.OfferGiftOption(negotiator.Map));
                }
                if (!faction.HostileTo(Faction.OfPlayer) && negotiator.Spawned && negotiator.Map.IsPlayerHome)
                {
                    if (CorruptionStoryTrackerUtilities.currentStoryTracker.IoMCanHelp)
                    {
                        FactionDialogMaker_IoM.root.options.Add(FactionDialogMaker_IoM.RequestMilitaryAidOption(map));
                    }
                    FactionDialogMaker_IoM.root.options.AddRange(FactionDialogMaker_IoM.FactionSpecificOptions(faction, map, negotiator));
                }
            }
            if (Prefs.DevMode)
            {
                foreach (DiaOption current in FactionDialogMaker_IoM.DebugOptions(FactionDialogMaker_IoM.faction))
                {
                    FactionDialogMaker_IoM.root.options.Add(current);
                }
            }
            DiaOption diaOption = new DiaOption("(" + "Disconnect".Translate() + ")");

            diaOption.resolveTree = true;
            FactionDialogMaker_IoM.root.options.Add(diaOption);
            return(FactionDialogMaker_IoM.root);
        }