def createGame(self): self.canCall = False self.tileSeed = None self.typeId = None self.cardId += 1 for spot in self.pond.spots: avId = self.pond.spots[spot].avId request = RequestCard.get(avId) if request: self.typeId, self.tileSeed = request del RequestCard[avId] if self.cardId > 65535: self.cardId = 0 if not self.tileSeed: self.tileSeed = random.randrange(0, 65535) if self.typeId == None: self.typeId = random.randrange(0, 4) if self.typeId == BingoGlobals.NORMAL_CARD: self.bingoCard = NormalBingo() elif self.typeId == BingoGlobals.DIAGONAL_CARD: self.bingoCard = DiagonalBingo() elif self.typeId == BingoGlobals.THREEWAY_CARD: self.bingoCard = ThreewayBingo() elif self.typeId == BingoGlobals.FOURCORNER_CARD: self.bingoCard = FourCornerBingo() else: self.bingoCard = BlockoutBingo() self.bingoCard.generateCard(self.tileSeed, self.pond.getArea()) self.sendCardStateUpdate() self.b_setJackpot(BingoGlobals.getJackpot(self.typeId)) self.state = 'Playing' self.sendStateUpdate() taskMgr.doMethodLater(BingoGlobals.getGameTime(self.typeId), DistributedPondBingoManagerAI.finishGame, 'finishGame%d' % self.getDoId(), [self])
def createGame(self): self.canCall = False self.tileSeed = None self.typeId = None self.cardId += 1 for spot in self.pond.spots.itervalues(): request = RequestCard.get(spot.avId) if request: self.typeId, self.tileSeed = request del RequestCard[spot.avId] if self.cardId > 65535: self.cardId = 0 if not self.tileSeed: self.tileSeed = random.randrange(0, 65535) if self.typeId == None: self.typeId = random.randrange(0, 4) if self.typeId == BingoGlobals.NORMAL_CARD: self.bingoCard = NormalBingo() elif self.typeId == BingoGlobals.DIAGONAL_CARD: self.bingoCard = DiagonalBingo() elif self.typeId == BingoGlobals.THREEWAY_CARD: self.bingoCard = ThreewayBingo() elif self.typeId == BingoGlobals.FOURCORNER_CARD: self.bingoCard = FourCornerBingo() else: self.bingoCard = BlockoutBingo() self.bingoCard.generateCard(self.tileSeed, self.pond.getArea()) self.sendCardStateUpdate() self.b_setJackpot(BingoGlobals.getJackpot(self.typeId)) self.state = 'Playing' self.sendStateUpdate() taskMgr.doMethodLater(BingoGlobals.getGameTime(self.typeId), DistributedPondBingoManagerAI.finishGame, 'finishGame%d' % self.getDoId(), [self])
def generateCard(self): if self.card: self.card.destroy() del self.card self.tileSeed = RandomNumGen.randHash(globalClock.getRealTime()) # Determine whether the next game should be a super game. If # we are coming out of an intermission, then it will be a # super game. These occur each hour on the hour, and for the # last game of the evening. if self.nextGameSuper: self.notify.info("generateCard: SUPER CARD GENERATION") self.typeId = BingoGlobals.BLOCKOUT_CARD self.jackpot = self.air.bingoMgr.getSuperJackpot(self.zoneId) # If this was an hourly super jackpot, not the final game of the # evening, reset so that we don't go into another intermission # at the end of this game. Otherwise, we want to transition # to the CloseEvent state after the game has ended, either by # a win or "loss." if self.finalGame == BG.INTERMISSION: self.finalGame = BG.NORMAL_GAME self.nextGameSuper = False else: rng = RandomNumGen.RandomNumGen(self.tileSeed) self.typeId = rng.randint(BingoGlobals.NORMAL_CARD, BingoGlobals.THREEWAY_CARD) self.jackpot = BingoGlobals.getJackpot(self.typeId) self.card = self.__cardChoice() self.card.generateCard(self.tileSeed, self.pond.getArea()) self.cardId += 1 self.numMarkedCells= 0 self.maxPlayers = len(self.avId2Fish)
def setCardState(self, cardId, typeId, tileSeed, gameState): self.cardId = cardId self.typeId = typeId self.tileSeed = tileSeed self.jackpot = BingoGlobals.getJackpot(typeId) self.initGameState = gameState