Esempio n. 1
0
 async def harass_command(self, dt: Unit, prism: Unit):
     self.knowledge.roles.set_task(UnitTask.Reserved, dt)
     if self.is_revealed_by_enemy(dt):
         if dt.distance_to(
                 prism) <= 5 and prism.shield_health_percentage >= 0.4:
             self.do(dt.smart(prism))
             return True
         else:
             self.do(dt.move(prism))
             return True
     else:
         await self.attack_priority_targets(dt, prism)
     return True
Esempio n. 2
0
    async def attack_command(self, unit: Unit, prism: Unit):
        self.knowledge.roles.set_task(UnitTask.Reserved, unit)
        if self.is_revealed_by_enemy(unit):
            if unit.distance_to(
                    prism) <= 8 and prism.shield_health_percentage >= 0.4:
                self.do(unit.smart(prism))
                return True

            else:
                base = self.knowledge.own_main_zone.center_location
                self.do(unit.move(base))
                return True

        else:
            await self.attack_priority_targets(unit, prism)
        return True
 async def on_building_construction_complete(self, unit: Unit):
     """ Set rally point of new hatcheries. """
     if unit.type_id == UnitTypeId.HATCHERY and self.mineral_field:
         mf = self.mineral_field.closest_to(unit)
         unit.smart(mf)