Commit 39513170 authored by m1ndgames's avatar m1ndgames

update

parent a75cd64d
......@@ -61,7 +61,7 @@ class GameManager():
if botdata:
if botdata.has_section("Enemy"):
if botdata.has_option("Enemy", "attacktime"):
self.bot.data_attacktime = int(botdata.get('Enemy', 'attacktime'))
self.bot.data_attacktime = botdata.get('Enemy', 'attacktime')
if botdata.has_option("Enemy", "units"):
self.bot.data_attackunits = botdata.get('Enemy', 'units')
if botdata.has_section(str(self.bot.race_self)):
......
......@@ -37,7 +37,7 @@ class ProtossManager():
# self.bot.strategy = ZealotRush(self.bot)
# self.bot.strategy = SkyToss(self.bot)
# self.bot.strategy = DarkTemplar(self.bot)
# return
#return
if self.bot.data_race_strategy in strategies:
self.bot.strategy = strategies[self.bot.data_race_strategy]
......
......@@ -19,7 +19,7 @@ class DarkTemplar:
self.bot.retreat_count = 0
if self.bot.usechat:
await self.bot._client.chat_send("Strategy: DarkTemplar", team_only=False)
await self.bot._client.chat_send("Strategy: DarkTemplar", team_only=True)
await self.Macro()
await self.Micro()
......@@ -65,9 +65,16 @@ class DarkTemplar:
ground_enemies = self.bot.enemy_units.not_flying
if ground_enemies:
for darktemplar in darktemplars:
near_enemies = ground_enemies.closer_than(30, darktemplar)
if near_enemies:
next_enemy = near_enemies.closest_to(darktemplar)
closeenemies = ground_enemies.closer_than(30, darktemplar)
if closeenemies:
for e in closeenemies:
if not self.bot.techtree.can_attack(darktemplar, e) or not e.can_be_attacked:
closeenemies.remove(e)
if not closeenemies:
break
next_enemy = closeenemies.closest_to(darktemplar)
distance2enemy = darktemplar.distance_to(next_enemy)
if distance2enemy < 20:
self.bot.do(darktemplar.attack(next_enemy))
......
......@@ -23,7 +23,7 @@ class SkyToss:
self.bot.not_commanderunit.extend([UnitTypeId.ADEPT, UnitTypeId.MOTHERSHIP, UnitTypeId.INTERCEPTOR])
if self.bot.usechat:
await self.bot._client.chat_send("Strategy: SkyToss", team_only=False)
await self.bot._client.chat_send("Strategy: SkyToss", team_only=True)
if int(self.bot.time) <= 360:
self.bot.attack_count = 5
......
......@@ -25,7 +25,7 @@ class StalkerRush:
self.bot.not_commanderunit.append(UnitTypeId.SENTRY)
if self.bot.usechat:
await self.bot._client.chat_send("Strategy: StalkerRush", team_only=False)
await self.bot._client.chat_send("Strategy: StalkerRush", team_only=True)
if int(self.bot.time) <= 360:
self.bot.attack_count = 5
......@@ -46,10 +46,9 @@ class StalkerRush:
await self.bot.unitmanager.createBuilding("Gateway", 1)
# Build a wall if enemy is attacking early
if self.bot.data_attacktime:
if self.bot.data_attacktime <= 180:
print("Build the Wall!")
await self.createWall()
#if self.bot.data_attacktime:
# if int(self.bot.data_attacktime) <= 180:
# await self.createWall()
if self.bot.structures(UnitTypeId.GATEWAY) or self.bot.structures(UnitTypeId.WARPGATE):
await self.bot.ressources.createGas()
......@@ -215,6 +214,15 @@ class StalkerRush:
async def createWall(self):
"""Wall-in Routine"""
if self.bot.structures(UnitTypeId.PHOTONCANNON).ready.exists:
cannons = self.bot.structures.filter(lambda w: w.type_id == UnitTypeId.PYLON).closer_than(10, self.bot.ramp_location)
if self.bot.structures(UnitTypeId.PHOTONCANNON).ready.exists:
shieldbattery = self.bot.structures.filter(lambda w: w.type_id == UnitTypeId.PYLON).closer_than(10, self.bot.ramp_location)
if shieldbattery and cannons.amount >= 2:
return
await self.bot.ressources.createGas()
rampsupplybuildposition = self.bot.ramp_location
......
......@@ -19,7 +19,7 @@ class ZealotRush:
self.bot.retreat_count = 0
if self.bot.usechat:
await self.bot._client.chat_send("Strategy: ZealotRush", team_only=False)
await self.bot._client.chat_send("Strategy: ZealotRush", team_only=True)
await self.Macro()
await self.Micro()
......
......@@ -21,7 +21,7 @@ class MarineRush:
self.bot.squadsize = 10
if self.bot.usechat:
await self.bot._client.chat_send("Strategy: MarineRush", team_only=False)
await self.bot._client.chat_send("Strategy: MarineRush", team_only=True)
await self.Macro()
await self.Micro()
......
......@@ -22,7 +22,7 @@ class BanelingSpam:
self.bot.not_commanderunit.append(UnitTypeId.QUEEN)
if self.bot.usechat:
await self.bot._client.chat_send("Strategy: BanelingSpam", team_only=False)
await self.bot._client.chat_send("Strategy: BanelingSpam", team_only=True)
await self.Macro()
await self.Micro()
......
......@@ -22,7 +22,7 @@ class MutaliskRush:
self.bot.not_commanderunit.append(UnitTypeId.QUEEN)
if self.bot.usechat:
await self.bot._client.chat_send("Strategy: MutaliskRush", team_only=False)
await self.bot._client.chat_send("Strategy: MutaliskRush", team_only=True)
await self.Macro()
await self.Micro()
......
......@@ -22,7 +22,7 @@ class RoachSpam:
self.bot.not_commanderunit.append(UnitTypeId.QUEEN)
if self.bot.usechat:
await self.bot._client.chat_send("Strategy: RoachSpam", team_only=False)
await self.bot._client.chat_send("Strategy: RoachSpam", team_only=True)
await self.Macro()
await self.Micro()
......
......@@ -22,7 +22,7 @@ class ZerglingRush:
self.bot.not_commanderunit.append(UnitTypeId.QUEEN)
if self.bot.usechat:
await self.bot._client.chat_send("Strategy: ZerglingRush", team_only=False)
await self.bot._client.chat_send("Strategy: ZerglingRush", team_only=True)
await self.Macro()
await self.Micro()
......
......@@ -49,7 +49,8 @@ class TerranManager():
if loosingstrategy == best_strategy:
print(
"Not picking " + best_strategy + " cause we lost with that - Using random strategy")
del strategies[best_strategy]
# TODO: Add a strategy so this is usable
#del strategies[best_strategy]
self.bot.strategy = random.choice(list(strategies.values()))
print("Using strategy:" + str(self.bot.strategy))
return
......
......@@ -48,7 +48,7 @@ class WarManager():
await self.estimate()
await self.estimate_status()
await self.check_retreat()
#await self.check_retreat()
await self.counterattack()
await self.commanderroutine()
await self.fightroutine()
......@@ -82,7 +82,7 @@ class WarManager():
botdata = configparser.ConfigParser()
botdata.read(datafile)
if botdata.has_section("Enemy"):
botdata.set("Enemy", 'attacktime', str(self.attacktime))
botdata.set("Enemy", 'attacktime', str(int(self.attacktime)))
botdata.set("Enemy", 'units', str(closeenemies))
with open(datafile, 'w') as dbfile:
botdata.write(dbfile)
......@@ -289,7 +289,6 @@ class WarManager():
hqs = self.bot.structures(townhall)
for hq in hqs:
if self.bot.enemy_units:
#enemies = self.bot.enemy_units.closer_than(30, hq)
enemies = self.bot.enemy_units.filter(lambda w: w.type_id not in [UnitTypeId.SCV] and w.type_id not in [UnitTypeId.DRONE] and w.type_id not in [UnitTypeId.PROBE] and w.type_id not in [UnitTypeId.OVERLORD] and w.type_id not in [UnitTypeId.EGG] and w.type_id not in [UnitTypeId.INTERCEPTOR])
if enemies:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment