def getMazeName(gameDoId, numPlayers, mazeNames): try: return forcedMaze except: names = mazeNames[numPlayers - 1] return names[RandomNumGen.randHash(gameDoId) % len(names)]
def __init__(self, air, tableNumber, x, y, z, h, p, r): """__init__(air) """ DistributedObjectAI.DistributedObjectAI.__init__(self, air) self.seats = [None, None, None, None] self.posHpr = (x, y, z, h, p, r) self.tableNumber = int(tableNumber) self.seed = RandomNumGen.randHash(globalClock.getRealTime()) # Flag that tells whether the trolley is currently accepting boarders self.accepting = 0 self.numPlayersExiting = 0 self.trolleyCountdownTime = \ ConfigVariableDouble("picnic-countdown-time", ToontownGlobals.PICNIC_COUNTDOWN_TIME).getValue() self.fsm = ClassicFSM.ClassicFSM( 'DistributedPicnicBasketAI', [ State.State('off', self.enterOff, self.exitOff, ['waitEmpty']), State.State('waitEmpty', self.enterWaitEmpty, self.exitWaitEmpty, ['waitCountdown']), State.State('waitCountdown', self.enterWaitCountdown, self.exitWaitCountdown, ['waitEmpty']) ], # Initial State 'off', # Final State 'off', ) self.fsm.enterInitialState()
def __init__(self, air, tableNumber, x, y, z, h, p, r): DistributedObjectAI.DistributedObjectAI.__init__(self, air) self.seats = [None, None, None, None] self.posHpr = (x, y, z, h, p, r) self.tableNumber = int(tableNumber) self.seed = RandomNumGen.randHash(globalClock.getRealTime()) self.accepting = 0 self.numPlayersExiting = 0 self.trolleyCountdownTime = simbase.config.GetFloat('picnic-countdown-time', ToontownGlobals.PICNIC_COUNTDOWN_TIME) self.fsm = ClassicFSM.ClassicFSM( 'DistributedPicnicBasketAI', [ State.State('off', self.enterOff, self.exitOff, ['waitEmpty']), State.State('waitEmpty', self.enterWaitEmpty, self.exitWaitEmpty, ['waitCountdown']), State.State('waitCountdown', self.enterWaitCountdown, self.exitWaitCountdown, ['waitEmpty']) ], 'off', 'off') self.fsm.enterInitialState()
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)