Exemplo n.º 1
0
        /// <summary>
        /// Calculates the strategy when there are no enemy regions in this super region.
        /// </summary>
        /// <param name="superRegion">The super region.</param>
        /// <returns></returns>
        public bool CalculateForNoEnemies(SuperRegion superRegion)
        {
            Region targetRegion = null, sourceRegion = null;
            bool   transferDone = false;

            var targetRegions = StrategyManager.GetTargetRegions(superRegion, Transfers, TargetStrategy.ConquerAll);

            /* No neutral armies found in this super region, that should mean we own the continent.
             * Let's explore the world and go to a new super region
             * */
            if (targetRegions.None())
            {
                targetRegions = StrategyManager.GetTargetRegions(superRegion, Transfers, TargetStrategy.ConquerOtherSuperRegions);

                if (targetRegions.Any())
                {
                    //We'll want to make more than 1 move
                    foreach (var cTargetRegion in targetRegions)
                    {
                        sourceRegion = StrategyManager.GetSourceRegion(cTargetRegion, Transfers, SourceStrategy.DominateOtherSuperRegions);
                        transferDone = AddCurrentPairToTransferList(sourceRegion, cTargetRegion);
                    }
                }
                else
                {
                    targetRegions = StrategyManager.GetTargetRegions(superRegion, Transfers, TargetStrategy.EnemyInvasionPaths);
                    targetRegion  = targetRegions.FirstOrDefault();

                    if (targetRegion != null)
                    {
                        sourceRegion = StrategyManager.GetSourceRegion(targetRegion, Transfers, SourceStrategy.AttackEnemyInvasionPath);
                        transferDone = AddCurrentPairToTransferList(sourceRegion, targetRegion);
                    }
                }
            }

            // Neutral regions found in this super region
            else
            {
                StrategyManager.ConquerNeutralRegions(targetRegions, Transfers, SourceStrategy.DominateOtherSuperRegions);
            }

            return(transferDone);
        }