예제 #1
0
        public override bool IsPossible()
        {
            worker     = new IncidentWorker_CallForAid();
            worker.def = IncidentDefOf.RaidFriendly;

            parms = StorytellerUtility.DefaultParmsNow(IncidentCategoryDefOf.AllyAssistance, Helper.AnyPlayerMap);

            IEnumerable <Faction> factionSearch = Find.FactionManager.AllFactions.Where(s => s.def.defName == factionDefName);

            Faction TaskForce141;

            if (factionSearch != null && factionSearch.Count() > 0)
            {
                TaskForce141 = factionSearch.ElementAt(0);
            }
            else
            {
                return(false);
            }

            if (TaskForce141.PlayerRelationKind == FactionRelationKind.Hostile)
            {
                return(false);
            }

            parms.faction = TaskForce141;
            parms.raidArrivalModeForQuickMilitaryAid = true;

            parms.points = DiplomacyTuning.RequestedMilitaryAidPointsRange.RandomInRange;

            return(true);
        }
        public override void TryExecute()
        {
            var incident = new IncidentWorker_CallForAid();

            FactionManager manager = Find.FactionManager;

            Faction ofPlayer = Faction.OfPlayer;

            Faction tryAlly = manager.RandomAlliedFaction(false, false, true, TechLevel.Industrial);

            if (tryAlly == null)
            {
                (from x in manager.AllFactions
                 where !x.IsPlayer && (false || !x.def.hidden) && (false || !x.defeated) && (true || x.def.humanlikeFaction) && (x.def.techLevel >= TechLevel.Industrial) && x.PlayerRelationKind == FactionRelationKind.Neutral
                 select x).TryRandomElement(out tryAlly);
            }

            IncidentParms incidentParms = new IncidentParms();

            incidentParms.target  = Helper.AnyPlayerMap;
            incidentParms.faction = tryAlly;
            incidentParms.raidArrivalModeForQuickMilitaryAid = true;
            incidentParms.points = DiplomacyTuning.RequestedMilitaryAidPointsRange.RandomInRange;
            tryAlly.lastMilitaryAidRequestTick = Find.TickManager.TicksGame;
            incident.TryExecute(incidentParms);
        }
예제 #3
0
        public override void TryExecute()
        {
            Map currentMap = Find.CurrentMap;

            IncidentParms incidentParms = StorytellerUtility.DefaultParmsNow(IncidentCategoryDefOf.AllyAssistance, currentMap);

            incidentParms.forced          = true;
            incidentParms.target          = currentMap;
            incidentParms.raidArrivalMode = PawnsArrivalModeDefOf.EdgeWalkIn;
            incidentParms.raidStrategy    = RaidStrategyDefOf.ImmediateAttackFriendly;

            var incident = new IncidentWorker_CallForAid()
            {
                def = IncidentDef.Named("RaidFriendly")
            };

            incident.TryExecute(incidentParms);
        }