Ejemplo n.º 1
0
 public static void CanAddHediffToAnyPartOfDefPrefix(IncidentWorker_DiseaseHuman __instance, IncidentParms parms, ref IEnumerable <Pawn> __result)
 {
     if (__instance != null)
     {
         if (__instance.def != null)
         {
             if (__instance.def.diseaseIncident != null)
             {
                 __result = __result.Where(x => x.def != USCMDefOf.RRY_Synth || (x.TryGetComp <CompSynthProps>() != null && x.TryGetComp <CompSynthProps>().AllowedDiseases.Contains(__instance.def.diseaseIncident)));
             }
         }
     }
 }
Ejemplo n.º 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 < 4)
            {
                TwitchWrapper.SendChatMessage($"@{viewer.username} syntax is {this.storeIncident.syntax}");
                return(false);
            }

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

            string diseaseLabel = command[2].ToLower();

            worker = new IncidentWorker_DiseaseHuman();
            List <IncidentDef> allDiseases = DefDatabase <IncidentDef> .AllDefs.Where(s =>
                                                                                      s.category == IncidentCategoryDefOf.DiseaseHuman &&
                                                                                      string.Join("", s.LabelCap.RawText.Split(' ')).ToLower() == diseaseLabel
                                                                                      ).ToList();

            if (allDiseases.Count < 1)
            {
                TwitchWrapper.SendChatMessage($"@{viewer.username} no disease {diseaseLabel} found.");
                return(false);
            }

            allDiseases.Shuffle();
            worker.def = allDiseases[0];

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

            float defaultThreatPoints = StorytellerUtility.DefaultSiteThreatPointsNow();

            parms        = StorytellerUtility.DefaultParmsNow(worker.def.category, target);
            parms.points = IncidentHelper_PointsHelper.RollProportionalGamePoints(storeIncident, pointsWager, StorytellerUtility.DefaultThreatPointsNow(target));
            return(worker.CanFireNow(parms));
        }
        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);
            }

            worker = new IncidentWorker_DiseaseHuman();
            List <IncidentDef> allDiseases = DefDatabase <IncidentDef> .AllDefs.Where(s => s.workerClass == typeof(IncidentWorker_DiseaseHuman)).ToList();

            allDiseases.Shuffle();
            worker.def = allDiseases[0];

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

            float defaultThreatPoints = StorytellerUtility.DefaultSiteThreatPointsNow();

            parms        = StorytellerUtility.DefaultParmsNow(worker.def.category, target);
            parms.points = IncidentHelper_PointsHelper.RollProportionalGamePoints(storeIncident, pointsWager, StorytellerUtility.DefaultThreatPointsNow(target));
            return(worker.CanFireNow(parms));
        }