本文整理汇总了Python中toontown.battle.SuitBattleGlobals类的典型用法代码示例。如果您正苦于以下问题:Python SuitBattleGlobals类的具体用法?Python SuitBattleGlobals怎么用?Python SuitBattleGlobals使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SuitBattleGlobals类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sayFaceoffTaunt
def sayFaceoffTaunt(self, custom = False, phrase = "", dialogue = None):
if custom:
self.setChatAbsolute(phrase, CFSpeech | CFTimeout, dialogue)
elif not custom:
if random.random() < 0.2:
taunt = SuitBattleGlobals.getFaceoffTaunt(self.getStyleName(), self.doId, randomChoice = True)
self.setChatAbsolute(taunt, CFSpeech | CFTimeout)
示例2: getActualLevel
def getActualLevel(self):
if hasattr(self, 'dna'):
return SuitBattleGlobals.getActualFromRelativeLevel(
self.getStyleName(), self.level) + 1
else:
self.notify.warning(
'called getActualLevel with no DNA, returning 1 for level')
return 1
示例3: pickLevelTypeAndTrack
def pickLevelTypeAndTrack(self, level=None, type=None, track=None):
if level is None:
level = random.choice(self.SuitHoodInfo[self.hoodInfoIdx][self.SUIT_HOOD_INFO_LVL])
if type is None:
typeChoices = range(max(level - 4, 1), min(level, self.MAX_SUIT_TYPES) + 1)
type = random.choice(typeChoices)
else:
level = min(max(level, type), type + 4)
if track is None:
track = SuitDNA.suitDepts[SuitBattleGlobals.pickFromFreqList(self.SuitHoodInfo[self.hoodInfoIdx][self.SUIT_HOOD_INFO_TRACK])]
self.notify.debug('pickLevelTypeAndTrack: %s %s %s' % (level, type, track))
return (level, type, track)
示例4: setLevel
def setLevel(self, lvl = None):
attributes = SuitBattleGlobals.SuitAttributes[self.dna.name]
if lvl is not None:
self.level = lvl - attributes['level'] - 1
else:
self.level = SuitBattleGlobals.pickFromFreqList(attributes['freq'])
self.notify.debug('Assigning level ' + str(lvl))
if hasattr(self, 'doId'):
self.d_setLevelDist(self.level)
hp = attributes['hp'][self.level]
self.maxHP = hp
self.currHP = hp
示例5: setLevel
def setLevel(self, lvl=None):
attributes = SuitBattleGlobals.SuitAttributes[self.dna.name]
if lvl is not None:
self.level = lvl - attributes["level"] - 1
else:
self.level = SuitBattleGlobals.pickFromFreqList(attributes["freq"])
self.notify.debug("Assigning level " + str(lvl))
if hasattr(self, "doId"):
self.d_setLevelDist(self.level)
hp = attributes["hp"][self.level]
self.maxHP = hp
self.currHP = hp
示例6: updateRolloverBind
def updateRolloverBind(self):
if not self.suit:
return
attributes = SuitBattleGlobals.SuitAttributes[self.suit.getStyleName()]
groupAttacks, singleAttacks = SuitBattleGlobals.getAttacksByType(attributes)
level = self.suit.getLevel()
info = TTLocalizer.BattleCogPopup % (self.getAttackStrings(groupAttacks, level), self.getAttackStrings(singleAttacks, level))
if TTLocalizer.BattleCogPopupDangerColor in info:
info = TTLocalizer.BattleCogPopupDanger + info
self.hoverButton.bind(DGG.ENTER, self.battle.showRolloverFrame, extraArgs=[self, TTLocalizer.BattleHoverCog, info])
示例7: setLevel
def setLevel(self, lvl = None):
attributes = SuitBattleGlobals.SuitAttributes[self.dna.name]
if lvl is not None:
self.level = lvl - attributes['level'] - 1
else:
self.level = SuitBattleGlobals.pickFromFreqList(attributes['freq'])
self.notify.debug('Assigning level ' + str(lvl))
if hasattr(self, 'doId'):
self.d_setLevelDist(self.level)
if len(attributes['hp'])<=self.level:
print "HP is less then level, Oops!"
raise Exception("invalid list index: len(attributes['hp') = %d, self.level=%d" % (len(attributes['hp']), self.level))
hp = attributes['hp'][self.level]
self.maxHP = hp
self.currHP = hp
示例8: setPanelStatus
def setPanelStatus(self, panel, status):
index = self.panels.index(panel)
if status == COG_UNSEEN:
panel['text'] = TTLocalizer.SuitPageMystery
elif status == COG_BATTLED:
suitName = SuitDNA.suitHeadTypes[index]
suitFullName = SuitBattleGlobals.SuitAttributes[suitName]['name']
panel['text'] = suitFullName
if panel.quotaLabel:
panel.quotaLabel.show()
else:
self.addQuotaLabel(panel)
if panel.head and panel.shadow:
panel.head.show()
panel.shadow.show()
else:
self.addSuitHead(panel, suitName)
if base.localAvatar.hasCogSummons(index):
if panel.summonButton:
panel.summonButton.show()
else:
self.addSummonButton(panel)
elif status == COG_DEFEATED:
count = str(base.localAvatar.cogCounts[index])
if base.localAvatar.cogs[index] < COG_COMPLETE1:
quota = str(COG_QUOTAS[0][index % SuitDNA.suitsPerDept])
else:
quota = str(COG_QUOTAS[1][index % SuitDNA.suitsPerDept])
panel.quotaLabel['text'] = TTLocalizer.SuitPageQuota % (count, quota)
elif status == COG_COMPLETE1:
panel['image_color'] = PANEL_COLORS_COMPLETE1[index / SuitDNA.suitsPerDept]
elif status == COG_COMPLETE2:
panel['image_color'] = PANEL_COLORS_COMPLETE2[index / SuitDNA.suitsPerDept]
if status in (COG_DEFEATED, COG_COMPLETE1, COG_COMPLETE2):
name = SuitDNA.suitHeadTypes[index]
attributes = SuitBattleGlobals.SuitAttributes[name]
level = attributes['level']
groupAttacks, singleAttacks = SuitBattleGlobals.getAttacksByType(attributes)
info = TTLocalizer.SuitPageAttackFormat % (level + 1, level + 5, self.getAttackStrings(groupAttacks), self.getAttackStrings(singleAttacks))
panel.hoverButton.bind(DGG.ENTER, self.showInfo, extraArgs=[panel, info])
panel.hoverButton.bind(DGG.EXIT, self.hideInfo)
示例9: sayFaceoffTaunt
def sayFaceoffTaunt(self, custom=False, phrase="", dialogue=None):
if custom:
self.virtualSuit.setChatAbsolute(phrase, CFSpeech | CFTimeout, dialogue)
else:
if self.attackProp == 'teeth':
taunt = SuitBattleGlobals.getAttackTaunt(random.choice(['Bite', 'Chomp']))
elif self.attackProp == 'synergy':
taunt = SuitBattleGlobals.getAttackTaunt('Synergy')
elif self.attackProp == 'golf-ball':
taunt = SuitBattleGlobals.getAttackTaunt('TeeOff')
elif self.attackProp == 'baseball':
taunt = SuitBattleGlobals.getAttackTaunt('PlayHardball')
elif self.attackProp == 'write-off':
taunt = SuitBattleGlobals.getAttackTaunt('WriteOff')
elif self.attackProp == 'crunch':
taunt = SuitBattleGlobals.getAttackTaunt('Crunch')
else:
taunt = SuitBattleGlobals.getFaceoffTaunt(self.virtualSuit.style.name, self.doId)
self.virtualSuit.setChatAbsolute(taunt, CFSpeech | CFTimeout)
示例10: __faceOff
def __faceOff(self, ts, name, callback):
if len(self.suits) == 0:
self.notify.warning('__faceOff(): no suits.')
return
if len(self.toons) == 0:
self.notify.warning('__faceOff(): no toons.')
return
toon = self.toons[0]
point = self.toonPoints[0][0]
toonPos = point[0]
toonHpr = VBase3(point[1], 0.0, 0.0)
p = toon.getPos(self)
toon.setPos(self, p[0], p[1], 0.0)
toon.setShadowHeight(0)
if len(self.suits) == 1:
leaderIndex = 0
elif self.bossBattle == 1:
for suit in self.suits:
if suit.boss:
leaderIndex = self.suits.index(suit)
break
else:
maxTypeNum = -1
for suit in self.suits:
suitTypeNum = SuitDNA.getSuitType(suit.dna.name)
if maxTypeNum < suitTypeNum:
maxTypeNum = suitTypeNum
leaderIndex = self.suits.index(suit)
delay = FACEOFF_TAUNT_T
suitTrack = Parallel()
suitLeader = None
for suit in self.suits:
suit.setState('Battle')
suitIsLeader = 0
oneSuitTrack = Sequence()
oneSuitTrack.append(Func(suit.loop, 'neutral'))
oneSuitTrack.append(Func(suit.headsUp, toonPos))
if self.suits.index(suit) == leaderIndex:
suitLeader = suit
suitIsLeader = 1
if self.bossBattle == 1 and self.levelDoId in base.cr.doId2do:
level = base.cr.doId2do[self.levelDoId]
if suit.boss:
taunt = level.getBossTaunt()
else:
taunt = level.getBossBattleTaunt()
else:
taunt = SuitBattleGlobals.getFaceoffTaunt(suit.getStyleName(), suit.doId)
oneSuitTrack.append(Func(suit.setChatAbsolute, taunt, CFSpeech | CFTimeout))
destPos, destHpr = self.getActorPosHpr(suit, self.suits)
oneSuitTrack.append(Wait(delay))
if suitIsLeader == 1:
oneSuitTrack.append(Func(suit.clearChat))
oneSuitTrack.append(self.createAdjustInterval(suit, destPos, destHpr))
suitTrack.append(oneSuitTrack)
suitHeight = suitLeader.getHeight()
suitOffsetPnt = Point3(0, 0, suitHeight)
toonTrack = Parallel()
for toon in self.toons:
oneToonTrack = Sequence()
destPos, destHpr = self.getActorPosHpr(toon, self.toons)
oneToonTrack.append(Wait(delay))
oneToonTrack.append(self.createAdjustInterval(toon, destPos, destHpr, toon=1, run=1))
toonTrack.append(oneToonTrack)
if self.hasLocalToon():
MidTauntCamHeight = suitHeight * 0.66
MidTauntCamHeightLim = suitHeight - 1.8
if MidTauntCamHeight < MidTauntCamHeightLim:
MidTauntCamHeight = MidTauntCamHeightLim
TauntCamY = 18
TauntCamX = 0
TauntCamHeight = random.choice((MidTauntCamHeight, 1, 11))
camTrack = Sequence()
camTrack.append(Func(base.camera.reparentTo, suitLeader))
camTrack.append(Func(base.camLens.setMinFov, self.camFOFov/(4./3.)))
camTrack.append(Func(base.camera.setPos, TauntCamX, TauntCamY, TauntCamHeight))
camTrack.append(Func(base.camera.lookAt, suitLeader, suitOffsetPnt))
camTrack.append(Wait(delay))
camTrack.append(Func(base.camLens.setMinFov, self.camFov/(4./3.)))
camTrack.append(Func(base.camera.wrtReparentTo, self))
camTrack.append(Func(base.camera.setPos, self.camFOPos))
camTrack.append(Func(base.camera.lookAt, suit))
mtrack = Parallel(suitTrack, toonTrack)
if self.hasLocalToon():
NametagGlobals.setWant2dNametags(False)
mtrack = Parallel(mtrack, camTrack)
done = Func(callback)
track = Sequence(mtrack, done, name=name)
track.start(ts)
self.storeInterval(track, name)
return