Skip to content

Commit c61226d

Browse files
committed
don't include pets in Player.home_troops
1 parent 88e9739 commit c61226d

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

coc/enums.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ def __str__(self):
103103
]
104104

105105
# TODO: When v2 comes around, remove siege machines from here
106-
HOME_TROOP_ORDER = ELIXIR_TROOP_ORDER + SUPER_TROOP_ORDER + DARK_ELIXIR_TROOP_ORDER + SIEGE_MACHINE_ORDER
106+
HOME_TROOP_ORDER = ELIXIR_TROOP_ORDER + DARK_ELIXIR_TROOP_ORDER + \
107+
SIEGE_MACHINE_ORDER + SUPER_TROOP_ORDER
108+
107109

108110
BUILDER_TROOPS_ORDER = [
109111
"Raged Barbarian",

coc/players.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,10 @@ def home_troops(self) -> typing.List[Troop]:
364364
if not self._home_troops:
365365
_ = self.troops
366366

367-
return list(sorted(self._home_troops.values(), key=lambda t: order.get(t.name, 0)))
367+
return list(sorted(
368+
filter(lambda t: t.name in HOME_TROOP_ORDER, self._home_troops.values()),
369+
key=lambda t: order[t.name]
370+
))
368371

369372
@cached_property("_cs_builder_troops")
370373
def builder_troops(self) -> typing.List[Troop]:

0 commit comments

Comments
 (0)