static void Postfix(MechDef def, BattleTech.StatTooltipData __instance) { ChassisDef currentChassis = def.Chassis; float max_walk_distance = currentChassis.MovementCapDef.MaxWalkDistance; float max_sprint_distance = currentChassis.MovementCapDef.MaxSprintDistance; float max_jump_distance = BTMechDef.GetJumpJetsMaxDistance(def); foreach (MechComponentRef mechComponentRef in def.Inventory) { if (mechComponentRef.Def == null) { mechComponentRef.RefreshComponentDef(); } // Various movement effects if (mechComponentRef.Def.statusEffects != null) { foreach (EffectData effect in mechComponentRef.Def.statusEffects) { StatisticEffectData statisticData = effect.statisticData; if (statisticData.statName == "WalkSpeed") { BTStatistics.ApplyEffectStatistic(statisticData, ref max_walk_distance); } else if (statisticData.statName == "RunSpeed") { BTStatistics.ApplyEffectStatistic(statisticData, ref max_sprint_distance); } else if (statisticData.statName == "JumpDistanceMultiplier") { BTStatistics.ApplyEffectStatistic(statisticData, ref max_jump_distance); } } } } __instance.dataList.Add("Walk distance", string.Format("{0}m", (int)max_walk_distance)); __instance.dataList.Add("Sprint distance", string.Format("{0}m", (int)max_sprint_distance)); if (max_jump_distance > 0) { __instance.dataList.Add("Jump distance", string.Format("{0}m", (int)max_jump_distance)); } }
static void Postfix(MechDef def, BattleTech.StatTooltipData __instance) { float alpha_damage = 0; float alpha_instability = 0; float alpha_heat = 0; // Calculate alpha strike total damage, heat damage and instability. foreach (MechComponentRef mechComponentRef in def.Inventory) { if (mechComponentRef.Def is WeaponDef weapon) { alpha_damage += weapon.Damage * weapon.ShotsWhenFired; alpha_instability += weapon.Instability * weapon.ShotsWhenFired; alpha_heat += weapon.HeatDamage * weapon.ShotsWhenFired; } } string damage_string = ModBase.MakeDamageString(alpha_damage, alpha_instability, alpha_heat); if (!String.IsNullOrEmpty(damage_string)) { __instance.dataList.Add("Alpha strike damage", damage_string); } }
static void Postfix(MechDef def, BattleTech.StatTooltipData __instance) { ChassisDef currentChassis = def.Chassis; float melee_damage = currentChassis.MeleeDamage; float melee_instability = currentChassis.MeleeInstability; float dfa_damage = currentChassis.DFADamage * 2; float dfa_instability = currentChassis.DFAInstability; float dfa_self_damage = currentChassis.DFASelfDamage; float support_damage = 0; float support_instability = 0; float support_heat = 0; foreach (MechComponentRef mechComponentRef in def.Inventory) { if (mechComponentRef.Def == null) { mechComponentRef.RefreshComponentDef(); } // Take Melee/DFA upgrades into account if (mechComponentRef.Def.statusEffects != null) { foreach (EffectData effect in mechComponentRef.Def.statusEffects) { if (effect.effectType != EffectType.StatisticEffect) { continue; } if (effect.statisticData.targetWeaponSubType == WeaponSubType.Melee) { if (effect.statisticData.statName == "DamagePerShot") { BTStatistics.ApplyEffectStatistic(effect.statisticData, ref melee_damage); } else if (effect.statisticData.statName == "Instability") { BTStatistics.ApplyEffectStatistic(effect.statisticData, ref melee_instability); } } else if (effect.statisticData.targetWeaponSubType == WeaponSubType.DFA) { if (effect.statisticData.statName == "DamagePerShot") { BTStatistics.ApplyEffectStatistic(effect.statisticData, ref dfa_damage); } else if (effect.statisticData.statName == "Instability") { BTStatistics.ApplyEffectStatistic(effect.statisticData, ref dfa_instability); } else if (effect.statisticData.statName == "DFASelfDamage") { BTStatistics.ApplyEffectStatistic(effect.statisticData, ref dfa_self_damage); } } } } // Calculate support weapon damage if (mechComponentRef.Def is WeaponDef weapon && weapon.Category == WeaponCategory.AntiPersonnel) { support_damage += weapon.Damage * weapon.ShotsWhenFired; support_instability += weapon.Instability * weapon.ShotsWhenFired; support_heat += weapon.HeatDamage * weapon.ShotsWhenFired; } } __instance.dataList.Add("Melee damage", ModBase.MakeDamageString(melee_damage, melee_instability)); if (BTMechDef.GetJumpJetsAmount(def) > 0) { __instance.dataList.Add("DFA damage", ModBase.MakeDamageString(dfa_damage, dfa_instability)); __instance.dataList.Add("DFA self-damage", string.Format("{0}x2", (int)dfa_self_damage)); } string damage_string = ModBase.MakeDamageString(support_damage, support_instability, support_heat); if (!String.IsNullOrEmpty(damage_string)) { __instance.dataList.Add("Support damage", damage_string); } }
static void Postfix(MechDef def, BattleTech.StatTooltipData __instance) { HeatConstantsDef heatConstants = ModBase.combatConstants.Heat; float total_heat_sinking = heatConstants.InternalHeatSinkCount * heatConstants.DefaultHeatSinkDissipationCapacity; float extra_engine_heat_sinking = BTMechDef.GetExtraEngineSinking(def); total_heat_sinking += extra_engine_heat_sinking; float heat_sinking_ratio = 1; float total_weapon_heat = 0; float weapon_heat_ratio = 1; float jump_distance = BTMechDef.GetJumpJetsMaxDistance(def); int max_heat = heatConstants.MaxHeat; foreach (MechComponentRef mechComponentRef in def.Inventory) { if (mechComponentRef.Def == null) { mechComponentRef.RefreshComponentDef(); } // Weapon total heat if (mechComponentRef.Def is WeaponDef weapon) { total_weapon_heat += (float)weapon.HeatGenerated; } // Heat sink total dissipation else if (mechComponentRef.Def is HeatSinkDef heat_sink) { total_heat_sinking += heat_sink.DissipationCapacity; } // Bank/Exchanger effects if (mechComponentRef.Def.statusEffects != null) { foreach (EffectData effect in mechComponentRef.Def.statusEffects) { StatisticEffectData statisticData = effect.statisticData; if (statisticData.statName == "MaxHeat") { BTStatistics.ApplyEffectStatistic(statisticData, ref max_heat); } else if (statisticData.statName == "HeatGenerated" && (statisticData.targetCollection == StatisticEffectData.TargetCollection.Weapon || BTStatistics.IsWildcardStatistic(statisticData))) { BTStatistics.ApplyEffectStatistic(statisticData, ref weapon_heat_ratio); } else if (statisticData.statName == "JumpDistanceMultiplier") { BTStatistics.ApplyEffectStatistic(statisticData, ref jump_distance); } } } } total_weapon_heat *= weapon_heat_ratio; total_heat_sinking *= heat_sinking_ratio; if (extra_engine_heat_sinking > 0f) { __instance.dataList.Add("Heat dissipation", string.Format("{0}\n(DHS)", (int)total_heat_sinking)); } else { __instance.dataList.Add("Heat dissipation", string.Format("{0}", (int)total_heat_sinking)); } if (total_weapon_heat > 0) { __instance.dataList.Add("Alpha strike heat", string.Format("{0}", (int)total_weapon_heat)); __instance.dataList.Add("Alpha strike heat delta", string.Format("{0}", (int)(total_weapon_heat - total_heat_sinking))); } __instance.dataList.Add("Max heat capacity", string.Format("{0}", (int)max_heat)); if (jump_distance > 0) { float max_jump_heat = ((jump_distance / heatConstants.JumpHeatUnitSize) + 1) * heatConstants.JumpHeatPerUnit; max_jump_heat *= heatConstants.GlobalHeatIncreaseMultiplier; max_jump_heat = Mathf.Max(heatConstants.JumpHeatMin, max_jump_heat); __instance.dataList.Add("Max jump heat", string.Format("{0}", (int)max_jump_heat)); } }