public override bool IsPossible(string message, Viewer viewer, bool separateChannel = false)
        {
            ToolkitPatchLogger.Log(incidentDef.defName, "Checking if possible..");
            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);
            }

            ToolkitPatchLogger.Log(incidentDef.defName, $"Got the points wager of '{pointsWager}' and incident of '{storeIncident.abbreviation}:{storeIncident.defName}'");

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

            ToolkitPatchLogger.Log(incidentDef.defName, $"Target found '{target.Tile}'");

            parms        = StorytellerUtility.DefaultParmsNow(categoryDef, target);
            parms.points = IncidentHelper_PointsHelper.RollProportionalGamePoints(storeIncident, pointsWager, parms.points);
            if (raidStratDef != null)
            {
                parms.raidStrategy = raidStratDef;
            }
            if (pawnArrivalModeDef != null)
            {
                parms.raidArrivalMode = pawnArrivalModeDef;
            }

            worker     = Activator.CreateInstance <T>();
            worker.def = incidentDef;

            bool success = worker.CanFireNow(parms);

            if (!success)
            {
                WorkerCanFireCheck.CheckDefaultFireNowConditions(worker, parms, incidentDef);
            }

            ToolkitPatchLogger.Log(incidentDef.defName, $"Can fire with params '{parms.ToString()}' on worker {worker.ToString()}? {success}");

            return(success);
        }
        public override bool IsPossible()
        {
            ToolkitPatchLogger.Log(incidentDef.defName, "Checking if possible..");
            worker     = GetWorker();
            worker.def = incidentDef;

            if (target != null)
            {
                parms        = StorytellerUtility.DefaultParmsNow(incidentCategoryDef, target);
                parms.forced = shouldForceFire;

                bool success = worker.CanFireNow(parms);
                if (!success)
                {
                    WorkerCanFireCheck.CheckDefaultFireNowConditions(worker, parms, incidentDef);
                }
                ToolkitPatchLogger.Log(incidentDef.defName, $"Can fire with params '{parms.ToString()}' on worker {worker.ToString()}? {success}");
                return(success);
            }

            ToolkitPatchLogger.ErrorLog(incidentDef.defName, $"Failed to get target. Cannot fire");
            return(false);
        }
예제 #3
0
        public override bool IsPossible()
        {
            ToolkitPatchLogger.Log(incidentDef.defName, "Checking if possible..");
            worker     = GetWorker();
            worker.def = incidentDef;

            float points = StorytellerUtility.DefaultThreatPointsNow(target);

            parms        = StorytellerUtility.DefaultParmsNow(category, target);
            parms.forced = shouldForceFire;
            parms.points = points;

            bool success = worker.CanFireNow(parms);

            if (!success)
            {
                WorkerCanFireCheck.CheckDefaultFireNowConditions(worker, parms, incidentDef);
            }

            ToolkitPatchLogger.Log(incidentDef.defName, $"Can fire with params '{parms.ToString()}' on worker {worker.ToString()}? {success}");

            return(success);
        }