Esempio n. 1
0
        public static Mission OpenCapturedConversation(
            IEncounterProvider encounterProvider,
            IDialogProvider dialogProvider,
            IAssassinationActions assassinationActions,
            Settlement settlement,
            Hero assassinationTarget
            )
        {
            var encounterConfig = encounterProvider.GetCapturedEncounter(settlement);

            var locationToOpen = settlement.LocationComplex.GetLocationWithId(encounterConfig.LocationId);

            PlayerEncounter.Current.AddLocationEncounter(encounterConfig.LocationEncounter);

            var sceneName = locationToOpen.GetSceneName(encounterConfig.WallLevel);

            var dialogFlow = dialogProvider.GetCapturedDialogFlow(Hero.MainHero, assassinationTarget);

            var conversationManager = Campaign.Current.ConversationManager;

            var listenerHandle = new object();

            conversationManager.AddDialogFlow(dialogFlow, listenerHandle);

            CampaignEvents.ConversationEnded.AddNonSerializedListener(listenerHandle, character =>
            {
                CampaignEvents.ConversationEnded.ClearListeners(listenerHandle);

                conversationManager.RemoveRelatedLines(listenerHandle);

                assassinationActions.ApplyAssassinationFailedConsequences(settlement, Hero.MainHero, assassinationTarget);

                CampaignEvents.GameMenuOpened.AddNonSerializedListener(listenerHandle, args => {
                    CampaignEvents.GameMenuOpened.ClearListeners(listenerHandle);

                    GameMenu.SwitchToMenu("settlement_wait");
                });
            });

            return(SandBoxMissions.OpenConversationMission(
                       new ConversationCharacterData(Hero.MainHero.CharacterObject)
            {
                IsCivilianEquipmentRequired = true,
                NoHorse = true,
                NoWeapon = true
            },
                       new ConversationCharacterData(assassinationTarget.CharacterObject)
            {
                IsCivilianEquipmentRequired = true,
                NoWeapon = true,
                NoHorse = true
            },
                       sceneName
                       ));
        }
Esempio n. 2
0
        public static Mission OpenBattleNormal(string scene, string sceneLevels)
        {
            MissionAgentSpawnLogic lc = 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", SandBoxMissions.CreateSandBoxMissionInitializerRecord(scene, sceneLevels, false), delegate(Mission mission)
            {
                MissionBehaviour[] expr_07 = new MissionBehaviour[26];
                expr_07[0] = new MissionOptionsComponent();
                expr_07[1] = new CampaignMissionComponent();
                expr_07[2] = new BattleEndLogic();
                expr_07[3] = new MissionCombatantsLogic(MobileParty.MainParty.MapEvent.InvolvedParties, PartyBase.MainParty, MobileParty.MainParty.MapEvent.GetLeaderParty(BattleSideEnum.Defender), MobileParty.MainParty.MapEvent.GetLeaderParty(BattleSideEnum.Attacker), Mission.MissionTeamAITypeEnum.FieldBattle, isPlayerSergeant);
                expr_07[4] = new MissionDefaultCaptainAssignmentLogic();
                expr_07[5] = new BattleMissionStarterLogic();
                expr_07[6] = new BattleSpawnLogic("battle_set");
                expr_07[7] = new AgentBattleAILogic();
                expr_07[8] = lc;
                expr_07[9] = new BaseMissionTroopSpawnHandler();
                expr_07[10] = new AgentFadeOutLogic();
                expr_07[11] = new BattleObserverMissionLogic();
                expr_07[12] = new BattleAgentLogic();
                expr_07[13] = new AgentVictoryLogic();
                expr_07[14] = new MissionDebugHandler();
                expr_07[15] = new MissionAgentPanicHandler();
                expr_07[16] = new MissionHardBorderPlacer();
                expr_07[17] = new MissionBoundaryPlacer();
                expr_07[18] = new MissionBoundaryCrossingHandler();
                expr_07[19] = new BattleMissionAgentInteractionLogic();
                expr_07[20] = new FieldBattleController();
                expr_07[21] = new AgentMoraleInteractionLogic();
                expr_07[22] = new HighlightsController();
                expr_07[23] = new BattleHighlightsController();
                expr_07[24] = 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;
                expr_07[arg_190_1] = new CreateBodyguardMissionBehavior(arg_18B_0, (expr_177 != null) ? expr_177.Name.ToString() : null, null, null, true);
                return expr_07;
            }, true, true));
        }
        public static Mission OpenCustomBattleMission(string scene, int PlayerTroopLimit, int AITroopLimit)
        {
            bool          isPlayerSergeant             = MobileParty.MainParty.MapEvent.IsPlayerSergeant();
            bool          isPlayerInArmy               = MobileParty.MainParty.Army != null;
            List <string> heroesOnPlayerSideByPriority = HeroHelper.OrderHeroesOnPlayerSideByPriority();

            return(MissionState.OpenNew("Battle", SandBoxMissions.CreateSandBoxMissionInitializerRecord(scene), (InitializeMissionBehvaioursDelegate)(mission => (IEnumerable <MissionBehaviour>) new MissionBehaviour[26]
            {
                (MissionBehaviour) new MissionOptionsComponent(),
                (MissionBehaviour) new CampaignMissionComponent(),
                (MissionBehaviour) new BattleEndLogic(),
                (MissionBehaviour) new MissionCombatantsLogic((IEnumerable <IBattleCombatant>)MobileParty.MainParty.MapEvent.InvolvedParties, (IBattleCombatant)PartyBase.MainParty, (IBattleCombatant)MobileParty.MainParty.MapEvent.GetLeaderParty(BattleSideEnum.Defender), (IBattleCombatant)MobileParty.MainParty.MapEvent.GetLeaderParty(BattleSideEnum.Attacker), Mission.MissionTeamAITypeEnum.FieldBattle, false),
                (MissionBehaviour) new MissionDefaultCaptainAssignmentLogic(),
                (MissionBehaviour) new BattleMissionStarterLogic(),
                (MissionBehaviour) new BattleSpawnLogic("battle_set"),
                (MissionBehaviour) new AgentBattleAILogic(),
                (MissionBehaviour) new MissionAgentSpawnLogic(new IMissionTroopSupplier[2]
                {
                    (IMissionTroopSupplier) new PartyGroupTroopSupplier(MapEvent.PlayerMapEvent, BattleSideEnum.Defender),
                    (IMissionTroopSupplier) new PartyGroupTroopSupplier(MapEvent.PlayerMapEvent, BattleSideEnum.Attacker)
                }, PartyBase.MainParty.Side),
                (MissionBehaviour) new CustomMissionTroopSpawnHandler(PlayerTroopLimit, AITroopLimit, false),
                (MissionBehaviour) new AgentFadeOutLogic(),
                (MissionBehaviour) new BattleObserverMissionLogic(),
                (MissionBehaviour) new BattleAgentLogic(),
                (MissionBehaviour) new AgentVictoryLogic(),
                (MissionBehaviour) new MissionDebugHandler(),
                (MissionBehaviour) new MissionAgentPanicHandler(),
                (MissionBehaviour) new MissionHardBorderPlacer(),
                (MissionBehaviour) new MissionBoundaryPlacer(),
                (MissionBehaviour) new MissionBoundaryCrossingHandler(),
                (MissionBehaviour) new BattleMissionAgentInteractionLogic(),
                (MissionBehaviour) new FieldBattleController(),
                (MissionBehaviour) new AgentMoraleInteractionLogic(),
                (MissionBehaviour) new HighlightsController(),
                (MissionBehaviour) new BattleHighlightsController(),
                (MissionBehaviour) new AssignPlayerRoleInTeamMissionController(!isPlayerSergeant, isPlayerSergeant, isPlayerInArmy, heroesOnPlayerSideByPriority),
                (MissionBehaviour) new CreateBodyguardMissionBehavior(MapEvent.PlayerMapEvent.AttackerSide.LeaderParty.LeaderHero?.Name.ToString(), MapEvent.PlayerMapEvent.DefenderSide.LeaderParty.LeaderHero?.Name.ToString())
            })));
        }
Esempio n. 4
0
        public static Mission OpenDateMission(string scene, List <Hero> heros)
        {
            return(MissionState.OpenNew("TownCenter", SandBoxMissions.CreateSandBoxMissionInitializerRecord(scene, "", false), (Mission mission) => new MissionBehaviour[]
            {
                new MissionOptionsComponent(),
                new CampaignMissionComponent(),
                new MissionBasicTeamLogic(),
                new BattleSpawnLogic("battle_set"),
                new SpousesDateSpawnLogic(heros),
                new BattleAgentLogic(),
                new AgentBattleAILogic(),
                new MissionFacialAnimationHandler(),

                new MissionHardBorderPlacer(),
                new MissionBoundaryPlacer(),
                new MissionBoundaryCrossingHandler(),

                new AgentMoraleInteractionLogic(),
                new HighlightsController(),
                new BattleHighlightsController()
            }, true, true));
        }
Esempio n. 5
0
        public static Mission OpenCastleCourtyardMission(string scene, string sceneLevels, Location location, CharacterObject talkToChar)
        {
            return(MissionState.OpenNew("TownCenter", SandBoxMissions.CreateSandBoxMissionInitializerRecord(scene, sceneLevels, false), delegate(Mission mission)
            {
                List <MissionBehaviour> list = new List <MissionBehaviour>();
                list.Add(new MissionOptionsComponent());
                list.Add(new CampaignMissionComponent());

                list.Add(new MissionBasicTeamLogic());
                list.Add(new MissionSettlementPrepareLogic());
                list.Add(new TownCenterMissionController());
                list.Add(new MissionAgentLookHandler());
                list.Add(new SandBoxMissionHandler());
                list.Add(new BasicLeaveMissionLogic());
                list.Add(new LeaveMissionLogic());
                list.Add(new BattleAgentLogic());

                /*	Settlement currentTown = SandBoxMissions.GetCurrentTown();
                 *   if (currentTown != null)
                 *   {
                 *           list.Add(new WorkshopMissionHandler(currentTown));
                 *   }*/
                list.Add(new MissionAgentPanicHandler());
                list.Add(new AgentTownAILogic());
                list.Add(new MissionConversationHandler(talkToChar));
                list.Add(new MissionAgentHandler(location, null));
                list.Add(new HeroSkillHandler());
                list.Add(new MissionFightHandler());
                list.Add(new MissionFacialAnimationHandler());
                list.Add(new MissionDebugHandler());
                list.Add(new MissionHardBorderPlacer());
                list.Add(new MissionBoundaryPlacer());
                list.Add(new MissionBoundaryCrossingHandler());
                list.Add(new VisualTrackerMissionBehavior());
                return list.ToArray();
            }, true, true));
        }
Esempio n. 6
0
        public static Mission OpenCastleAssassination(
            IEncounterProvider encounterProvider,
            ILocationCharacterProvider locationCharacterProvider,
            IDialogProvider dialogProvider,
            IMissionOutcomeHandler missionOutcomeHandler,
            IAssassinationActions assassinationActions,
            Settlement settlement,
            Hero assassinationTarget,
            bool sneakInSuccessful
            )
        {
            var encounterConfig = encounterProvider.GetSneakInEncounter(settlement);

            var locationToOpen = settlement.LocationComplex.GetLocationWithId(encounterConfig.LocationId);

            PlayerEncounter.Current.AddLocationEncounter(encounterConfig.LocationEncounter);

            var sceneName = locationToOpen.GetSceneName(encounterConfig.WallLevel);

            var missionRecord = SandBoxMissions.CreateSandBoxMissionInitializerRecord(sceneName, string.Empty, true);

            var missionBehaviors = new List <MissionBehaviour> {
                new MissionOptionsComponent(),
                new CampaignMissionComponent(),
                new MissionBasicTeamLogic(),
                //new BasicLeaveMissionLogic(),// maybe implement own
                //new LeaveMissionLogic(),//maybe implement own
                new MissionAgentLookHandler(),
                new MissionConversationHandler(),
                new MissionAgentHandler(locationToOpen, null),
                new HeroSkillHandler(),
                new MissionFightHandler(),
                new BattleAgentLogic(),
                new AgentTownAILogic(),    //not sure, maybe implement my own version
                new MissionCrimeHandler(), // maybe keep
                new MissionFacialAnimationHandler(),
                //new MissionDebugHandler(),
                //new LocationItemSpawnHandler(),// remove?
                //new VisualTrackerMissionBehavior(),
                new CastleAssassinationController(locationCharacterProvider, assassinationTarget, sneakInSuccessful),
                new AssassinationOutcomeLogic(missionOutcomeHandler, assassinationActions, settlement, assassinationTarget, sneakInSuccessful),
                new AssassinationConversationLogic(dialogProvider, Campaign.Current.ConversationManager, assassinationTarget.CharacterObject, sneakInSuccessful)
            };

            if (!sneakInSuccessful)
            {
                missionBehaviors.Add(new AssassinationCaughtByGuardsLogic(locationCharacterProvider, Campaign.Current.ConversationManager, settlement, assassinationTarget));
            }

            // Hacky way to disable exiting via the doors - I don't know how to lock the doors yet
            var cachedLocations = locationToOpen.LocationsOfPassages.ToList();

            locationToOpen.LocationsOfPassages.Clear();

            // I don't think I like this
            missionOutcomeHandler.Initialise((settl, ass) => {
                OpenCapturedConversation(
                    encounterProvider,
                    dialogProvider,
                    assassinationActions,
                    settl,
                    ass
                    );
            },
                                             () => {
                locationToOpen.LocationsOfPassages.AddRange(cachedLocations);
            });

            return(MissionState.OpenNew("CastleAssassination", missionRecord, (Mission mission) => missionBehaviors, true, true, true));
        }