public static List <TextObject> CanBreakAllianceExceptions(KingdomTruceItemVM item, bool forcePlayerCharacterCosts = false) { return(_breakAllianceConditions.Select((condition) => { condition.ApplyCondition(item.Faction1 as Kingdom, item.Faction2 as Kingdom, out TextObject textObject, forcePlayerCharacterCosts); return textObject; }).OfType <TextObject>().ToList()); }
public static List <TextObject> CanFormAllianceExceptions(KingdomTruceItemVM item, bool forcePlayerCharacterCosts = false) { List <TextObject> textObjects = _declareAllianceConditions.Select((condition) => { condition.ApplyCondition(item.Faction1 as Kingdom, item.Faction2 as Kingdom, out TextObject textObject, forcePlayerCharacterCosts); return(textObject); }).OfType <TextObject>().ToList(); if (AllianceScoringModel.GetFormAllianceScore(item.Faction2 as Kingdom, item.Faction1 as Kingdom) < AllianceScoringModel.FormAllianceScoreThreshold) { TextObject scoreTooLow = new TextObject("{=VvTTrRpl}This faction is not interested in forming an alliance with you."); textObjects.Add(scoreTooLow); } return(textObjects); }
public static void OnSetPeaceItemPatch(KingdomTruceItemVM item, KingdomDiplomacyVM __instance) { try { if (SettingsHelper.SubSystemEnabled(SubSystemType.ElectionCooldownsForPlayer)) { bool HasCooldown = AOCooldownManager.HasDecisionCooldown(new DeclareWarDecision(Clan.PlayerClan, item.Faction2), out float elapsedDaysUntilNow); __instance.IsActionEnabled = __instance.IsActionEnabled && !HasCooldown; __instance.ProposeActionExplanationText += HasCooldown ? "\n" + StringHelper.GetCooldownText(typeof(DeclareWarDecision), elapsedDaysUntilNow).ToString() : string.Empty; } } catch (Exception ex) { MethodInfo?methodInfo = MethodBase.GetCurrentMethod() as MethodInfo; DebugHelper.HandleException(ex, methodInfo, "Harmony patch for KingdomDiplomacyVM. OnSetPeaceItem"); } }
public static List <TextObject> CanDeclareWarExceptions(KingdomTruceItemVM item) { return(CanDeclareWarExceptions(item.Faction1 as Kingdom, item.Faction2 as Kingdom, true)); }