private static void Postfix(MissionState __instance, ref Mission __result)
        {
            PartyBase mainParty = PartyBase.MainParty;
            bool      flag;

            if (mainParty == null)
            {
                flag = false;
            }
            else
            {
                Hero leaderHero = mainParty.LeaderHero;
                bool?flag2      = (leaderHero != null) ? new bool?(leaderHero.GetPerkValue(DefaultPerks.Tactics.OneStepAhead)) : null;
                bool flag3      = true;
                flag = (flag2.GetValueOrDefault() == flag3 & flag2 != null);
            }
            bool flag4 = flag;

            if (__instance.MissionName == "Battle" && ((flag4 && ST_opsSettings.Instance.deploymentConfig == 1) || ST_opsSettings.Instance.deploymentConfig == 2))
            {
                bool isPlayerAttacker = MapEvent.PlayerMapEvent.AttackerSide.LeaderParty == PartyBase.MainParty;
                __result.AddMissionBehaviour(new DH_opsDepolyment(isPlayerAttacker));
                __result.AddMissionBehaviour(new MissionBoundaryMarker(new FlagFactory("swallowtail_banner"), 2f));
            }
        }
        public override void OnMissionBehaviourInitialize(Mission mission)
        {
            mission.AddMissionBehaviour(GetTroopAttributeMissionLogic());

            // Replace the default morale interaction logic with our new custom morale logic
            mission.RemoveMissionBehaviour(mission.GetMissionBehaviour <AgentMoraleInteractionLogic>());
            mission.AddMissionBehaviour(new CustomBaseAgentMoraleInteractionLogic());
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Runs when a mission (ie. field battle, arena, siege) is initialized.
        /// </summary>
        public override void OnMissionBehaviourInitialize(Mission mission)
        {
            // reads config file and serializes it into Config object
            // doing this on mission initialization allows us to change settings when game is still running
            var serializer = new XmlSerializer(typeof(Config));
            var reader     = new StreamReader(BasePath.Name + "Modules/LifeLeech/bin/Win64_Shipping_Client/config.xml");

            config = (Config)serializer.Deserialize(reader);
            reader.Close();

            // if debug output is enabled in config, prints config details
            if (config.DebugOutput)
            {
                InformationManager.DisplayMessage(new InformationMessage($"Life Leech mod activated." +
                                                                         $"\nmultiplerHealing = {config.MultiplerHealing.Enabled} @ {config.MultiplerHealing.Value:N1}" +
                                                                         $"\nstaticHealing = {config.StaticHealing.Enabled} @ {config.StaticHealing.Value:N1}" +
                                                                         $"\nplayerOnly = {config.PlayerOnly}" +
                                                                         $"\nkillBased = {config.KillBased}" +
                                                                         $"\nexcludeCavalry = {config.ExcludeCavalry}"));
            }

            // adds custom mission behavior - a mission script, so to speak.
            mission.AddMissionBehaviour(new LeechBehavior(config));
            base.OnMissionBehaviourInitialize(mission);
        }
Ejemplo n.º 4
0
        public override void OnMissionBehaviourInitialize(Mission mission)
        {
            if (!disabled && !mission.HasMissionBehaviour <TournamentXPandedMatchBehavior>() &&
                (mission.HasMissionBehaviour <TournamentArcheryMissionController>() ||
                 mission.HasMissionBehaviour <TournamentJoustingMissionController>() ||
                 mission.HasMissionBehaviour <TownHorseRaceMissionController>() ||
                 mission.HasMissionBehaviour <TournamentFightMissionController>()
                ))
            {
                if (TournamentXPSettings.Instance.BonusRenownFirstKill > 0 ||
                    TournamentXPSettings.Instance.BonusRenownLeastDamage > 0 ||
                    TournamentXPSettings.Instance.BonusRenownMostDamage > 0 ||
                    TournamentXPSettings.Instance.BonusRenownMostKills > 0)
                {
                    foreach (var t in TournamentsXPandedBehavior.Tournaments)
                    {
                        t.Active = false;
                    }
                    var tournamentInfo = TournamentsXPandedBehavior.GetTournamentInfo(Settlement.CurrentSettlement.Town);
                    tournamentInfo.Rewards = new TournamentReward();
                    tournamentInfo.Active  = true;

                    var mb = mission.GetMissionBehaviour <TournamentBehavior>();
                    mission.AddMissionBehaviour(new TournamentXPandedMatchBehavior(mb));
                    mission.AddListener(new TournamentXPandedMatchListener(mb));
                }
            }
        }
Ejemplo n.º 5
0
 public override void OnMissionBehaviourInitialize(Mission mission)
 {
     if (mission.CombatType == Mission.MissionCombatType.Combat && !mission.IsFriendlyMission)
     {
         mission.AddMissionBehaviour(new VolleyMissionBehavior());
     }
 }
Ejemplo n.º 6
0
 public override void OnMissionBehaviourInitialize(Mission mission)
 {
     if (mission.CombatType == Mission.MissionCombatType.Combat)
     {
         mission.AddMissionBehaviour(new LootBehavior());
     }
 }
Ejemplo n.º 7
0
 public override void OnMissionBehaviourInitialize(Mission mission)
 {
     base.OnMissionBehaviourInitialize(mission);
     InformationManager.DisplayMessage(new InformationMessage("Mission Started at: "));
     InformationManager.DisplayMessage(new InformationMessage(mission.SceneName));
     mission.AddMissionBehaviour(new DangerousMissionBehaviour());
 }
Ejemplo n.º 8
0
 public override void OnMissionBehaviourInitialize(Mission mission)
 {
     if (mission.CombatType == Mission.MissionCombatType.Combat)
     {
         mission.AddMissionBehaviour(new CustomMissionLogic());
     }
     base.OnMissionBehaviourInitialize(mission);
 }
        private void ConfigureHorseCrippleLogic(Mission mission)
        {
            if (Config.ConfigSettings.ProjectileBalancingEnabled)
            {
                mission.AddMissionBehaviour(new HorseCrippleLogic());
            }

        }
        private void ConfigureQueuedVoiceLogic(Mission mission)
        {
            if (Config.ConfigSettings.OrderVoiceCommandQueuing && mission.IsOrderShoutingAllowed())
            {
                mission.AddMissionBehaviour(new QueuedVoiceLogic());

            }
        }
Ejemplo n.º 11
0
        public override void OnMissionBehaviourInitialize(Mission mission)
        {
            base.OnMissionBehaviourInitialize(mission);

            if (Settings.Instance.TournamentExperienceEnabled && !mission.HasMissionBehaviour <TournamentExperienceMissionLogic>() &&
                (mission.HasMissionBehaviour <TournamentFightMissionController>() || mission.HasMissionBehaviour <TournamentArcheryMissionController>() ||
                 mission.HasMissionBehaviour <TournamentArcheryMissionController>() || mission.HasMissionBehaviour <TownHorseRaceMissionController>()))
            {
                mission.AddMissionBehaviour(new TournamentExperienceMissionLogic());
            }

            if (Settings.Instance.ArenaExperienceEnabled && !mission.HasMissionBehaviour <TournamentExperienceMissionLogic>() &&
                mission.HasMissionBehaviour <ArenaPracticeFightMissionController>())
            {
                mission.AddMissionBehaviour(new TournamentExperienceMissionLogic());
            }
        }
 public override void OnMissionBehaviourInitialize(Mission mission)
 {
     base.OnMissionBehaviourInitialize(mission);
     if (mission.Mode != MissionMode.StartUp)
     {
         return;
     }
     mission.AddMissionBehaviour(new ProtectiveGuardsMissionLogic(mission));
 }
Ejemplo n.º 13
0
        private void AddMissionBehaviours(Mission mission)
        {
            if (mission.HasMissionBehaviour <MWAXArenaWeaponSwapLogic>() || !mission.HasMissionBehaviour <ArenaPracticeFightMissionController>())
            {
                return;
            }

            mission.AddMissionBehaviour((MissionBehaviour) new MWAXArenaWeaponSwapLogic());
        }
Ejemplo n.º 14
0
 public override void OnMissionBehaviourInitialize(Mission mission)
 {
     if (!mission.HasMissionBehaviour <TournamentXPandedTournamentBehavior>() &&
         (mission.HasMissionBehaviour <TournamentArcheryMissionController>() ||
          mission.HasMissionBehaviour <TournamentJoustingMissionController>() ||
          mission.HasMissionBehaviour <TownHorseRaceMissionController>() ||
          mission.HasMissionBehaviour <TournamentFightMissionController>()
         ))
     {
         mission.AddMissionBehaviour(new TournamentXPandedTournamentBehavior());
     }
 }
        /// <summary>
        /// Entry point of the mod. When a mission is initialized and is a field battle,
        /// it reads user config, serializes it into Config object and adds Cheer behaviour
        /// to the mission.
        /// </summary>
        public override void OnMissionBehaviourInitialize(Mission mission)
        {
            if (MissionState.Current.MissionName == "TournamentFight" ||
                MissionState.Current.MissionName == "ArenaPracticeFight")
            {
                return;
            }
            _common  = new CheerCommonMethods();
            _config  = ReadAndStoreAsType <Config>("config");
            _strings = ReadAndStoreAsType <Strings>("strings");

            if (_config.Cheering.DebugMode == true)
            {
                Log("{=debug_loadingsuccessful}" + _strings.Debug.LoadingSuccessful);
                Log(MissionState.Current.MissionName);
            }

            CorrectConfig();

            if (mission.CombatType == Mission.MissionCombatType.ArenaCombat)
            {
                return;
            }
            if (mission.CombatType == Mission.MissionCombatType.NoCombat)
            {
                return;
            }

            mission.AddMissionBehaviour(new LeadershipBehaviour(_config, _common, _strings));
            if (_config.AI.Enabled)
            {
                mission.AddMissionBehaviour(new LeadershipAIBehaviour(_config, _common, _strings));
            }
            if (_config.ResponsiveOrders.Enabled)
            {
                mission.AddMissionBehaviour(new LeadershipResponsiveOrdersBehaviour(_config));
            }
        }
Ejemplo n.º 16
0
        public override void OnMissionBehaviourInitialize(Mission mission)
        {
            var serializer = new XmlSerializer(typeof(Config));
            var reader     = new StreamReader(BasePath.Name + "Modules/Bleeding/bin/Win64_Shipping_Client/config.xml");

            config = (Config)serializer.Deserialize(reader);
            reader.Close();

            config.BleedRate.Clamp(0, 1);
            config.SlowOnBleed.Value.Clamp(0, 1);

            if (config.Debug)
            {
                Say($"Bleeding mod activated.");
            }

            if (config.Bandages.Enabled)
            {
                mission.AddMissionBehaviour(new BandageBehavior(config, mission));
            }
            mission.AddMissionBehaviour(new BleedingBehavior(config, mission));
            base.OnMissionBehaviourInitialize(mission);
        }
        public override void OnMissionBehaviourInitialize(Mission mission)
        {
            base.OnMissionBehaviourInitialize(mission);

            // Mission.Current.Is

            if (IsVisitingTownCenter(mission))
            {
                Print("Detected visiting town center");
                mission.AddMissionBehaviour(new TownThievingLogic());
            }
            else
            {
                Print("Is not visiting town center mission");
            }


            if (!mission.IsFieldBattle && !IsSiegeBattle(mission) && !IsCustomBattleGameType(mission))
            {
                if (ArePatchesApplied())
                {
                    ResetPatches();
                    Print($"{typeof(GiveOrdersAfterDeathSubModule)} : All patches reset");
                }
                return;
            }

            if (!ArePatchesApplied())
            {
                ApplyPatches();
                Print($"{typeof(GiveOrdersAfterDeathSubModule)} : All patches applied");
            }

            mission.AddMissionBehaviour(new GiveOrdersWhileDeadLogic());
            Print($"{typeof(GiveOrdersAfterDeathSubModule)} : Added GiveOrdersWhileDeadLogic to mission");
        }
 private void ConfigureHealthOnkillLogic(Mission mission)
 {
     if (Config.ConfigSettings.HPOnKillEnabledForHeros)
     {
         if (mission.Scene != null)
         {
             bool isCombat = mission.CombatType == Mission.MissionCombatType.Combat;
             bool isArenaCombat = mission.CombatType == Mission.MissionCombatType.ArenaCombat;
             if (mission.IsFieldBattle || isCombat || isArenaCombat)
             {
                 mission.AddMissionBehaviour(new HealthOnKillLogic());
             }
         }
     }
 }
        private void ConfigureCameraLogic(Mission mission)
        {
            if (Config.ConfigSettings.OrderControllerCameraImprovementsEnable)
            {
                if (mission.Scene != null)
                {
                    bool isCombat = mission.CombatType == Mission.MissionCombatType.Combat;
                    bool isArenaCombat = mission.CombatType == Mission.MissionCombatType.ArenaCombat;
                    if (mission.IsFieldBattle || isCombat || isArenaCombat)
                    {
                        mission.AddMissionBehaviour(new CameraLogic());
                    }

                }
            }
        }
Ejemplo n.º 20
0
        public override void OnMissionBehaviourInitialize(Mission mission)
        {
            base.OnMissionBehaviourInitialize(mission);
            try
            {
                if (_settings == null)
                {
                    throw new InvalidOperationException("Settings were not initialized");
                }

                if (Mission.Current.CombatType == Mission.MissionCombatType.Combat)
                {
                    if (mission.IsFieldBattle || mission.IsSiege() || mission.IsHideout() /*TODO custom battle mode || mission.IsCustomBattle()*/)
                    {
                        mission.AddMissionBehaviour(new BattleBannerAssignBehaviour(_settings));
                    }
                }
            }
            catch (Exception ex)
            {
                LogInMessageLog("BMB Error: " + ex.Message);
            }
        }
Ejemplo n.º 21
0
        public override void OnMissionBehaviourInitialize(Mission mission)
        {
            try
            {
                // Add the marker overlay for appropriate mission types
                if (mission.GetMissionBehaviour <MissionNameMarkerUIHandler>() == null &&
                    (MissionHelpers.InSiegeMission() ||
                     MissionHelpers.InFieldBattleMission() ||
                     Mission.Current?.GetMissionBehaviour <TournamentFightMissionController>() != null))
                {
                    mission.AddMissionBehaviour(SandBoxViewCreator.CreateMissionNameMarkerUIHandler(mission));
                }

                mission.AddMissionBehaviour(new BLTAdoptAHeroCommonMissionBehavior());
                mission.AddMissionBehaviour(new BLTAdoptAHeroCustomMissionBehavior());
                mission.AddMissionBehaviour(new BLTSummonBehavior());
                mission.AddMissionBehaviour(new BLTRemoveAgentsBehavior());
                mission.AddMissionBehaviour(new BLTHeroPowersMissionBehavior());
            }
            catch (Exception e)
            {
                Log.Exception(nameof(OnMissionBehaviourInitialize), e);
            }
        }
Ejemplo n.º 22
0
 public override void OnMissionBehaviourInitialize(Mission mission)
 {
     mission.AddMissionBehaviour(new LootBehavior());
 }
Ejemplo n.º 23
0
 public override void OnMissionBehaviourInitialize(Mission mission)
 {
     mission.AddMissionBehaviour((MissionBehaviour) new FireArrowLogic());
     mission.AddMissionBehaviour((MissionBehaviour) new FireSwordLogic());
 }
 public override void OnMissionBehaviourInitialize(Mission mission)
 {
     base.OnMissionBehaviourInitialize(mission);
     mission.AddMissionBehaviour(new ShoulderCamMissionLogic());
 }
 public override void OnMissionBehaviourInitialize(Mission mission)
 {
     base.OnMissionBehaviourInitialize(mission);
     mission.AddMissionBehaviour(new SpearBracingMissionLogic(mission));
 }