Skip to content

Commit 35a6f43

Browse files
committed
Default teamless AI players to team 2 instead of 0. closes #86
1 parent 9dd2f94 commit 35a6f43

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

sc2reader/resources.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,13 @@ def createPlayer(pid, pdata, attributes):
354354
player = Player(pid,pdata.name)
355355

356356
# Cross reference the player and team lookups
357-
# TODO: Players without attribute events, where do we get the team info?
358-
# print pdata.name, attributes, pdata
359-
team_number = attributes.get('Teams'+self.type,0)
357+
# In HotS Beta we've had weird issues where AI players don't have team attributes
358+
# In these cases, assign the AI to team 2, its not great but won't break doesn't
359+
# break as many expectations for teams as other approaches might. Team 2 is a good
360+
# option because it will always exist and generally in Comp Stomps the players are
361+
# in team 1. This will still break for things like FFA with comps but I'm not too
362+
# concerned yet.
363+
team_number = attributes.get('Teams'+self.type, 2)
360364
if not team_number in self.team:
361365
self.team[team_number] = Team(team_number)
362366
self.teams.append(self.team[team_number])

0 commit comments

Comments
 (0)