private static float HowMuchIsTooMuch(ref WearNTear instance, float health, float damage) { float remainingHealth = health - (damage / 100f * instance.m_health); float howMuchIsTooMuch = Mathf.Abs(minHealths[instance.GetInstanceID()] - remainingHealth); return(howMuchIsTooMuch / instance.m_health * 100f); }
public static void WearNTear_Awake(ref WearNTear __instance) { minHealthPercentage = (1.0f - Mathf.Clamp(maxRainDamagePercentage.Value, 0.0f, 1.0f)); minHealths.Add(__instance.GetInstanceID(), __instance.m_health * minHealthPercentage); }
public static void WearNTear_OnDestroy(ref WearNTear __instance) { minHealths.Remove(__instance.GetInstanceID()); }
private static bool IsTooMuchDamage(ref WearNTear instance, float health, float damage) { float healthAfterDamage = health - (damage / 100f * instance.m_health); return(healthAfterDamage < minHealths[instance.GetInstanceID()]); }