示例#1
0
        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);
            }
        }
示例#2
0
        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);
            }
        }