From 8ba27cdaeae84914aced36851d78f070b1ee1f63 Mon Sep 17 00:00:00 2001 From: RndName Date: Mon, 5 Jul 2021 22:36:01 +0200 Subject: [PATCH] remove completely destroyed units from the convoy --- game/transfers.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/game/transfers.py b/game/transfers.py index fadbf3dc..64870b50 100644 --- a/game/transfers.py +++ b/game/transfers.py @@ -130,7 +130,10 @@ class TransferOrder: def kill_unit(self, unit_type: GroundUnitType) -> None: if unit_type not in self.units or not self.units[unit_type]: raise KeyError(f"{self} has no {unit_type} remaining") - self.units[unit_type] -= 1 + if self.units[unit_type] == 1: + del self.units[unit_type] + else: + self.units[unit_type] -= 1 @property def size(self) -> int: