コード例 #1
0
        private void CalculateInstability(Mech attacker, AbstractActor target)
        {
            Mod.MeleeLog.Info?.Write($"Calculating DFA instability for attacker: {CombatantUtils.Label(attacker)} " +
                                     $"vs. target: {CombatantUtils.Label(target)}");

            float targetTonnage = 0;

            if (target is Vehicle vehicle)
            {
                targetTonnage = vehicle.tonnage;
            }
            else if (target is Mech mech)
            {
                targetTonnage = mech.tonnage;
            }
            Mod.MeleeLog.Info?.Write($" - Target tonnage is: {targetTonnage}");

            float attackerInstab = attacker.DFAAttackerInstability(targetTonnage);

            attackerInstab           = attacker.ApplyDFAInstabReduction(attackerInstab);
            this.AttackerInstability = attackerInstab;

            float targetInstab = attacker.DFATargetInstability();

            targetInstab           = target.ApplyDFAInstabReduction(targetInstab);
            this.TargetInstability = targetInstab;
        }