コード例 #1
0
        public override bool IsPossible()
        {
            worker       = new IncidentWorker_Infestation();
            worker.def   = IncidentDef.Named("Infestation");
            parms        = StorytellerUtility.DefaultParmsNow(IncidentCategoryDefOf.ThreatBig, target);
            parms.forced = true;
            points       = parms.points;

            return(worker.CanFireNow(parms));
        }
コード例 #2
0
        public override bool IsPossible(string message, Viewer viewer, bool separateChannel = false)
        {
            this.separateChannel = separateChannel;
            this.viewer          = viewer;
            string[] command = message.Split(' ');
            if (command.Length < 3)
            {
                Toolkit.client.SendMessage($"@{viewer.username} syntax is {this.storeIncident.syntax}", separateChannel);
                return(false);
            }

            if (!VariablesHelpers.PointsWagerIsValid(
                    command[2],
                    viewer,
                    ref pointsWager,
                    ref storeIncident,
                    separateChannel
                    ))
            {
                return(false);
            }

            target = Current.Game.AnyPlayerHomeMap;
            if (target == null)
            {
                return(false);
            }

            Log.Warning("found target");

            parms        = StorytellerUtility.DefaultParmsNow(IncidentCategoryDefOf.ThreatBig, target);
            parms.points = IncidentHelper_PointsHelper.RollProportionalGamePoints(storeIncident, pointsWager, StorytellerUtility.DefaultThreatPointsNow(target));
            parms.forced = true;

            Log.Warning("genned parms");

            worker     = new IncidentWorker_Infestation();
            worker.def = IncidentDef.Named("Infestation");

            bool canFire = worker.CanFireNow(parms);

            if (!canFire)
            {
                Toolkit.client.SendMessage($"@{viewer.username} Found no place for infestation to occur.", separateChannel);
            }

            return(canFire);
        }
コード例 #3
0
        public override bool IsPossible(string message, Viewer viewer, bool separateChannel = false)
        {
            this.separateChannel = separateChannel;
            this.viewer          = viewer;
            string[] command = message.Split(' ');
            if (command.Length < 3)
            {
                Toolkit.client.SendMessage($"@{viewer.username} syntax is {this.storeIncident.syntax}", separateChannel);
                return(false);
            }

            if (!VariablesHelpers.PointsWagerIsValid(
                    command[2],
                    viewer,
                    ref pointsWager,
                    ref storeIncident,
                    separateChannel
                    ))
            {
                return(false);
            }

            target = Current.Game.AnyPlayerHomeMap;
            if (target == null)
            {
                return(false);
            }

            parms         = StorytellerUtility.DefaultParmsNow(IncidentCategoryDefOf.RaidBeacon, target);
            parms.points  = IncidentHelper_PointsHelper.RollProportionalGamePoints(storeIncident, pointsWager, parms.points);
            parms         = StorytellerUtility.DefaultParmsNow(worker.def.category, target);
            parms.faction = Find.FactionManager.OfInsects;

            worker     = new IncidentWorker_Infestation();
            worker.def = IncidentDef.Named("Infestation");


            return(worker.CanFireNow(parms));
        }