Пример #1
0
        public bool KnowEnemyNatural()
        {
            if (Interface().baseLocations[(int)ForceLocations.EnemyNatural] is TilePosition)
            {
                return(true);
            }

            TilePosition ePos = bwapi.Broodwar.enemy().getStartLocation();

            if (ePos != null && ePos.isValid())
            {
                TilePosition eNat = bwta.getBaseLocations().Where(loc => !loc.isStartLocation()).OrderBy(loc => loc.getPosition().getApproxDistance(new Position(ePos))).First().getTilePosition();
                Interface().baseLocations[(int)ForceLocations.EnemyNatural] = eNat;
                return(true);
            }

            // only two starting locations so its easy to determine where the enemy is
            if (bwta.getBaseLocations().Where(loc => loc.isStartLocation() && !loc.getTilePosition().opEquals(Interface().StartLocation())).Count() == 2)
            {
                TilePosition eBase = bwta.getBaseLocations().Where(loc => loc.isStartLocation() && !loc.getTilePosition().opEquals(Interface().baseLocations[(int)ForceLocations.OwnStart])).First().getTilePosition();
                TilePosition eNat  = bwta.getBaseLocations().Where(loc => !loc.isStartLocation()).OrderBy(loc => loc.getPosition().getApproxDistance(new Position(ePos))).First().getTilePosition();
                Interface().baseLocations[(int)ForceLocations.EnemyNatural] = eNat;
                return(true);
            }

            return(false);
        }
Пример #2
0
        public bool GuessEnemyBase()
        {
            if (enemyStartLocations is IEnumerable <BaseLocation> && enemyStartLocations.GetEnumerator().Current != null)
            {
                TilePosition ePos = enemyStartLocations.GetEnumerator().Current.getTilePosition();
                if (ePos != null && ePos.isValid())
                {
                    Interface().baseLocations[(int)ForceLocations.EnemyStart] = ePos;
                    enemyStartLocations.GetEnumerator().MoveNext();
                    return(true);
                }
            }
            enemyStartLocations = bwta.getBaseLocations().Where(loc => loc.isStartLocation() && !loc.getTilePosition().opEquals(Interface().StartLocation()));
            enemyStartLocations.GetEnumerator().MoveNext();

            TilePosition ePos2 = enemyStartLocations.GetEnumerator().Current.getTilePosition();

            if (ePos2 != null && ePos2.isValid())
            {
                Interface().baseLocations[(int)ForceLocations.EnemyStart] = ePos2;
                enemyStartLocations.GetEnumerator().MoveNext();
                return(true);
            }

            return(false);
        }
Пример #3
0
        public bool KnowEnemyBase()
        {
            TilePosition ePos = bwapi.Broodwar.enemy().getStartLocation();

            if (ePos != null && ePos.isValid())
            {
                Interface().baseLocations[(int)ForceLocations.EnemyStart] = ePos;
                return(true);
            }

            return(false);
        }