public virtual bool CanSign(Alliance alliance, AllianceAgreementDef allianceAgreementDef, Pawn speaker, out string reason)
        {
            reason = string.Empty;

            if (alliance.AgreementActive(allianceAgreementDef))
            {
                reason = "Alliance_CanSignAgreement_AlreadyActive".Translate();
                return(false);
            }

            if (!allianceAgreementDef.TargetGoals.Contains(alliance.AllianceGoalDef))
            {
                reason = "Alliance_CanSignAgreement_NoTargetGoal".Translate();
                return(false);
            }

            if (allianceAgreementDef.UseAgreementsSlot && alliance.AllianceAgreements.Count == alliance.AgreementsSlots)
            {
                reason = "Alliance_CanSignAgreement_NoSlots".Translate(alliance.AgreementsSlots);
                return(false);
            }

            var conditions = allianceAgreementDef.Conditions;

            if (conditions != null)
            {
                foreach (var condition in conditions)
                {
                    if (!condition.Avaliable(alliance))
                    {
                        reason = condition.Reason;
                        return(false);
                    }
                }
            }

            if (alliance.Factions.Count < allianceAgreementDef.MinMembersRequired)
            {
                reason = "Alliance_CanSignAgreement_MinMembersRequired".Translate(allianceAgreementDef.MinMembersRequired);
                return(false);
            }

            return(true);
        }
 public virtual void MenuSelect(Alliance alliance, AllianceAgreementDef allianceAgreementDef, Pawn negotiator)
 {
 }
Ejemplo n.º 3
0
 public Dialog_RenameAlliance(Alliance alliance)
 {
     this.alliance = alliance;
 }
Ejemplo n.º 4
0
 public abstract bool Avaliable(Alliance alliance);
Ejemplo n.º 5
0
 public override void MenuSelect(QuestRim.Alliance alliance, AllianceAgreementDef allianceAgreementDef, Pawn negotiator)
 {
     Find.WindowStack.Add(new TradeSchedulingAgreementWindow(alliance, this, negotiator));
 }
 public override void MenuSelect(QuestRim.Alliance alliance, AllianceAgreementDef allianceAgreementDef, Pawn negotiator)
 {
     Find.WindowStack.Add(new DefenseContractCompWindow(alliance, this, negotiator));
 }
Ejemplo n.º 7
0
        private void DrawFactionCard(Rect rect, ref int y, FactionInteraction faction)
        {
            Text.Anchor = TextAnchor.UpperLeft;
            Text.Font   = GameFont.Small;

            Rect r         = new Rect(10, y, rect.width - 20, 75);
            Rect titleRect = new Rect(15, y, rect.width - 20, 50);

            Widgets.Label(titleRect, faction.Faction.Name);
            Text.Font = GameFont.Tiny;
            Rect rect2 = new Rect(15, y + 22, rect.width - 20, 50);
            FactionRelationKind kindWithPlayer = faction.Faction.PlayerRelationKind;
            Alliance            alliance       = faction.Alliance;

            Widgets.Label(rect2, "RelationsWithPlayer".Translate(kindWithPlayer.GetLabel(), faction.Faction.PlayerGoodwill.ToStringWithSign(), faction.Trust, "AllianceInformation".Translate(alliance == null ? "NoAllianceAlias".Translate().ToString() : alliance.Name)));

            Text.Font = GameFont.Small;
            Widgets.DrawHighlightIfMouseover(r);

            if (Mouse.IsOver(r))
            {
                string str2 = "CurrentGoodwillTip".Translate();
                if (faction.Faction.def.permanentEnemy)
                {
                    str2 = str2 + "\n\n" + "CurrentGoodwillTip_PermanentEnemy".Translate();
                }
                else
                {
                    str2 += "\n\n";
                    switch (faction.Faction.PlayerRelationKind)
                    {
                    case FactionRelationKind.Ally:
                        str2 += "CurrentGoodwillTip_Ally".Translate(0.ToString("F0"));
                        break;

                    case FactionRelationKind.Neutral:
                        str2 += "CurrentGoodwillTip_Neutral".Translate(0.ToString("F0"), 75.ToString("F0"));
                        break;

                    case FactionRelationKind.Hostile:
                        str2 += "CurrentGoodwillTip_Hostile".Translate(0.ToString("F0"));
                        break;
                    }
                    if (faction.Faction.def.goodwillDailyGain > 0f || faction.Faction.def.goodwillDailyFall > 0f)
                    {
                        str2 = str2 + "\n\n" + "CurrentGoodwillTip_NaturalGoodwill".Translate(faction.Faction.def.naturalColonyGoodwill.min.ToString("F0"), faction.Faction.def.naturalColonyGoodwill.max.ToString("F0"), faction.Faction.def.goodwillDailyGain.ToString("0.#"), faction.Faction.def.goodwillDailyFall.ToString("0.#"));
                    }
                }
                str2 += "TrustFactionInformation".Translate();
                TooltipHandler.TipRegion(r, str2);
            }

            GUI.color = faction.Faction.Color;
            Widgets.DrawHighlight(r);
            GUI.color = Color.white;

            var war = hasWarsWithPlayer[faction];

            if (war != null)
            {
                GUI.color = war.WarGoalDef.MenuColor;
                Widgets.DrawBox(r);
                GUI.color = Color.white;

                if (war.Started == false)
                {
                    hasWarsWithPlayer[faction] = null;
                }
            }

            if (Widgets.ButtonInvisible(r))
            {
                currentFaction = faction;
                defendant      = currentFaction.Faction.leader;
            }
            y += 85;
        }
Ejemplo n.º 8
0
 public static bool InAlliance(this FactionInteraction interaction, Alliance alliance)
 {
     return(alliance.Factions.Contains(interaction));
 }