Пример #1
0
        public void DetermineWarAsIfNoPlayerInteraction(Faction faction, Faction factionInstigator)
        {
            unrestIsBrewing = false;

            var rollForIntendedOutcome = Rand.Bool
                ? DesiredOutcome.CURRY_FAVOUR_FACTION_ONE
                : DesiredOutcome.BROKER_PEACE;

            if (faction.leader?.GetStatValue(StatDefOf.NegotiationAbility) != null)
            {
                var dialogue = new FactionWarDialogue(faction.leader, faction, factionInstigator, null);
                dialogue.DetermineOutcome(rollForIntendedOutcome, out _);

                Find.LetterStack.ReceiveLetter("MFI_FactionWarLeaderDecidedLabel".Translate(),
                                               WarIsOngoing
                        ? "MFI_FactionWarLeaderDecidedOnWar".Translate(faction, factionInstigator)
                        : "MFI_FactionWarLeaderDecidedAgainstWar".Translate(faction, factionInstigator),
                                               WarIsOngoing ? LetterDefOf.NegativeEvent : LetterDefOf.NeutralEvent);
            }
            else if (factionInstigator.leader?.GetStatValue(StatDefOf.NegotiationAbility) != null)
            {
                var dialogue = new FactionWarDialogue(factionInstigator.leader, factionInstigator, faction, null);
                dialogue.DetermineOutcome(rollForIntendedOutcome, out _);

                Find.LetterStack.ReceiveLetter("MFI_FactionWarLeaderDecidedLabel".Translate(),
                                               WarIsOngoing
                        ? "MFI_FactionWarLeaderDecidedOnWar".Translate(factionInstigator, faction)
                        : "MFI_FactionWarLeaderDecidedAgainstWar".Translate(factionInstigator, faction),
                                               WarIsOngoing ? LetterDefOf.NegativeEvent : LetterDefOf.NeutralEvent);
            }
        }
        public void DetermineWarAsIfNoPlayerInteraction(Faction faction, Faction factionInstigator)
        {
            this.unrestIsBrewing = false;

            if (faction.leader?.GetStatValue(StatDefOf.NegotiationAbility) != null)
            {
                int rollForIntendedOutcome = Rand.Bool ? 1 : 4;
                FactionWarDialogue.DetermineOutcome(faction, factionInstigator, faction.leader, rollForIntendedOutcome, out string blah);
                Find.LetterStack.ReceiveLetter("MFI_FactionWarLeaderDecidedLabel".Translate(),
                                               WarIsOngoing ? "MFI_FactionWarLeaderDecidedOnWar".Translate(faction, factionInstigator)
                                                            : "MFI_FactionWarLeaderDecidedAgainstWar".Translate(faction, factionInstigator),
                                               WarIsOngoing ? LetterDefOf.NegativeEvent : LetterDefOf.NeutralEvent);
                return;
            }
            else if (factionInstigator.leader?.GetStatValue(StatDefOf.NegotiationAbility) != null)
            {
                int rollForIntendedOutcome = Rand.Bool ? 1 : 4;
                FactionWarDialogue.DetermineOutcome(factionInstigator, faction, factionInstigator.leader, rollForIntendedOutcome, out string blah);
                Find.LetterStack.ReceiveLetter("MFI_FactionWarLeaderDecidedLabel".Translate(),
                                               WarIsOngoing ? "MFI_FactionWarLeaderDecidedOnWar".Translate(factionInstigator, faction)
                                                            : "MFI_FactionWarLeaderDecidedAgainstWar".Translate(factionInstigator, faction),
                                               WarIsOngoing ? LetterDefOf.NegativeEvent : LetterDefOf.NeutralEvent);
                return;
            }
        }
        public void Notify_CaravanArrived(Caravan caravan)
        {
            Pawn pawn = BestCaravanPawnUtility.FindBestDiplomat(caravan: caravan);

            if (pawn == null)
            {
                Messages.Message(text: "MessagePeaceTalksNoDiplomat".Translate(), lookTargets: caravan, def: MessageTypeDefOf.NegativeEvent, historical: false);
            }
            else
            {
                CameraJumper.TryJumpAndSelect(target: caravan);
                var dialogue = new FactionWarDialogue(pawn: pawn, factionOne: this.factionOne, factionInstigator: this.factionInstigator, incidentTarget: caravan);
                var nodeRoot = dialogue.FactionWarPeaceTalks();
                Find.WindowStack.Add(window: new Dialogue_FactionWarNegotiation(factionOne: this.factionOne, factionInstigator: this.factionInstigator, nodeRoot: nodeRoot));
                this.canRemoveWithoutPostRemove = true;
                Find.WorldObjects.Remove(this);
            }
        }
        public void Notify_CaravanArrived(Caravan caravan)
        {
            var pawn = BestCaravanPawnUtility.FindBestDiplomat(caravan);

            if (pawn == null)
            {
                Messages.Message("MessagePeaceTalksNoDiplomat".Translate(), caravan, MessageTypeDefOf.NegativeEvent,
                                 false);
            }
            else
            {
                CameraJumper.TryJumpAndSelect(caravan);
                var dialogue = new FactionWarDialogue(pawn, factionOne, factionInstigator, caravan);
                var nodeRoot = dialogue.FactionWarPeaceTalks();
                Find.WindowStack.Add(new Dialogue_FactionWarNegotiation(factionOne, factionInstigator, nodeRoot));
                canRemoveWithoutPostRemove = true;
                Find.WorldObjects.Remove(this);
            }
        }