private void RegisterKingdomDecisionConcluded(KingdomDecision decision, DecisionOutcome chosenOutcome, bool isPlayerInvolved) { if (AOCooldownManager.SupportedDecisionTypes.Contains(decision.GetType())) { _cooldownManager.UpdateKingdomDecisionHistory(decision, chosenOutcome, CampaignTime.Now); } }
public static bool HasPrimaryDecisionCooldown(KingdomDecision decision, out float elapsedDaysUntilNow) { elapsedDaysUntilNow = default; return(SupportedDecisionTypes.Contains(decision.GetType()) && KingdomDecisionHistory.TryGetValue(decision, out KingdomDecisionConclusion decisionConclusion) && (elapsedDaysUntilNow = decisionConclusion.ConclusionTime.ElapsedDaysUntilNow) < GetRequiredDecisionCooldown(decision)); }
protected virtual float GetCollectiveSupportScore(Clan clan, KingdomDecision decision, DecisionOutcome possibleOutcome) { Dictionary <DecisionMaker, double> personalScores = GetDecisionMakersSupportScores(clan, decision, possibleOutcome); return(personalScores.Count <= 1 ? (float)personalScores.FirstOrDefault().Value : (float)(personalScores.Sum(x => x.Value) / personalScores.Sum(x => x.Key.DecisionWeight))); }
/* * public override int GetNumberOfFiefsDesired(DecisionMaker decisionMaker) * { * int baseNumber = CalculateBaseNumberOfFiefs(decisionMaker.Hero.Clan, Settings.Instance!.DesiredFiefsBaseline.SelectedValue.EnumValue); * return baseNumber >= 0 * ? Math.Max(0, baseNumber + Settings.Instance.DesiredFiefsModifier + CalculateTraitsModifierForDesiredFiefs(decisionMaker, Settings.Instance.DesiredFiefsBaseline.SelectedValue.EnumValue)) * : baseNumber; * } * * public override int GetNumberOfFiefsDeemedFair(Clan clan) * { * int baseNumber = CalculateBaseNumberOfFiefs(clan, Settings.Instance!.FiefsDeemedFairBaseline.SelectedValue.EnumValue); * return baseNumber >= 0 * ? Math.Max(0, baseNumber + Settings.Instance.FiefsDeemedFairModifier) * : baseNumber; * } */ //Protected overrides protected override float GetGeneralSupportScore(Clan clan, KingdomDecision decision, DecisionOutcome possibleOutcome) { return(decision switch { MakePeaceKingdomDecision makePeaceDecision => GetGeneralSupportScore(clan, makePeaceDecision, possibleOutcome), DeclareWarDecision declareWarDecision => GetGeneralSupportScore(clan, declareWarDecision, possibleOutcome), SettlementClaimantDecision claimantDecision => GetGeneralSupportScore(clan, claimantDecision, possibleOutcome), SettlementClaimantPreliminaryDecision annexationDecision => GetGeneralSupportScore(clan, annexationDecision, possibleOutcome), _ => throw new ArgumentOutOfRangeException(nameof(decision), string.Format("Kingdom decision of type {0} is not supported.", decision.GetType().FullName)), });
public static int GetRequiredDecisionCooldown(KingdomDecision decision) { return(decision switch { MakePeaceKingdomDecision _ => Settings.Instance !.MakePeaceDecisionCooldown, DeclareWarDecision _ => Settings.Instance !.DeclareWarDecisionCooldown, ExpelClanFromKingdomDecision _ => Settings.Instance !.ExpelClanDecisionCooldown, KingdomPolicyDecision _ => Settings.Instance !.KingdomPolicyDecisionCooldown, SettlementClaimantPreliminaryDecision _ => Settings.Instance !.AnnexationDecisionCooldown, _ => throw new ArgumentException(string.Format("{0} is not supported KingdomDecision type", decision.GetType().FullName), nameof(decision)), });
public static bool HasAlternativeDecisionCooldown(KingdomDecision decision) { switch (decision) { case SettlementClaimantPreliminaryDecision preliminaryDecision: CampaignTime?campaignTime = GetTimeOfLastAnnexDecisionAgainstClan(preliminaryDecision.Settlement.OwnerClan); return(campaignTime.HasValue && campaignTime.Value.ElapsedDaysUntilNow < GetRequiredDecisionCooldown(decision)); default: return(false); } }
public static bool Prefix(Clan clan, ref KingdomDecision __result, KingdomDecisionProposalBehavior __instance) //Bool prefixes compete with each other and skip others, as well as original, if return false { try { bool SubSystemEnabled = SettingsHelper.SubSystemEnabled(SubSystemType.ElectionCooldowns, clan) || SettingsHelper.SubSystemEnabled(SubSystemType.DecisionSupportRebalance, clan); bool SystemDebugEnabled = SettingsHelper.SystemDebugEnabled(AOSystems.PoliticsRebalance, DebugType.General, clan); if (!SubSystemEnabled && !SystemDebugEnabled) { return(true); } Kingdom kingdom = clan.Kingdom; __result = null; if (kingdom.UnresolvedDecisions.FirstOrDefault(x => x is SettlementClaimantPreliminaryDecision) == null && clan.Influence >= 300.0) { bool possessionsFactorApplied = SettingsHelper.SubSystemEnabled(SubSystemType.AnnexationSupportRebalance, clan) && Settings.Instance.AnnexSupportCalculationMethod.SelectedValue.EnumValue.HasFlag(FiefOwnershipConsideration.PossessionsFactor) && Settings.Instance.FiefsDeemedFairBaseline.SelectedValue.EnumValue != NumberOfFiefsCalculationMethod.WithoutRestrictions; Clan randomClan = kingdom.Clans.Where(x => x != clan && x.Fortifications.Count > 0 && (x.GetRelationWithClan(clan) < -25 || (possessionsFactorApplied && Campaign.Current.GetAOGameModels().DecisionSupportScoringModel.GetNumberOfFiefsDeemedFair(x) < x.Fortifications.Count)) && x.Fortifications.FirstOrDefault(f => !(SubSystemEnabled && AOCooldownManager.HasDecisionCooldown(new SettlementClaimantPreliminaryDecision(clan, f.Settlement)))) != null ).ToArray().GetRandomElement(); Town randomFortification = SettingsHelper.SubSystemEnabled(SubSystemType.ElectionCooldowns, clan) ? clan.Fortifications.Where(f => !(AOCooldownManager.HasDecisionCooldown(new SettlementClaimantPreliminaryDecision(clan, f.Settlement)))).ToArray().GetRandomElement() : clan.Fortifications.ToArray().GetRandomElement(); //ConsiderAnnexDelegate deConsiderAnnex = AccessHelper.GetDelegate<ConsiderAnnexDelegate, KingdomDecisionProposalBehavior>(__instance, "ConsiderAnnex"); if (randomClan != null && deConsiderAnnex(__instance, clan, kingdom, randomClan, randomFortification)) { __result = new SettlementClaimantPreliminaryDecision(clan, randomFortification.Settlement); } if (SystemDebugEnabled) { PoliticsDebugHelper.PrepareConsiderationDebugMessage(clan, randomFortification, __result, out TextObject debugLogMessage); MessageHelper.SimpleMessage(debugLogMessage); } } return(false); } catch (Exception ex) { MethodInfo methodInfo = MethodBase.GetCurrentMethod() as MethodInfo; DebugHelper.HandleException(ex, methodInfo, "Harmony patch for KingdomDecisionProposalBehavior. GetRandomAnnexationDecision"); return(true); } }
public void UpdateKingdomDecisionHistory(KingdomDecision decision, DecisionOutcome chosenOutcome, CampaignTime conclusionTime) { if (SupportedDecisionTypes.Contains(decision.GetType())) { if (_KingdomDecisionHistory.ContainsKey(decision)) { _KingdomDecisionHistory.Remove(decision); } _KingdomDecisionHistory[decision] = new KingdomDecisionConclusion(chosenOutcome, conclusionTime); } else { throw new ArgumentException(string.Format("{0} is not supported KingdomDecision type", decision.GetType().FullName), nameof(decision)); } }
public static bool Prefix(Clan clan, ref KingdomDecision __result, KingdomDecisionProposalBehavior __instance) //Bool prefixes compete with each other and skip others, as well as original, if return false { try { bool SubSystemEnabled = SettingsHelper.SubSystemEnabled(SubSystemType.ElectionCooldowns, clan); bool SystemDebugEnabled = SettingsHelper.SystemDebugEnabled(AOSystems.PoliticsRebalance, DebugType.General, clan); if (!SubSystemEnabled && !SystemDebugEnabled) { return(true); } Kingdom kingdom = clan.Kingdom; __result = null; if (kingdom.UnresolvedDecisions.FirstOrDefault(x => x is DeclareWarDecision) == null) { Kingdom randomElement = Kingdom.All.Where(x => x != kingdom && !x.IsAtWarWith(kingdom) && x.GetStanceWith(kingdom).PeaceDeclarationDate.ElapsedDaysUntilNow > 20.0 && !(SubSystemEnabled && AOCooldownManager.HasDecisionCooldown(new DeclareWarDecision(clan, x))) ).ToArray().GetRandomElement(); //ConsiderWarDelegate deConsiderWar = AccessHelper.GetDelegate<ConsiderWarDelegate, KingdomDecisionProposalBehavior>(__instance, "ConsiderWar"); if (randomElement != null && deConsiderWar(__instance, clan, kingdom, randomElement)) { __result = new DeclareWarDecision(clan, randomElement); } if (SystemDebugEnabled) { PoliticsDebugHelper.PrepareConsiderationDebugMessage(ConsiderationType.DeclaringWar, clan, randomElement, __result, out TextObject debugLogMessage); MessageHelper.SimpleMessage(debugLogMessage); } } return(false); } catch (Exception ex) { MethodInfo methodInfo = MethodBase.GetCurrentMethod() as MethodInfo; DebugHelper.HandleException(ex, methodInfo, "Harmony patch for KingdomDecisionProposalBehavior. GetRandomWarDecision"); return(true); } }
public static bool Prefix(Clan clan, ref KingdomDecision __result, KingdomDecisionProposalBehavior __instance) //Bool prefixes compete with each other and skip others, as well as original, if return false { try { bool SubSystemEnabled = SettingsHelper.SubSystemEnabled(SubSystemType.ElectionCooldowns, clan); bool SystemDebugEnabled = SettingsHelper.SystemDebugEnabled(AOSystems.PoliticsRebalance, DebugType.General, clan); if (!SubSystemEnabled && !SystemDebugEnabled) { return(true); } Kingdom kingdom = clan.Kingdom; __result = null; if (kingdom.UnresolvedDecisions.FirstOrDefault(x => x is KingdomPolicyDecision) == null && clan.Influence >= 200.0) { PolicyObject randomElement = DefaultPolicies.All.Where(x => !(SubSystemEnabled && AOCooldownManager.HasDecisionCooldown(new KingdomPolicyDecision(clan, x, kingdom.ActivePolicies.Contains(x)))) ).ToArray().GetRandomElement(); bool revertPolicy = kingdom.ActivePolicies.Contains(randomElement); //ConsiderPolicyDelegate deConsiderPolicy = AccessHelper.GetDelegate<ConsiderPolicyDelegate, KingdomDecisionProposalBehavior>(__instance, "ConsiderPolicy"); if (randomElement != null && deConsiderPolicy(__instance, clan, kingdom, randomElement, revertPolicy)) { __result = new KingdomPolicyDecision(clan, randomElement, revertPolicy); } if (SystemDebugEnabled) { PoliticsDebugHelper.PrepareConsiderationDebugMessage(clan, randomElement, __result, out TextObject debugLogMessage); MessageHelper.SimpleMessage(debugLogMessage); } } return(false); } catch (Exception ex) { MethodInfo methodInfo = MethodBase.GetCurrentMethod() as MethodInfo; DebugHelper.HandleException(ex, methodInfo, "Harmony patch for KingdomDecisionProposalBehavior. GetRandomPolicyDecision"); return(true); } }
static void Postfix(Kingdom __instance, ref List <KingdomDecision> ____unresolvedDecisions) { if (PreviousCount == ____unresolvedDecisions.Count) { // no change return; } KingdomDecision newKingdomDecision = ____unresolvedDecisions[____unresolvedDecisions.Count - 1]; // If the player is a mercenary of the kingdom, then immediately resolve without player input. // The original code doesn't check for mercenary service when adding the decision. Since the player is a mercenary, it should ignore it for decision making. if (newKingdomDecision.Kingdom == Clan.PlayerClan.Kingdom && Clan.PlayerClan.IsUnderMercenaryService) { Debug.Print("MercenaryDiplomacyFix.MercenaryDecisionsFixPatch.Kingdom.AddDecision.Postfix: Forced decision to complete without player, who is a mercenary."); new KingdomElection(newKingdomDecision).StartElectionWithoutPlayer(); // ApplyChosenOutcome will remove decision for us so no need for manual removal } }
public static void GetInfluenceRequiredToOverrideKingdomDecision( ref DecisionOutcome popularOption, ref DecisionOutcome overridingOption, ref KingdomDecision decision, ref int __result) { try { if (BannerlordCheatsSettings.Instance?.DecisionOverrideInfluenceCostPercentage < 100f) { var factor = BannerlordCheatsSettings.Instance.DecisionOverrideInfluenceCostPercentage / 100.0f; var newValue = __result * factor; __result = (int)Math.Round(newValue); } } catch (Exception e) { SubModule.LogError(e, typeof(DecisionOverrideInfluenceCostPercentage)); } }
private static bool GetRandomWarDecision(Clan clan, ref KingdomDecision __result) { if (!DiplomacySetting.Instance.EnableSmartChoseFactionToDeclareWar) { return(true); } __result = null; Kingdom kingdom = clan.Kingdom; if (kingdom.UnresolvedDecisions.FirstOrDefault((KingdomDecision x) => x is DeclareWarDecision) != null) { return(false); } IFaction DeclaredWarFaction = KingdomDecisionProposalBehaviorHelp.GetRandomPossibleDeclarWar(kingdom); if (DeclaredWarFaction != null && KingdomDecisionProposalBehaviorHelp.ConsiderWar(clan, kingdom, DeclaredWarFaction)) { // InformationManager.DisplayMessage(new InformationMessage(kingdom.Name.ToString() + ":" + DeclaredWarFaction.Name.ToString())); __result = new DeclareWarDecision(clan, DeclaredWarFaction); } return(false); }
public static int GetRequiredDecisionCooldown(KingdomDecision decision) { switch (decision) { case MakePeaceKingdomDecision _: return(Settings.Instance.MakePeaceDecisionCooldown); case DeclareWarDecision _: return(Settings.Instance.DeclareWarDecisionCooldown); case ExpelClanFromKingdomDecision _: return(Settings.Instance.ExpelClanDecisionCooldown); case KingdomPolicyDecision _: return(Settings.Instance.KingdomPolicyDecisionCooldown); case SettlementClaimantPreliminaryDecision _: return(Settings.Instance.AnnexationDecisionCooldown); default: throw new ArgumentException(string.Format("{0} is not supported KingdomDecision type", decision.GetType().FullName), nameof(decision)); } }
protected abstract double GetSupportScoreOfDecisionMaker(DecisionMaker decisionMaker, KingdomDecision decision, DecisionOutcome possibleOutcome);
protected virtual Dictionary <DecisionMaker, double> GetDecisionMakersSupportScores(Clan clan, KingdomDecision decision, DecisionOutcome possibleOutcome) { return(GetDecisionMakers(clan).ToDictionary(keySelector: dm => dm, elementSelector: dm => GetSupportScoreOfDecisionMaker(dm, decision, possibleOutcome))); }
protected override double GetSupportScoreOfDecisionMaker(DecisionMaker decisionMaker, KingdomDecision decision, DecisionOutcome possibleOutcome) { switch (decision) { case MakePeaceKingdomDecision makePeaceDecision: return(GetSupportScoreOfDecisionMaker(decisionMaker, makePeaceDecision, possibleOutcome) * decisionMaker.DecisionWeight); case DeclareWarDecision declareWarDecision: return(GetSupportScoreOfDecisionMaker(decisionMaker, declareWarDecision, possibleOutcome) * decisionMaker.DecisionWeight); case SettlementClaimantDecision claimantDecision: return(GetSupportScoreOfDecisionMaker(decisionMaker, claimantDecision, possibleOutcome) * decisionMaker.DecisionWeight); case SettlementClaimantPreliminaryDecision annexationDecision: return(GetSupportScoreOfDecisionMaker(decisionMaker, annexationDecision, possibleOutcome) * decisionMaker.DecisionWeight); default: throw new ArgumentOutOfRangeException(nameof(decision), string.Format("Kingdom decision of type {0} is not supported.", decision.GetType().FullName)); } }
protected abstract float GetGeneralSupportScore(Clan clan, KingdomDecision decision, DecisionOutcome possibleOutcome);
public virtual float DetermineSupport(Hero hero, KingdomDecision decision, DecisionOutcome possibleOutcome) { return(GetGeneralSupportScore(hero.Clan, decision, possibleOutcome) + (float)GetSupportScoreOfDecisionMaker(new DecisionMaker(hero, 1), decision, possibleOutcome)); }
public virtual float DetermineSupport(Clan clan, KingdomDecision decision, DecisionOutcome possibleOutcome) { return(GetGeneralSupportScore(clan, decision, possibleOutcome) + GetCollectiveSupportScore(clan, decision, possibleOutcome)); }
public static bool HasDecisionCooldown(KingdomDecision decision) { return(HasPrimaryDecisionCooldown(decision) || HasAlternativeDecisionCooldown(decision)); }
public static void PrepareConsiderationDebugMessage(ConsiderationType considerationType, Clan clan, IFaction otherFaction, KingdomDecision clanDecision, out TextObject debugLogMessage) { if (otherFaction != null) { SetConsideredAction(out debugLogMessage, otherFaction.Name, clanDecision, considerationType); } else { SetPossibleAction(out debugLogMessage, considerationType); } StringHelper.SetEntitiyProperties(debugLogMessage, "REFLECTING_CLAN", clan); }
public static void PrepareConsiderationDebugMessage(Clan clan, PolicyObject policyObject, KingdomDecision clanDecision, out TextObject debugLogMessage) { if (policyObject != null) { SetConsideredAction(out debugLogMessage, policyObject.Name, clanDecision, ConsiderationType.ChangingKingdomPolicy, revertPolicy: clan.Kingdom.ActivePolicies.Contains(policyObject)); } else { SetPossibleAction(out debugLogMessage, ConsiderationType.ChangingKingdomPolicy); } StringHelper.SetEntitiyProperties(debugLogMessage, "REFLECTING_CLAN", clan); }
public static void PrepareConsiderationDebugMessage(Clan clan, Town fiefBeingAnnexed, KingdomDecision clanDecision, out TextObject debugLogMessage) { if (fiefBeingAnnexed != null) { SetConsideredAction(out debugLogMessage, fiefBeingAnnexed.Name, clanDecision, ConsiderationType.AnnexingFief, annexedSettlement: fiefBeingAnnexed.Settlement); } else { SetPossibleAction(out debugLogMessage, ConsiderationType.AnnexingFief); } StringHelper.SetEntitiyProperties(debugLogMessage, "REFLECTING_CLAN", clan); }
public static bool HasDecisionCooldown(KingdomDecision decision, out float elapsedDaysUntilNow) { return(HasPrimaryDecisionCooldown(decision, out elapsedDaysUntilNow) || HasAlternativeDecisionCooldown(decision, out elapsedDaysUntilNow)); }
public static void Postfix(DecisionOutcome popularOption, DecisionOutcome overridingOption, KingdomDecision decision, ref int __result) { try { bool SubSystemEnabled = SettingsHelper.SubSystemEnabled(SubSystemType.ElectionRebalance, decision.Kingdom); bool SystemDebugEnabled = SettingsHelper.SystemDebugEnabled(AOSystems.PoliticsRebalance, DebugType.Technical, decision.Kingdom); if (!SubSystemEnabled && !SystemDebugEnabled) { if (SettingsHelper.SubSystemEnabled(SubSystemType.FreeDecisionOverriding)) { __result = 0; } return; } float PopularOptionSupportPoints = popularOption.TotalSupportPoints; float OverridingOptionSupportPoints = overridingOption.TotalSupportPoints; float CalculatedResult = 0.0f; if (decision.Kingdom.RulingClan == Clan.PlayerClan) { CalculatedResult += ApplySupport(ref PopularOptionSupportPoints, ref OverridingOptionSupportPoints, decision); } float LackingPointsCompensationCost = 0; if (PopularOptionSupportPoints > OverridingOptionSupportPoints) { LackingPointsCompensationCost = GetBaseCompensationCost(Settings.Instance.OverrideDecisionCostCalculationMethod.SelectedValue.EnumValue, popularOption, overridingOption, decision); if (decision.Kingdom.ActivePolicies.Contains(DefaultPolicies.RoyalPrivilege)) { LackingPointsCompensationCost *= 0.8f; } if (decision.Kingdom.RulingClan != Clan.PlayerClan) { LackingPointsCompensationCost *= 0.8f; } CalculatedResult += LackingPointsCompensationCost; } if (SettingsHelper.SubSystemEnabled(SubSystemType.FreeDecisionOverriding)) { CalculatedResult = 0f; } if (SystemDebugEnabled) { string InfluenceRequiredDebugInfo = string.Format("DefaultClanPoliticsModel - InfluenceRequiredToOverrideKingdomDecision. Kingdom: {0}. Decision: {1}. PopularOption: {2}. OverridingOption: {3}. " + "PopularOptionSupportPoints = {4}. OverridingOptionSupportPoints = {5}. " + "OverrideDecisionCostCalculationMethod: {6}. LackingPointsCompensationCost = {7}. " + "Royal Privilege modifier: {8}. NPC modifier: {9}. Free of charge cheat modifier: {10} " + "CalculatedResult = {11}. NativeResult = {12}", decision.Kingdom.Name, decision.GetGeneralTitle(), popularOption.GetDecisionTitle(), overridingOption.GetDecisionTitle(), PopularOptionSupportPoints, OverridingOptionSupportPoints, Settings.Instance.OverrideDecisionCostCalculationMethod.SelectedValue, LackingPointsCompensationCost, GetModifierApplied(decision.Kingdom.ActivePolicies.Contains(DefaultPolicies.RoyalPrivilege)), GetModifierApplied(decision.Kingdom.RulingClan != Clan.PlayerClan), GetModifierApplied(SettingsHelper.SubSystemEnabled(SubSystemType.FreeDecisionOverriding)), CalculatedResult.ToString("N"), __result.ToString("N")); MessageHelper.TechnicalMessage(InfluenceRequiredDebugInfo); } if (SubSystemEnabled) { __result = (int)CalculatedResult; } } catch (Exception ex) { MethodInfo methodInfo = MethodBase.GetCurrentMethod() as MethodInfo; DebugHelper.HandleException(ex, methodInfo, "Harmony patch for DefaultClanPoliticsModel. GetInfluenceRequiredToOverrideKingdomDecision"); } }
private static float GetKingdomSupportForDecision(KingdomDecision decision) { return(new KingdomElection(decision).GetLikelihoodForOutcome(0)); }
private static float GetBaseCompensationCost(ODCostCalculationMethod calculationMethod, DecisionOutcome popularOption, DecisionOutcome overridingOption, KingdomDecision decision) { float PopularOptionSupportPoints = popularOption.TotalSupportPoints; float OverridingOptionSupportPoints = overridingOption.TotalSupportPoints + 3f; return(calculationMethod switch { ODCostCalculationMethod.FlatInfluenceOverride => popularOption.SupporterList.Sum(sup => decision.GetInfluenceCostOfSupport(sup.SupportWeight)), ODCostCalculationMethod.SlightlyFavor => (PopularOptionSupportPoints - OverridingOptionSupportPoints) * decision.GetInfluenceCostOfSupport(Supporter.SupportWeights.SlightlyFavor), ODCostCalculationMethod.StronglyFavor => (PopularOptionSupportPoints - OverridingOptionSupportPoints) * decision.GetInfluenceCostOfSupport(Supporter.SupportWeights.StronglyFavor), ODCostCalculationMethod.FullyPush => (PopularOptionSupportPoints - OverridingOptionSupportPoints) * decision.GetInfluenceCostOfSupport(Supporter.SupportWeights.FullyPush), _ => throw new ArgumentOutOfRangeException(nameof(Settings.Instance.OverrideDecisionCostCalculationMethod.SelectedValue.EnumValue), Settings.Instance !.OverrideDecisionCostCalculationMethod.SelectedValue.EnumValue, null), });
private static float ApplySupport(ref float popularOptionSupportPoints, ref float overridingOptionSupportPoints, KingdomDecision decision) { if (popularOptionSupportPoints == overridingOptionSupportPoints + 1.0) { ++overridingOptionSupportPoints; return(decision.GetInfluenceCostOfSupport(Supporter.SupportWeights.SlightlyFavor)); } else if (popularOptionSupportPoints == overridingOptionSupportPoints + 2.0) { overridingOptionSupportPoints += 2f; return(decision.GetInfluenceCostOfSupport(Supporter.SupportWeights.StronglyFavor)); } else if (popularOptionSupportPoints > overridingOptionSupportPoints + 2.0) { overridingOptionSupportPoints += 3f; return(decision.GetInfluenceCostOfSupport(Supporter.SupportWeights.FullyPush)); } else { return(0.0f); } }
private static void SetConsideredAction(out TextObject textObject, TextObject actionTargetName, KingdomDecision clanDecision, ConsiderationType considerationType, bool revertPolicy = false, Settlement annexedSettlement = null) { textObject = new TextObject(ConsiderationDescription); switch (considerationType) { case ConsiderationType.MakingPeace: textObject.SetTextVariable("CONSIDERED_ACTION", ActionMakingPeace); textObject.SetTextVariable("ACTION_DETAILS", TextObject.Empty); break; case ConsiderationType.DeclaringWar: textObject.SetTextVariable("CONSIDERED_ACTION", ActionDeclaringWar); textObject.SetTextVariable("ACTION_DETAILS", TextObject.Empty); break; case ConsiderationType.ChangingKingdomPolicy: textObject.SetTextVariable("CONSIDERED_ACTION", revertPolicy ? ActionDisavowingKingdomPolicy : ActionIntroducingKingdomPolicy); textObject.SetTextVariable("ACTION_DETAILS", TextObject.Empty); break; case ConsiderationType.AnnexingFief: StringHelper.SetEntitiyProperties(null, "ANNEXED_SETTLEMENT", annexedSettlement); textObject.SetTextVariable("CONSIDERED_ACTION", new TextObject(ActionAnnexingFief)); textObject.SetTextVariable("ACTION_DETAILS", new TextObject(AnnexingFiefActionDetails)); break; default: throw new ArgumentException(string.Format("{0} is not supported Consideration type", considerationType.ToString()), nameof(considerationType)); } textObject.SetTextVariable("ACTION_TARGET", actionTargetName); textObject.SetTextVariable("CONSIDER_OUTCOME", clanDecision is null ? OutcomeIsAbstain : OutcomeIsElectionStart); }