コード例 #1
0
        public static float GetEjectionModifiersFromAttack(Mech mech, AttackDirector.AttackSequence attackSequence)
        {
            Logger.Info("---");
            float ejectModifiers = 0f;

            // Attack destroyed any location
            if (attackSequence.GetAttackDestroyedAnyLocation(mech.GUID))
            {
                Logger.Info($"[Assess_GetEjectionModifiersFromAttack] ({mech.DisplayName}) just lost a location");
                ejectModifiers += SimpleEjectionSystem.Settings.AttackDestroyedAnyLocationModifier;
                Logger.Info($"[Assess_GetEjectionModifiersFromAttack] ({mech.DisplayName}) -> ejectModifiers: {ejectModifiers}");
            }

            // Attack caused ammo explosion
            if (attackSequence.GetAttackCausedAmmoExplosion(mech.GUID))
            {
                Logger.Info($"[Assess_GetEjectionModifiersFromAttack] ({mech.DisplayName}) just suffered an ammo explosion");
                ejectModifiers += SimpleEjectionSystem.Settings.AttackCausedAmmoExplosionModifier;
                Logger.Info($"[Assess_GetEjectionModifiersFromAttack] ({mech.DisplayName}) -> ejectModifiers: {ejectModifiers}");
            }

            // Lost one or more weapons
            if (attackSequence.GetAttackDestroyedWeapon(mech.GUID))
            {
                Logger.Info($"[Assess_GetEjectionModifiersFromAttack] ({mech.DisplayName}) just lost one or more weapons");
                ejectModifiers += SimpleEjectionSystem.Settings.AttackDestroyedWeaponModifier;
                Logger.Info($"[Assess_GetEjectionModifiersFromAttack] ({mech.DisplayName}) -> ejectModifiers: {ejectModifiers}");
            }

            // Next shot like that could kill
            Logger.Info($"[Assess_GetEjectionModifiersFromAttack] ({mech.DisplayName}) attackSequence.cumulativeDamage: {attackSequence.cumulativeDamage}");
            float ctHealth  = mech.GetRemainingHealth(ArmorLocation.CenterTorso);
            float legHealth = mech.GetRemainingHealth(ArmorLocation.RightLeg) + mech.GetRemainingHealth(ArmorLocation.LeftLeg);
            float mostVulnerableLocation = Math.Min(ctHealth, legHealth);

            Logger.Info($"[Assess_GetEjectionModifiersFromAttack] ({mech.DisplayName}) ctHealth: {ctHealth}");
            Logger.Info($"[Assess_GetEjectionModifiersFromAttack] ({mech.DisplayName}) legHealth: {legHealth}");
            Logger.Info($"[Assess_GetEjectionModifiersFromAttack] ({mech.DisplayName}) mostVulnerableLocation: {mostVulnerableLocation}");
            if (mostVulnerableLocation <= attackSequence.cumulativeDamage)
            {
                Logger.Info($"[Assess_GetEjectionModifiersFromAttack] ({mech.DisplayName}) Next shot like that could kill({attackSequence.cumulativeDamage} dmg)");
                ejectModifiers += SimpleEjectionSystem.Settings.NextShotLikeThatCouldKillModifier;
                Logger.Info($"[Assess_GetEjectionModifiersFromAttack] ({mech.DisplayName}) -> ejectModifiers: {ejectModifiers}");
            }
            Logger.Debug($"[Assess_GetEjectionModifiersFromAttack] ({mech.DisplayName}) ---> ejectModifiers: {ejectModifiers}");

            return(ejectModifiers);
        }