本文整理汇总了Python中pirates.battle.WeaponGlobals.getNumHits方法的典型用法代码示例。如果您正苦于以下问题:Python WeaponGlobals.getNumHits方法的具体用法?Python WeaponGlobals.getNumHits怎么用?Python WeaponGlobals.getNumHits使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pirates.battle.WeaponGlobals
的用法示例。
在下文中一共展示了WeaponGlobals.getNumHits方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getCombo
# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getNumHits [as 别名]
def getCombo(self):
totalCombo = 0
totalDamage = 0
numAttackers = 0
for avId in self.timers:
numAttackers += 1
for entry in self.timers[avId]:
skillId = entry[self.SKILLID_INDEX]
numHits = WeaponGlobals.getNumHits(skillId)
totalCombo += numHits
totalDamage += entry[self.DAMAGE_INDEX]
return (totalCombo, totalDamage, numAttackers)
示例2: hasCombo
# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getNumHits [as 别名]
def hasCombo(self, avId):
comboHistory = self.timers.get(avId)
if comboHistory:
totalCombo = 0
for entry in comboHistory:
skillId = entry[self.SKILLID_INDEX]
numHits = WeaponGlobals.getNumHits(skillId)
totalCombo += numHits
if totalCombo > 1:
return 1
return 0
示例3: useTargetedSkill
# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getNumHits [as 别名]
def useTargetedSkill(self, skillId, ammoSkillId, skillResult, targetId, areaIdList, attackerEffects, targetEffects, areaIdEffects, itemEffects, timestamp, pos, charge = 0, localSignal = 0):
if WeaponGlobals.isSelfUseSkill(skillId) and not localSignal:
selfUse = True
else:
selfUse = False
if localSignal:
target = self.cr.doId2do.get(targetId)
if target and target != self and WeaponGlobals.isBreakAttackComboSkill(skillId) and skillResult == WeaponGlobals.RESULT_HIT:
levelGrade = self.cr.battleMgr.getModifiedExperienceGrade(self, target)
self.guiMgr.combatTray.updateSkillCharges(levelGrade)
if not self.isLocal() and localSignal and WeaponGlobals.getSkillTrack(skillId) == WeaponGlobals.DEFENSE_SKILL_INDEX or selfUse:
multiHits = []
numHits = WeaponGlobals.getNumHits(skillId)
hitTiming = WeaponGlobals.getMultiHitAttacks(skillId)
if hitTiming:
multiHits += hitTiming
if ammoSkillId:
numHits += WeaponGlobals.getNumHits(ammoSkillId) - 1
hitTiming = WeaponGlobals.getMultiHitAttacks(ammoSkillId)
if hitTiming:
multiHits += hitTiming
if not selfUse or self.isNpc:
if not targetId and areaIdList:
self.playSkillMovie(skillId, ammoSkillId, skillResult, charge, areaIdList[0], areaIdList)
else:
self.playSkillMovie(skillId, ammoSkillId, skillResult, charge, targetId, areaIdList)
if skillResult == WeaponGlobals.RESULT_REFLECTED or selfUse:
target = self
targetId = self.getDoId()
elif skillResult == WeaponGlobals.RESULT_BLOCKED:
target = None
else:
target = self.currentTarget
if target and targetId:
if multiHits and numHits:
multiHitEffects = self.packMultiHitEffects(targetEffects, numHits)
for i in range(numHits):
target.targetedWeaponHit(skillId, ammoSkillId, skillResult, multiHitEffects[i], self, pos, charge, multiHits[i], i, itemEffects = itemEffects)
else:
target.targetedWeaponHit(skillId, ammoSkillId, skillResult, targetEffects, self, pos, charge, itemEffects = itemEffects)
for (targetId, areaEffects) in zip(areaIdList, areaIdEffects):
target = self.cr.doId2do.get(targetId)
if target:
if multiHits and numHits:
multiHitEffects = self.packMultiHitEffects(areaEffects, numHits)
for i in range(numHits):
target.targetedWeaponHit(skillId, ammoSkillId, skillResult, multiHitEffects[i], self, pos, charge, multiHits[i], i, itemEffects = itemEffects)
else:
target.targetedWeaponHit(skillId, ammoSkillId, skillResult, areaEffects, self, pos, charge, itemEffects = itemEffects)
if not (self.currentTarget) and not areaIdList:
self.playHitSound(skillId, ammoSkillId, WeaponGlobals.RESULT_MISS)
示例4: checkComboExpired
# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getNumHits [as 别名]
def checkComboExpired(self, avId, weaponId, skillId, skillResult):
attacker = base.cr.doId2do.get(avId)
if not attacker:
return 0
if skillId in self.EXCLUDED_SKILLS:
return 0
skillInfo = WeaponGlobals.getSkillAnimInfo(skillId)
if not skillInfo:
return 0
barTime = self.TimingCache.get(skillId, None)
if barTime is None:
anim = skillInfo[WeaponGlobals.PLAYABLE_INDEX]
skillAnim = getattr(base.cr.combatAnims, anim)(attacker, skillId, 0, 0, None, skillResult)
if skillAnim == None:
return 1
barTime = skillAnim.getDuration()
self.TimingCache[skillId] = barTime
curTime = globalClock.getFrameTime()
for attackerId in self.timers:
comboLength = len(self.timers[attackerId])
lastEntry = self.timers[attackerId][comboLength - 1]
lastSkillId = lastEntry[self.SKILLID_INDEX]
timestamp = lastEntry[self.TIMESTAMP_INDEX]
if (barTime + timestamp - curTime) + self.TOLERANCE > 0:
if attackerId != avId:
return 0
subtypeId = ItemGlobals.getSubtype(weaponId)
if not subtypeId:
return 0
repId = WeaponGlobals.getSkillReputationCategoryId(skillId)
if not repId:
return 0
if repId != WeaponGlobals.getRepId(weaponId):
return 0
comboChain = self.COMBO_ORDER.get(subtypeId)
if comboChain:
if skillId in self.SPECIAL_SKILLS.get(repId, []):
if lastSkillId not in self.SPECIAL_SKILLS.get(repId, []):
return 0
elif lastSkillId == skillId:
numHits = WeaponGlobals.getNumHits(skillId)
if comboLength < numHits:
return 0
elif comboLength >= numHits:
preMultihitEntry = self.timers[attackerId][comboLength - numHits]
preMultihitSkillId = preMultihitEntry[self.SKILLID_INDEX]
if preMultihitSkillId != skillId:
return 0
elif skillId in comboChain:
index = comboChain.index(skillId)
if index > 0:
requisiteAttack = comboChain[index - 1]
if lastSkillId == requisiteAttack:
return 0
currentAttack = comboChain[index]
if lastSkillId == skillId:
return 0
elif not comboLength:
return 0
return 1