コード例 #1
0
    async def create_plan(self) -> BuildOrder:
        rnd = random.randint(0, 2)
        if rnd == 2:
            cannon_rush = self.cannon_expand()
        elif rnd == 1:
            cannon_rush = self.cannon_rush()
        else:
            cannon_rush = self.cannon_contain()

        return BuildOrder([
            Step(None,
                 ChronoUnitProduction(UnitTypeId.PROBE, UnitTypeId.NEXUS),
                 skip=RequiredUnitExists(UnitTypeId.PROBE, 16),
                 skip_until=RequiredUnitReady(UnitTypeId.PYLON, 1)),
            ChronoAnyTech(0),
            SequentialList([
                ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 13),
                GridBuilding(UnitTypeId.PYLON, 1), cannon_rush,
                BuildOrder(
                    [[
                        ActExpand(2),
                        ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 30),
                        Step(RequiredUnitExists(UnitTypeId.NEXUS, 2),
                             ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 44)),
                    ],
                     GridBuilding(UnitTypeId.GATEWAY, 2),
                     GridBuilding(UnitTypeId.CYBERNETICSCORE, 1),
                     StepBuildGas(2),
                     AutoPylon(),
                     StepBuildGas(3, skip=RequiredGas(300)),
                     ActTech(UpgradeId.WARPGATERESEARCH,
                             UnitTypeId.CYBERNETICSCORE),
                     BuildOrder([]).forge_upgrades_all,
                     Step(
                         RequiredUnitReady(UnitTypeId.TWILIGHTCOUNCIL, 1),
                         ActTech(UpgradeId.BLINKTECH,
                                 UnitTypeId.TWILIGHTCOUNCIL)),
                     [
                         ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 22),
                         Step(RequiredUnitExists(UnitTypeId.NEXUS, 2),
                              ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 44)),
                         StepBuildGas(3, skip=RequiredGas(300))
                     ], [GateUnit(UnitTypeId.STALKER, 100)],
                     [
                         Step(RequiredUnitReady(UnitTypeId.CYBERNETICSCORE, 1),
                              GridBuilding(UnitTypeId.TWILIGHTCOUNCIL, 1)),
                         Step(RequiredUnitReady(UnitTypeId.CYBERNETICSCORE, 1),
                              GridBuilding(UnitTypeId.GATEWAY, 7)),
                         StepBuildGas(4, skip=RequiredGas(200)),
                     ]])
            ]),
            SequentialList([
                PlanCancelBuilding(),
                PlanZoneDefense(),
                PlanDistributeWorkers(),
                PlanZoneGather(),
                PlanZoneAttack(6),
                PlanFinishEnemy(),
            ])
        ])
コード例 #2
0
ファイル: gate4.py プロジェクト: danielvschoor/sharpy-sc2
 async def create_plan(self) -> BuildOrder:
     attack = PlanZoneAttack(6)
     return BuildOrder([
         Step(None,
              ChronoUnitProduction(UnitTypeId.PROBE, UnitTypeId.NEXUS),
              skip=RequiredUnitExists(UnitTypeId.PROBE,
                                      20,
                                      include_pending=True),
              skip_until=RequiredUnitExists(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,
                                 UnitTypeId.TWILIGHTCOUNCIL)),
                 ]),
                 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,
                             UnitTypeId.CYBERNETICSCORE),
                     GateUnit(UnitTypeId.STALKER, 100)
                 ]),
                 Step(RequiredUnitExists(UnitTypeId.CYBERNETICSCORE, 1),
                      GridBuilding(UnitTypeId.GATEWAY, 4))
             ]),
         ]),
         SequentialList([
             PlanZoneDefense(),
             RestorePower(),
             PlanDistributeWorkers(),
             PlanZoneGather(),
             Step(RequiredTechReady(UpgradeId.BLINKTECH, 0.9), attack),
             PlanFinishEnemy(),
         ])
     ])
コード例 #3
0
ファイル: lings.py プロジェクト: danielvschoor/sharpy-sc2
    def aggressive(self) -> BuildOrder:
        worker_scout = Step(None,
                            WorkerScout(),
                            skip_until=RequireCustom(
                                lambda k: len(self.enemy_start_locations) > 1))
        stop_gas = RequiredAny([
            RequiredGas(100),
            RequiredTechReady(UpgradeId.ZERGLINGMOVEMENTSPEED, 0.001)
        ])
        end_game = RequiredAny(
            [RequiredSupply(90),
             RequiredUnitExists(UnitTypeId.LAIR, 1)])

        return BuildOrder([
            LingFloodBuild(),
            SequentialList([
                worker_scout,
                SpreadCreep(),
                InjectLarva(),
                Step(None,
                     PlanDistributeWorkers(3, 3),
                     skip=RequiredAny([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()
            ]),
        ])
コード例 #4
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])
コード例 #5
0
    async def create_plan(self) -> BuildOrder:
        stop_gas = RequiredAny([
            RequiredGas(100),
            RequiredTechReady(UpgradeId.ZERGLINGMOVEMENTSPEED, 0.001)
        ])
        end_game = RequiredAny(
            [RequiredSupply(70),
             RequiredUnitExists(UnitTypeId.LAIR, 1)])

        return BuildOrder([
            ActUnitOnce(UnitTypeId.DRONE, UnitTypeId.LARVA, 24),
            LingFloodBuild(),
            SequentialList([
                InjectLarva(),
                Step(None,
                     PlanDistributeWorkers(3, 3),
                     skip=RequiredAny([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()
            ]),
        ])
コード例 #6
0
 async def create_plan(self) -> BuildOrder:
     attack = TheAttack(4)
     return BuildOrder([
         Step(None, ChronoUnitProduction(UnitTypeId.PROBE, UnitTypeId.NEXUS),
              skip=RequiredUnitExists(UnitTypeId.PROBE, 40, include_pending=True), skip_until=RequiredUnitExists(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, UnitTypeId.CYBERNETICSCORE),
                     [
                         ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 22),
                         Step(RequiredUnitExists(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), attack),
                 PlanFinishEnemy(),
             ])
     ])
コード例 #7
0
ファイル: lings.py プロジェクト: danielvschoor/sharpy-sc2
    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()
            ]),
        ])
コード例 #8
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))
        self.distribute = PlanDistributeWorkers()

        return BuildOrder([
            RoachHydraBuild(),
            SequentialList([
                PlanCancelBuilding(),
                PlanZoneGather(),
                PlanZoneDefense(),
                worker_scout,
                SpreadCreep(),
                InjectLarva(),
                self.distribute,
                PlanZoneAttack(),
                PlanFinishEnemy()
            ]),
        ])
コード例 #9
0
ファイル: rusty.py プロジェクト: danielvschoor/sharpy-sc2
    async def create_plan(self) -> BuildOrder:
        self.attack = Step(None, PlanZoneAttack(random.randint(50, 80)))
        worker_scout = Step(None,
                            WorkerScout(),
                            skip_until=RequiredUnitExists(
                                UnitTypeId.SUPPLYDEPOT, 1))

        tactics = [
            PlanCancelBuilding(),
            LowerDepots(),
            PlanZoneDefense(),
            worker_scout,
            CallMule(100),
            ScanEnemy(),
            PlanDistributeWorkers(),
            ManTheBunkers(),
            Repair(),
            ContinueBuilding(),
            PlanZoneGatherTerran(),
            self.attack,
            PlanFinishEnemy(),
        ]

        return BuildOrder([BuildTanks(), SequentialList(tactics)])
コード例 #10
0
 async def create_plan(self) -> BuildOrder:
     attack = TheAttack(4)
     return BuildOrder([
         Step(None,
              ChronoUnitProduction(UnitTypeId.PROBE, UnitTypeId.NEXUS),
              skip=RequiredUnitExists(UnitTypeId.PROBE,
                                      30,
                                      include_pending=True),
              skip_until=RequiredUnitExists(UnitTypeId.ASSIMILATOR, 1)),
         ChronoUnitProduction(UnitTypeId.IMMORTAL,
                              UnitTypeId.ROBOTICSFACILITY),
         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(),
                 GateUnit(UnitTypeId.STALKER, 2, priority=True),
                 ActTech(UpgradeId.WARPGATERESEARCH,
                         UnitTypeId.CYBERNETICSCORE),
                 [
                     ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 22),
                     Step(RequiredUnitExists(UnitTypeId.NEXUS, 2),
                          ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 44)),
                     StepBuildGas(3, skip=RequiredGas(300)),
                     Step(RequiredUnitExists(UnitTypeId.NEXUS, 3),
                          ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 56)),
                     StepBuildGas(5, skip=RequiredGas(200)),
                 ],
                 SequentialList([
                     Step(RequiredUnitReady(UnitTypeId.CYBERNETICSCORE, 1),
                          GridBuilding(UnitTypeId.TWILIGHTCOUNCIL, 1)),
                     GridBuilding(UnitTypeId.ROBOTICSFACILITY, 1),
                     Step(
                         RequiredUnitReady(UnitTypeId.TWILIGHTCOUNCIL, 1),
                         ActTech(UpgradeId.CHARGE,
                                 UnitTypeId.TWILIGHTCOUNCIL)),
                 ]),
                 [
                     ActUnit(UnitTypeId.IMMORTAL,
                             UnitTypeId.ROBOTICSFACILITY,
                             1,
                             priority=True),
                     ActUnit(UnitTypeId.OBSERVER,
                             UnitTypeId.ROBOTICSFACILITY,
                             1,
                             priority=True),
                     ActUnit(UnitTypeId.IMMORTAL,
                             UnitTypeId.ROBOTICSFACILITY,
                             20,
                             priority=True)
                 ],
                 Step(RequiredTime(60 * 5), ActExpand(3)),
                 [GateUnit(UnitTypeId.ZEALOT, 100)],
                 [
                     GridBuilding(UnitTypeId.GATEWAY, 4),
                     StepBuildGas(4, skip=RequiredGas(200)),
                     GridBuilding(UnitTypeId.ROBOTICSFACILITY, 2),
                 ]
             ])
         ]),
         SequentialList([
             PlanCancelBuilding(),
             PlanHeatObserver(),
             PlanZoneDefense(),
             RestorePower(),
             PlanDistributeWorkers(),
             PlanZoneGather(),
             Step(RequiredUnitReady(UnitTypeId.IMMORTAL, 3), attack),
             PlanFinishEnemy(),
         ])
     ])
コード例 #11
0
    async def create_plan(self) -> BuildOrder:
        attack_value = random.randint(50, 80)
        self.attack = Step(None, PlanZoneAttack(attack_value))
        empty = BuildOrder([])
        self.jump = random.randint(0,2)

        if self.jump == 0:
            self.knowledge.print(f"Att at {attack_value}", "Build")
        else:
            self.knowledge.print(f"Jump, att at {attack_value }", "Build")
        worker_scout = Step(None, WorkerScout(), skip_until=RequiredUnitExists(UnitTypeId.SUPPLYDEPOT, 1))
        self.distribute_workers = PlanDistributeWorkers(4)
        tactics = [
            PlanCancelBuilding(),
            LowerDepots(),
            PlanZoneDefense(),
            worker_scout,
            Step(None, CallMule(50), skip=RequiredTime(5* 60)),
            Step(None, CallMule(100), skip_until=RequiredTime(5 * 60)),
            Step(None, ScanEnemy(), skip_until=RequiredTime(5 * 60)),

            self.distribute_workers,
            ManTheBunkers(),
            Repair(),
            ContinueBuilding(),
            PlanZoneGatherTerran(),
            Step(None, JumpIn(), RequireCustom(lambda k: self.jump == 0)),
            self.attack,
            PlanFinishEnemy(),
        ]

        return BuildOrder([
            empty.depots,
            Step(None, MorphOrbitals(), skip_until=RequiredUnitReady(UnitTypeId.BARRACKS, 1)),
            [
                Step(None, ActUnit(UnitTypeId.SCV, UnitTypeId.COMMANDCENTER, 34 + 12))
            ],
            [
                Step(RequiredSupply(13), GridBuilding(UnitTypeId.SUPPLYDEPOT, 1)),

                Step(RequiredUnitReady(UnitTypeId.SUPPLYDEPOT, 0.95), GridBuilding(UnitTypeId.BARRACKS, 1)),
                StepBuildGas(1),
                ActExpand(2),
                Step(RequiredSupply(20), GridBuilding(UnitTypeId.SUPPLYDEPOT, 2)),
                StepBuildGas(2),
                Step(None, GridBuilding(UnitTypeId.FACTORY, 1),
                     skip_until=RequiredUnitReady(UnitTypeId.BARRACKS, 1)),
                Step(RequiredUnitReady(UnitTypeId.FACTORY, 1), GridBuilding(UnitTypeId.STARPORT, 1)),
                DefensiveBuilding(UnitTypeId.BUNKER, DefensePosition.Entrance, 1),
                Step(None, GridBuilding(UnitTypeId.BARRACKS, 2)),
                StepBuildGas(3),

                Step(None, ActBuildAddon(UnitTypeId.FACTORYTECHLAB, UnitTypeId.FACTORY, 1)),
                Step(RequiredUnitReady(UnitTypeId.STARPORT, 1), GridBuilding(UnitTypeId.FUSIONCORE, 1)),
                Step(None, ActBuildAddon(UnitTypeId.STARPORTTECHLAB, UnitTypeId.STARPORT, 1)),
                StepBuildGas(4, None, RequiredUnitExists(UnitTypeId.BATTLECRUISER,1,include_killed=True, include_pending=True)),
                Step(RequiredUnitExists(UnitTypeId.BATTLECRUISER,1,include_killed=True), GridBuilding(UnitTypeId.BARRACKS, 3)),
                Step(None, ActBuildAddon(UnitTypeId.BARRACKSTECHLAB, UnitTypeId.BARRACKS, 1)),
                Step(None, ActBuildAddon(UnitTypeId.BARRACKSREACTOR, UnitTypeId.BARRACKS, 1)),

                Step(None, GridBuilding(UnitTypeId.STARPORT, 2)),

                Step(RequiredUnitReady(UnitTypeId.STARPORT, 2), ActBuildAddon(UnitTypeId.STARPORTTECHLAB, UnitTypeId.STARPORT, 2)),
                Step(None, ActTech(UpgradeId.SHIELDWALL, UnitTypeId.BARRACKSTECHLAB)),

                Step(RequiredMinerals(600), GridBuilding(UnitTypeId.BARRACKS, 5)),
                ActExpand(3),
            ],
            [
                Step(RequiredAny([RequiredEnemyBuildingExists(UnitTypeId.DARKSHRINE),
                                  RequiredEnemyUnitExistsAfter(UnitTypeId.DARKTEMPLAR),
                                  RequiredEnemyUnitExistsAfter(UnitTypeId.BANSHEE)]), None),
                Step(RequiredUnitReady(UnitTypeId.STARPORT, 1), ActUnit(UnitTypeId.RAVEN, UnitTypeId.STARPORT, 2, priority=True)),
            ],
            Step(None, SequentialList([
                ActUnit(UnitTypeId.BATTLECRUISER, UnitTypeId.STARPORT, 20, priority=True)
            ]), skip_until=RequiredUnitReady(UnitTypeId.FUSIONCORE, 1)),
            ActUnit(UnitTypeId.SIEGETANK, UnitTypeId.FACTORY, 10),
            ActUnit(UnitTypeId.MARINE, UnitTypeId.BARRACKS, 50),
            SequentialList(tactics)
        ])
コード例 #12
0
    async def create_plan(self) -> BuildOrder:
        self.tactic_index = random.randint(0, 2)

        if self.tactic_index == 0:
            self.knowledge.print("Proxy 2 rax bunker rush", "Build")
            self.attack = DodgeRampAttack(3)
            zone = self.knowledge.expansion_zones[-random.randint(3, 5)]
            natural = self.knowledge.expansion_zones[-2]
            chunk = [
                Step(RequiredSupply(12), GridBuilding(UnitTypeId.SUPPLYDEPOT,
                                                      1)),
                BuildPosition(UnitTypeId.BARRACKS,
                              zone.center_location,
                              exact=False,
                              only_once=True),
                BuildPosition(UnitTypeId.BARRACKS,
                              zone.center_location.towards(
                                  self.knowledge.enemy_base_ramp.bottom_center,
                                  5),
                              exact=False,
                              only_once=True),
                BuildPosition(UnitTypeId.BARRACKS,
                              zone.center_location.towards(
                                  self.game_info.map_center, 5),
                              exact=False,
                              only_once=True),
                Step(None, GridBuilding(UnitTypeId.SUPPLYDEPOT, 2)),
                Step(
                    RequiredUnitReady(UnitTypeId.MARINE, 1),
                    BuildPosition(UnitTypeId.BUNKER,
                                  natural.center_location.towards(
                                      self.game_info.map_center, 6),
                                  exact=False,
                                  only_once=True)),
                Step(RequiredMinerals(225),
                     GridBuilding(UnitTypeId.BARRACKS, 6)),
            ]
        elif self.tactic_index == 1:
            self.knowledge.print("20 marine all in", "Build")
            self.attack = DodgeRampAttack(20)
            chunk = [
                Step(RequiredSupply(14), GridBuilding(UnitTypeId.SUPPLYDEPOT,
                                                      1)),
                Step(RequiredUnitReady(UnitTypeId.SUPPLYDEPOT, 1),
                     GridBuilding(UnitTypeId.BARRACKS, 1)),
                Step(None, GridBuilding(UnitTypeId.SUPPLYDEPOT, 2)),
                GridBuilding(UnitTypeId.BARRACKS, 6),
            ]
        else:
            self.knowledge.print("10 marine proxy rax", "Build")
            self.attack = DodgeRampAttack(10)
            zone = self.knowledge.expansion_zones[-random.randint(3, 5)]
            chunk = [
                Step(RequiredSupply(14), GridBuilding(UnitTypeId.SUPPLYDEPOT,
                                                      1)),
                Step(RequiredUnitReady(UnitTypeId.SUPPLYDEPOT, 1),
                     GridBuilding(UnitTypeId.BARRACKS, 1)),
                Step(None, GridBuilding(UnitTypeId.SUPPLYDEPOT, 2)),
                BuildPosition(UnitTypeId.BARRACKS,
                              zone.center_location,
                              exact=False,
                              only_once=True),
                BuildPosition(UnitTypeId.BARRACKS,
                              zone.center_location.towards(
                                  self.knowledge.enemy_base_ramp.bottom_center,
                                  5),
                              exact=False,
                              only_once=True),
                Step(RequiredMinerals(225),
                     GridBuilding(UnitTypeId.BARRACKS, 6)),
            ]

        empty = BuildOrder([])

        worker_scout = Step(None,
                            WorkerScout(),
                            skip_until=RequiredUnitExists(
                                UnitTypeId.SUPPLYDEPOT, 1))
        self.distribute_workers = PlanDistributeWorkers()

        tactics = [
            PlanCancelBuilding(),
            LowerDepots(),
            PlanZoneDefense(),
            worker_scout,
            Step(None, CallMule(50), skip=RequiredTime(5 * 60)),
            Step(None, CallMule(100), skip_until=RequiredTime(5 * 60)),
            Step(None, ScanEnemy(), skip_until=RequiredTime(5 * 60)),
            self.distribute_workers,
            ManTheBunkers(),
            Repair(),
            ContinueBuilding(),
            PlanZoneGatherTerran(),
            Step(None, self.attack),
            PlanFinishEnemy(),
        ]

        return BuildOrder([
            empty.depots,
            Step(None,
                 MorphOrbitals(),
                 skip_until=RequiredUnitReady(UnitTypeId.BARRACKS, 1)),
            [
                Step(None, ActUnit(UnitTypeId.SCV, UnitTypeId.COMMANDCENTER,
                                   20))
            ], chunk,
            ActUnit(UnitTypeId.MARINE, UnitTypeId.BARRACKS, 200),
            SequentialList(tactics)
        ])
コード例 #13
0
ファイル: cyclones.py プロジェクト: danielvschoor/sharpy-sc2
    async def create_plan(self) -> BuildOrder:
        buildings = [
            Step(RequiredSupply(13), GridBuilding(UnitTypeId.SUPPLYDEPOT, 1)),
            Step(RequiredSupply(16), ActExpand(2)),
            Step(RequiredSupply(18), GridBuilding(UnitTypeId.BARRACKS, 1)),
            StepBuildGas(1),
            Step(RequiredSupply(20), GridBuilding(UnitTypeId.SUPPLYDEPOT, 2)),
            Step(None,
                 StepBuildGas(2),
                 skip_until=RequiredUnitExists(UnitTypeId.MARINE, 2)),
            Step(None,
                 GridBuilding(UnitTypeId.FACTORY, 1),
                 skip_until=RequiredUnitReady(UnitTypeId.BARRACKS, 1)),
            GridBuilding(UnitTypeId.FACTORY, 1),
            ActBuildAddon(UnitTypeId.FACTORYTECHLAB, UnitTypeId.FACTORY, 1),
            StepBuildGas(4),
            Step(None, ActExpand(3)),
            GridBuilding(UnitTypeId.FACTORY, 2),
            ActBuildAddon(UnitTypeId.FACTORYTECHLAB, UnitTypeId.FACTORY, 2),
            Step(None,
                 ActTech(UpgradeId.CYCLONELOCKONDAMAGEUPGRADE,
                         UnitTypeId.FACTORYTECHLAB),
                 skip_until=RequiredUnitReady(UnitTypeId.FACTORYTECHLAB, 1)),
            StepBuildGas(5),
            Step(None,
                 ActTech(UpgradeId.HIGHCAPACITYBARRELS,
                         UnitTypeId.FACTORYTECHLAB),
                 skip_until=RequiredUnitReady(UnitTypeId.FACTORYTECHLAB, 2)),
            StepBuildGas(6, None, RequiredGas(100)),
            Step(RequiredMinerals(400), GridBuilding(UnitTypeId.FACTORY, 4)),
            Step(
                None,
                ActBuildAddon(UnitTypeId.FACTORYREACTOR, UnitTypeId.FACTORY,
                              1)),
            ActBuildAddon(UnitTypeId.FACTORYTECHLAB, UnitTypeId.FACTORY, 3),
            Step(RequiredMinerals(400), ActExpand(4)),
            GridBuilding(UnitTypeId.ENGINEERINGBAY, 1),
            StepBuildGas(8),
            GridBuilding(UnitTypeId.FACTORY, 6),
            Step(RequiredMinerals(400), GridBuilding(UnitTypeId.FACTORY, 8)),
            ActBuildAddon(UnitTypeId.FACTORYTECHLAB, UnitTypeId.FACTORY, 7),
            Step(RequiredSupply(120), GridBuilding(UnitTypeId.ARMORY, 2)),
        ]

        upgrades = [
            Step(
                RequiredUnitReady(UnitTypeId.ARMORY, 1),
                ActTech(UpgradeId.TERRANVEHICLEWEAPONSLEVEL1,
                        UnitTypeId.ARMORY)),
            ActTech(UpgradeId.TERRANVEHICLEANDSHIPARMORSLEVEL1,
                    UnitTypeId.ARMORY),
            ActTech(UpgradeId.TERRANVEHICLEWEAPONSLEVEL2, UnitTypeId.ARMORY),
            ActTech(UpgradeId.TERRANVEHICLEANDSHIPARMORSLEVEL2,
                    UnitTypeId.ARMORY),
            ActTech(UpgradeId.TERRANVEHICLEWEAPONSLEVEL3, UnitTypeId.ARMORY),
            ActTech(UpgradeId.TERRANVEHICLEANDSHIPARMORSLEVEL3,
                    UnitTypeId.ARMORY),
        ]

        self.attack = PlanZoneAttack(40)

        worker_scout = Step(None,
                            WorkerScout(),
                            skip_until=RequiredUnitExists(
                                UnitTypeId.SUPPLYDEPOT, 1))
        self.distribute_workers = PlanDistributeWorkers()

        tactics = [
            PlanCancelBuilding(),
            LowerDepots(),
            PlanZoneDefense(),
            worker_scout,
            Step(None, CallMule(50), skip=RequiredTime(5 * 60)),
            Step(None, CallMule(100), skip_until=RequiredTime(5 * 60)),
            Step(None, ScanEnemy(), skip_until=RequiredTime(5 * 60)),
            self.distribute_workers,
            ManTheBunkers(),
            Repair(),
            ContinueBuilding(),
            PlanZoneGatherTerran(),
            Step(RequiredTechReady(UpgradeId.CYCLONELOCKONDAMAGEUPGRADE, 0.95),
                 self.attack),
            PlanFinishEnemy(),
        ]

        return BuildOrder([
            Step(RequiredUnitExists(UnitTypeId.BARRACKS, 1),
                 SequentialList(self.depots)),
            [
                Step(RequiredUnitExists(UnitTypeId.COMMANDCENTER, 2),
                     MorphOrbitals(3),
                     skip_until=RequiredUnitReady(UnitTypeId.BARRACKS, 1)),
                Step(None,
                     MorphPlanetary(2),
                     skip_until=RequiredUnitReady(UnitTypeId.ENGINEERINGBAY,
                                                  1)),
            ],
            [
                Step(None, ActUnit(UnitTypeId.SCV, UnitTypeId.COMMANDCENTER,
                                   40)),
                Step(RequiredUnitExists(UnitTypeId.COMMANDCENTER, 3),
                     ActUnit(UnitTypeId.SCV, UnitTypeId.COMMANDCENTER, 70))
            ], upgrades,
            ActUnit(UnitTypeId.MARINE, UnitTypeId.BARRACKS, 4),
            [
                ActUnit(UnitTypeId.CYCLONE, UnitTypeId.FACTORY, 4),
                ActUnitOnce(UnitTypeId.HELLION, UnitTypeId.FACTORY, 1),
                ActUnit(UnitTypeId.CYCLONE, UnitTypeId.FACTORY, 4),
                ActUnit(UnitTypeId.CYCLONE,
                        UnitTypeId.FACTORY,
                        120,
                        priority=True),
            ],
            Step(
                RequiredUnitReady(UnitTypeId.FACTORYREACTOR, 1),
                ActUnit(UnitTypeId.HELLION, UnitTypeId.FACTORY, 60),
                skip_until=RequiredMinerals(300),
            ), buildings,
            SequentialList(tactics)
        ])
コード例 #14
0
    async def create_plan(self) -> BuildOrder:
        self.knowledge.building_solver.wall_type = WallType.ProtossMainProtoss
        attack = PlanZoneAttack(7)
        attack.retreat_multiplier = 0.3
        # attack.attack_started = True
        backup = BuildOrder([
            Step(None,
                 ChronoUnitProduction(UnitTypeId.PROBE, UnitTypeId.NEXUS),
                 skip=RequiredUnitExists(UnitTypeId.PROBE,
                                         30,
                                         include_pending=True),
                 skip_until=RequiredUnitExists(UnitTypeId.ASSIMILATOR, 1)),
            ChronoUnitProduction(UnitTypeId.VOIDRAY, UnitTypeId.STARGATE),
            ActDefensiveCannons(0, 1),
            SequentialList([
                ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 14),
                GridBuilding(UnitTypeId.PYLON, 1),
                StepBuildGas(1),
                GridBuilding(UnitTypeId.GATEWAY, 1),
                ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 20),
                GridBuilding(UnitTypeId.CYBERNETICSCORE, 1),
                ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 21),
                ActExpand(2),
                ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 22),
                StepBuildGas(2),
                GridBuilding(UnitTypeId.PYLON, 1),
                BuildOrder([
                    AutoPylon(),
                    GateUnit(UnitTypeId.STALKER, 2, priority=True),
                    ActTech(UpgradeId.WARPGATERESEARCH,
                            UnitTypeId.CYBERNETICSCORE),
                    [
                        ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 22),
                        Step(RequiredUnitExists(UnitTypeId.NEXUS, 2),
                             ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 44)),
                        StepBuildGas(3, skip=RequiredGas(300)),
                        Step(RequiredUnitExists(UnitTypeId.NEXUS, 3),
                             ActUnit(UnitTypeId.PROBE, UnitTypeId.NEXUS, 56)),
                        StepBuildGas(5, skip=RequiredGas(200)),
                    ],
                    SequentialList([
                        Step(RequiredUnitReady(UnitTypeId.CYBERNETICSCORE, 1),
                             GridBuilding(UnitTypeId.TWILIGHTCOUNCIL, 1)),
                        GridBuilding(UnitTypeId.STARGATE, 1),
                        Step(
                            RequiredUnitReady(UnitTypeId.TWILIGHTCOUNCIL, 1),
                            ActTech(UpgradeId.CHARGE,
                                    UnitTypeId.TWILIGHTCOUNCIL)),
                        Step(
                            RequiredUnitReady(UnitTypeId.TWILIGHTCOUNCIL, 1),
                            ActTech(UpgradeId.ADEPTPIERCINGATTACK,
                                    UnitTypeId.TWILIGHTCOUNCIL)),
                    ]),
                    [
                        ActUnit(UnitTypeId.VOIDRAY,
                                UnitTypeId.STARGATE,
                                20,
                                priority=True)
                    ],
                    Step(RequiredTime(60 * 5), ActExpand(3)),
                    [GateUnit(UnitTypeId.STALKER, 30)],
                    [
                        GridBuilding(UnitTypeId.GATEWAY, 4),
                        StepBuildGas(4, skip=RequiredGas(200)),
                        GridBuilding(UnitTypeId.STARGATE, 2),
                    ]
                ])
            ]),
        ])
        proxy_zealots = ProxyZealots()

        return BuildOrder([
            SequentialList([
                Step(None,
                     proxy_zealots,
                     skip=RequireCustom(
                         lambda k: self.knowledge.lost_units_manager.
                         own_lost_type(UnitTypeId.GATEWAY))), backup
            ]),
            [
                PlanDistributeWorkers(),
                PlanZoneDefense(),
                PlanZoneGather(),
                attack,
                PlanFinishEnemy(),
            ],
            ChronoUnitProduction(UnitTypeId.ZEALOT, UnitTypeId.GATEWAY)
        ])