public void PrepareAttackSupport(DeathmatchMap Map, int ActivePlayerIndex, Squad AttackingSquad, int DefendingPlayerIndex, int DefendingSquadIndex)
        {
            Squad DefendingSquad = Map.ListPlayer[DefendingPlayerIndex].ListSquad[DefendingSquadIndex];

            Clear();

            Player ActivePlayer = Map.ListPlayer[ActivePlayerIndex];

            for (int X = -1; X <= 1; X++)
            {
                for (int Y = -1; Y <= 1; Y++)
                {
                    if ((AttackingSquad.X + X == AttackingSquad.X && AttackingSquad.Y + Y == AttackingSquad.Y) || (Math.Abs(X) + Math.Abs(Y) > 1))
                    {
                        continue;
                    }

                    int SquadIndex = Map.CheckForSquadAtPosition(ActivePlayerIndex, AttackingSquad.Position, new Microsoft.Xna.Framework.Vector3(X, Y, 0));

                    //Can't support if the attacking unit is flying and the support can't fly.
                    if (SquadIndex >= 0 && ActivePlayer.ListSquad[SquadIndex].CurrentLeader.Boosts.SupportAttackModifier > 0 &&
                        (!AttackingSquad.IsFlying ||
                         ActivePlayer.ListSquad[SquadIndex].CurrentLeader.ListTerrainChoices.Contains(UnitStats.TerrainAir)))
                    {
                        if (!ActivePlayer.ListSquad[SquadIndex].CanMove || ActivePlayer.ListSquad[SquadIndex] == AttackingSquad)
                        {
                            continue;
                        }

                        Squad AttackerSupportSquad = ActivePlayer.ListSquad[SquadIndex];
                        Unit  AttackerSupportUnit  = AttackerSupportSquad.CurrentLeader;
                        Unit  Defender             = DefendingSquad.CurrentLeader;

                        AttackerSupportUnit.DisableAllAttacks();
                        AttackerSupportUnit.UpdateAllAttacks(AttackerSupportSquad.Position, DefendingSquad.Position, DefendingSquad.ArrayMapSize, DefendingSquad.CurrentMovement, true);

                        if (AttackerSupportUnit.CanAttack)
                        {
                            AttackerSupportUnit.BattleDefenseChoice = Unit.BattleDefenseChoices.Attack;
                            int BestDamage      = 0;
                            int BestAttackIndex = -1;

                            for (AttackerSupportUnit.AttackIndex = 0; AttackerSupportUnit.AttackIndex < AttackerSupportUnit.ListAttack.Count; ++AttackerSupportUnit.AttackIndex)
                            {
                                if (!AttackerSupportUnit.CurrentAttack.CanAttack)
                                {
                                    continue;
                                }

                                int Accuracy = Map.CalculateHitRate(AttackerSupportUnit, AttackerSupportSquad, DefendingSquad.CurrentLeader, DefendingSquad, DefendingSquad.CurrentLeader.BattleDefenseChoice);
                                AttackerSupportUnit.AttackAccuracy = Accuracy + "%";

                                if (Accuracy > 0)
                                {
                                    BattleMap.BattleResult Result = Map.DamageFormula(AttackerSupportUnit, ActivePlayer.ListSquad[SquadIndex], 1, DefendingPlayerIndex, DefendingSquadIndex, 0, Defender.BattleDefenseChoice, true);

                                    if (Result.AttackDamage > BestDamage)
                                    {
                                        BestDamage      = Result.AttackDamage;
                                        BestAttackIndex = AttackerSupportUnit.AttackIndex;
                                    }
                                }
                            }
                            if (BestAttackIndex >= 0)
                            {
                                AttackerSupportUnit.AttackIndex = BestAttackIndex;
                                AddSupportSquad(AttackerSupportSquad);
                                ActiveSquadSupportIndex = Count - 1;
                            }
                        }
                    }
                }
            }
        }