Ejemplo n.º 1
0
        public static int GetModifiedRelation(this Hero hero, Hero otherHero)
        {
#if STABLE
            ExplainedNumber relationBetweenHeroes = new ExplainedNumber(CharacterRelationManager.GetHeroRelation(hero, otherHero), false, null);
            deGetPersonalityEffects !(Campaign.Current.Models.DiplomacyModel is DefaultDiplomacyModel defaultDiplomacyModel ? defaultDiplomacyModel : new DefaultDiplomacyModel(), ref relationBetweenHeroes, hero, otherHero);
            return(MBMath.Round(MBMath.ClampFloat(relationBetweenHeroes.ResultNumber + (RelativesHelper.BloodRelatives(hero, otherHero) ? 30f : 0f), -100f, 100f)));
#else
            int relationBetweenHeroes = CharacterRelationManager.GetHeroRelation(hero, otherHero);
            deGetPersonalityEffects !(Campaign.Current.Models.DiplomacyModel is DefaultDiplomacyModel defaultDiplomacyModel ? defaultDiplomacyModel : new DefaultDiplomacyModel(), ref relationBetweenHeroes, hero, otherHero);
            return(MBMath.Round(MBMath.ClampFloat(relationBetweenHeroes + (RelativesHelper.BloodRelatives(hero, otherHero) ? 30f : 0f), -100f, 100f)));
#endif
        }
        public static int GetRelationThreshold(Clan clan, Kingdom?kingdom = null)
        {
            int RelationThreshold = Settings.Instance !.EnsuredLoyaltyBaseline;

            if (Settings.Instance.UseContextForEnsuredLoyalty)
            {
                RelationThreshold -= RelativesHelper.BloodRelatives(clan.Kingdom.RulingClan, clan) ? Settings.Instance.BloodRelativesEnsuredLoyaltyModifier : 0;
                RelationThreshold +=
                    kingdom != null && RelativesHelper.BloodRelatives(kingdom.RulingClan, clan) ? Settings.Instance.BloodRelativesEnsuredLoyaltyModifier : 0 +
                    (clan.IsMinorFaction ? Settings.Instance.MinorFactionEnsuredLoyaltyModifier : 0) +
                    (kingdom is null ? Settings.Instance.DefectionEnsuredLoyaltyModifier : 0) +
                    (clan.Fiefs?.Count < 1 ? Settings.Instance.LandlessClanEnsuredLoyaltyModifier : 0) +
                    (GetKingdomFortificationsCount(clan.Kingdom) < 1 ? Settings.Instance.LandlessKingdomEnsuredLoyaltyModifier : 0);
            }

            if (Settings.Instance.UseHonorForEnsuredLoyalty)
            {
                RelationThreshold += GetHonorModifier(clan.Leader, kingdom is null);
            }

            return(RelationThreshold);
        }
Ejemplo n.º 3
0
 public static void Postfix(ref bool __result)
 {
     try
     {
         if (SettingsHelper.SubSystemEnabled(SubSystemType.LoyaltyInConversations, Hero.OneToOneConversationHero.Clan))
         {
             if (!__result && LoyaltyRebalance.EnsuredLoyalty.LoyaltyManager.CheckLoyalty(Hero.OneToOneConversationHero.Clan, Clan.PlayerClan.Kingdom))
             {
                 float RelationWithPlayer = Hero.OneToOneConversationHero.GetRelationWithPlayer();
                 if (RelationWithPlayer >= 30)
                 {
                     MBTextManager.SetTextVariable("LIEGE_IS_RELATIVE", new TextObject(LoyaltyFriendlyRefuse), false);
                 }
                 else
                 {
                     MBTextManager.SetTextVariable("LIEGE_IS_RELATIVE", new TextObject(!RelativesHelper.BloodRelatives(Hero.OneToOneConversationHero, Hero.MainHero) && RelationWithPlayer <= -10 ? LoyaltyRefuse : LoyaltyPoliteRefuse), false);
                 }
                 __result = true;
             }
         }
     }
     catch (Exception ex)
     {
         MethodInfo?methodInfo = MethodBase.GetCurrentMethod() as MethodInfo;
         DebugHelper.HandleException(ex, methodInfo, "Harmony patch for conversation_lord_from_ruling_clan_on_condition");
     }
 }