Browse Source

Strategická: Získávání příbytku hráčů za kolo z configu

master
Martin Koreček 2 years ago
parent
commit
dbcff21a78
  1. 9
      server/hra/game.py

9
server/hra/game.py

@ -41,6 +41,8 @@ class Occupy(Logic):
assert(teams_count == self.teams_width * self.teams_height)
self.map_width = self.teams_width * configuration["width_per_team"]
self.map_height = self.teams_height * configuration["height_per_team"]
# born per round - nultý index je počet vojáků každého týmu v zero-stavu
self.bpr = self.configuration["born_per_round"]
def generate_soldier(self, team_id, soldier_id):
return {
@ -74,7 +76,9 @@ class Occupy(Logic):
for _ in range(self.teams_width):
map[home_y][home_x]["home_for_team"] = team_id
map[home_y][home_x]["occupied_by_team"] = team_id
map[home_y][home_x]["members"].append(self.generate_soldier(team_id, 0))
# Initial stav vojáků:
for soldier_id in range(self.bpr[0]):
map[home_y][home_x]["members"].append(self.generate_soldier(team_id, soldier_id))
team_id += 1
home_x += self.configuration["width_per_team"]
home_y += self.configuration["height_per_team"]
@ -156,7 +160,8 @@ class Occupy(Logic):
# Přidáme vojáky v homes:
for team_id in range(self.teams_count):
home_pos = home_positions[team_id]
soldier_lists[home_pos[0]][home_pos[1]][team_id].append(highest_ids[team_id] + 1)
for i in range(self.bpr[(round_id + 1) % len(self.bpr)]):
soldier_lists[home_pos[0]][home_pos[1]][team_id].append(highest_ids[team_id] + i + 1)
# Vojáci se pomlátí:
for y in range(self.map_height):

Loading…
Cancel
Save