public static bool Prefix(ref float __result, ShipStatus __instance, [HarmonyArgument(0)] GameData.LGBOMGHJELL player) { ISystemType systemType = __instance.Systems.ContainsKey(SystemTypes.Electrical) ? __instance.Systems[SystemTypes.Electrical] : null; if (systemType == null) { return(true); } SwitchSystem switchSystem = systemType.TryCast <SwitchSystem>(); if (switchSystem == null) { return(true); } float num = (float)switchSystem.FPHHBGCHEJG / 255f; if (player == null || player.IAGJEKLJCCI) // IsDead { __result = __instance.MaxLightRadius; } else if (player.FDNMBJOAPFL) // IsImpostor { __result = __instance.MaxLightRadius * PlayerControl.GameOptions.EJPJACEEECE; } else if (Lighter.lighter != null && Lighter.lighter.PlayerId == player.FNPNJHNKEBK && Lighter.lighterTimer > 0f) // if player is Lighter and Lighter has his ability active { __result = Mathf.Lerp(__instance.MaxLightRadius * Lighter.lighterModeLightsOffVision, __instance.MaxLightRadius * Lighter.lighterModeLightsOnVision, num); } else if (Trickster.trickster != null && Trickster.lightsOutTimer > 0f) { float lerpValue = 1f; if (Trickster.lightsOutDuration - Trickster.lightsOutTimer < 0.5f) { lerpValue = Mathf.Clamp01((Trickster.lightsOutDuration - Trickster.lightsOutTimer) * 2); } else if (Trickster.lightsOutTimer < 0.5) { lerpValue = Mathf.Clamp01(Trickster.lightsOutTimer * 2); } __result = Mathf.Lerp(__instance.MinLightRadius, __instance.MaxLightRadius, 1 - lerpValue) * PlayerControl.GameOptions.FAJGBBKDEHP; // Instant lights out? Maybe add a smooth transition? } else { __result = Mathf.Lerp(__instance.MinLightRadius, __instance.MaxLightRadius, num) * PlayerControl.GameOptions.FAJGBBKDEHP; } return(false); }
private static bool CheckAndEndGameForSabotageWin(ShipStatus __instance) { if (__instance.Systems == null) { return(false); } ISystemType systemType = __instance.Systems.ContainsKey(SystemTypes.LifeSupp) ? __instance.Systems[SystemTypes.LifeSupp] : null; if (systemType != null) { LifeSuppSystemType lifeSuppSystemType = systemType.TryCast <LifeSuppSystemType>(); if (lifeSuppSystemType != null && lifeSuppSystemType.GPBBPGOINOF < 0f) { EndGameForSabotage(__instance); lifeSuppSystemType.GPBBPGOINOF = 10000f; return(true); } } ISystemType systemType2 = __instance.Systems.ContainsKey(SystemTypes.Reactor) ? __instance.Systems[SystemTypes.Reactor] : null; if (systemType2 == null) { systemType2 = __instance.Systems.ContainsKey(SystemTypes.Laboratory) ? __instance.Systems[SystemTypes.Laboratory] : null; } if (systemType2 != null) { ICriticalSabotage criticalSystem = systemType2.TryCast <ICriticalSabotage>(); if (criticalSystem != null && criticalSystem.GPBBPGOINOF < 0f) { EndGameForSabotage(__instance); criticalSystem.ClearSabotage(); return(true); } } return(false); }