Beispiel #1
0
        static void Surround(BattleData battleData)
        {
            if (battleData.EnemyArmy.Length < 1)
            {
                return;
            }

            for (int i = 0; i < battleData.AllyArmy.Length; i++)
            {
                int    TargetIndex = Strategy.NearestToAll(battleData.AllyArmy, battleData.EnemyArmy);
                Step[] Path        = DistanceAndPath.PathTo(
                    battleData,
                    battleData.AllyArmy[i].Position,
                    battleData.EnemyArmy[TargetIndex].Position,
                    battleData.AllyArmy[i].Unit.Range);

                Strategy.MoveAndAttack(battleData.AllyArmy[i], battleData.EnemyArmy[TargetIndex], Path, battleData);
            }
        }
Beispiel #2
0
        static void HitAndRun(BattleData battleData)
        {
            if (battleData.EnemyArmy.Length < 1)
            {
                return;
            }
            for (int i = 0; i < battleData.AllyArmy.Length; i++)
            {
                int TargetIndex = Strategy.NearestToPoint(battleData.AllyArmy[i].Position, battleData.EnemyArmy);

                Step[] Path = DistanceAndPath.PathTo(
                    battleData,
                    battleData.AllyArmy[i].Position,
                    battleData.EnemyArmy[TargetIndex].Position,
                    battleData.AllyArmy[i].Unit.Range);
                if (Path != null)
                {
                    if (Path.Length == 0)
                    {
                        Point SafePoint = GetSafeFrom(battleData.AllyArmy[i].Position, battleData.EnemyArmy[TargetIndex].Position);

                        Path = DistanceAndPath.PathTo(
                            battleData,
                            battleData.AllyArmy[i].Position,
                            SafePoint,
                            0);

                        Strategy.AttackAndMove(battleData.AllyArmy[i], battleData.EnemyArmy[TargetIndex], Path, battleData);
                    }
                    else
                    {
                        Strategy.MoveAndAttack(battleData.AllyArmy[i], battleData.EnemyArmy[TargetIndex], Path, battleData);
                    }
                }
            }
        }