public static void PrefixMechCalledShot(ref Dictionary <ArmorLocation, int> hitTable, ArmorLocation bonusLocation, ref float bonusLocationMultiplier)
 {
     try {
         bonusLocationMultiplier = FixMultiplier(bonusLocation, bonusLocationMultiplier);
         if (Settings.CalledShotUseClustering && CurrentHitDirection != AttackDirection.None)
         {
             if (bonusLocation != ArmorLocation.None)
             {
                 hitTable = CombatConstants.GetMechClusterTable(bonusLocation, CurrentHitDirection);
             }
             CurrentHitDirection = AttackDirection.None;
         }
     }                 catch (Exception ex) { Error(ex); }
 }
Esempio n. 2
0
        public static bool OverrideHUDMechCalledShotPercent(ref string __result, ArmorLocation location, ArmorLocation targetedLocation)
        {
            try {
                Dictionary <ArmorLocation, int> hitTable = (targetedLocation == ArmorLocation.None || !CallShotClustered || !Settings.ShowRealMechCalledShotChance)
                                                   ? Combat.HitLocation.GetMechHitTable(AttackDirection)
                                                   : CombatConstants.GetMechClusterTable(targetedLocation, AttackDirection);
                if (CacheNeedRefresh(hitTable, (int)targetedLocation))
                {
                    HitTableTotalWeight = SumWeight(hitTable, targetedLocation, FixMultiplier(targetedLocation, ActorCalledShotBonus), scale);
                }

                int local = TryGet(hitTable, location) * scale;
                if (location == targetedLocation)
                {
                    local = (int)(local * FixMultiplier(targetedLocation, ActorCalledShotBonus));
                }

                __result = FineTuneAndFormat(hitTable, location, local, Settings.ShowRealMechCalledShotChance);
                return(false);
            }                 catch (Exception ex) { return(Error(ex)); }
        }
        public override void CombatStarts()
        {
            ClusterChanceNeverMultiplyHead          = CombatConstants.ToHit.ClusterChanceNeverMultiplyHead;
            ClusterChanceOriginalLocationMultiplier = CombatConstants.ToHit.ClusterChanceOriginalLocationMultiplier;
            CalledShotBonusMultiplier = CombatConstants.HitTables.CalledShotBonusMultiplier;

            if (Settings.FixHitDistribution)
            {
                foreach (AttackDirection direction in Enum.GetValues(typeof(AttackDirection)))
                {
                    if (direction == AttackDirection.None)
                    {
                        continue;
                    }
                    if (direction != AttackDirection.ToProne)
                    {
                        Dictionary <VehicleChassisLocations, int> hitTableV = Combat.HitLocation.GetVehicleHitTable(direction);
                        ScaledVehicleHitTables.Add(hitTableV, ScaleHitTable(hitTableV));
                    }
                    Dictionary <ArmorLocation, int> hitTableM = Combat.HitLocation.GetMechHitTable(direction);
                    ScaledMechHitTables.Add(hitTableM, ScaleHitTable(hitTableM));
                    if (direction != AttackDirection.FromArtillery)
                    {
                        foreach (ArmorLocation armor in hitTableM.Keys)
                        {
                            if (hitTableM[armor] <= 0)
                            {
                                continue;
                            }
                            Dictionary <ArmorLocation, int> hitTableC = CombatConstants.GetMechClusterTable(armor, direction);
                            ScaledMechHitTables.Add(hitTableC, ScaleHitTable(hitTableC));
                        }
                    }
                }
            }
        }