本文整理汇总了Python中SuitDNA.getSuitDept方法的典型用法代码示例。如果您正苦于以下问题:Python SuitDNA.getSuitDept方法的具体用法?Python SuitDNA.getSuitDept怎么用?Python SuitDNA.getSuitDept使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SuitDNA
的用法示例。
在下文中一共展示了SuitDNA.getSuitDept方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createInitialSuitBuildings
# 需要导入模块: import SuitDNA [as 别名]
# 或者: from SuitDNA import getSuitDept [as 别名]
def createInitialSuitBuildings(self):
if self.buildingMgr is None:
return
# If we aren't at our minimum number of buildings, let's spawn some!
suitBlockCount = len(self.buildingMgr.getSuitBlocks())
if suitBlockCount < self.targetNumSuitBuildings:
for _ in xrange(self.targetNumSuitBuildings - suitBlockCount):
blockNumber = random.choice(self.buildingMgr.getToonBlocks())
building = self.buildingMgr.getBuilding(blockNumber)
if building is None:
continue
if NPCToons.isZoneProtected(building.getExteriorAndInteriorZoneId()[1]):
continue
suitName = self.air.suitInvasionManager.getInvadingCog()[0]
if suitName is None:
suitName = self.defaultSuitName
suitType = None
suitTrack = None
if suitName is not None:
suitType = SuitDNA.getSuitType(suitName)
suitTrack = SuitDNA.getSuitDept(suitName)
(suitLevel, suitType, suitTrack) = self.pickLevelTypeAndTrack(None, suitType, suitTrack)
building.suitTakeOver(suitTrack, suitLevel, None)
# Save the building manager's state:
self.buildingMgr.save()
示例2: startTakeOver
# 需要导入模块: import SuitDNA [as 别名]
# 或者: from SuitDNA import getSuitDept [as 别名]
def startTakeOver(self):
if not self.SUIT_BUILDINGS:
return
blockNumber = self.buildingDestination
if not self.sp.buildingMgr.isSuitBlock(blockNumber):
self.notify.debug('Suit %d taking over building %d in %d' % (self.getDoId(), blockNumber, self.zoneId))
difficulty = self.getActualLevel() - 1
if self.buildingDestinationIsCogdo:
self.sp.cogdoTakeOver(blockNumber, difficulty, self.buildingHeight)
else:
dept = SuitDNA.getSuitDept(self.dna.name)
self.sp.suitTakeOver(blockNumber, dept, difficulty, self.buildingHeight)
示例3: createNewSuit
# 需要导入模块: import SuitDNA [as 别名]
# 或者: from SuitDNA import getSuitDept [as 别名]
def createNewSuit(self, blockNumbers, streetPoints, toonBlockTakeover=None,
cogdoTakeover=None, minPathLen=None, maxPathLen=None,
buildingHeight=None, suitLevel=None, suitType=None, suitTrack=None,
suitName=None, skelecog=None, revives=None):
startPoint = None
blockNumber = None
if self.notify.getDebug():
self.notify.debug('Choosing origin from %d+%d possibles.' % (len(streetPoints), len(blockNumbers)))
while startPoint == None and len(blockNumbers) > 0:
bn = random.choice(blockNumbers)
blockNumbers.remove(bn)
if self.buildingSideDoors.has_key(bn):
for doorPoint in self.buildingSideDoors[bn]:
points = self.dnaStore.getAdjacentPoints(doorPoint)
i = points.getNumPoints() - 1
while blockNumber == None and i >= 0:
pi = points.getPointIndex(i)
p = self.pointIndexes[pi]
i -= 1
startTime = SuitTimings.fromSuitBuilding
startTime += self.dnaStore.getSuitEdgeTravelTime(doorPoint.getIndex(), pi, self.suitWalkSpeed)
if not self.pointCollision(p, doorPoint, startTime):
startTime = SuitTimings.fromSuitBuilding
startPoint = doorPoint
blockNumber = bn
while startPoint == None and len(streetPoints) > 0:
p = random.choice(streetPoints)
streetPoints.remove(p)
if not self.pointCollision(p, None, SuitTimings.fromSky):
startPoint = p
startTime = SuitTimings.fromSky
continue
if startPoint == None:
print 'DSP failed to create a new suit! REASON: startPoint = None'
return None
newSuit = DistributedSuitAI.DistributedSuitAI(simbase.air, self)
newSuit.startPoint = startPoint
if blockNumber != None:
newSuit.buildingSuit = 1
if suitTrack == None:
suitTrack = self.buildingMgr.getBuildingTrack(blockNumber)
else:
newSuit.flyInSuit = 1
newSuit.attemptingTakeover = self.newSuitShouldAttemptTakeover()
if newSuit.attemptingTakeover:
if suitTrack == None and len(self.pendingBuildingTracks) > 0:
suitTrack = self.pendingBuildingTracks[0]
del self.pendingBuildingTracks[0]
self.pendingBuildingTracks.append(suitTrack)
if buildingHeight == None and len(self.pendingBuildingHeights) > 0:
buildingHeight = self.pendingBuildingHeights[0]
del self.pendingBuildingHeights[0]
self.pendingBuildingHeights.append(buildingHeight)
if suitName == None:
(suitName, skelecog, v2, waiter) = self.air.suitInvasionManager.getInvadingCog()
if suitName == None:
suitName = self.defaultSuitName
if suitType == None and suitName != None:
suitType = SuitDNA.getSuitType(suitName)
suitTrack = SuitDNA.getSuitDept(suitName)
if suitLevel == None and buildingHeight != None:
suitLevel = self.chooseSuitLevel(self.SuitHoodInfo[self.hoodInfoIdx][self.SUIT_HOOD_INFO_LVL], buildingHeight)
(suitLevel, suitType, suitTrack) = self.pickLevelTypeAndTrack(suitLevel, suitType, suitTrack)
newSuit.setupSuitDNA(suitLevel, suitType, suitTrack)
newSuit.buildingHeight = buildingHeight
gotDestination = self.chooseDestination(newSuit, startTime, toonBlockTakeover = toonBlockTakeover, cogdoTakeover = cogdoTakeover, minPathLen = minPathLen, maxPathLen = maxPathLen)
if not gotDestination:
self.notify.debug("Couldn't get a destination in %d!" % self.zoneId)
newSuit.doNotDeallocateChannel = None
newSuit.delete()
print 'DSP failed to create a new suit! REASON: gotDestination = None'
return None
newSuit.initializePath()
self.zoneChange(newSuit, None, newSuit.zoneId)
if skelecog:
newSuit.setSkelecog(skelecog)
newSuit.generateWithRequired(newSuit.zoneId)
if v2:
revives = 1
if revives:
newSuit.b_setSkeleRevives(revives)
newSuit.d_setSPDoId(self.doId)
newSuit.moveToNextLeg(None)
self.suitList.append(newSuit)
if newSuit.flyInSuit:
self.numFlyInSuits += 1
if newSuit.buildingSuit:
self.numBuildingSuits += 1
if newSuit.attemptingTakeover:
self.numAttemptingTakeover += 1
return newSuit
示例4: createNewSuit
# 需要导入模块: import SuitDNA [as 别名]
# 或者: from SuitDNA import getSuitDept [as 别名]
def createNewSuit(
self,
blockNumbers,
streetPoints,
toonBlockTakeover=None,
cogdoTakeover=None,
minPathLen=None,
maxPathLen=None,
buildingHeight=None,
suitLevel=None,
suitType=None,
suitTrack=None,
suitName=None,
specialSuit=0,
):
startPoint = None
blockNumber = None
if self.notify.getDebug():
self.notify.debug("Choosing origin from %d+%d possibles." % (len(streetPoints), len(blockNumbers)))
while startPoint == None and len(blockNumbers) > 0:
bn = random.choice(blockNumbers)
blockNumbers.remove(bn)
if self.buildingSideDoors.has_key(bn):
for doorPoint in self.buildingSideDoors[bn]:
points = self.dnaData.suitGraph.getAdjacentPoints(doorPoint)
for p in points:
startTime = SuitTimings.fromSuitBuilding
startTime += self.dnaData.suitGraph.getSuitEdgeTravelTime(doorPoint, p, self.suitWalkSpeed)
if not self.pointCollision(p, doorPoint, startTime):
startTime = SuitTimings.fromSuitBuilding
startPoint = doorPoint
blockNumber = bn
break
while startPoint == None and len(streetPoints) > 0:
p = random.choice(streetPoints)
streetPoints.remove(p)
if not self.pointCollision(p, None, SuitTimings.fromSky):
startPoint = p
startTime = SuitTimings.fromSky
if startPoint == None:
return
newSuit = DistributedSuitAI.DistributedSuitAI(simbase.air, self)
newSuit.startPoint = startPoint
if blockNumber != None:
newSuit.buildingSuit = 1
if suitTrack == None:
suitTrack = self.buildingMgr.getBuildingTrack(blockNumber)
else:
newSuit.flyInSuit = 1
newSuit.attemptingTakeover = self.newSuitShouldAttemptTakeover()
if newSuit.attemptingTakeover:
if suitTrack == None and len(self.pendingBuildingTracks) > 0:
suitTrack = self.pendingBuildingTracks[0]
del self.pendingBuildingTracks[0]
self.pendingBuildingTracks.append(suitTrack)
if buildingHeight == None and len(self.pendingBuildingHeights) > 0:
buildingHeight = self.pendingBuildingHeights[0]
del self.pendingBuildingHeights[0]
self.pendingBuildingHeights.append(buildingHeight)
if suitName == None:
suitName, specialSuit = self.air.suitInvasionManager.getInvadingCog()
if suitName == None:
suitName = self.defaultSuitName
if suitType == None and suitName != None:
suitType = SuitDNA.getSuitType(suitName)
suitTrack = SuitDNA.getSuitDept(suitName)
if suitLevel == None and buildingHeight != None:
suitLevel = self.chooseSuitLevel(
self.SuitHoodInfo[self.hoodInfoIdx][self.SUIT_HOOD_INFO_LVL], buildingHeight
)
suitLevel, suitType, suitTrack = self.pickLevelTypeAndTrack(suitLevel, suitType, suitTrack)
newSuit.setupSuitDNA(suitLevel, suitType, suitTrack)
newSuit.buildingHeight = buildingHeight
gotDestination = self.chooseDestination(
newSuit,
startTime,
toonBlockTakeover=toonBlockTakeover,
cogdoTakeover=cogdoTakeover,
minPathLen=minPathLen,
maxPathLen=maxPathLen,
)
if not gotDestination:
self.notify.debug("Couldn't get a destination in %d!" % self.zoneId)
newSuit.doNotDeallocateChannel = None
newSuit.delete()
return
newSuit.initializePath()
self.zoneChange(newSuit, None, newSuit.zoneId)
# Determine if we are spawning a special type of suit. 1 is Skelecog, 2 is v2.0.
if specialSuit == 1:
newSuit.setSkelecog(1)
elif specialSuit == 2:
newSuit.setSkeleRevives(1)
newSuit.generateWithRequired(newSuit.zoneId)
newSuit.moveToNextLeg(None)
self.suitList.append(newSuit)
if newSuit.flyInSuit:
self.numFlyInSuits += 1
#.........这里部分代码省略.........