public static void GetConstructionProgressPerHour(SiegeEngineType type, SiegeEvent siegeEvent, ISiegeEventSide side, StatExplainer explanation, ref float __result)
        {
            BattleSideEnum otherSide;

            switch (side.BattleSide)
            {
            case BattleSideEnum.Attacker:
                otherSide = BattleSideEnum.Defender;
                break;

            case BattleSideEnum.Defender:
                otherSide = BattleSideEnum.Attacker;
                break;

            default:
                return;
            }

            if ((siegeEvent.GetSiegeEventSide(otherSide)?.SiegeParties.Any(x => x.Leader?.IsPlayerCharacter ?? false) ?? false) &&
                BannerlordCheatsSettings.Instance.EnemySiegeBuildingSpeedPercentage < 100)
            {
                var factor = BannerlordCheatsSettings.Instance.EnemySiegeBuildingSpeedPercentage / 100f;

                var newValue = factor * __result;

                __result = newValue;
            }
        }
Ejemplo n.º 2
0
        public static void GetConstructionProgressPerHour(ref SiegeEngineType type, ref SiegeEvent siegeEvent, ref ISiegeEventSide side, ref float __result)
        {
            try
            {
                BattleSideEnum otherSide;
                switch (side.BattleSide)
                {
                case BattleSideEnum.Attacker:
                    otherSide = BattleSideEnum.Defender;
                    break;

                case BattleSideEnum.Defender:
                    otherSide = BattleSideEnum.Attacker;
                    break;

                default:
                    return;
                }

                if ((siegeEvent.GetSiegeEventSide(otherSide)?.SiegeParties.Any(x => x.IsPlayerParty()) ?? false) &&
                    BannerlordCheatsSettings.Instance?.EnemySiegeBuildingSpeedPercentage < 100f)
                {
                    var factor = BannerlordCheatsSettings.Instance.EnemySiegeBuildingSpeedPercentage / 100f;

                    var newValue = factor * __result;

                    __result = newValue;
                }
            }
            catch (Exception e)
            {
                SubModule.LogError(e, typeof(EnemySiegeBuildingSpeedPercentage));
            }
        }
 private static ISiegeEventSide GetSiegeContainerSide(SiegeEvent siegeEvent, SiegeEvent.SiegeEnginesContainer siegeEngines)
 => siegeEvent.GetSiegeEventSide(siegeEvent.BesiegerCamp.SiegeEngines == siegeEngines ? BattleSideEnum.Attacker : BattleSideEnum.Defender);