本文整理汇总了Python中toontown.toon.NPCToons.getNPCTrackLevelHpRarity方法的典型用法代码示例。如果您正苦于以下问题:Python NPCToons.getNPCTrackLevelHpRarity方法的具体用法?Python NPCToons.getNPCTrackLevelHpRarity怎么用?Python NPCToons.getNPCTrackLevelHpRarity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类toontown.toon.NPCToons
的用法示例。
在下文中一共展示了NPCToons.getNPCTrackLevelHpRarity方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __generateSOS
# 需要导入模块: from toontown.toon import NPCToons [as 别名]
# 或者: from toontown.toon.NPCToons import getNPCTrackLevelHpRarity [as 别名]
def __generateSOS(self, difficulty):
g = lambda : random.choice(NPCToons.FOnpcFriends.keys())
v = g()
getStars = lambda x: NPCToons.getNPCTrackLevelHpRarity(x)[-1]
maxStars = min(2, int(math.ceil(difficulty / 5.0)))
minStars = max(0, maxStars - 1)
while not minStars <= getStars(v) <= maxStars:
v = g()
return v
示例2: __generateSOS
# 需要导入模块: from toontown.toon import NPCToons [as 别名]
# 或者: from toontown.toon.NPCToons import getNPCTrackLevelHpRarity [as 别名]
def __generateSOS(self, difficulty):
g = lambda: random.choice(NPCToons.FOnpcFriends.keys())
v = g()
getStars = lambda x: NPCToons.getNPCTrackLevelHpRarity(x)[-1]
maxStars = min(2, int(math.ceil(difficulty / 5.)))
minStars = max(0, maxStars - 1)
while not (minStars <= getStars(v) <= maxStars):
v = g()
self.notify.info('selected SOS %s (stars = %s)' % (v, getStars(v)))
return v
示例3: setValues
# 需要导入模块: from toontown.toon import NPCToons [as 别名]
# 或者: from toontown.toon.NPCToons import getNPCTrackLevelHpRarity [as 别名]
def setValues(self, index, track, level = None, numTargets = None, targetIndex = None, localNum = None):
self.notify.debug('Toon Panel setValues: index=%s track=%s level=%s numTargets=%s targetIndex=%s localNum=%s' % (index,
track,
level,
numTargets,
targetIndex,
localNum))
self.undecidedText.hide()
self.sosText.hide()
self.fireText.hide()
self.gagNode.hide()
self.whichText.hide()
self.passNode.hide()
self.cleanupSosHead()
self.hoverButton.unbind(DGG.ENTER)
if self.hasGag:
self.gag.removeNode()
self.hasGag = 0
if track == BattleBase.NO_ATTACK or track == BattleBase.UN_ATTACK:
self.undecidedText.show()
elif track == BattleBase.PASS_ATTACK:
self.passNode.show()
elif track == BattleBase.FIRE:
self.fireText.show()
self.whichText.show()
self.whichText['text'] = self.determineWhichText(numTargets, targetIndex, localNum, index)
elif track == BattleBase.NPCSOS:
self.sosHead = createNPCToonHead(targetIndex)
self.sosHead.reparentTo(self)
self.sosHead.setPos(0.1, 0, 0.045)
self.sosHead.setScale(0.24)
track, level, hp, rarity = NPCToons.getNPCTrackLevelHpRarity(targetIndex)
sosType = self.sosTracks[track]
if track == NPC_RESTOCK_GAGS:
if level == -1:
sosType += ' All'
else:
sosType += ' ' + self.sosTracks[level]
if hp:
hpString = TTLocalizer.BattleSOSPopupHP % (TTLocalizer.BattleSOSPopupHeal if track == HEAL_TRACK else TTLocalizer.BattleSOSPopupHarm, hp)
sosType = TextEncoder.upper(sosType)
count = max(0, self.avatar.getNPCFriendCount(targetIndex) - 1)
info = TTLocalizer.BattleSOSPopup % (sosType, NPCToons.getNPCName(targetIndex), hpString if hp else '', rarity, count)
self.hoverButton.bind(DGG.ENTER, self.battle.showRolloverFrame, extraArgs=[self, TTLocalizer.BattleHoverSos, info])
elif track == BattleBase.SOS or track == BattleBase.PETSOS:
self.sosText.show()
elif track >= MIN_TRACK_INDEX and track <= MAX_TRACK_INDEX:
self.undecidedText.hide()
self.passNode.hide()
self.gagNode.show()
invButton = base.localAvatar.inventory.buttonLookup(track, level)
self.gag = invButton.instanceUnderNode(self.gagNode, 'gag')
self.gag.setScale(0.8)
self.gag.setPos(0, 0, 0.02)
self.hasGag = 1
if self.avatar:
curExp, nextExp = self.avatar.inventory.getCurAndNextExpValues(track)
organic = self.avatar.checkGagBonus(track, level)
damage = int(getAvPropDamage(track, level, curExp, organic))
numItems = max(0, self.avatar.inventory.numItem(track, level) - 1)
info = TTLocalizer.BattleGagPopup % (self.avatar.inventory.getToonupDmgStr(track, 0), damage, numItems)
self.hoverButton.bind(DGG.ENTER, self.battle.showRolloverFrame, extraArgs=[self, TTLocalizer.BattleHoverGag, info])
if self.avatar.checkGagBonus(track, level):
self.gag.setColor((1, 0, 0, 1) if track == 1 and level == 5 else (0, 1, 0, 1))
if numTargets is not None and targetIndex is not None and localNum is not None:
self.whichText.show()
self.whichText['text'] = self.determineWhichText(numTargets, targetIndex, localNum, index)
else:
self.notify.error('Bad track value: %s' % track)