Skip to content

Commit

Permalink
Fix: attribute error
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Perestoronin committed Dec 15, 2019
1 parent 9789690 commit 942cf22
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## `3.4.0b1`

- **Исправление**: падение при переборе противников на арене

## `3.4.0b0`

- **Новое**: сохраненная информация о командах других игроков будет использоваться для атаки на топ-100 Гранд Арены
Expand Down
2 changes: 1 addition & 1 deletion bestmobabot/arena.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def filter_enemies(self, enemies: Iterable[BaseArenaEnemy]) -> Iterable[BaseAren
if len(enemy.teams) < self.n_required_teams:
if teams := self.db.get(f'{self.enemy_key(enemy)}:teams'):
logger.warning('Using stored teams for this enemy.')
enemy.teams = [[Hero(**hero) for hero in team] for team in teams]
enemy.set_teams([[Hero(**hero) for hero in team] for team in teams])
else:
logger.warning('Enemy has unknown teams: {}.', enemy.user)
continue
Expand Down
11 changes: 5 additions & 6 deletions bestmobabot/dataclasses_.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,11 +319,12 @@ class Config:
}

@property
@abstractmethod
def teams(self) -> List[List[Hero]]:
raise NotImplementedError()

@teams.setter
def teams(self, teams: List[List[Hero]]):
@abstractmethod
def set_teams(self, teams: List[List[Hero]]):
raise NotImplementedError()

def __str__(self) -> str:
Expand All @@ -337,8 +338,7 @@ class ArenaEnemy(BaseArenaEnemy):
def teams(self) -> List[List[Hero]]:
return [self.heroes]

@teams.setter
def teams(self, teams: List[List[Hero]]):
def set_teams(self, teams: List[List[Hero]]):
self.heroes = teams[0]


Expand All @@ -349,8 +349,7 @@ class GrandArenaEnemy(BaseArenaEnemy):
def teams(self) -> List[List[Hero]]:
return self.heroes

@teams.setter
def teams(self, teams: List[List[Hero]]):
def set_teams(self, teams: List[List[Hero]]):
self.heroes = teams


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name='bestmobabot',
version='3.4.0b0',
version='3.4.0b1',
author='Pavel Perestoronin',
author_email='eigenein@gmail.com',
description='Hero Wars game bot 🏆',
Expand Down

0 comments on commit 942cf22

Please sign in to comment.