Example #1
0
        public override IEnumerable <FiringIncident> MakeIntervalIncidents(IIncidentTarget target)
        {
            if (VoteHandler.voteActive)
            {
                yield break;
            }
            float acceptFraction = 1f;

            if (this.Props.acceptFractionByDaysPassedCurve != null)
            {
                acceptFraction *= this.Props.acceptFractionByDaysPassedCurve.Evaluate(GenDate.DaysPassedFloat);
            }
            if (this.Props.acceptPercentFactorPerThreatPointsCurve != null)
            {
                acceptFraction *= this.Props.acceptPercentFactorPerThreatPointsCurve.Evaluate(StorytellerUtility.DefaultThreatPointsNow(target));
            }
            int incCount = IncidentCycleUtility.IncidentCountThisInterval(target, Find.Storyteller.storytellerComps.IndexOf(this), this.Props.minDaysPassed, this.Props.onDays, this.Props.offDays, this.Props.minSpacingDays, this.Props.numIncidentsRange.min, this.Props.numIncidentsRange.max, acceptFraction);

            for (int i = 0; i < incCount; i++)
            {
                Helper.Log("Trying to gen OFC Inc");
                FiringIncident fi = this.GenerateIncident(target);
                if (fi != null)
                {
                    yield return(fi);
                }
            }
            yield break;
        }
        public override IEnumerable <FiringIncident> MakeIntervalIncidents(IIncidentTarget target)
        {
            //Settings.DebugString("== Enter StorytellerComp_OmenOnOffCycle.MakeIntervalIncidents ==");
            var num = 1f;

            if (Props.acceptFractionByDaysPassedCurve != null)
            {
                num *= Props.acceptFractionByDaysPassedCurve.Evaluate(GenDate.DaysPassedFloat);
            }

            if (Props.acceptPercentFactorPerThreatPointsCurve != null)
            {
                num *= Props.acceptPercentFactorPerThreatPointsCurve.Evaluate(
                    StorytellerUtility.DefaultThreatPointsNow(target));
            }

            var incCount = IncidentCycleUtility.IncidentCountThisInterval(target,
                                                                          Find.Storyteller.storytellerComps.IndexOf(this), Props.minDaysPassed, Props.onDays, Props.offDays,
                                                                          Props.minSpacingDays, Props.numIncidentsRange.min, Props.numIncidentsRange.max, num);

            //Settings.DebugString($"Accept Fraction: {num} + Incident Count: {incCount}");
            for (var i = 0; i < incCount; i++)
            {
                var firingIncident = GenerateIncident(target);
                if (firingIncident != null)
                {
                    Settings.DebugString($"Make Incident: {firingIncident.def.defName}");
                    yield return(firingIncident);
                }
            }

            //Settings.DebugString("== Exit StorytellerComp_OmenOnOffCycle.MakeIntervalIncidents ==");
        }
        public override IEnumerable <FiringIncident> MakeIntervalIncidents(IIncidentTarget target)
        {
            if (VoteHandler.currentVote is Vote_Milasandra)
            {
                yield break;
            }

            if (GenDate.DaysPassed <= Props.minDaysPassed)
            {
                yield break;
            }

            float acceptFraction = 1f;

            if (this.Props.acceptFractionByDaysPassedCurve != null)
            {
                acceptFraction *= this.Props.acceptFractionByDaysPassedCurve.Evaluate(GenDate.DaysPassedFloat);
            }
            if (this.Props.acceptPercentFactorPerThreatPointsCurve != null)
            {
                acceptFraction *= this.Props.acceptPercentFactorPerThreatPointsCurve.Evaluate(StorytellerUtility.DefaultThreatPointsNow(target));
            }
            int rand = Rand.Range(1, 25);
            //Helper.Log($"{rand} {this.Props.minDaysPassed} {this.Props.onDays} {this.Props.offDays} {this.Props.minSpacingDays}");
            int incCount = IncidentCycleUtility.IncidentCountThisInterval(target, rand, this.Props.minDaysPassed, this.Props.onDays, this.Props.offDays, this.Props.minSpacingDays, this.Props.numIncidentsRange.min, this.Props.numIncidentsRange.max, acceptFraction);

            for (int i = 0; i < incCount; i++)
            {
                FiringIncident fi = this.GenerateIncident(target);
            }
            // will never return an incident because it has to be voted on

            yield break;
        }
Example #4
0
        public override IEnumerable <FiringIncident> MakeIntervalIncidents(IIncidentTarget target)
        {
            int incCount = IncidentCycleUtility.IncidentCountThisInterval(target, Find.Storyteller.storytellerComps.IndexOf(this), Props.minDaysPassed, 60f, 0f,
                                                                          Props.minSpacingDays, Props.baseIncidentsPerYear, Props.baseIncidentsPerYear);

            for (int i = 0; i < incCount; i++)
            {
                IncidentParms parms = GenerateParms(Props.incident.category, target);
                if (Props.incident.Worker.CanFireNow(parms))
                {
                    yield return(new FiringIncident(Props.incident, this, parms));
                }
            }
        }
        public override IEnumerable <FiringIncident> MakeIntervalIncidents(IIncidentTarget target)
        {
            var num = 1f;

            if (Props.acceptFractionByDaysPassedCurve != null)
            {
                num *= Props.acceptFractionByDaysPassedCurve.Evaluate(GenDate.DaysPassedFloat);
            }

            if (Props.acceptPercentFactorPerThreatPointsCurve != null)
            {
                num *= Props.acceptPercentFactorPerThreatPointsCurve.Evaluate(
                    StorytellerUtility.DefaultThreatPointsNow(target));
            }

            var incCount = IncidentCycleUtility.IncidentCountThisInterval(target,
                                                                          Find.Storyteller.storytellerComps.IndexOf(this), Props.minDaysPassed, Props.onDays, Props.offDays,
                                                                          Props.minSpacingDays, Props.numIncidentsRange.min, Props.numIncidentsRange.max, num);

            for (var i = 0; i < incCount; i++)
            {
                var firingIncident = GenerateIncident(target);
                if (firingIncident != null)
                {
                    yield return(firingIncident);
                }
            }

            /*
             *
             *  ((1.0))
             *          float difficultyFactor = (!this.Props.applyRaidBeaconThreatMtbFactor)
             *              ? 1f
             *              : Find.Storyteller.difficulty. raidBeaconThreatCountFactor;
             *          int incCount = IncidentCycleUtility.IncidentCountThisInterval(target,
             *              Find.Storyteller.storytellerComps.IndexOf(this), this.Props.minDaysPassed, this.Props.onDays,
             *              this.Props.offDays, this.Props.minSpacingDays, this.Props.numIncidentsRange.min * difficultyFactor,
             *              this.Props.numIncidentsRange.max * difficultyFactor, 1f);
             *          for (int i = 0; i < incCount; i++)
             *          {
             *              FiringIncident fi = this.GenerateIncident(target);
             *              if (fi != null)
             *              {
             *                  yield return fi;
             *              }
             *          }
             *          yield break;*/

            //        (( B18 ))
            //            float curCycleDays = (GenDate.DaysPassedFloat - this.Props.minDaysPassed) % this.Props.ThreatCycleTotalDays;
            //            if (curCycleDays > this.Props.threatOffDays)
            //            {
            //                float daysSinceThreatBig =
            //                    (float) (Find.TickManager.TicksGame - target.StoryState.LastThreatBigTick) / 60000f;
            //                if (daysSinceThreatBig > this.Props.minDaysBetweenThreatBigs &&
            //                    ((daysSinceThreatBig > this.Props.ThreatCycleTotalDays * 0.9f &&
            //                      curCycleDays > this.Props.ThreatCycleTotalDays * 0.95f) ||
            //                     Rand.MTBEventOccurs(this.Props.mtbDaysThreatBig, 60000f, 1000f)))
            //                {
            //                    FiringIncident st = this.GenerateQueuedThreatBig(target);
            //                    if (st != null)
            //                    {
            //                        yield return st;
            //                    }
            //                }
            //
            //                if (Rand.MTBEventOccurs(this.Props.mtbDaysThreatSmall, 60000f, 1000f))
            //                {
            //                    FiringIncident st = this.GenerateQueuedThreatSmall(target);
            //                    if (st != null)
            //                    {
            //                        yield return st;
            //                    }
            //                }
            //            }
        }