Exemplo n.º 1
0
        public override ExplainedNumber CalculateFinalSpeed(MobileParty mobileParty, ExplainedNumber finalSpeed)
        {
            ExplainedNumber result = base.CalculateFinalSpeed(mobileParty, finalSpeed);

            if (mobileParty.Party == PartyBase.MainParty)
            {
                result.AddFactor(SHADOWFAX_MOVEMENT_BONUS);
            }

            result.LimitMin(1f);
            return(result);
        }
 static bool Prefix(DefaultCharacterDevelopmentModel __instance, int attributeValue, int focusValue, TextObject attributeName, StatExplainer explainer, ref int __result)
 {
     if (explainer != null)
     {
         ExplainedNumber explainedNumber = new ExplainedNumber(0.0f, explainer, (TextObject)null);
         explainedNumber.Add(SKILLLEVEL, _LevelText);
         explainedNumber.Add(attributeValue * Reworked_SkillsSubModule.__ATTR_VALUE, attributeName);
         explainedNumber.Add(focusValue * Reworked_SkillsSubModule.__FOCUS_VALUE, Patch3.desription);
         explainedNumber.LimitMin(0.0f);
         __result = (int)explainedNumber.ResultNumber;
         return(false);
     }
     __result = (int)Reworked_SkillsSubModule.__LEANRINGLIMIT;
     return(false);
 }
        static void Postfix(MobileParty mobileParty, ref ExplainedNumber __result)
        {
            if (!Main.PartySpeedContext.IsPartySpeedBonusAllowedByUser())
            {
                return;
            }

            string partyId = CampaignUtils.IsolateMobilePartyStringID(mobileParty); //TODO if this is non-trivial make it more efficient

            if (Main.PartySpeedContext.IsPartyMinimumSpeedOverriden(partyId))       //minimum adjustment
            {
                __result.LimitMin(Main.PartySpeedContext.GetMinimumSpeed(partyId));
            }

            if (Main.PartySpeedContext.IsPartyMaximumSpeedOverriden(partyId))//maximum adjustment
            {
                __result.LimitMax(Main.PartySpeedContext.GetMaximumSpeed(partyId));
            }
        }
        static bool Prefix(DefaultCharacterDevelopmentModel __instance,
                           int attributeValue, int focusValue, int skillValue, int characterLevel, TextObject attributeName, StatExplainer explainer, ref float __result)
        {
            if (attributeValue == 11)
            {
                skillValue -= (int)(attributeValue * Reworked_SkillsSubModule.__ATTR_VALUE + focusValue * Reworked_SkillsSubModule.__FOCUS_VALUE);
            }
            ExplainedNumber explainedNumber = new ExplainedNumber(0, explainer, (TextObject)null);
            float           BaseByLevel     = (float)(20.0 / (10.0 + (double)characterLevel));
            float           Attribute       = 0.4f * (float)10;
            float           Focus           = (float)5 * 1f;

            if (Reworked_SkillsSubModule.__DEFAULTLEARNING)
            {
                explainedNumber.Add(BaseByLevel, _LevelText);
                explainedNumber.Add(Attribute, attributeName);
                explainedNumber.Add(Focus, _skillFocusText);
            }
            else if (Reworked_SkillsSubModule.__DEFAULTNORMALIZEDLEARNING)
            {
                float penalty = Math.Max(0, Reworked_SkillsSubModule.__SKILLPNLT - skillValue) / Reworked_SkillsSubModule.__SKILLPNLTDV;
                explainedNumber.Add(BaseByLevel, _LevelText);
                explainedNumber.Add(Attribute, attributeName);
                explainedNumber.Add(Focus, _skillFocusText);
                explainedNumber.Add(-penalty, _NormalizedPenaltyText);
            }
            else if (Reworked_SkillsSubModule.__FIXEDRATE)
            {
                explainedNumber.Add(Reworked_SkillsSubModule.__FIXEDLEARNINGRATE, _FixedRateText);
            }
            int learningLimit = Reworked_SkillsSubModule.__LEANRINGLIMIT;// __instance.CalculateLearningLimit(10, 5, (TextObject)null, (StatExplainer)null);

            if (skillValue > learningLimit)
            {
                int num = skillValue - learningLimit;
                explainedNumber.AddFactor((float)(-1.0 - 0.100000001490116 * (double)num), _overLimitText);
            }
            explainedNumber.LimitMin(0.0f);
            __result = explainedNumber.ResultNumber;
            return(false); // make sure you only skip if really necessary
        }
Exemplo n.º 5
0
        public override ExplainedNumber CalculateFinalSpeed(MobileParty mobileParty, ExplainedNumber finalSpeed)
        {
            ExplainedNumber result = base.CalculateFinalSpeed(mobileParty, finalSpeed);

            if (!IsAffectedParty(mobileParty))
            {
                return(result);
            }

            Settlement closest_settlement = FindClosetSettlement(mobileParty);

            if (closest_settlement == null)
            {
                InformationManager.DisplayMessage(new InformationMessage("Unable to find closest settlement."));
                return(result);
            }

            PatchSpeedDueToFriendiness(ref mobileParty, ref result, ref closest_settlement);

            result.LimitMin(1f);
            return(result);
        }
        public override float CalculateFinalSpeed(MobileParty mobileParty, float baseSpeed, StatExplainer explanation)
        {
            try
            {
                PartyBase       party           = mobileParty.Party;
                ExplainedNumber explainedNumber = new ExplainedNumber(baseSpeed, explanation, null);
                explainedNumber.LimitMin(1f);
                string key = CampaignUtils.IsolateMobilePartyStringID(mobileParty); //TODO if this is non-trivial make it more efficient
                if (partyIDToBaseSpeed.ContainsKey(key) && partyIDToBaseSpeed[key] != float.MinValue)
                {
                    float bs = partyIDToBaseSpeed[key];
                    explainedNumber.Add(bs - explainedNumber.ResultNumber, explanationText);
                }
                else if (partyIDToExtraSpeed.ContainsKey(key))
                {
                    float extra = partyIDToExtraSpeed[key];
                    explainedNumber.Add(extra, explanationText);
                }
                TerrainType faceTerrainType = Campaign.Current.MapSceneWrapper.GetFaceTerrainType(mobileParty.CurrentNavigationFace);
                float       num             = explainedNumber.ResultNumber;
                if (partyIDToMinimumSpeed.ContainsKey(key))//minimum adjustment
                {
                    num = Math.Max(num, partyIDToMinimumSpeed[key]);
                }
                else
                {
                    explainedNumber.LimitMin(1f);
                }

                if (partyIDToMaximumSpeed.ContainsKey(key))//maximum adjustment
                {
                    num = Math.Min(num, partyIDToMaximumSpeed[key]);
                }

                explainedNumber.Add(num - explainedNumber.ResultNumber, new TextObject("Custom Spawns final modification"));
                if (faceTerrainType == TerrainType.Forest)
                {
                    explainedNumber.AddFactor(-0.3f, _movingInForest);
                    PerkHelper.AddFeatBonusForPerson(DefaultFeats.Cultural.BattanianForestAgility, mobileParty.Leader, ref explainedNumber);
                }
                else if (faceTerrainType == TerrainType.Water || faceTerrainType == TerrainType.River || faceTerrainType == TerrainType.Bridge || faceTerrainType == TerrainType.ShallowRiver)
                {
                    explainedNumber.AddFactor(-0.3f, _fordEffect);
                }
                if (Campaign.Current.IsNight)
                {
                    explainedNumber.AddFactor(-0.25f, _night);
                }
                if (faceTerrainType == TerrainType.Snow)
                {
                    explainedNumber.AddFactor(-0.1f, _snow);
                    if (party.Leader != null)
                    {
                        PerkHelper.AddFeatBonusForPerson(DefaultFeats.Cultural.SturgianSnowAgility, party.Leader, ref explainedNumber);
                    }
                }
                return(explainedNumber.ResultNumber);
            }
            catch (Exception e)
            {
                ErrorHandler.HandleException(e, " MOBILE PARTY FINAL SPEED CALCULATION ");
                return(1f);
            }
        }
        public override float CalculateFinalSpeed(MobileParty mobileParty, float baseSpeed, StatExplainer explanation)
        {
            PartyBase       party           = mobileParty.Party;
            ExplainedNumber explainedNumber = new ExplainedNumber(baseSpeed, explanation, null);
            TerrainType     faceTerrainType = Campaign.Current.MapSceneWrapper.GetFaceTerrainType(mobileParty.CurrentNavigationFace);

            if (faceTerrainType == TerrainType.Forest)
            {
                explainedNumber.AddFactor(MovingAtForestEffect, _movingInForest);
                // @CFF - Reduce the effect of forest instead of calculating off of base speed
                // PerkHelper.AddFeatBonusForPerson(DefaultFeats.Cultural.BattanianForestAgility, mobileParty.Leader, ref explainedNumber);

                // @CFF - Replace call to PerkHelper.AddFeatBonusForPerson and subsequent private calls
                if (mobileParty.Leader != null && mobileParty.Leader.GetFeatValue(DefaultFeats.Cultural.BattanianForestAgility))
                {
                    float battanianBonusFactor = Math.Abs(MovingAtForestEffect) * DefaultFeats.Cultural.BattanianForestAgility.EffectBonus;

                    if (DefaultFeats.Cultural.BattanianForestAgility.IncrementType == FeatObject.AdditionType.AddFactor)
                    {
                        explainedNumber.AddFactor(battanianBonusFactor, DefaultFeats.Cultural.BattanianForestAgility.Name);
                    }
                    else if (DefaultFeats.Cultural.BattanianForestAgility.IncrementType == FeatObject.AdditionType.Add)
                    {
                        // Backwards compatibility in case the modifier is set to Add in the future
                        explainedNumber.Add(battanianBonusFactor, DefaultFeats.Cultural.BattanianForestAgility.Name);
                    }
                    else
                    {
                        // This should not occur, explicitly do nothing
                    }
                }
            }

            else if (faceTerrainType == TerrainType.Water || faceTerrainType == TerrainType.River || faceTerrainType == TerrainType.Bridge || faceTerrainType == TerrainType.ShallowRiver)
            {
                explainedNumber.AddFactor(MovingAtWaterEffect, _fordEffect);
            }
            if (Campaign.Current.IsNight)
            {
                explainedNumber.AddFactor(MovingAtNightEffect, _night);
            }

            // @CFF - BUG: faceTerrainType is never TerrainType.Snow

            /*
             * if (faceTerrainType == TerrainType.Snow) {
             *  explainedNumber.AddFactor(MovingOnSnowEffect, _snow);
             *  if (party.Leader != null) {
             *      PerkHelper.AddFeatBonusForPerson(DefaultFeats.Cultural.SturgianSnowAgility, party.Leader, ref explainedNumber);
             *  }
             * }
             */

            // @CFF - Replace snow detection
            // Get the current weather for the party position
            var atmosphereModel = Campaign.Current.Models.MapWeatherModel.GetAtmosphereModel(CampaignTime.Now, mobileParty.GetPosition());

            if (atmosphereModel.SnowInfo.Density > 0f)
            {
                // if there is snow on the ground, apply the movement debuff as a factor of the density
                float snowDensityDebuff = MovingOnSnowEffect * atmosphereModel.SnowInfo.Density;
                explainedNumber.AddFactor(snowDensityDebuff, _snow);

                // @CFF - Replace call to PerkHelper.AddFeatBonusForPerson and subsequent private calls
                if (mobileParty.Leader != null && mobileParty.Leader.GetFeatValue(DefaultFeats.Cultural.SturgianSnowAgility))
                {
                    float sturgianBonusFactor = Math.Abs(snowDensityDebuff) * DefaultFeats.Cultural.SturgianSnowAgility.EffectBonus;

                    if (DefaultFeats.Cultural.SturgianSnowAgility.IncrementType == FeatObject.AdditionType.AddFactor)
                    {
                        explainedNumber.AddFactor(sturgianBonusFactor, DefaultFeats.Cultural.SturgianSnowAgility.Name);
                    }
                    else if (DefaultFeats.Cultural.SturgianSnowAgility.IncrementType == FeatObject.AdditionType.Add)
                    {
                        explainedNumber.Add(sturgianBonusFactor, DefaultFeats.Cultural.SturgianSnowAgility.Name);
                    }
                    else
                    {
                        // This should not occur, explicitly do nothing
                    }
                }
            }

            explainedNumber.LimitMin(1f);
            return(explainedNumber.ResultNumber);
        }
        public override float CalculatePureSpeed(MobileParty mobileParty, StatExplainer explanation, int additionalTroopOnFootCount = 0, int additionalTroopOnHorseCount = 0)
        {
            if (mobileParty.Army != null && mobileParty.Army.LeaderParty.AttachedParties.Contains(mobileParty))
            {
                return(this.CalculatePureSpeed(mobileParty.Army.LeaderParty, explanation, 0, 0));
            }

            PartyBase party = mobileParty.Party;
            int       numberOfAvailableMounts = 0;
            float     totalWeightCarried      = 0f;
            int       herdSize = 0;
            int       menCount = mobileParty.MemberRoster.TotalManCount + additionalTroopOnFootCount + additionalTroopOnHorseCount;

            AddCargoStats(mobileParty, ref numberOfAvailableMounts, ref totalWeightCarried, ref herdSize);

            float totalWeightOfItems = GetTotalWeightOfItems(mobileParty);
            int   inventryCapacity   = Campaign.Current.Models.InventoryCapacityModel.CalculateInventoryCapacity(mobileParty, null, additionalTroopOnFootCount, additionalTroopOnHorseCount, 0, false);
            int   horsemenCount      = party.NumberOfMenWithHorse + additionalTroopOnHorseCount;
            int   footmenCount       = party.NumberOfMenWithoutHorse + additionalTroopOnFootCount;
            int   woundedCount       = party.MemberRoster.TotalWounded;
            int   prisonerCount      = party.PrisonRoster.TotalManCount;
            float morale             = mobileParty.Morale;

            if (mobileParty.AttachedParties.Count != 0)
            {
                foreach (MobileParty attachedParty in mobileParty.AttachedParties)
                {
                    AddCargoStats(attachedParty, ref numberOfAvailableMounts, ref totalWeightCarried, ref herdSize);
                    menCount           += attachedParty.MemberRoster.TotalManCount;
                    totalWeightOfItems += GetTotalWeightOfItems(attachedParty);
                    inventryCapacity   += Campaign.Current.Models.InventoryCapacityModel.CalculateInventoryCapacity(attachedParty, null, 0, 0, 0, false);
                    horsemenCount      += attachedParty.Party.NumberOfMenWithHorse;
                    footmenCount       += attachedParty.Party.NumberOfMenWithoutHorse;
                    woundedCount       += attachedParty.MemberRoster.TotalWounded;
                    prisonerCount      += attachedParty.PrisonRoster.TotalManCount;
                }
            }
            float           baseNumber           = CalculateBaseSpeedForParty(menCount);
            ExplainedNumber explainedNumber      = new ExplainedNumber(baseNumber, explanation, null);
            float           cavalryRatioModifier = this.GetCavalryRatioModifier(menCount, horsemenCount);

            explainedNumber.AddFactor(cavalryRatioModifier, _textCavalry);

            int   min_footmenCount_numberOfAvailableMounts = Math.Min(footmenCount, numberOfAvailableMounts);
            float mountedFootmenRatioModifier = this.GetMountedFootmenRatioModifier(menCount, min_footmenCount_numberOfAvailableMounts);

            explainedNumber.AddFactor(mountedFootmenRatioModifier, _textMountedFootmen);

            if (mobileParty.Leader != null)
            {
                // @CFF - Calculates off of base value instead of (cavalry + footmen on horses) * bonus
                // PerkHelper.AddFeatBonusForPerson(DefaultFeats.Cultural.KhuzaitCavalryAgility, mobileParty.Leader, ref explainedNumber);

                // @CFF - Replace call to PerkHelper.AddFeatBonusForPerson and subsequent private calls
                if (mobileParty.Leader != null && mobileParty.Leader.GetFeatValue(DefaultFeats.Cultural.KhuzaitCavalryAgility))
                {
                    // Add khuzait bonus based on cavalry horsemen bonus already applied instead of base
                    float khuzaitBonusFactor = (cavalryRatioModifier + mountedFootmenRatioModifier) * DefaultFeats.Cultural.KhuzaitCavalryAgility.EffectBonus;
                    if (DefaultFeats.Cultural.KhuzaitCavalryAgility.IncrementType == FeatObject.AdditionType.AddFactor)
                    {
                        explainedNumber.AddFactor(khuzaitBonusFactor, DefaultFeats.Cultural.KhuzaitCavalryAgility.Name);
                    }
                    else if (DefaultFeats.Cultural.KhuzaitCavalryAgility.IncrementType == FeatObject.AdditionType.Add)
                    {
                        // Backwards compatibility in case the modifier is set to Add in the future
                        explainedNumber.Add(khuzaitBonusFactor, DefaultFeats.Cultural.KhuzaitCavalryAgility.Name);
                    }
                    else
                    {
                        // This should not occur, explicitly do nothing
                    }
                }
            }

            float num12 = Math.Min(totalWeightOfItems, (float)inventryCapacity);

            if (num12 > 0f)
            {
                float cargoEffect = this.GetCargoEffect(num12, inventryCapacity);
                explainedNumber.AddFactor(cargoEffect, _textCargo);
            }
            if (totalWeightCarried > (float)inventryCapacity)
            {
                float overBurdenedEffect = this.GetOverBurdenedEffect(totalWeightCarried - (float)inventryCapacity, inventryCapacity);
                explainedNumber.AddFactor(overBurdenedEffect, _textOverburdened);
            }
            if (mobileParty.Party.NumberOfAllMembers > mobileParty.Party.PartySizeLimit)
            {
                float overPartySizeEffect = this.GetOverPartySizeEffect(mobileParty);
                explainedNumber.AddFactor(overPartySizeEffect, _textOverPartySize);
            }
            if (mobileParty.Party.NumberOfPrisoners > mobileParty.Party.PrisonerSizeLimit)
            {
                float overPrisonerSizeEffect = this.GetOverPrisonerSizeEffect(mobileParty);
                explainedNumber.AddFactor(overPrisonerSizeEffect, _textOverPrisonerSize);
            }
            herdSize += Math.Max(0, numberOfAvailableMounts - min_footmenCount_numberOfAvailableMounts);
            float herdingModifier = this.GetHerdingModifier(menCount, herdSize);

            explainedNumber.AddFactor(herdingModifier, _textHerd);
            float woundedModifier = this.GetWoundedModifier(menCount, woundedCount, mobileParty);

            explainedNumber.AddFactor(woundedModifier, _textWounded);
            float sizeModifierPrisoner = GetSizeModifierPrisoner(menCount, prisonerCount);

            explainedNumber.AddFactor(1f / sizeModifierPrisoner - 1f, _textPrisoners);
            if (morale > 70f)
            {
                explainedNumber.AddFactor(0.05f * ((morale - 70f) / 30f), _textHighMorale);
            }
            if (morale < 30f)
            {
                explainedNumber.AddFactor(-0.1f * (1f - mobileParty.Morale / 30f), _textLowMorale);
            }
            if (mobileParty == MobileParty.MainParty)
            {
                float playerMapMovementSpeedBonusMultiplier = Campaign.Current.Models.DifficultyModel.GetPlayerMapMovementSpeedBonusMultiplier();
                if (playerMapMovementSpeedBonusMultiplier != 0f)
                {
                    explainedNumber.AddFactor(playerMapMovementSpeedBonusMultiplier, _difficulty);
                }
            }
            if (mobileParty.IsDisorganized)
            {
                explainedNumber.AddFactor(-0.3f, _textDisorganized);
            }
            explainedNumber.LimitMin(1f);
            return(explainedNumber.ResultNumber);
        }
Exemplo n.º 9
0
        private static void Postfix(ref float __result, MobileParty mobileParty, float baseSpeed, StatExplainer explanation)
        {
            if (mobileParty.LeaderHero == null)
            {
                return;
            }

            var             leader          = mobileParty.LeaderHero;
            PartyBase       party           = mobileParty.Party;
            ExplainedNumber bonuses         = new ExplainedNumber(__result, explanation);
            TerrainType     faceTerrainType = Campaign.Current.MapSceneWrapper.GetFaceTerrainType(mobileParty.CurrentNavigationFace);

            switch (faceTerrainType)
            {
            case TerrainType.Forest:
                if (leader.GetPerkValue(DefaultPerks.Scouting.ForestLore))
                {
                    bonuses.AddFactor(0.05f, DefaultPerks.Scouting.ForestLore.Name);
                }
                break;

            case TerrainType.Desert:
                if (leader.GetPerkValue(DefaultPerks.Scouting.DesertLore))
                {
                    bonuses.AddFactor(0.05f, DefaultPerks.Scouting.DesertLore.Name);
                }
                break;

            case TerrainType.Mountain:
                if (leader.GetPerkValue(DefaultPerks.Scouting.HillsLore))
                {
                    bonuses.AddFactor(0.05f, DefaultPerks.Scouting.HillsLore.Name);
                }

                break;

            case TerrainType.Swamp:
                if (leader.GetPerkValue(DefaultPerks.Scouting.MarshesLore))
                {
                    bonuses.AddFactor(0.05f, DefaultPerks.Scouting.MarshesLore.Name);
                }

                break;

            case TerrainType.Steppe:
                var scoutingGrasslandNavigator = PerkObject.FindFirst(a => a.Name.GetID() == "Ekqj9IFR");
                if (scoutingGrasslandNavigator != null && leader.GetPerkValue(scoutingGrasslandNavigator))
                {
                    bonuses.AddFactor(0.05f, scoutingGrasslandNavigator.Name);
                }
                break;

            case TerrainType.Water:
            case TerrainType.Bridge:
            case TerrainType.River:
            case TerrainType.ShallowRiver:


                break;
            }
            //第一层
            if (!Campaign.Current.IsNight)
            {
                if (leader.GetPerkValue(DefaultPerks.Scouting.Pathfinder) || (mobileParty.Scout != null && mobileParty.Scout.GetPerkValue(DefaultPerks.Scouting.Pathfinder)))
                {
                    bonuses.AddFactor(0.01f, DefaultPerks.Scouting.Pathfinder.Name);
                }
            }
            else
            {
                if (leader.GetPerkValue(DefaultPerks.Scouting.TorchCarriers) || (mobileParty.Scout != null && mobileParty.Scout.GetPerkValue(DefaultPerks.Scouting.TorchCarriers)))
                {
                    bonuses.AddFactor(0.02f, DefaultPerks.Scouting.TorchCarriers.Name);
                }
            }
            //2
            if (leader.GetPerkValue(DefaultPerks.Scouting.Navigator) || (mobileParty.Scout != null && mobileParty.Scout.GetPerkValue(DefaultPerks.Scouting.Navigator)))
            {
                bonuses.AddFactor(0.01f, DefaultPerks.Scouting.Navigator.Name);
            }

            var ScoutingExtra2 = PerkObject.FindFirst(a => a.Name.GetID() == "P68GX3zY");//{=P68GX3zY}Lay of the land", "{=RchM1puc} Extra 3% movement speed on map.

            if (ScoutingExtra2 != null && leader.GetPerkValue(ScoutingExtra2))
            {
                bonuses.AddFactor(0.03f, ScoutingExtra2.Name);
            }
            bonuses.LimitMin(1f);
            __result = bonuses.ResultNumber;
        }
Exemplo n.º 10
0
        // Token: 0x06000138 RID: 312 RVA: 0x00004210 File Offset: 0x00002410
        public override float CalculateFinalSpeed(MobileParty mobileParty, float baseSpeed, StatExplainer explanation)
        {
            PartyBase       party           = mobileParty.Party;
            ExplainedNumber explainedNumber = new ExplainedNumber(baseSpeed, explanation, null);
            TerrainType     faceTerrainType = Campaign.Current.MapSceneWrapper.GetFaceTerrainType(mobileParty.CurrentNavigationFace);
            bool            flag            = faceTerrainType == TerrainType.Forest;

            if (flag)
            {
                explainedNumber.AddFactor(-0.3f, KaosPartySpeed._movingInForest);
                PerkHelper.AddFeatBonusForPerson(DefaultFeats.Cultural.BattanianForestAgility, mobileParty.Leader, ref explainedNumber);
            }
            else
            {
                bool flag2 = faceTerrainType == TerrainType.Water || faceTerrainType == TerrainType.River || faceTerrainType == TerrainType.Bridge || faceTerrainType == TerrainType.ShallowRiver;
                if (flag2)
                {
                    explainedNumber.AddFactor(-0.3f, KaosPartySpeed._fordEffect);
                }
            }
            bool isNight = Campaign.Current.IsNight;

            if (isNight)
            {
                explainedNumber.AddFactor(-0.25f, KaosPartySpeed._night);
            }
            bool flag3 = faceTerrainType == TerrainType.Snow;

            if (flag3)
            {
                explainedNumber.AddFactor(-0.1f, KaosPartySpeed._snow);
                bool flag4 = party.Leader != null;
                if (flag4)
                {
                    PerkHelper.AddFeatBonusForPerson(DefaultFeats.Cultural.SturgianSnowAgility, party.Leader, ref explainedNumber);
                }
            }
            bool isActive = mobileParty.IsActive;

            if (isActive)
            {
                bool partyTypeFound = false;
                bool flag5          = mobileParty.StringId.Contains("looter") && ModSettings.Instance.looterSpeedReductiontEnabled;
                if (flag5)
                {
                    explainedNumber.Add(ModSettings.Instance.caravanSpeedReductionAmount, KaosPartySpeed._slowMessage);
                    partyTypeFound = true;
                }
                bool flag6 = mobileParty.StringId.Contains("caravan");
                if (flag6)
                {
                    bool flag7 = mobileParty.StringId.Contains("elite") && ModSettings.Instance.eliteCaravanSpeedReductiontEnabled;
                    if (flag7)
                    {
                        explainedNumber.Add(ModSettings.Instance.eliteCaravanSpeedReductionAmount, KaosPartySpeed._slowCaravansMessage);
                    }
                    else
                    {
                        bool caravanSpeedReductiontEnabled = ModSettings.Instance.caravanSpeedReductiontEnabled;
                        if (caravanSpeedReductiontEnabled)
                        {
                            explainedNumber.Add(ModSettings.Instance.caravanSpeedReductionAmount, KaosPartySpeed._slowCaravansMessage);
                        }
                    }
                    partyTypeFound = true;
                }
                bool flag8 = mobileParty.StringId.Contains("desert") && ModSettings.Instance.desertSpeedReductiontEnabled;
                if (flag8)
                {
                    explainedNumber.Add(ModSettings.Instance.desertSpeedReductionAmount, KaosPartySpeed._slowMessage);
                    partyTypeFound = true;
                }
                bool flag9 = mobileParty.StringId.Contains("forest") && ModSettings.Instance.forestSpeedReductiontEnabled;
                if (flag9)
                {
                    explainedNumber.Add(ModSettings.Instance.forestSpeedReductionAmount, KaosPartySpeed._slowMessage);
                    partyTypeFound = true;
                }
                bool flag10 = mobileParty.StringId.Contains("mountain") && ModSettings.Instance.mountainSpeedReductiontEnabled;
                if (flag10)
                {
                    explainedNumber.Add(ModSettings.Instance.mountainSpeedReductionAmount, KaosPartySpeed._slowMessage);
                    partyTypeFound = true;
                }
                bool flag11 = mobileParty.StringId.Contains("raider") && ModSettings.Instance.seaRaiderSpeedReductiontEnabled;
                if (flag11)
                {
                    explainedNumber.Add(ModSettings.Instance.seaRaiderSpeedReductionAmount, KaosPartySpeed._slowMessage);
                    partyTypeFound = true;
                }
                bool flag12 = mobileParty.StringId.Contains("steppe") && ModSettings.Instance.steppeSpeedReductiontEnabled;
                if (flag12)
                {
                    explainedNumber.Add(ModSettings.Instance.steppeSpeedReductionAmount, KaosPartySpeed._slowMessage);
                    partyTypeFound = true;
                }
                bool flag13 = mobileParty.StringId.Contains("villager") && ModSettings.Instance.villagerSpeedReductiontEnabled;
                if (flag13)
                {
                    explainedNumber.Add(ModSettings.Instance.villagerSpeedReductionAmount, KaosPartySpeed._slowVillagerMessage);
                    partyTypeFound = true;
                }
                bool flag14 = mobileParty.StringId.Contains("lord_") && ModSettings.Instance.kingdomSpeedReductiontEnabled;
                if (flag14)
                {
                    explainedNumber.Add(ModSettings.Instance.kingdomSpeedReductionAmount, KaosPartySpeed._slowKingdomMessage);
                    partyTypeFound = true;
                }
                bool flag15 = mobileParty.StringId.Contains("troops_of") && ModSettings.Instance.otherKingdomSpeedReductionEnabled;
                if (flag15)
                {
                    explainedNumber.Add(ModSettings.Instance.otherKingdomSpeedReductionAmount, KaosPartySpeed._slowMinorMessage);
                    partyTypeFound = true;
                }
                bool flag16 = mobileParty.IsMainParty && ModSettings.Instance.playerSpeedReductiontEnabled;
                if (flag16)
                {
                    explainedNumber.Add(ModSettings.Instance.playerSpeedReductionAmount, KaosPartySpeed._slowPlayerMessage);
                    partyTypeFound = true;
                }
                bool flag17 = !mobileParty.IsMainParty && !mobileParty.StringId.Contains("player_") && !mobileParty.StringId.Contains("militias_") && !mobileParty.StringId.Contains("garrison_");
                if (flag17)
                {
                    bool flag18 = !partyTypeFound && !mobileParty.IsLeaderless;
                    if (flag18)
                    {
                        Hero hero   = mobileParty.LeaderHero;
                        bool flag19 = hero != null;
                        if (flag19)
                        {
                            Clan clan       = hero.Clan;
                            Clan playerClan = Clan.PlayerClan;
                            bool flag20     = clan == playerClan && ModSettings.Instance.playerCompanionSpeedReductiontEnabled;
                            if (flag20)
                            {
                                explainedNumber.Add(ModSettings.Instance.playerCompanionSpeedReductionAmount, KaosPartySpeed._slowPlayerClanMessage);
                            }
                            else
                            {
                                bool otherKingdomSpeedReductionEnabled = ModSettings.Instance.otherKingdomSpeedReductionEnabled;
                                if (otherKingdomSpeedReductionEnabled)
                                {
                                    explainedNumber.Add(ModSettings.Instance.otherKingdomSpeedReductionAmount, KaosPartySpeed._slowMinorMessage);
                                }
                            }
                        }
                    }
                }
            }
            explainedNumber.LimitMin(ModSettings.Instance.kaosesmininumSpeedAmount);
            return(explainedNumber.ResultNumber);
        }