Ejemplo n.º 1
0
 async def create_plan(self) -> BuildOrder:
     return BuildOrder([
         SequentialList([
             ActUnit(UnitTypeId.SCV, UnitTypeId.COMMANDCENTER, 13),
             GridBuilding(UnitTypeId.SUPPLYDEPOT, 1),
             GridBuilding(UnitTypeId.BARRACKS, 3),
             ActUnit(UnitTypeId.SCV, UnitTypeId.COMMANDCENTER, 14),
             ActUnit(UnitTypeId.MARINE, UnitTypeId.BARRACKS, 1),
             ActUnit(UnitTypeId.SCV, UnitTypeId.COMMANDCENTER, 15),
             GridBuilding(UnitTypeId.BARRACKS, 4),
             BuildOrder([
                 AutoDepot(),
                 ActUnit(UnitTypeId.MARINE, UnitTypeId.BARRACKS, 200),
             ])
         ]),
         SequentialList([
             PlanCancelBuilding(),
             LowerDepots(),
             PlanZoneDefense(),
             DistributeWorkers(),
             Step(None, SpeedMining(), lambda ai: ai.client.game_step > 5),
             ManTheBunkers(),
             Repair(),
             ContinueBuilding(),
             PlanZoneGatherTerran(),
             AllInPlanZoneAttack(10),
             PlanFinishEnemy(),
         ])
     ])
Ejemplo n.º 2
0
 async def create_plan(self) -> BuildOrder:
     number = random.randint(10, 15)
     attack = TheAttack(number + 1)
     return BuildOrder(
         Step(
             None,
             ChronoUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS),
             skip=UnitExists(UnitTypeId.PROBE, 20, include_pending=True),
             skip_until=UnitExists(UnitTypeId.ASSIMILATOR, 1),
         ),
         SequentialList(
             GridBuilding(UnitTypeId.PYLON, 1),
             ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 14),
             GridBuilding(UnitTypeId.GATEWAY, 1),
             ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 16),
             BuildGas(1),
             ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 17),
             GridBuilding(UnitTypeId.GATEWAY, 2),
             ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 20),
             ArtosisPylon(2),
             BuildOrder(
                 AutoPylon(),
                 SequentialList(
                     Step(
                         None,
                         GridBuilding(UnitTypeId.CYBERNETICSCORE, 1),
                         skip_until=UnitReady(UnitTypeId.GATEWAY, 1),
                     ),
                     Step(
                         UnitReady(UnitTypeId.CYBERNETICSCORE, 1),
                         ProtossUnit(UnitTypeId.ADEPT, 2, only_once=True),
                     ),
                     Tech(UpgradeId.WARPGATERESEARCH),
                     ProtossUnit(UnitTypeId.ADEPT, 100),
                 ),
                 Step(
                     UnitExists(UnitTypeId.CYBERNETICSCORE, 1),
                     GridBuilding(UnitTypeId.GATEWAY, 4),
                     skip_until=Minerals(200),
                 ),
                 Step(
                     None,
                     ProtossUnit(UnitTypeId.ZEALOT, 100),
                     skip=Gas(25),
                     skip_until=Minerals(200),
                 ),
             ),
         ),
         SequentialList(
             ChronoAnyTech(0),
             PlanZoneDefense(),
             RestorePower(),
             DistributeWorkers(),
             Step(None, SpeedMining(), lambda ai: ai.client.game_step > 5),
             PlanZoneGather(),
             DoubleAdeptScout(number),
             attack,
             PlanFinishEnemy(),
         ),
     )
Ejemplo n.º 3
0
 async def create_plan(self) -> BuildOrder:
     attack = TheAttack(4)
     return BuildOrder([
         Step(None, ChronoUnit(UnitTypeId.STALKER, UnitTypeId.GATEWAY)),
         SequentialList([
             GridBuilding(UnitTypeId.PYLON, 1),
             ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 15),
             GridBuilding(UnitTypeId.GATEWAY, 1),
             ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 16),
             StepBuildGas(1),
             ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 19),
             StepBuildGas(2),
             GridBuilding(UnitTypeId.CYBERNETICSCORE, 1),
             ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 21),
             GridBuilding(UnitTypeId.PYLON, 2),
             ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 22),
             ProtossUnit(UnitTypeId.STALKER, 1),
             Tech(UpgradeId.WARPGATERESEARCH, UnitTypeId.CYBERNETICSCORE),
             ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 23),
             GridBuilding(UnitTypeId.GATEWAY, 4),
             GridBuilding(UnitTypeId.PYLON, 3),
             BuildOrder([AutoPylon(),
                         ProtossUnit(UnitTypeId.STALKER, 100)])
         ]),
         SequentialList([
             PlanZoneDefense(),
             RestorePower(),
             DistributeWorkers(),
             Step(None, SpeedMining(), lambda ai: ai.client.game_step > 5),
             PlanZoneGather(),
             Step(UnitReady(UnitTypeId.GATEWAY, 4), attack),
             PlanFinishEnemy(),
         ])
     ])
Ejemplo n.º 4
0
 async def create_plan(self) -> BuildOrder:
     attack = PlanZoneAttack(6)
     attack.attack_on_advantage = False  # Disables requirement for game analyzer
     return BuildOrder(
         Step(
             None,
             ChronoUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS),
             skip=UnitExists(UnitTypeId.PROBE, 20, include_pending=True),
             skip_until=UnitExists(UnitTypeId.ASSIMILATOR, 1),
         ),
         ChronoTech(AbilityId.RESEARCH_BLINK, UnitTypeId.TWILIGHTCOUNCIL),
         SequentialList(
             ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 14),
             GridBuilding(UnitTypeId.PYLON, 1),
             ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 16),
             GridBuilding(UnitTypeId.GATEWAY, 1),
             ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 17),
             BuildGas(2),
             ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 19),
             GridBuilding(UnitTypeId.GATEWAY, 2),
             BuildOrder(
                 AutoPylon(),
                 ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 22),
                 SequentialList(
                     Step(
                         UnitReady(UnitTypeId.CYBERNETICSCORE, 1),
                         GridBuilding(UnitTypeId.TWILIGHTCOUNCIL, 1),
                     ),
                     Step(UnitReady(UnitTypeId.TWILIGHTCOUNCIL, 1),
                          Tech(UpgradeId.BLINKTECH)),
                 ),
                 SequentialList(
                     Step(
                         None,
                         GridBuilding(UnitTypeId.CYBERNETICSCORE, 1),
                         skip_until=UnitReady(UnitTypeId.GATEWAY, 1),
                     ),
                     Step(
                         UnitReady(UnitTypeId.CYBERNETICSCORE, 1),
                         ProtossUnit(UnitTypeId.ADEPT, 2, only_once=True),
                     ),
                     Tech(UpgradeId.WARPGATERESEARCH),
                     ProtossUnit(UnitTypeId.STALKER, 100),
                 ),
                 Step(UnitExists(UnitTypeId.CYBERNETICSCORE, 1),
                      GridBuilding(UnitTypeId.GATEWAY, 4)),
             ),
         ),
         SequentialList(
             PlanZoneDefense(),
             RestorePower(),
             DistributeWorkers(),
             Step(None, SpeedMining(), lambda ai: ai.client.game_step > 5),
             PlanZoneGather(),
             Step(TechReady(UpgradeId.BLINKTECH, 0.9), attack),
             PlanFinishEnemy(),
         ),
     )
Ejemplo n.º 5
0
 async def create_plan(self) -> BuildOrder:
     flying_buildings = lambda k: self._bot.enemy_structures.flying.exists and self._bot.supply_used > 30
     in_case_of_air = [
         Step(flying_buildings, StepBuildGas(2)),
         ActUnit(UnitTypeId.DRONE, UnitTypeId.LARVA, 20),
         MorphLair(),
         ActUnit(UnitTypeId.DRONE, UnitTypeId.LARVA, 30),
         StepBuildGas(4),
         ActBuilding(UnitTypeId.SPIRE),
         ZergUnit(UnitTypeId.MUTALISK, 10, priority=True)
     ]
     limit_gas = Any(
         [Gas(100),
          TechReady(UpgradeId.ZERGLINGMOVEMENTSPEED, 0.001)])
     return BuildOrder([
         SequentialList([
             ActUnit(UnitTypeId.DRONE, UnitTypeId.LARVA, 14),
             Expand(2),
             StepBuildGas(1),
             ActBuilding(UnitTypeId.SPAWNINGPOOL, 1),
             ActUnit(UnitTypeId.OVERLORD, UnitTypeId.LARVA, 2),
             Step(None,
                  Tech(UpgradeId.ZERGLINGMOVEMENTSPEED,
                       UnitTypeId.SPAWNINGPOOL),
                  skip_until=Gas(100)),
             ActUnit(UnitTypeId.QUEEN, UnitTypeId.HATCHERY, 1),
             ActUnit(UnitTypeId.ZERGLING, UnitTypeId.LARVA, 30),
             ActBuilding(UnitTypeId.BANELINGNEST, 1),
             BuildOrder([
                 Step(None,
                      ActUnit(UnitTypeId.ZERGLING, UnitTypeId.LARVA, 200),
                      skip=RequireCustom(lambda k: self._bot.vespene > 25 or
                                         flying_buildings)),
                 Step(None,
                      ActUnit(UnitTypeId.BANELING, UnitTypeId.ZERGLING,
                              200),
                      skip=RequireCustom(flying_buildings)),
             ])
         ]),
         SequentialList([
             Step(None, DistributeWorkers(), skip=limit_gas),
             Step(limit_gas,
                  DistributeWorkers(1, 1),
                  skip=RequireCustom(flying_buildings)),
             Step(RequireCustom(flying_buildings), DistributeWorkers()),
         ]), in_case_of_air,
         SequentialList([
             Step(None, SpeedMining(), lambda ai: ai.client.game_step > 5),
             PlanZoneDefense(),
             AutoOverLord(),
             InjectLarva(),
             PlanZoneGather(),
             Step(TechReady(UpgradeId.ZERGLINGMOVEMENTSPEED),
                  PlanZoneAttackAllIn(10)),
             PlanFinishEnemy(),
         ])
     ])
Ejemplo n.º 6
0
 async def create_plan(self) -> BuildOrder:
     attack = PlanZoneAttack(6)
     return BuildOrder(
         Step(
             None,
             ChronoUnitProduction(UnitTypeId.PROBE, UnitTypeId.NEXUS),
             skip=UnitExists(UnitTypeId.PROBE, 20, include_pending=True),
             skip_until=UnitExists(UnitTypeId.ASSIMILATOR, 1),
         ),
         ChronoTech(AbilityId.RESEARCH_BLINK, UnitTypeId.TWILIGHTCOUNCIL),
         SequentialList(
             ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 14),
             GridBuilding(UnitTypeId.PYLON, 1),
             ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 16),
             GridBuilding(UnitTypeId.GATEWAY, 1),
             ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 17),
             StepBuildGas(2),
             ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 19),
             GridBuilding(UnitTypeId.GATEWAY, 2),
             BuildOrder(
                 AutoPylon(),
                 ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 22),
                 SequentialList(
                     Step(
                         RequiredUnitReady(UnitTypeId.CYBERNETICSCORE, 1),
                         GridBuilding(UnitTypeId.TWILIGHTCOUNCIL, 1),
                     ),
                     Step(RequiredUnitReady(UnitTypeId.TWILIGHTCOUNCIL, 1), ActTech(UpgradeId.BLINKTECH)),
                 ),
                 SequentialList(
                     Step(
                         None,
                         GridBuilding(UnitTypeId.CYBERNETICSCORE, 1),
                         skip_until=RequiredUnitReady(UnitTypeId.GATEWAY, 1),
                     ),
                     Step(
                         RequiredUnitReady(UnitTypeId.CYBERNETICSCORE, 1),
                         GateUnit(UnitTypeId.ADEPT, 2, only_once=True),
                     ),
                     ActTech(UpgradeId.WARPGATERESEARCH),
                     GateUnit(UnitTypeId.STALKER, 100),
                 ),
                 Step(UnitExists(UnitTypeId.CYBERNETICSCORE, 1), GridBuilding(UnitTypeId.GATEWAY, 4)),
             ),
         ),
         SequentialList(
             PlanZoneDefense(),
             RestorePower(),
             PlanDistributeWorkers(),
             PlanZoneGather(),
             Step(RequiredTechReady(UpgradeId.BLINKTECH, 0.9), attack),
             PlanFinishEnemy(),
         ),
     )
Ejemplo n.º 7
0
 async def create_plan(self) -> BuildOrder:
     finish_rush = Any([Gas(150), UnitExists(UnitTypeId.PLANETARYFORTRESS)])
     return BuildOrder([
         SequentialList([
             BuildPosition(UnitTypeId.COMMANDCENTER,
                           self._bot.knowledge.zone_manager.enemy_natural.
                           center_location,
                           exact=True,
                           only_once=True),
             StepBuildGas(2),
             ActBuilding(UnitTypeId.ENGINEERINGBAY),
             ActUnit(UnitTypeId.SCV, UnitTypeId.COMMANDCENTER, 17),
             MorphProxyPlanetary(),
             GridBuilding(UnitTypeId.SUPPLYDEPOT, 1),
             BuildOrder([
                 ActUnit(UnitTypeId.SCV, UnitTypeId.COMMANDCENTER, 38),
                 ActUnit(UnitTypeId.SCV, UnitTypeId.PLANETARYFORTRESS, 38),
                 GridBuilding(UnitTypeId.BARRACKS, 4),
                 BuildAddon(UnitTypeId.BARRACKSTECHLAB, UnitTypeId.BARRACKS,
                            2),
                 BuildAddon(UnitTypeId.BARRACKSREACTOR, UnitTypeId.BARRACKS,
                            2),
                 Tech(UpgradeId.STIMPACK, UnitTypeId.BARRACKSTECHLAB),
                 Tech(UpgradeId.TERRANINFANTRYWEAPONSLEVEL1,
                      UnitTypeId.ENGINEERINGBAY),
                 AutoDepot(),
                 ActUnit(UnitTypeId.MARAUDER, UnitTypeId.BARRACKS, 50),
                 ActUnit(UnitTypeId.MARINE, UnitTypeId.BARRACKS, 100),
                 GridBuilding(UnitTypeId.BARRACKS, 6),
                 BuildAddon(UnitTypeId.BARRACKSREACTOR, UnitTypeId.BARRACKS,
                            4),
             ]),
         ]),
         SequentialList([
             Step(None, DistributeWorkers(min_gas=6), skip=finish_rush),
             Step(finish_rush, DistributeWorkers(max_gas=4)),
         ]),
         SequentialList([
             Step(None, SpeedMining(), lambda ai: ai.client.game_step > 5),
             PlanCancelBuilding(),
             LowerDepots(),
             PlanZoneDefense(),
             ManTheBunkers(),
             Repair(),
             ContinueBuilding(),
             PlanZoneGatherTerran(),
             Step(TechReady(UpgradeId.TERRANINFANTRYWEAPONSLEVEL1),
                  PlanZoneAttack(20)),
             PlanFinishEnemy(),
         ])
     ])
Ejemplo n.º 8
0
    def __init__(self):
        """Create plan for build order."""
        self.drones = ZergUnit(UnitTypeId.DRONE, to_count=0)
        self.lings = ZergUnit(UnitTypeId.ZERGLING, to_count=999)
        self.queens = ZergUnit(UnitTypeId.QUEEN, to_count=3)
        self.roaches = ZergUnit(UnitTypeId.ROACH, to_count=100, priority=True)
        self.ravagers = ZergUnit(UnitTypeId.RAVAGER, to_count=0)
        self.defense_spines = DefensiveBuilding(
            unit_type=UnitTypeId.SPINECRAWLER, position_type=DefensePosition.Entrance, to_base_index=1, to_count=3
        )
        self.gas = StepBuildGas(to_count=3)

        unit_building = BuildOrder(
            [
                Step(None, self.drones, skip_until=self.should_build_drones),
                Step(UnitExists(UnitTypeId.SPAWNINGPOOL), self.defense_spines),
                Step(
                    RequiredAll([UnitExists(UnitTypeId.ROACHWARREN), UnitExists(UnitTypeId.ROACH)]),
                    self.ravagers,
                    skip_until=self.should_build_ravagers,
                ),
                Step(UnitExists(UnitTypeId.ROACHWARREN), self.roaches),
                Step(
                    RequiredAll(
                        [
                            UnitExists(UnitTypeId.SPAWNINGPOOL),
                            UnitExists(
                                UnitTypeId.ROACHWARREN,
                                include_pending=True,
                                include_not_ready=True,
                                include_killed=True,
                            ),
                        ]
                    ),
                    self.lings,
                ),
                Step(UnitExists(UnitTypeId.SPAWNINGPOOL), self.queens),
                Step(UnitExists(UnitTypeId.SPAWNINGPOOL), self.lings),
            ]
        )

        buildings: BuildOrder = BuildOrder(
            [
                Step(None, ActBuilding(UnitTypeId.SPAWNINGPOOL, to_count=1)),
                Step(UnitExists(UnitTypeId.SPAWNINGPOOL), ActBuilding(UnitTypeId.ROACHWARREN, to_count=1)),
                Step(None, self.gas, skip_until=self.should_build_gas),
            ]
        )

        super().__init__(buildings, unit_building)
Ejemplo n.º 9
0
    def cannon_expand(self) -> ActBase:
        self.knowledge.print(f"Cannon expand", "Build")
        natural = self.knowledge.expansion_zones[-2]
        pylon_pos: Point2 = natural.behind_mineral_position_center

        return BuildOrder(
            [
                [
                    ActUnitOnce(UnitTypeId.PROBE, UnitTypeId.NEXUS, 14),
                    GridBuilding(UnitTypeId.FORGE, 1),
                    ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 18),
                ],
                [
                    BuildPosition(UnitTypeId.PYLON, pylon_pos, exact=False, only_once=True),
                    Step(
                        None,
                        BuildPosition(
                            UnitTypeId.PHOTONCANNON,
                            pylon_pos.towards(natural.center_location, 4),
                            exact=False,
                            only_once=True,
                        ),
                        skip=RequireCustom(lambda k: k.lost_units_manager.own_lost_type(UnitTypeId.PYLON) > 0),
                    ),
                    Expand(2),
                    GridBuilding(UnitTypeId.GATEWAY, 1),
                    DefensiveCannons(2, 0, 1),
                ],
            ]
        )
Ejemplo n.º 10
0
    async def create_plan(self) -> BuildOrder:
        tactics = SequentialList([
            # TauntEnemy(),
            # worker_scout,
            InjectLarva(),
            PlanHeatOverseer(),
            PlanWorkerOnlyDefense(),
            PlanZoneDefense(),
            PlanZoneGather(),
            PlanZoneAttack(),
            PlanFinishEnemy(),
        ])

        return BuildOrder([[
            ZergUnit(UnitTypeId.DRONE, 14),
            ZergUnit(UnitTypeId.OVERLORD, 2),
            ActBuilding(UnitTypeId.SPAWNINGPOOL),
            ZergUnit(UnitTypeId.DRONE, 20),
            ZergUnit(UnitTypeId.ZERGLING, 20)
        ],
                           [
                               Step(
                                   RequiredUnitReady(UnitTypeId.SPAWNINGPOOL),
                                   DefensiveBuilding(UnitTypeId.SPINECRAWLER,
                                                     DefensePosition.Entrance,
                                                     0)),
                               ZergUnit(UnitTypeId.QUEEN, 2)
                           ],
                           [
                               Step(RequiredUnitReady(UnitTypeId.SPAWNINGPOOL),
                                    AutoOverLord()),
                           ], tactics])
Ejemplo n.º 11
0
    def __init__(self, orders: List[Union[ActBase, List[ActBase]]]):
        """
        Build order package that replaces normal build order for Zerg with one that builds mutalisks to destroy terran
        flying buildings.
        Add any PlanDistributeWorkers acts with orders
        """
        cover_list = SequentialList([
            PlanDistributeWorkers(),
            AutoOverLord(),
            Step(None, ZergUnit(UnitTypeId.DRONE, 20), skip=Supply(198)),
            StepBuildGas(4, None),
            MorphLair(),
            ActBuilding(UnitTypeId.SPIRE, 1),
            Step(
                None,
                DefensiveBuilding(UnitTypeId.SPORECRAWLER,
                                  DefensePosition.BehindMineralLineCenter),
                skip_until=Supply(199),
            ),
            Step(
                None,
                DefensiveBuilding(UnitTypeId.SPINECRAWLER,
                                  DefensePosition.Entrance),
                skip_until=Supply(199),
            ),
            ZergUnit(UnitTypeId.MUTALISK, 10),
        ])

        new_build_order = [
            Step(None, cover_list, skip_until=self.should_build_mutalisks),
            Step(None, BuildOrder(orders), skip=self.should_build_mutalisks),
        ]
        super().__init__(new_build_order)
Ejemplo n.º 12
0
 async def create_plan(self) -> BuildOrder:
     flying_buildings = lambda k: self._bot.enemy_structures.flying.exists and self._bot.supply_used > 30
     in_case_of_air = [
         Step(flying_buildings, StepBuildGas(2)),
         ActUnit(UnitTypeId.DRONE, UnitTypeId.LARVA, 20),
         MorphLair(),
         ActUnit(UnitTypeId.DRONE, UnitTypeId.LARVA, 30),
         StepBuildGas(4),
         ActBuilding(UnitTypeId.SPIRE),
         ZergUnit(UnitTypeId.MUTALISK, 10, priority=True)
     ]
     return BuildOrder([
         SequentialList([
             ActBuilding(UnitTypeId.SPAWNINGPOOL, 1),
             ActUnit(UnitTypeId.DRONE, UnitTypeId.LARVA, 14),
             StepBuildGas(1),
             ActUnit(UnitTypeId.DRONE, UnitTypeId.LARVA, 14),
             ActUnit(UnitTypeId.OVERLORD, UnitTypeId.LARVA, 2),
             ActBuilding(UnitTypeId.ROACHWARREN, 1),
             ActUnit(UnitTypeId.DRONE, UnitTypeId.LARVA, 14),
             ActUnit(UnitTypeId.QUEEN, UnitTypeId.HATCHERY, 1),
             ActUnit(UnitTypeId.ROACH, UnitTypeId.LARVA, 100),
         ]), in_case_of_air,
         SequentialList([
             DistributeWorkers(),
             Step(None, SpeedMining(), lambda ai: ai.client.game_step > 5),
             PlanZoneDefense(),
             AutoOverLord(),
             InjectLarva(),
             PlanZoneGather(),
             Step(UnitExists(UnitTypeId.ROACH, 7), PlanZoneAttackAllIn(1)),
             PlanFinishEnemy(),
         ])
     ])
Ejemplo n.º 13
0
    def aggressive(self) -> BuildOrder:
        worker_scout = Step(None,
                            WorkerScout(),
                            skip_until=RequireCustom(
                                lambda k: len(self.enemy_start_locations) > 1))
        stop_gas = Any(
            [Gas(100),
             TechReady(UpgradeId.ZERGLINGMOVEMENTSPEED, 0.001)])
        end_game = Any([Supply(90), UnitExists(UnitTypeId.LAIR, 1)])

        return BuildOrder([
            LingFloodBuild(),
            SequentialList([
                worker_scout,
                SpreadCreep(),
                InjectLarva(),
                Step(None,
                     PlanDistributeWorkers(3, 3),
                     skip=Any([stop_gas, end_game])),
                Step(None,
                     PlanDistributeWorkers(0, 0),
                     skip_until=stop_gas,
                     skip=end_game),
                Step(None,
                     PlanDistributeWorkers(None, None),
                     skip_until=end_game),
                DummyZergAttack(),
            ]),
        ])
Ejemplo n.º 14
0
    async def create_plan(self) -> BuildOrder:
        stop_gas = Any(
            [Gas(100),
             TechReady(UpgradeId.ZERGLINGMOVEMENTSPEED, 0.001)])
        end_game = Any([Supply(70), UnitExists(UnitTypeId.LAIR, 1)])

        return BuildOrder(
            ActUnitOnce(UnitTypeId.DRONE, UnitTypeId.LARVA, 24),
            LingFloodBuild(),
            SequentialList(
                InjectLarva(),
                Step(None,
                     PlanDistributeWorkers(3, 3),
                     skip=Any([stop_gas, end_game])),
                Step(None,
                     PlanDistributeWorkers(0, 0),
                     skip_until=stop_gas,
                     skip=end_game),
                Step(None,
                     PlanDistributeWorkers(None, None),
                     skip_until=end_game),
                WorkerAttack(),
                DummyZergAttack(),
            ),
        )
Ejemplo n.º 15
0
    async def create_plan(self) -> BuildOrder:
        worker_scout = Step(
            None,
            WorkerScout(),
            skip=RequireCustom(
                lambda k: len(self._bot.enemy_start_locations) == 1),
            skip_until=Supply(20),
        )
        distribute = DistributeWorkers()

        return BuildOrder(
            MutaliskBuild(),
            SequentialList(
                PlanCancelBuilding(),
                PlanZoneGather(),
                PlanZoneDefense(),
                worker_scout,
                SpreadCreep(),
                InjectLarva(),
                distribute,
                Step(None, SpeedMining(), lambda ai: ai.client.game_step > 5),
                PlanZoneAttack(),
                PlanFinishEnemy(),
            ),
        )
Ejemplo n.º 16
0
 async def create_plan(self) -> BuildOrder:
     return BuildOrder(
         Step(
             None,
             ChronoUnitProduction(UnitTypeId.PROBE, UnitTypeId.NEXUS),
             skip=UnitExists(UnitTypeId.PROBE, 40, include_pending=True),
             skip_until=UnitExists(UnitTypeId.ASSIMILATOR, 1),
         ),
         SequentialList(
             ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 14),
             GridBuilding(UnitTypeId.PYLON, 1),
             ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 16),
             StepBuildGas(1),
             GridBuilding(UnitTypeId.GATEWAY, 1),
             ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 20),
             ActExpand(2),
             GridBuilding(UnitTypeId.CYBERNETICSCORE, 1),
             ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 21),
             StepBuildGas(2),
             ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 22),
             GridBuilding(UnitTypeId.PYLON, 1),
             BuildOrder(
                 AutoPylon(),
                 ActTech(UpgradeId.WARPGATERESEARCH),
                 [
                     ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 22),
                     Step(UnitExists(UnitTypeId.NEXUS, 2),
                          ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 44)),
                     StepBuildGas(3, skip=RequiredGas(300)),
                 ],
                 [GateUnit(UnitTypeId.STALKER, 100)],
                 [
                     GridBuilding(UnitTypeId.GATEWAY, 7),
                     StepBuildGas(4, skip=RequiredGas(200))
                 ],
             ),
         ),
         SequentialList(
             PlanZoneDefense(),
             RestorePower(),
             PlanDistributeWorkers(),
             PlanZoneGather(),
             Step(RequiredUnitReady(UnitTypeId.GATEWAY, 4),
                  PlanZoneAttack(4)),
             PlanFinishEnemy(),
         ),
     )
Ejemplo n.º 17
0
    async def create_plan(self) -> BuildOrder:
        attack = PlanZoneAttack(1)
        attack.retreat_multiplier = 0.1
        attack.attack_on_advantage = False

        return BuildOrder(
            [PlanDistributeWorkers(),
             Step(RequiredTime(60), attack)])
Ejemplo n.º 18
0
    async def create_plan(self) -> BuildOrder:
        build_step_buildings = [
            # 12 Pool
            Step(None, ActBuilding(UnitTypeId.SPAWNINGPOOL, 1),
                 UnitExists(UnitTypeId.SPAWNINGPOOL, 1)),
        ]

        finish = [
            Step(
                RequireCustom(lambda k: self._bot.enemy_structures.flying.
                              exists and self._bot.supply_used > 30),
                BuildGas(2)),
            Expand(2),
            UnitExists(UnitTypeId.DRONE, 20),
            MorphLair(),
            UnitExists(UnitTypeId.DRONE, 30),
            BuildGas(4),
            ActBuilding(UnitTypeId.SPIRE),
            ZergUnit(UnitTypeId.MUTALISK, 10, priority=True),
        ]

        build_step_units = [
            # 12 Pool followed by overlord
            Step(
                UnitExists(UnitTypeId.SPAWNINGPOOL, 1),
                ActUnit(UnitTypeId.OVERLORD, UnitTypeId.LARVA, 2),
                UnitExists(UnitTypeId.OVERLORD, 2),
            ),
            # TheMusZero
            Step(
                UnitExists(UnitTypeId.SPAWNINGPOOL, 1),
                ActUnit(UnitTypeId.DRONE, UnitTypeId.LARVA, 14),
                UnitExists(UnitTypeId.DRONE, 14),
            ),
            # Queen for more larvae
            # BuildStep(UnitExists(UnitTypeId.SPAWNINGPOOL, 1), ActUnit(UnitTypeId.QUEEN, UnitTypeId.HATCHERY, 1), UnitExists(UnitTypeId.QUEEN, 1)),
            # Endless zerglings
            Step(UnitExists(UnitTypeId.SPAWNINGPOOL, 1),
                 ActUnit(UnitTypeId.ZERGLING, UnitTypeId.LARVA), None),
        ]

        return BuildOrder(
            build_step_buildings,
            Step(SupplyLeft(0), AutoOverLord()),
            finish,
            build_step_units,
            AutoOverLord(),
            DistributeWorkers(),
            Step(None, SpeedMining(), lambda ai: ai.client.game_step > 5),
            InjectLarva(),
            PlanWorkerOnlyDefense(),
            PlanZoneDefense(),
            PlanZoneGather(),
            PlanZoneAttack2(2),
            PlanFinishEnemy(),
        )
Ejemplo n.º 19
0
    async def create_plan(self) -> BuildOrder:
        return BuildOrder(
            Step(
                None,
                ChronoUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS),
                skip=UnitExists(UnitTypeId.PROBE, 20, include_pending=True),
                skip_until=UnitExists(UnitTypeId.ASSIMILATOR, 1),
            ),
            # ChronoTech(AbilityId.RESEARCH_BLINK, UnitTypeId.TWILIGHTCOUNCIL),
            SequentialList(
                ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 14),
                GridBuilding(UnitTypeId.PYLON, 1),
                ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 16),
                GridBuilding(UnitTypeId.GATEWAY, 1),
                ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 17),
                BuildGas(2),
                ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 19),
                GridBuilding(UnitTypeId.GATEWAY, 2),
                BuildOrder(
                    AutoPylon(),
                    ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 22),

                    SequentialList(
                        Step(
                            None,
                            GridBuilding(UnitTypeId.CYBERNETICSCORE, 1),
                            skip_until=UnitReady(UnitTypeId.GATEWAY, 1),
                        ),
                        Step(
                            UnitReady(UnitTypeId.CYBERNETICSCORE, 1), ProtossUnit(UnitTypeId.ADEPT, 2, only_once=True),
                        ),
                        Tech(UpgradeId.WARPGATERESEARCH),
                        ProtossUnit(UnitTypeId.STALKER, 100),
                    ),
                    Step(UnitExists(UnitTypeId.CYBERNETICSCORE, 1), GridBuilding(UnitTypeId.GATEWAY, 4)),
                ),
            ),
            BuildOrder(
                DistributeWorkers(),
                PlanZoneAttack(),
                PlanFinishEnemy(),
            ),
        )
Ejemplo n.º 20
0
 async def create_plan(self) -> BuildOrder:
     self._bot.building_solver.wall_type = WallType.ProtossMainZerg
     attack = PlanZoneAttack(4)
     return BuildOrder([
         ChronoUnit(UnitTypeId.TEMPEST, UnitTypeId.STARGATE),
         SequentialList(
             ProtossUnit(UnitTypeId.PROBE, 14),
             GridBuilding(UnitTypeId.PYLON, 1),
             ProtossUnit(UnitTypeId.PROBE, 15),
             GridBuilding(UnitTypeId.GATEWAY, 1),
             GridBuilding(UnitTypeId.FORGE, 1),
             BuildGas(2),
             ProtossUnit(UnitTypeId.PROBE, 18),
             GridBuilding(UnitTypeId.PYLON, 2),
             GridBuilding(UnitTypeId.CYBERNETICSCORE, 1),
             ProtossUnit(UnitTypeId.PROBE, 22),
             BuildOrder(
                 AutoPylon(),
                 SequentialList(
                     GridBuilding(UnitTypeId.STARGATE, 1),
                     Step(UnitReady(UnitTypeId.STARGATE, 1),
                          GridBuilding(UnitTypeId.FLEETBEACON, 1)),
                 ),
                 [ProtossUnit(UnitTypeId.TEMPEST, 100, priority=True)],
                 [
                     Step(UnitExists(UnitTypeId.FLEETBEACON, 1),
                          GridBuilding(UnitTypeId.STARGATE, 2))
                 ],
             ),
         ),
         DefensiveCannons(4, 2, 0),
         SequentialList(
             PlanZoneDefense(),
             RestorePower(),
             DistributeWorkers(),
             Step(None, SpeedMining(), lambda ai: ai.client.game_step > 5),
             PlanZoneGather(),
             Step(UnitExists(UnitTypeId.TEMPEST, 1, include_killed=True),
                  attack),
             PlanFinishEnemy(),
         ),
     ])
Ejemplo n.º 21
0
 async def create_plan(self) -> BuildOrder:
     attack = PlanZoneAttack(120)
     attack.retreat_multiplier = 0.3
     tactics = [
         PlanCancelBuilding(),
         InjectLarva(),
         PlanDistributeWorkers(),
         attack,
         PlanFinishEnemy(),
     ]
     return BuildOrder(MacroBuild(), tactics,)
Ejemplo n.º 22
0
    def cannon_contain(self) -> ActBase:
        self.knowledge.print(f"Cannon contain", "Build")
        enemy_main = self.knowledge.expansion_zones[-1]
        natural = self.knowledge.expansion_zones[-2]
        enemy_ramp = self.knowledge.enemy_base_ramp

        return Step(None, BuildOrder(
            [
                [
                    ActUnitOnce(UnitTypeId.PROBE, UnitTypeId.NEXUS, 14),
                    GridBuilding(UnitTypeId.FORGE, 1),
                    ActUnitOnce(UnitTypeId.PROBE, UnitTypeId.NEXUS, 18),
                ],
                [
                    BuildPosition(UnitTypeId.PYLON, natural.center_location),
                    BuildPosition(UnitTypeId.PHOTONCANNON, natural.center_location.towards(enemy_ramp.bottom_center, 5),
                                  exact=False, only_once=True),
                    BuildPosition(UnitTypeId.PYLON, natural.center_location.towards(enemy_ramp.bottom_center, 8),
                                  exact=False, only_once=True),
                    BuildPosition(UnitTypeId.PHOTONCANNON, natural.center_location.towards(enemy_ramp.top_center, 13),
                                  exact=False, only_once=True),
                    BuildPosition(UnitTypeId.PYLON,
                                  natural.center_location.towards(enemy_ramp.bottom_center, 16), exact=False,
                                  only_once=True),
                    BuildPosition(UnitTypeId.PHOTONCANNON,
                                  natural.center_location.towards(enemy_ramp.top_center, 20), exact=False,
                                  only_once=True),
                ],
                [
                    BuildPosition(UnitTypeId.PYLON, natural.behind_mineral_position_center, exact=False,
                                  only_once=True),
                    BuildPosition(UnitTypeId.PHOTONCANNON,
                                  natural.center_location.towards(enemy_main.behind_mineral_position_center, 5),
                                  exact=False, only_once=True),
                    BuildPosition(UnitTypeId.PYLON,
                                  natural.center_location.towards(enemy_main.behind_mineral_position_center, 8),
                                  exact=False, only_once=True),
                    BuildPosition(UnitTypeId.PHOTONCANNON,
                                  natural.center_location.towards(enemy_main.behind_mineral_position_center, 12),
                                  exact=False, only_once=True),

                    BuildPosition(UnitTypeId.PYLON,
                                  natural.center_location.towards(enemy_main.behind_mineral_position_center, 16),
                                  exact=False,
                                  only_once=True),
                    BuildPosition(UnitTypeId.PHOTONCANNON,
                                  natural.center_location.towards(enemy_main.behind_mineral_position_center, 20),
                                  exact=False,
                                  only_once=True),
                ],
                ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 16),
            ]),
        # Skip cannon rushing if we started nexus, or have over 750 minerals, the build is probably stuck
        skip=RequiredAny([RequiredUnitExists(UnitTypeId.NEXUS, 2), RequiredMinerals(750)]))
Ejemplo n.º 23
0
    def macro(self) -> BuildOrder:
        worker_scout = Step(
            None, WorkerScout(), skip_until=RequireCustom(lambda k: len(self.enemy_start_locations) > 1)
        )
        distribute = PlanDistributeWorkers()

        return BuildOrder(
            [
                LingSpeedBuild(),
                SequentialList([worker_scout, SpreadCreep(), InjectLarva(), distribute, DummyZergAttack()]),
            ]
        )
Ejemplo n.º 24
0
    def __init__(self):
        """Set everything up."""
        self.enemy_rushes = {
            EnemyBuild.GeneralRush,
            EnemyBuild.Pool12,
            EnemyBuild.RoachRush,
            EnemyBuild.LingRush,
            EnemyBuild.CannonRush,
            EnemyBuild.EarlyMarines,
        }
        self.distribute = PlanDistributeWorkers()

        # basic build (17, 18, 17)
        base_build = SequentialList([
            Step(None, ZergUnit(UnitTypeId.DRONE, to_count=13)),
            Step(None, ZergUnit(UnitTypeId.OVERLORD, to_count=2)),
            Step(None, ZergUnit(UnitTypeId.DRONE, to_count=17)),
            Step(
                None,
                ActExpand(to_count=2,
                          priority=True,
                          consider_worker_production=False)),
            Step(None, ZergUnit(UnitTypeId.DRONE, to_count=18)),
            Step(RequiredMinerals(120), StepBuildGas(to_count=1)),
            Step(None, ActBuilding(UnitTypeId.SPAWNINGPOOL)),
            Step(None, ZergUnit(UnitTypeId.DRONE, to_count=20)),
            Step(UnitExists(UnitTypeId.SPAWNINGPOOL),
                 ZergUnit(UnitTypeId.ZERGLING, to_count=6)),
            Step(UnitExists(UnitTypeId.SPAWNINGPOOL),
                 ZergUnit(UnitTypeId.QUEEN, to_count=2)),
            Step(
                RequiredAll(
                    [UnitExists(UnitTypeId.SPAWNINGPOOL),
                     RequiredGas(100)]),
                ActTech(UpgradeId.ZERGLINGMOVEMENTSPEED),
            ),
            Step(UnitExists(UnitTypeId.SPAWNINGPOOL),
                 ZergUnit(UnitTypeId.ZERGLING, to_count=100)),
        ])

        build_together = BuildOrder([
            Step(None,
                 base_build,
                 skip=lambda k: k.ai.scout_manager.enemy_build in self.
                 enemy_rushes),
            Step(None,
                 RoachRushResponse(),
                 skip=lambda k: k.ai.scout_manager.enemy_build != EnemyBuild.
                 RoachRush),
        ])

        super().__init__(build_together, self.distribute, AutoOverLord(),
                         InjectLarva(), SpreadCreep())
Ejemplo n.º 25
0
 def __init__(self):
     """Build order steps to be combined."""
     opening = SequentialList([
         Step(None, ZergUnit(UnitTypeId.DRONE, to_count=13,
                             only_once=True)),
         Step(None, ZergUnit(UnitTypeId.OVERLORD,
                             to_count=2,
                             only_once=True)),
         Step(None, ZergUnit(UnitTypeId.DRONE, to_count=17)),
         Step(None, ActExpand(2)),
         Step(None, ZergUnit(UnitTypeId.DRONE, to_count=18,
                             only_once=True)),
         Step(None, StepBuildGas(to_count=1)),
         Step(
             RequiredUnitExists(
                 UnitTypeId.EXTRACTOR,
                 count=1,
                 include_pending=True,
                 include_not_ready=True,
             ),
             ActBuilding(UnitTypeId.SPAWNINGPOOL),
         ),
         Step(
             RequiredUnitExists(
                 UnitTypeId.SPAWNINGPOOL,
                 count=1,
                 include_not_ready=True,
                 include_pending=True,
             ),
             ZergUnit(UnitTypeId.DRONE, to_count=21),
         ),
         Step(
             RequiredUnitExists(UnitTypeId.SPAWNINGPOOL),
             ZergUnit(UnitTypeId.ZERGLING, to_count=6),
         ),
         Step(
             RequiredUnitExists(UnitTypeId.SPAWNINGPOOL),
             ZergUnit(UnitTypeId.QUEEN, to_count=2),
         ),
         Step(None, ActExpand(3)),
     ])
     ling_speed = BuildOrder([
         Step(
             RequiredAll([
                 RequiredUnitExists(UnitTypeId.SPAWNINGPOOL),
                 RequiredGas(100)
             ]),
             ActTech(UpgradeId.ZERGLINGMOVEMENTSPEED,
                     UnitTypeId.SPAWNINGPOOL),
         )
     ])
     super().__init__([opening, ling_speed])
Ejemplo n.º 26
0
 def cannon_rush(self) -> ActBase:
     self.knowledge.print(f"Cannon rush", "Build")
     return BuildOrder(
         [
             [GridBuilding(UnitTypeId.PYLON, 1), GridBuilding(UnitTypeId.FORGE, 1, priority=True)],
             ProxyCannoneer(),
             ProtossUnit(UnitTypeId.PROBE, 18),
             ChronoUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS),
             [
                 Step(Minerals(400), GridBuilding(UnitTypeId.GATEWAY, 1)),
                 Step(Minerals(700), Expand(2), skip=UnitExists(UnitTypeId.NEXUS, 2)),
                 GridBuilding(UnitTypeId.CYBERNETICSCORE, 1),
             ],
         ]
     )
Ejemplo n.º 27
0
    async def create_plan(self) -> BuildOrder:
        """Turn plan into BuildOrder."""
        attack_tactics = [
            PlanZoneGather(),
            PlanZoneDefense(),
            self.attack,
            PlanFinishEnemy(),
            PlanWorkerOnlyDefense(),
        ]

        return BuildOrder([
            CounterTerranTie([PaulBuild()]),
            attack_tactics,
            InjectLarva(),
            SpreadCreep(),
            PlanCancelBuilding(),
            MassExpand(),
            PlanHeatOverseer(),
        ])
Ejemplo n.º 28
0
    async def create_plan(self) -> BuildOrder:
        worker_scout = Step(
            None,
            WorkerScout(),
            skip=RequireCustom(lambda k: len(self.enemy_start_locations) == 1),
            skip_until=RequiredSupply(20))
        distribute = PlanDistributeWorkers()

        return BuildOrder([
            MutaliskBuild(),
            SequentialList([
                PlanCancelBuilding(),
                PlanZoneGather(),
                PlanZoneDefense(), worker_scout,
                SpreadCreep(),
                InjectLarva(), distribute,
                PlanZoneAttack(),
                PlanFinishEnemy()
            ]),
        ])
Ejemplo n.º 29
0
 async def create_plan(self) -> BuildOrder:
     perform_cleanup = RequireCustom(
         lambda k: self._bot.zone_manager.enemy_main_zone.
         is_scouted_at_least_once and not self._bot.zone_manager.
         enemy_main_zone.is_enemys)
     return BuildOrder([
         Step(
             None,
             SequentialList(
                 SetGameStepSize(1),  # improve our worker micro
                 WorkerAttack()),
             skip=perform_cleanup),
         Step(
             None,
             SequentialList(
                 SetGameStepSize(self._bot.client.game_step
                                 ),  # back to the original step size
                 await self.cleanup.create_plan()),
             skip_until=perform_cleanup),
     ])
Ejemplo n.º 30
0
 def __init__(self):
     """Create the build order."""
     opener = SequentialList(
         Step(
             RequiredUnitReady(UnitTypeId.SPAWNINGPOOL),
             NatSpines(4),
             skip=RequiredUnitReady(UnitTypeId.SPINECRAWLER, count=4),
             skip_until=lambda k: k.build_detector.rush_detected,
         ), Step(None, ZergUnit(UnitTypeId.DRONE, to_count=13)),
         Step(None, ZergUnit(UnitTypeId.OVERLORD, to_count=2)),
         Step(None, ZergUnit(UnitTypeId.DRONE, to_count=17)),
         Step(None,
              ActExpand(2, priority=True,
                        consider_worker_production=False)),
         Step(
             UnitExists(UnitTypeId.HATCHERY,
                        count=2,
                        include_pending=True,
                        include_not_ready=True),
             ZergUnit(UnitTypeId.DRONE, to_count=18),
         ), Step(None, ActBuilding(UnitTypeId.SPAWNINGPOOL)),
         Step(None, ZergUnit(UnitTypeId.DRONE, to_count=20)),
         StepBuildGas(1),
         Step(RequiredUnitReady(UnitTypeId.SPAWNINGPOOL),
              ZergUnit(UnitTypeId.QUEEN, 2)),
         Step(RequiredUnitReady(UnitTypeId.SPAWNINGPOOL),
              ZergUnit(UnitTypeId.ZERGLING, 6)),
         Step(None, ZergUnit(UnitTypeId.OVERLORD, to_count=3)),
         BuildOrder([
             Step(RequiredGas(100), MorphLair()),
             Step(
                 None,
                 ZergUnit(UnitTypeId.DRONE),
                 skip=UnitExists(UnitTypeId.LAIR,
                                 include_pending=True,
                                 include_not_ready=True),
             ),
         ])
         # end of build hard order, switch to reactive play
     )
     super().__init__([opener, AutoOverLord()])