Ejemplo n.º 1
0
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            Map map      = (Map)parms.target;
            int duration = Mathf.RoundToInt(this.def.durationDays.RandomInRange * 60000f);
            GameCondition_Flashstorm gameCondition_Flashstorm = (GameCondition_Flashstorm)GameConditionMaker.MakeCondition(GameConditionDefOf.Flashstorm, duration, 0);

            map.gameConditionManager.RegisterCondition(gameCondition_Flashstorm);
            base.SendStandardLetter(new TargetInfo(gameCondition_Flashstorm.centerLocation.ToIntVec3, map, false), null, new string[0]);
            if (map.weatherManager.curWeather.rainRate > 0.1f)
            {
                map.weatherDecider.StartNextWeather();
            }
            return(true);
        }
        public override void Apply(LocalTargetInfo target, LocalTargetInfo dest)
        {
            base.Apply(target, dest);
            Map   map             = parent.pawn.Map;
            Thing conditionCauser = GenSpawn.Spawn(ThingDefOf.Flashstorm, target.Cell, parent.pawn.Map);
            GameCondition_Flashstorm gameCondition_Flashstorm = (GameCondition_Flashstorm)GameConditionMaker.MakeCondition(GameConditionDefOf.Flashstorm);

            gameCondition_Flashstorm.centerLocation     = target.Cell.ToIntVec2;
            gameCondition_Flashstorm.areaRadiusOverride = new IntRange(Mathf.RoundToInt(parent.def.EffectRadius), Mathf.RoundToInt(parent.def.EffectRadius));
            gameCondition_Flashstorm.Duration           = Mathf.RoundToInt(parent.def.EffectDuration.SecondsToTicks());
            gameCondition_Flashstorm.suppressEndMessage = true;
            gameCondition_Flashstorm.initialStrikeDelay = new IntRange(60, 180);
            gameCondition_Flashstorm.conditionCauser    = conditionCauser;
            gameCondition_Flashstorm.ambientSound       = true;
            map.gameConditionManager.RegisterCondition(gameCondition_Flashstorm);
            ApplyGoodwillImpact(target, gameCondition_Flashstorm.AreaRadius);
        }