public static void CalculateLightOutage(BaseLight baseLight, EffectsObject eo)
{
if (!Data.UseRandomLightOutage || IsDefraggable(baseLight) || !IsControllable(baseLight, eo) || !eo.EffectsMap.UseRandomLightOutage || (baseLight is TSBaseLight && !((TSBaseLight)baseLight).UseRandomLightOutage))
{
return;
}
int lowNumber = Support.GetRandom(0, (100 - eo.EffectsMap.LightOutageChancePerTick));
int highNumber = lowNumber + eo.EffectsMap.LightOutageChancePerTick;
int randomChance = Support.GetRandom(0, 100);
if (randomChance >= lowNumber && randomChance <= highNumber)
{
if (baseLight.Burning)
{
baseLight.Douse();
}
else
{
baseLight.Ignite();
}
}
}