public LeadershipAIBehaviour(Config config, CheerCommonMethods common, Strings strings) { _config = config; _strings = strings; _common = common; _personalDeathEffectAgentList = new List <Agent>(); }
public LeadershipBehaviour(Config config, CheerCommonMethods common, Strings strings) { _config = config; _strings = strings; _canCheer = true; _common = common; _rng = new Random(); _soundManager = new SoundManager(config); }
/// <summary> /// Allows AI to cheer under almost the same rules as the player. /// </summary> public LeadershipAIComponent(Config config, Agent agent, CheerCommonMethods common, Strings strings) : base(agent) { _config = config; _strings = strings; _agent = agent; _common = common; _leadership = agent.Character?.GetSkillValue(DefaultSkills.Leadership) ?? 0; _cheerAmount = _config.AI.BaselineCheerAmount; _cheerAmount += Math.DivRem(_leadership, _config.Cheering.CheersPerXLeadershipLevels, out _); _initialMorale = _agent?.GetMorale() ?? 0; CheerRange = (_leadership / 2).Clamp(50, 200); _canCheer = false; _timerToEnableCheering = MBCommon.TimeType.Mission.GetTime() + MBRandom.RandomInt(8, 20); }
/// <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)); } }