internal float BarValue(float totalDamage, bool useMeleeConstants = false) { var constants = UnityGameInstance.BattleTechGame.MechStatisticsConstants; var min = useMeleeConstants ? constants.MinStockMeleeDamage + constants.MinStockFirepower : constants.MinStockFirepower; var max = useMeleeConstants ? constants.MaxStockMeleeDamage + constants.MaxStockFirepower : constants.MaxStockFirepower; return(MechStatUtils.NormalizeToFraction(totalDamage, min, max)); }
public float BarValue(MechDef mechDef) { var armor = mechDef.MechDefAssignedArmor; armor *= ArmorMultiplier(mechDef); armor *= DamageReductionMultiplierAll(mechDef); var stats = UnityGameInstance.BattleTechGame.MechStatisticsConstants; return MechStatUtils.NormalizeToFraction(armor, 0, stats.MaxArmorFactor); }
public static bool Prefix(ChassisDef chassisDef, ref float currentValue, ref float maxValue) { try { MechStatUtils.SetStatValues(0, ref currentValue, ref maxValue); return(false); } catch (Exception e) { Control.mod.Logger.LogError(e); } return(true); }
public static bool Prefix(MechDef mechDef, ref float currentValue, ref float maxValue) { try { var value = OverrideStatTooltipsFeature.MeleeStat.BarValue(mechDef); MechStatUtils.SetStatValues(value, ref currentValue, ref maxValue); return(false); } catch (Exception e) { Control.Logger.Error.Log(e); } return(true); }