def boxSpawn(self): Plyrs = 0 for team in self.teams: for player in team.players: if player.gameData['lives'] > 0: Plyrs += 1 maxBoxes = Plyrs * self.boxMult if maxBoxes > 16: maxBoxes = 16 for box in self.totBoxes: if not box.exists(): self.totBoxes.remove(box) while len(self.totBoxes) < maxBoxes: #print([Plyrs, self.boxMult,len(self.totBoxes), maxBoxes]) if random.randint( 1, self.settings["Curse Box Chance (lower = more chance)"] ) == 1: self.totBoxes.append( bsPowerup.Powerup(position=self.getRandomPowerupPoint(), powerupType='curse', expire=False).autoRetain()) else: self.totBoxes.append( bsPowerup.Powerup(position=self.getRandomPowerupPoint(), powerupType='health', expire=False).autoRetain()) self.boxMult -= self.settings["Box Reduction Rate"]
def _standardDropPowerup(self, index, expire=True): forbidded = [] if bool( self.settings.get("Allow gloves and shields", False)) else ['punch', 'shield'] import bsPowerup if not self._customPowerupRespawn: bsPowerup.Powerup( position=self.getMap().powerupSpawnPoints[index], powerupType=bs.Powerup.getFactory().getRandomPowerupType( excludeTypes=forbidded), expire=expire).autoRetain() else: expire = not self._keepPowerupsAliveWhenFighting self.allPowerups[index] = bsPowerup.Powerup( position=self.getMap().powerupSpawnPoints[index], powerupType=bs.Powerup.getFactory().getRandomPowerupType( excludeTypes=forbidded), expire=expire).autoRetain()
def _standardDropPowerup( self, index, expire=True ): #Overloaded from bsGame in order to randomize without curse, health, or freeze. bsPowerup.Powerup( position=self.getMap().powerupSpawnPoints[index], powerupType=bs.Powerup.getFactory().getRandomPowerupType( forceType=None, excludeTypes=self.excludePowerups), expire=expire).autoRetain()
def boxSpawn(self): Plyrs = 0 for team in self.teams: for player in team.players: Plyrs += 1 maxBoxes = int(Plyrs * self.settings["Boxes Per Player"]) if maxBoxes > 16: maxBoxes = 16 elif maxBoxes < 1: maxBoxes = 1 for box in self.totBoxes: if not box.exists(): self.totBoxes.remove(box) while len(self.totBoxes) < maxBoxes: #print([Plyrs, self.boxMult,len(self.totBoxes), maxBoxes]) if random.randint( 1, self.settings["Curse Box Chance (lower = more chance)"] ) == 1: type = 'curse' else: type = 'health' box = bsPowerup.Powerup(position=self.getRandomPowerupPoint(), powerupType=type, expire=False).autoRetain() #we have to remove the default powerup material because it doesn't allow for pickups. #Then we add our own powerup material. pm = box.getFactory().powerupMaterial materials = getattr(box.node, 'materials') if pm in materials: setattr(box.node, 'materials', tuple(m for m in materials if m != pm)) materials = getattr(box.node, 'materials') if not self.fpowerupMaterial in materials: setattr(box.node, 'materials', materials + (self.fpowerupMaterial, )) self.totBoxes.append(box)
def _standardDropPowerup(self,index,expire=True): import bsPowerup forbidded = ['iceBombs','punch','stickyBombs','landMines', 'snoball'] bsPowerup.Powerup(position=self.getMap().powerupSpawnPoints[index], powerupType=bs.Powerup.getFactory().getRandomPowerupType(None,forbidded),expire=expire).autoRetain()
def _dropPowerUp(self, position, powerupType): bsPowerup.Powerup(position=position, powerupType=powerupType, expire=True).autoRetain()
def _standardDropPowerup(self, index, expire=True): import bsPowerup bsPowerup.Powerup( position=self.getMap().powerupSpawnPoints[index], powerupType=SiegePowerupFactory().getRandomPowerupType(), expire=expire).autoRetain()
def spewWithTimer(self, pos): bsPowerup.Powerup(position=pos, powerupType='health', expire=False).autoRetain()