Beispiel #1
0
        private Mission HandleOpenNew(
            string missionName,
            MissionInitializerRecord rec,
            InitializeMissionBehvaioursDelegate handler,
            bool addDefaultMissionBehaviors)
        {
            this.MissionName = missionName;
            this.CreateMission(rec);
            IEnumerable <MissionBehaviour> behaviours = handler(this.CurrentMission);

            if (addDefaultMissionBehaviors)
            {
                behaviours = MissionState.AddDefaultMissionBehavioursTo(this.CurrentMission, behaviours);
            }
            foreach (MissionBehaviour missionBehaviour in behaviours)
            {
                missionBehaviour.OnAfterMissionCreated();
            }
            this.AddBehavioursToMission(behaviours);
            if (this.Handler != null)
            {
                this.AddBehavioursToMission(this.Handler.OnAddBehaviours((IEnumerable <MissionBehaviour>) new MissionBehaviour[0], this.CurrentMission, missionName, addDefaultMissionBehaviors));
            }
            return(this.CurrentMission);
        }
        public static Mission OpenBattleJustHero(string scene, string upgradeLevel)
        {
            MissionInitializerRecord record = new MissionInitializerRecord(scene)
            {
                PlayingInCampaignMode = Campaign.Current.GameMode == CampaignGameMode.Campaign,
                AtmosphereOnCampaign  = (Campaign.Current.GameMode == CampaignGameMode.Campaign) ? Campaign.Current.Models.MapWeatherModel.GetAtmosphereModel(CampaignTime.Now, MobileParty.MainParty.GetLogicalPosition()) : null,
                SceneLevels           = upgradeLevel
            };

            MissionAgentSpawnLogic lc2 = new MissionAgentSpawnLogic(new IMissionTroopSupplier[]
            {
                new PartyGroupTroopSupplier(MapEvent.PlayerMapEvent, BattleSideEnum.Defender, null),
                new PartyGroupTroopSupplier(MapEvent.PlayerMapEvent, BattleSideEnum.Attacker, null)
            }, PartyBase.MainParty.Side);

            bool          isPlayerSergeant             = MobileParty.MainParty.MapEvent.IsPlayerSergeant();
            bool          isPlayerInArmy               = MobileParty.MainParty.Army != null;
            List <string> heroesOnPlayerSideByPriority = HeroHelper.OrderHeroesOnPlayerSideByPriority();

            return(MissionState.OpenNew("Battle", record, delegate(Mission mission)
            {
                List <MissionBehaviour> list = new List <MissionBehaviour>();
                list.Add(new MissionOptionsComponent());
                list.Add(new CampaignMissionComponent());
                list.Add(new BattleEndLogic());
                list.Add(new MissionCombatantsLogic(MobileParty.MainParty.MapEvent.InvolvedParties, PartyBase.MainParty, MobileParty.MainParty.MapEvent.GetLeaderParty(BattleSideEnum.Defender), MobileParty.MainParty.MapEvent.GetLeaderParty(BattleSideEnum.Attacker), Mission.MissionTeamAITypeEnum.FieldBattle, isPlayerSergeant));
                list.Add(new BattleMissionStarterLogic());
                //list.Add(new MissionDefaultCaptainAssignmentLogic());
                list.Add(new BattleSpawnLogic("battle_set"));
                list.Add(new MissionAgentPanicHandler());
                list.Add(new AgentBattleAILogic());
                list.Add(new BattleObserverMissionLogic());
                list.Add(lc2);
                list.Add(new MissionFightHandler());
                list.Add(new AgentFadeOutLogic());
                list.Add(new BattleAgentLogic());
                list.Add(new AgentVictoryLogic());
                list.Add(new MissionDebugHandler());
                list.Add(new MissionHardBorderPlacer());
                list.Add(new MissionBoundaryPlacer());
                list.Add(new MissionBoundaryCrossingHandler());
                list.Add(new BattleMissionAgentInteractionLogic());
                list.Add(new HighlightsController());
                list.Add(new BattleHighlightsController());

                list.Add(new BattleHeroJustTroopSpawnHandler());
                list.Add(new FieldBattleController());
                //list.Add(new AgentMoraleInteractionLogic());
                //list.Add(new  AssignPlayerRoleInTeamMissionController(!isPlayerSergeant, isPlayerSergeant, isPlayerInArmy, heroesOnPlayerSideByPriority, FormationClass.NumberOfRegularFormations));

                //int arg_190_1 = 25;
                Hero expr_152 = MapEvent.PlayerMapEvent.AttackerSide.LeaderParty.LeaderHero;
                string arg_18B_0 = (expr_152 != null) ? expr_152.Name.ToString() : null;
                Hero expr_177 = MapEvent.PlayerMapEvent.DefenderSide.LeaderParty.LeaderHero;
                list.Add(new CreateBodyguardMissionBehavior(arg_18B_0, (expr_177 != null) ? expr_177.Name.ToString() : null, null, null, true));
                return list.ToArray();
            }, true, true));
        }
Beispiel #3
0
 private void CreateMission(MissionInitializerRecord rec) => this.CurrentMission = new Mission(rec, this);