Пример #1
0
        public void RemoveFaction(FactionInteraction faction, AllianceRemoveReason reason)
        {
            Factions.Remove(faction);

            if (reason == AllianceRemoveReason.Kick)
            {
                faction.Faction.TrySetRelationKind(FactionOwner, FactionRelationKind.Hostile);
                faction.Trust -= KickTrustChange;

                foreach (var allianceFaction in Factions)
                {
                    allianceFaction.Faction.TrySetRelationKind(faction.Faction, FactionRelationKind.Hostile);
                }
            }

            if (AllianceAgreements != null)
            {
                for (int i = 0; i < AllianceAgreements.Count; i++)
                {
                    AllianceAgreementComp agreement = AllianceAgreements[i];

                    if (agreement.SignedFaction == faction)
                    {
                        EndAgreement(agreement, AgreementEndReason.FactionLeave);
                    }
                }
            }

            RemoveFromWars(faction);

            Find.LetterStack.ReceiveLetter("AllianceRemoveFactionTitle".Translate(faction.Faction.Name), "Alliance_RemoveFactionDesc".Translate(faction.Faction.Name, reason.Translate()), LetterDefOf.NeutralEvent);
        }
Пример #2
0
        public void EndAgreement(AllianceAgreementComp allianceAgreementComp, AgreementEndReason agreementEndReason)
        {
            if (AllianceAgreements.Contains(allianceAgreementComp))
            {
                allianceAgreementComp.End(agreementEndReason);

                AllianceAgreements.Remove(allianceAgreementComp);
            }
        }
Пример #3
0
        public bool AddAgreement(AllianceAgreementDef allianceAgreementDef, FactionInteraction signedFaction, int endTicks)
        {
            if (!CanSignAgreement(allianceAgreementDef, out string reason))
            {
                Messages.Message("Alliance_AddAgreement_False".Translate(reason), MessageTypeDefOf.NeutralEvent);
                return(false);
            }

            AllianceAgreementComp allianceAgreementComp = (AllianceAgreementComp)Activator.CreateInstance(allianceAgreementDef.Comp.compClass);

            allianceAgreementComp.AllianceAgreementDef = allianceAgreementDef;
            allianceAgreementComp.SignedFaction        = signedFaction;
            allianceAgreementComp.OwnerFaction         = QuestsManager.Communications.FactionManager.GetInteraction(FactionOwner);
            allianceAgreementComp.EndTicks             = Find.TickManager.TicksGame + endTicks;
            allianceAgreementComp.SignTicks            = Find.TickManager.TicksGame;
            allianceAgreementComp.Alliance             = this;

            AllianceAgreements.Add(allianceAgreementComp);

            return(true);
        }
Пример #4
0
        public bool AddAgreement(AllianceAgreementComp allianceAgreementComp)
        {
            AllianceAgreements.Add(allianceAgreementComp);

            return(true);
        }