Skip to content

Commit 4ace9e3

Browse files
committed
Merge branch 'g5_2.2.2_candidate' of github.com:mathsman5133/coc.py into g5_2.2.2_candidate
2 parents 4d035d3 + f4dffd5 commit 4ace9e3

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

coc/clans.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ class Clan(BaseClan):
107107
The clan's versus trophy count. This is calculated according to members' versus trophy counts.
108108
required_trophies: :class:`int`
109109
The minimum trophies required to apply to this clan.
110+
required_townhall: :class:`int`
111+
The minimum townhall level required to apply to this clan.
110112
war_frequency: :class:`str`
111113
The frequency for when this clan goes to war.
112114
For example, this could be ``always``.
@@ -159,6 +161,7 @@ class Clan(BaseClan):
159161
"capital_district_cls",
160162
"war_league",
161163
"chat_language",
164+
"required_townhall",
162165

163166
"_cs_labels",
164167
"_cs_members",
@@ -197,6 +200,7 @@ def _from_data(self, data: dict) -> None:
197200
self.description: str = data_get("description")
198201
self.war_league = try_enum(WarLeague, data=data_get("warLeague"))
199202
self.chat_language = try_enum(ChatLanguage, data=data_get("chatLanguage"))
203+
self.required_townhall = data_get("requiredTownhallLevel")
200204

201205
label_cls = self.label_cls
202206
self._iter_labels = (label_cls(data=ldata, client=self._client) for ldata in data_get("labels", []))

coc/war_clans.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def _from_data(self, data: dict) -> None:
104104

105105
if self._war:
106106
self.max_stars: int = self._war.team_size * 3
107-
self.total_attacks: int = self._war.team_size * 2
107+
self.total_attacks: int = self._war.team_size * self._war.attacks_per_member
108108
else:
109109
self.max_stars: int = (data_get("teamSize") or 0) * 3
110110
self.total_attacks: int = (data_get("teamSize") or 0) * 3

coc/wars.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def _from_data(self, data: dict) -> None:
103103
self.start_time = try_enum(Timestamp, data=data_get("startTime"))
104104
self.end_time = try_enum(Timestamp, data=data_get("endTime"))
105105
self.war_tag: str = data_get("tag")
106-
if data_get("attacksPerMember") is None and self.is_cwl:
106+
if data_get("attacksPerMember") is None or self.is_cwl:
107107
self.attacks_per_member: int = 1
108108
else:
109109
self.attacks_per_member: int = data_get("attacksPerMember")

0 commit comments

Comments
 (0)