当前位置: 首页>>代码示例>>Python>>正文


Python FishGlobals.getRandomFishVitals方法代码示例

本文整理汇总了Python中toontown.fishing.FishGlobals.getRandomFishVitals方法的典型用法代码示例。如果您正苦于以下问题:Python FishGlobals.getRandomFishVitals方法的具体用法?Python FishGlobals.getRandomFishVitals怎么用?Python FishGlobals.getRandomFishVitals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在toontown.fishing.FishGlobals的用法示例。


在下文中一共展示了FishGlobals.getRandomFishVitals方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: generateCard

# 需要导入模块: from toontown.fishing import FishGlobals [as 别名]
# 或者: from toontown.fishing.FishGlobals import getRandomFishVitals [as 别名]
 def generateCard(self, tileSeed, zoneId):
     rng = RandomNumGen.RandomNumGen(tileSeed)
     rowSize = self.game.getRowSize()
     fishList = FishGlobals.getPondGeneraList(zoneId)
     for i in xrange(len(fishList)):
         fishTuple = fishList.pop(0)
         weight = FishGlobals.getRandomWeight(fishTuple[0], fishTuple[1])
         fish = FishBase.FishBase(fishTuple[0], fishTuple[1], weight)
         fishList.append(fish)
     
     emptyCells = self.game.getCardSize() - 1 - len(fishList)
     rodId = 0
     for i in xrange(emptyCells):
         fishVitals = FishGlobals.getRandomFishVitals(zoneId, rodId, rng)
         while not fishVitals[0]:
             fishVitals = FishGlobals.getRandomFishVitals(zoneId, rodId, rng)
         fish = FishBase.FishBase(fishVitals[1], fishVitals[2], fishVitals[3])
         fishList.append(fish)
         rodId += 1
         if rodId > 4:
             rodId = 0
             continue
     
     for i in xrange(rowSize):
         for j in xrange(self.game.getColSize()):
             color = self.getCellColor(i * rowSize + j)
             if i * rowSize + j == self.game.getCardSize() / 2:
                 tmpFish = 'Free'
             else:
                 choice = rng.randrange(0, len(fishList))
                 tmpFish = fishList.pop(choice)
             xPos = BG.CellImageScale * (j - 2) + BG.GridXOffset
             yPos = BG.CellImageScale * (i - 2) - 0.014999999999999999
             cellGui = BingoCardCell.BingoCardCell(i * rowSize + j, tmpFish, self.model, color, self, image_scale = BG.CellImageScale, pos = (xPos, 0, yPos))
             self.cellGuiList.append(cellGui)
开发者ID:ponyboy837,项目名称:Toontown-2003-Server,代码行数:37,代码来源:BingoCardGui.py

示例2: generateCard

# 需要导入模块: from toontown.fishing import FishGlobals [as 别名]
# 或者: from toontown.fishing.FishGlobals import getRandomFishVitals [as 别名]
 def generateCard(self, tileSeed, zoneId):
     rng = RandomNumGen.RandomNumGen(tileSeed)
     fishList = FishGlobals.getPondGeneraList(zoneId)
     emptyCells = self.cardSize - 1 - len(fishList)
     rodId = 0
     for i in xrange(emptyCells):
         fish = FishGlobals.getRandomFishVitals(zoneId, rodId, rng)
         while not fish[0]:
             fish = FishGlobals.getRandomFishVitals(zoneId, rodId, rng)
         fishList.append((fish[1], fish[2]))
         rodId += 1
         if rodId > 4:
             rodId = 0
             continue
     
     for index in xrange(self.cardSize):
         if index != self.cardSize / 2:
             choice = rng.randrange(0, len(fishList))
             self.cellList.append(fishList.pop(choice))
             continue
         self.cellList.append((None, None))
开发者ID:OldToontown,项目名称:OldToontown,代码行数:23,代码来源:BingoCardBase.py

示例3: generateCatch

# 需要导入模块: from toontown.fishing import FishGlobals [as 别名]
# 或者: from toontown.fishing.FishGlobals import getRandomFishVitals [as 别名]
 def generateCatch(self, av, zoneId):
     if len(av.fishTank) >= av.getMaxFishTank():
         return [FishGlobals.OverTankLimit, 0, 0, 0]
     caughtItem = simbase.air.questManager.toonFished(av, zoneId)
     if caughtItem:
         return [FishGlobals.QuestItem, caughtItem, 0, 0]
     rand = random.random() * 100.0
     for cutoff in FishGlobals.SortedProbabilityCutoffs:
         if rand <= cutoff:
             itemType = FishGlobals.ProbabilityDict[cutoff]
             break
     if av.doId in self.requestedFish:
         genus, species = self.requestedFish[av.doId]
         weight = FishGlobals.getRandomWeight(genus, species)
         fish = FishBase(genus, species, weight)
         fishType = av.fishCollection.collectFish(fish)
         if fishType == FishGlobals.COLLECT_NEW_ENTRY:
             itemType = FishGlobals.FishItemNewEntry
         elif fishType == FishGlobals.COLLECT_NEW_RECORD:
             itemType = FishGlobals.FishItemNewRecord
         else:
             itemType = FishGlobals.FishItem
         netlist = av.fishCollection.getNetLists()
         av.d_setFishCollection(netlist[0], netlist[1], netlist[2])
         av.fishTank.addFish(fish)
         netlist = av.fishTank.getNetLists()
         av.d_setFishTank(netlist[0], netlist[1], netlist[2])
         del self.requestedFish[av.doId]
         return [itemType, genus, species, weight]
     if itemType == FishGlobals.FishItem:
         success, genus, species, weight = FishGlobals.getRandomFishVitals(
             zoneId, av.getFishingRod())
         fish = FishBase(genus, species, weight)
         fishType = av.fishCollection.collectFish(fish)
         if fishType == FishGlobals.COLLECT_NEW_ENTRY:
             itemType = FishGlobals.FishItemNewEntry
         elif fishType == FishGlobals.COLLECT_NEW_RECORD:
             itemType = FishGlobals.FishItemNewRecord
         else:
             itemType = FishGlobals.FishItem
         netlist = av.fishCollection.getNetLists()
         av.d_setFishCollection(netlist[0], netlist[1], netlist[2])
         av.fishTank.addFish(fish)
         netlist = av.fishTank.getNetLists()
         av.d_setFishTank(netlist[0], netlist[1], netlist[2])
         return [itemType, genus, species, weight]
     elif itemType == FishGlobals.BootItem:
         return [itemType, 0, 0, 0]
     else:
         money = FishGlobals.Rod2JellybeanDict[av.getFishingRod()]
         av.addMoney(money)
         return [itemType, money, 0, 0]
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leak,代码行数:54,代码来源:FishManagerAI.py


注:本文中的toontown.fishing.FishGlobals.getRandomFishVitals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。