def endGame(self): curTime = bs.getGameTime() if not self.timeLimitOnly: # mark 'death-time' as now for any still-living players # and award players points for how long they lasted. # (these per-player scores are only meaningful in team-games) for team in self.teams: for player in team.players: # throw an extra fudge factor +1 in so teams that # didn't die come out ahead of teams that did if 'survivalSeconds' in player.gameData: score = player.gameData['survivalSeconds'] elif 'survivalSeconds' in team.gameData: score = team.gameData['survivalSeconds'] else: score = (curTime - self._startGameTime) / 1000 + 1 #if 'survivalSeconds' not in player.gameData: # player.gameData['survivalSeconds'] = (curTime - self._startGameTime)/1000 + 1 # print('extraBonusSwag for player') # award a per-player score depending on how many seconds they lasted # (per-player scores only affect teams mode; everywhere else just looks at the per-team score) #score = (player.gameData['survivalSeconds']) self.scoreSet.playerScored(player, score, screenMessage=False) # ok now calc game results: set a score for each team and then tell the game to end results = bs.TeamGameResults() # remember that 'free-for-all' mode is simply a special form of 'teams' mode # where each player gets their own team, so we can just always deal in teams # and have all cases covered for team in self.teams: # set the team score to the max time survived by any player on that team longestLife = 0 for player in team.players: if 'survivalSeconds' in player.gameData: time = player.gameData['survivalSeconds'] elif 'survivalSeconds' in team.gameData: time = team.gameData['survivalSeconds'] else: time = (curTime - self._startGameTime) / 1000 + 1 longestLife = max(longestLife, time) results.setTeamScore(team, longestLife) self.end(results=results) else: results = bs.TeamGameResults() for team in self.teams: deaths = sum( [0 - player.gameData['lives'] for player in team.players]) results.setTeamScore(team, deaths) self.end(results=results)
def endGame(self): current_time = bs.getGameTime() for team in self.teams: for player in team.players: if 'deathTime' not in player.gameData: player.gameData['deathTime'] = current_time + 1 score = (player.gameData['deathTime'] - self._timer.getStartTime()) / 1000 if 'deathTime' not in player.gameData: score += 50 # a bit extra for survivors self.scoreSet.playerScored(player, score, screenMessage=False) results = bs.TeamGameResults() for team in self.teams: # set the team score to the max time survived by any player on that team longestLife = 0 for player in team.players: longestLife = max(longestLife, (player.gameData['deathTime'] - self._timer.getStartTime())) results.setTeamScore(team, longestLife) self.end(results=results)
def endGame(self): # jasonhu5 global exitFlag, thread1 exitFlag = True if not thread1 is None: print("set flag") tempS = socket.socket() tempS.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) tempS.connect((socket.gethostname(), 12345)) tempS.send("-1\n") tempS.close() thread1.join() print("joint thread") thread1 = None exitFlag = False # results = bs.TeamGameResults() for t in self.teams: results.setTeamScore(t, t.gameData['score']) self.end(results=results, announceDelay=800)
def endGame(self): if self.hasEnded(): return results = bs.TeamGameResults() self._vsText = None # kill our 'vs' if its there for team in self.teams: results.setTeamScore(team, team.gameData['survivalSeconds']) self.end(results=results)
def endGame(self): results = bs.TeamGameResults() for team in self.teams: score = max( [player.gameData["state"].index for player in team.players]) results.setTeamScore(team, score) self.end(results=results)
def endGame(self): curTime = bs.getGameTime() for team in self.teams: for player in team.players: if 'notIn' in player.gameData: player.gameData['deathTime'] = 0 elif 'deathTime' not in player.gameData: player.gameData['deathTime'] = curTime + 1 score = (player.gameData['deathTime'] - self._timer.getStartTime()) / 1000 if 'deathTime' not in player.gameData: score += 50 self.scoreSet.playerScored(player, score, screenMessage=False) # stop updating our time text, and set the final time to match # exactly when our last guy died. self._timer.stop(endTime=self._lastPlayerDeathTime) # ok now calc game results: set a score for each team and then tell the game to end results = bs.TeamGameResults() # remember that 'free-for-all' mode is simply a special form of 'teams' mode # where each player gets their own team, so we can just always deal in teams # and have all cases covered for team in self.teams: # set the team score to the max time survived by any player on that team longestLife = 0 for player in team.players: longestLife = max(longestLife, (player.gameData['deathTime'] - self._timer.getStartTime())) results.setTeamScore(team, longestLife) self.end(results=results)
def endGame(self): if self.hasEnded(): return results = bs.TeamGameResults() for team in self.teams: results.setTeamScore(team, team.gameData['score']) self.end(results=results)
def endGame(self): #bsInternal._fadeScreen(False, time=500) bs.screenMessage('GAME STARTING...', color=(0, 0.9, 0)) ourResults = bs.TeamGameResults() for team in self.teams: ourResults.setTeamScore(team, 0) self.end(results=ourResults)
def endGame(self, winner): results = bs.TeamGameResults() for team in self.teams: if winner.getPlayer() in team.players: score = 50 else: score = 0 results.setTeamScore(team, score) self.end(results=results, announceDelay=10)
def endGame(self): curTime = bs.getGameTime() for team in self.teams: for player in team.players: if 'deathTime' not in player.gameData: player.gameData['deathTime'] = curTime + 1 score = (player.gameData['deathTime'] - self._timer.getStartTime()) / 1000 if 'deathTime' not in player.gameData: score += 50 self.scoreSet.playerScored(player, score, screenMessage=False) self._timer.stop(endTime=self._lastPlayerDeathTime) results = bs.TeamGameResults() for team in self.teams: longestLife = 0 for player in team.players: longestLife = max(longestLife, (player.gameData['deathTime'] - self._timer.getStartTime())) results.setTeamScore(team, longestLife) self.end(results=results)
def endGame(self): results = bs.TeamGameResults() for team in self.teams: results.setTeamScore( team, self.settings['Frozen One Time'] - team.gameData['timeRemaining']) self.end(results=results, announceDelay=0)
def endGame(self): results = bs.TeamGameResults() for team in self.teams: results.setTeamScore( team, min(int(team.gameData['minesPlanted']), self.settings['Mines to win'])) self.end(results=results, announceDelay=0)
def endGame(self): if self.set == True: return self.set = True results = bs.TeamGameResults() #Set the results for the game to display at the end of the game for team in self.teams: results.setTeamScore(team, team.gameData['score']) self.end(results=results)
def endGame(self): results = bs.TeamGameResults() for team in self.teams: results.setTeamScore(team, team.gameData['score']) i = 0 for player in team.players: if player.isAlive(): i = 1 if i == 0: results.setTeamScore(team, 0) self.end(results=results)
def endGame(self): if self._timer.hasStarted(): self._timer.stop(endTime=None if self._lastTeamTime is None else ( self._timer.getStartTime() + self._lastTeamTime)) results = bs.TeamGameResults() for t in self.teams: results.setTeamScore(t, t.gameData['time']) self.end(results=results, announceWinningTeam=True)
def handleMessage(self, m): if isinstance(m, bs.SpazBotDeathMessage): if self.getTeam(m.killerPlayer) == 0: results = bs.TeamGameResults() results.setTeamScore(self.teams[0], 0) results.setTeamScore(self.teams[1], 100) self.end(results=results) bs.screenMessage("Don't take it out on the ref!", color=(1, 0, 0)) elif self.getTeam(m.killerPlayer) == 1: results = bs.TeamGameResults() results.setTeamScore(self.teams[1], 0) results.setTeamScore(self.teams[0], 100) self.end(results=results) bs.screenMessage("Don't take it out on the ref!", color=(0, 0, 1)) elif isinstance(m, bs.PlayerSpazDeathMessage): bs.TeamGameActivity.handleMessage(self, m) if m.spaz.getPlayer().sessionData['fouledOut']: return if m.killed: if self.getTeam(m.spaz.getPlayer()) == 0: team = self.teams[0] elif self.getTeam(m.spaz.getPlayer()) == 1: team = self.teams[1] if m.killerPlayer not in team.players: m.killerPlayer.sessionData['fouls'] += 1 m.killerPlayer.actor.setScoreText( "FOUL " + str(m.killerPlayer.sessionData['fouls'])) bs.playSound(bs.getSound('bearDeath')) if m.killerPlayer.sessionData['fouls'] >= 3: self.foulOut(m.killerPlayer) if self.fouled == True: self.spawnPlayerSpaz(player=m.spaz.getPlayer()) return self.fouled = True self.giveFoulShots(m.spaz.getPlayer()) elif m.spaz.getPlayer().sessionData['fouls'] < 3: self.respawnPlayer(m.spaz.getPlayer()) elif m.spaz.getPlayer().sessionData['fouls'] < 3: self.respawnPlayer(m.spaz.getPlayer()) s = self.settings else: bs.TeamGameActivity.handleMessage(self, m)
def endGame(self): if self.hasEnded(): return #Reset the default color for the ToughGuyBot setattr(bs.ToughGuyBot, 'color', (0.6, 0.6, 0.6)) setattr(bs.ToughGuyBot, 'highlight', (0.6, 0.6, 0.6)) setattr(bs.ToughGuyBot, 'character', 'Kronk') results = bs.TeamGameResults() self._vsText = None # kill our 'vs' if its there for team in self.teams: results.setTeamScore(team, team.gameData['score']) self.end(results=results)
def endGame(self): results = bs.TeamGameResults() for team in self.teams: c = 0 for player in team.players: if player.gameData['piece'] == 'king' and player.isAlive(): c += 1 if c == 0: results.setTeamScore(team,0) else: score = team.gameData['score'] results.setTeamScore(team,score) self.end(results=results,announceDelay=10)
def endGame(self): self.ended = True if isinstance(self.getSession(), bs.FreeForAllSession): results = bs.TeamGameResults() for team in self.teams: score = 0 for player in team.players: score += player.gameData['score'] results.setTeamScore(team, score) self.end(results=results) for i in self.nodes: i.delete() for flag in self.flags: flag.handleMessage(bs.DieMessage())
def endGame(self): if isinstance(self.getSession(), bs.FreeForAllSession): for player in self.players: if player.isAlive(): player.gameData['score'] = 1 else: player.gameData['score'] = 0 results = bs.TeamGameResults() for team in self.teams: for player in team.players: if player.isAlive(): results.setTeamScore(team, 5) break else: results.setTeamScore(team, 0) else: results = bs.TeamGameResults() for team in self.teams: results.setTeamScore(team, 0) for player in team.players: if player.isAlive(): team.gameData['score'] = 1 results.setTeamScore(team, 10) self.end(results=results)
def endGame(self): curTime = bs.getGameTime() # mark 'death-time' as now for any still-living players # and award players points for how long they lasted. # (these per-player scores are only meaningful in team-games) for team in self.teams: for player in team.players: # throw an extra fudge factor +1 in so teams that # didn't die come out ahead of teams that did if 'deathTime' not in player.gameData: player.gameData['deathTime'] = curTime+1 # award a per-player score depending on how many seconds # they lasted (per-player scores only affect teams mode; # everywhere else just looks at the per-team score) score = (player.gameData['deathTime'] -self._timer.getStartTime())/1000 if 'deathTime' not in player.gameData: score += 50 # a bit extra for survivors self.scoreSet.playerScored(player, score, screenMessage=False) # stop updating our time text, and set the final time to match # exactly when our last guy died. self._timer.stop(endTime=self._lastPlayerDeathTime) # ok now calc game results: set a score for each team and then tell # the game to end results = bs.TeamGameResults() # remember that 'free-for-all' mode is simply a special form # of 'teams' mode where each player gets their own team, so we can # just always deal in teams and have all cases covered for team in self.teams: # set the team score to the max time survived by any player on # that team longestLife = 0 for player in team.players: longestLife = max( longestLife, (player.gameData['deathTime'] - self._timer.getStartTime())) results.setTeamScore(team, longestLife) self.end(results=results)
def endGame(self): # stop updating our time text, and set it to show the exact last finish time if we have one.. # (so users dont get upset if their final time differs from what they see onscreen by a tiny bit) if self._timer.hasStarted(): self._timer.stop(endTime=None if self._lastTeamTime is None else ( self._timer.getStartTime() + self._lastTeamTime)) results = bs.TeamGameResults() for t in self.teams: results.setTeamScore(t, t.gameData['time']) # we don't announce a winner in ffa mode since its probably been a while since the first place guy # crossed the finish line so it seems odd to be announcing that now.. self.end(results=results, announceWinningTeam=True if isinstance( self.getSession(), bs.TeamsSession) else False)
def endGame(self): # stop our on-screen timer so players can see what they got self._timer.stop() results = bs.TeamGameResults() # if we won, set our score to the elapsed time # (there should just be 1 team here since this is co-op) # ..if we didn't win, leave scores as default (None) which means we lost if self._won: elapsedTime = bs.getGameTime() - self._timer.getStartTime() self.cameraFlash() bs.playSound(self._winSound) for team in self.teams: team.celebrate() # woooo! par-tay! results.setTeamScore(team, elapsedTime) # ends this activity.. self.end(results)
def endGame(self): self._timer.stop() results = bs.TeamGameResults() if self._won: bs.playMusic('Victory') self._awardAchievement( self.settings.get("preset") + " Boss Fight completed") elapsedTime = bs.getGameTime() - self._timer.getStartTime() self.cameraFlash() bs.playSound(self._winSound) for team in self.teams: team.celebrate() # woooo! par-tay! results.setTeamScore(team, elapsedTime) else: self._boss.finalCelebrate() self.fadeToRed() bs.playMusic(None) bs.netTimer(3000, bs.WeakCall(self.end, results))
def endGame(self): results = bs.TeamGameResults() for t in self.teams: results.setTeamScore(t, t.gameData['score']) self.end(results=results)
def endGame(self): results = bs.TeamGameResults() for t in self.teams: results.setTeamScore(t, t.gameData['survivalSeconds']) self.end(results=results, announceDelay=800)
def endGame(self): results = bs.TeamGameResults() for team in self.teams: results.setTeamScore(team, team.gameData['score'].get()) self.end(results)
def endGame(self): # game's over - set a score for each team and tell our activity to finish ourResults = bs.TeamGameResults() for team in self.teams: ourResults.setTeamScore(team, 0) self.end(results=ourResults)
def endGame(self): results = bs.TeamGameResults() for team in self.teams: results.setTeamScore(team, team.gameData['survivalSeconds']) self.end(results=results)
def endGame(self): results = bs.TeamGameResults() for team in self.teams: score = team.gameData['score'] results.setTeamScore(team, score) self.end(results=results, announceDelay=10)