Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions sc2/game_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,15 +325,11 @@ def __bool__(self) -> bool:
return self.minerals != 0 or self.vespene != 0

def __add__(self, other: Cost) -> Cost:
if not other:
return self
if not self:
return other
time = (self.time or 0) + (other.time or 0)
return Cost(self.minerals + other.minerals, self.vespene + other.vespene, time=time)

def __sub__(self, other: Cost) -> Cost:
time = (self.time or 0) + (other.time or 0)
time = (self.time or 0) - (other.time or 0)
return Cost(self.minerals - other.minerals, self.vespene - other.vespene, time=time)

def __mul__(self, other: int) -> Cost:
Expand Down
Loading