public static void Postfix(PartyBase party, StatExplainer explanation, ref int __result)
        {
            XmlNode settings = ClanTweakerSubModule.settings.xmlSettings.ChildNodes[1].SelectSingleNode("PartySizeSettings");

            bool flag;

            if (settings.SelectSingleNode("AffectClanParties").InnerText == "true")
            {
                flag = party.LeaderHero != null && (party.LeaderHero == Hero.MainHero || party.LeaderHero.Clan.Name == Hero.MainHero.Clan.Name);
            }
            else
            {
                flag = party.LeaderHero != null && party.LeaderHero == Hero.MainHero;
            }


            if (party.LeaderHero != null && party.LeaderHero == Hero.MainHero)
            {
                SkillObject leadership = SkillObject.FindFirst((SkillObject x) => x.Name.ToString() == "Leadership");
                SkillObject steward    = SkillObject.FindFirst((SkillObject x) => x.Name.ToString() == "Steward");

                int num = (int)Math.Ceiling((double)party.LeaderHero.GetSkillValue(leadership) * float.Parse(settings.SelectSingleNode("LeadershipBonus").InnerText) * 0.25f);
                __result += num;
                if (explanation != null)
                {
                    explanation.AddLine("Leadership bonus", (float)num, StatExplainer.OperationType.Add);
                }
                num       = (int)Math.Ceiling((double)party.LeaderHero.GetSkillValue(steward) * float.Parse(settings.SelectSingleNode("StewardBonus").InnerText) * 0.25f);
                __result += num;
                if (explanation != null)
                {
                    explanation.AddLine("Steward bonus", (float)num, StatExplainer.OperationType.Add);
                }
            }
        }
Example #2
0
 public static void PostFix2(ref StatExplainer __result, MobileParty __instance)
 {
     if (__instance != null && __instance.LeaderHero != null &&
         BuffManager.Instance.IsBuffCurrentlyActiveForHero(__instance.LeaderHero, "bannerbuff_partyspeedbuff_1"))
     {
         __result.AddLine("Active Speed Buff", 3f, StatExplainer.OperationType.Add);
     }
 }
Example #3
0
        public static StatExplainer MaxHitpointsExplanation(StatExplainer __result, CharacterObject __instance)
        {
            var bonuses = new CharacterAttributeBonuses(__instance);
            var bonusHP = (int)(__instance.MaxHitPoints() * bonuses.HPMultiplier / (1 + bonuses.HPMultiplier));

            __result.AddLine("Endurance modifier", bonusHP);
            return(__result);
        }
Example #4
0
        private static void PartySizeLimitExplainerPatched(PartyBase __instance, ref StatExplainer __result)
        {
            var extra = BannerlordPatch.BannerlordPerkExtra(__instance.LeaderHero);

            if (extra > 0)
            {
                __result.AddLine("Bannerlord", extra);
            }
        }
        private static void PartySizeLimitExplainerPatched(PartyBase __instance, ref StatExplainer __result)
        {
            var extra = ManAtArmsPatch.ManAtArmsPerkExtra(__instance.LeaderHero);

            if (extra > 0)
            {
                __result.AddLine("Man-At-Arms", extra);
            }
        }
Example #6
0
        private static void PartySizeLimitExplainerPatched(PartyBase __instance, ref StatExplainer __result)
        {
            var extra = StewardSwordsAsTributePatch.StewardSwordsAsTributePerkExtra(__instance.LeaderHero);

            if (extra > 0)
            {
                __result.AddLine("Swords As Tribute", extra);
            }
        }
        public static float CalculateLearningRate(float __result, Hero hero, SkillObject skill, StatExplainer explainer = null)
        {
            var bonus = __result * new CharacterAttributeBonuses(hero.CharacterObject).XPMultiplier;

            if (explainer != null)
            {
                explainer.AddLine("INT bonus", bonus); // TODO: Why this explainer stuff doesn't work?
            }
            Logger.Log("Bonus " + bonus.ToString("F2") + " learning rate from INT", hero.CharacterObject);
            return(__result + bonus);
        }
        private void OnCalculateInfluenceChange(RefContainer <float> influence, Clan clan, StatExplainer explanation)
        {
            if (clan.IsUnderMercenaryService && !IsContributingToWar(clan))
            {
                var penalty = MercenarySettings.Instance.InfluencePenalty;

                influence.Value += penalty;
                // Null check is critical, explanation can be null sometimes.
                explanation?.AddLine(GameTexts.FindText("str_mercenary_contract_not_contributing_to_war", null).ToString(), penalty);
            }
        }
        public static void Postfix(ref float __result,
                                   Settlement settlement,
                                   StatExplainer explanation)
        {
            if (explanation != null)
            {
                explanation.AddLine("Prosperity Bonus", SubModule.Settings.MilitiaGrowthBonus);
            }

            __result += SubModule.Settings.MilitiaGrowthBonus;
        }
        static void Postfix(MobileParty party, StatExplainer explanation, ref int __result)
        {
            if (party.LeaderHero != null && party.LeaderHero == Hero.MainHero)
            {
                int num;
                if (Settings.Instance.LeadershipPartySizeBonusEnabled)
                {
                    num       = (int)Math.Ceiling(party.LeaderHero.GetSkillValue(DefaultSkills.Leadership) * Settings.Instance.LeadershipPartySizeBonus);
                    __result += num;
                    explanation?.AddLine("Leadership bonus", num);
                }

                if (Settings.Instance.StewardPartySizeBonusEnabled)
                {
                    num       = (int)Math.Ceiling(party.LeaderHero.GetSkillValue(DefaultSkills.Steward) * Settings.Instance.StewardPartySizeBonus);
                    __result += num;
                    explanation?.AddLine("Steward bonus", num);
                }
            }
        }
        static void Postfix(MobileParty party, StatExplainer explanation, ref int __result)
        {
            if (party.LeaderHero != null && party.LeaderHero == Hero.MainHero)
            {
                SkillObject skill;
                int         num;
                if (Settings.Instance.LeadershipPartySizeBonusEnabled)
                {
                    skill     = SkillObject.FindFirst((x) => { return(x.StringId == "Leadership"); });
                    num       = (int)Math.Ceiling(party.LeaderHero.GetSkillValue(skill) * Settings.Instance.LeadershipPartySizeBonus);
                    __result += num;
                    explanation?.AddLine("Leadership bonus", num);
                }

                if (Settings.Instance.StewardPartySizeBonusEnabled)
                {
                    skill     = SkillObject.FindFirst((x) => x.StringId == "Steward");
                    num       = (int)Math.Ceiling(party.LeaderHero.GetSkillValue(skill) * Settings.Instance.StewardPartySizeBonus);
                    __result += num;
                    explanation?.AddLine("Steward bonus", num);
                }
            }
        }
        public static void CalculateInfluenceChangePatch(ref float __result, Clan clan, StatExplainer explanation = null)
        {
            if (Settings.Instance.EnableInfluenceBalancing)
            {
                float influenceChange = __result;

                if (Settings.Instance.EnableCorruption)
                {
                    float corruption = clan.GetCorruption();
                    if (corruption > 0)
                    {
                        explanation?.AddLine(new TextObject("{=dUCOV7km}Corruption (too many fiefs)").ToString(), -corruption);
                        influenceChange -= corruption;
                    }
                }

                if (Settings.Instance.EnableInfluenceDecay)
                {
                    int influenceDecayFactor = clan.Influence > Settings.Instance.InfluenceDecayThreshold ? (int)-((clan.Influence - Settings.Instance.InfluenceDecayThreshold) * (Settings.Instance.InfluenceDecayPercentage / 100)) : 0;
                    if (influenceDecayFactor < 0)
                    {
                        explanation?.AddLine(new TextObject("{=koTNaZUX}Influence Decay (too much influence)").ToString(), influenceDecayFactor);
                        influenceChange += influenceDecayFactor;
                    }
                }

                float maximumInfluenceLoss = Settings.Instance.MaximumInfluenceLoss;
                if (influenceChange < -maximumInfluenceLoss)
                {
                    explanation?.AddLine(new TextObject("{=uZc8Hg01}Maximum Influence Loss").ToString(), -maximumInfluenceLoss, StatExplainer.OperationType.LimitMin);
                    influenceChange = -maximumInfluenceLoss;
                }

                __result = influenceChange;
            }
        }
        public override float CalculateClanGoldChange(Clan clan, StatExplainer explanation = null, bool applyWithdrawals = false)
        {
            float gold = base.CalculateClanGoldChange(clan, explanation, applyWithdrawals);

            if (clan.Leader.StringId == Hero.MainHero.StringId && explanation != null)
            {
                var(purse, _, _) = BankBehavior.BankAccount.EstimateInterests();

                if (purse > 0)
                {
                    explanation.AddLine("Iron Bank - interests", purse, StatExplainer.OperationType.Add);
                    return(gold + purse);
                }
            }

            return(gold);
        }
 public static int GetPartyMemberSizeLimit(int __result, PartyBase party, StatExplainer explanation = null) =>
 (int)(__result * party.GetPartyBonus(
           bonuses => bonuses.PartySizeMultiplier,
           (explanation != null)
             ? (bonus, name) => explanation.AddLine(name + "'s SOC", bonus * __result)
             : (LogBonusDelegate)null));