本文整理汇总了Python中pirates.battle.WeaponGlobals.isFriendlyFire方法的典型用法代码示例。如果您正苦于以下问题:Python WeaponGlobals.isFriendlyFire方法的具体用法?Python WeaponGlobals.isFriendlyFire怎么用?Python WeaponGlobals.isFriendlyFire使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pirates.battle.WeaponGlobals
的用法示例。
在下文中一共展示了WeaponGlobals.isFriendlyFire方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: takeAim
# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import isFriendlyFire [as 别名]
def takeAim(self, av, skillId = None, ammoSkillId = None):
if not self.aimTrav:
return (None, None)
self.aimTrav.traverse(render)
numEntries = self.aimQueue.getNumEntries()
if numEntries == 0:
return (None, None)
self.aimQueue.sortEntries()
avTeam = av.getTeam()
(currentWeaponId, isWeaponDrawn) = av.getCurrentWeapon()
friendlyWeapon = WeaponGlobals.isFriendlyFireWeapon(currentWeaponId)
if skillId:
friendlySkill = WeaponGlobals.isFriendlyFire(skillId, ammoSkillId)
for i in range(numEntries):
entry = self.aimQueue.getEntry(i)
targetColl = entry.getIntoNodePath()
if targetColl.node().getIntoCollideMask().hasBitsInCommon(PiratesGlobals.BattleAimOccludeBitmask):
break
target = self.getObjectFromNodepath(targetColl)
if target:
if targetColl.hasNetPythonTag('MonstrousObject'):
dist = entry.getSurfacePoint(localAvatar)[1]
else:
dist = target.getY(av)
targetTeam = target.getTeam()
if target.gameFSM.state == 'Death':
continue
if dist < 0:
continue
if not TeamUtils.damageAllowed(target, localAvatar):
if not friendlyWeapon:
continue
if skillId and not friendlySkill:
continue
if not self.cr.battleMgr.obeysPirateCode(av, target):
if ItemGlobals.getSubtype(av.currentWeaponId) != ItemGlobals.BAYONET:
localAvatar.guiMgr.showPirateCode()
continue
return (target, dist)
continue
continue
return (None, None)
示例2: updateSkillTrayStates
# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import isFriendlyFire [as 别名]
def updateSkillTrayStates(self):
if not self.traySkillMap:
return None
if not hasattr(base, 'localAvatar'):
return None
inv = localAvatar.getInventory()
if not inv:
return None
self.numberOfItems = len(self.traySkillMap)
for i in range(self.numberOfItems):
skillId = self.traySkillMap[i]
greyOut = 0
if self.tray[i + 1].greyOut == -1:
continue
if self.tray[i + 1].showQuantity:
maxQuant = WeaponGlobals.getSkillMaxQuantity(skillId)
if maxQuant == WeaponGlobals.INF_QUANT and WeaponGlobals.canUseInfiniteAmmo(localAvatar.currentWeaponId, skillId) or WeaponGlobals.canUseInfiniteAmmo(localAvatar.getCurrentCharm(), skillId):
quantity = WeaponGlobals.INF_QUANT
else:
ammoInvId = WeaponGlobals.getSkillAmmoInventoryId(skillId)
quantity = inv.getStackQuantity(ammoInvId)
if quantity == 0:
greyOut = 1
if localAvatar.mojo < -1 * WeaponGlobals.getMojoCost(skillId):
greyOut = 1
if localAvatar.ship:
if (skillId == InventoryType.SailBroadsideLeft or skillId == InventoryType.SailBroadsideRight) and not (localAvatar.ship.broadside):
greyOut = 1
elif localAvatar.guiMgr.combatTray.skillDisabled(skillId):
greyOut = 1
rep = WeaponGlobals.getSkillReputationCategoryId(skillId)
if rep == InventoryType.DollRep:
haveFriendly = localAvatar.getFriendlyStickyTargets()
haveHostile = localAvatar.getHostileStickyTargets()
if haveFriendly and not haveHostile:
if not WeaponGlobals.isFriendlyFire(skillId):
greyOut = 1
elif not haveFriendly and haveHostile:
if WeaponGlobals.isFriendlyFire(skillId):
greyOut = 1
if self.tray[i + 1].greyOut != greyOut:
if hasattr(self.tray[i + 1], 'skillButton'):
self.tray[i + 1].greyOut = greyOut
if greyOut == 1:
self.tray[i + 1].setGeomColor(0.5, 0.5, 0.5, 1.0)
if self.tray[i + 1].showRing:
self.tray[i + 1].skillRing.meterFaceHalf1.setColorScale(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1.0)
self.tray[i + 1].skillRing.meterFaceHalf2.setColorScale(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1.0)
elif greyOut == 2:
self.tray[i + 1].setGeomColor(0.5, 0.5, 0.5, 1.0)
elif greyOut == 3:
self.tray[i + 1].setGeomColor(0.5, 0.5, 0.5, 1.0)
else:
self.tray[i + 1].setGeomColor(1, 1, 1, 1)
if self.tray[i + 1].showRing:
self.tray[i + 1].skillRing.meterFaceHalf1.clearColorScale()
self.tray[i + 1].skillRing.meterFaceHalf2.clearColorScale()
if self.isPowerRecharged:
self.continuePowerRechargeEffect()
continue
示例3: radialMenuHeartBeat
# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import isFriendlyFire [as 别名]
def radialMenuHeartBeat(self, task):
if base.mouseWatcherNode.hasMouse():
mouseData = base.win.getPointer(0)
curX = mouseData.getX()
curY = mouseData.getY()
else:
curX = 0
curY = 0
hLItem = RingMatch(self.numberOfItems, curX - self.mouseBasePosX, curY - self.mouseBasePosY)
if hLItem != self.hiLiteItem:
if hLItem < 1:
self.radialHelp.hide()
else:
self.radialHelp['text'] = PLocalizer.InventoryTypeNames[self.radialSkillMap[hLItem - 1]]
basePos = self.radial[hLItem].getPos()
self.radialHelp.setPos(basePos[0] + 0.059999999999999998, basePos[1], basePos[2] - 0.040000000000000001)
self.radialHelp.show()
if self.hiLiteItem != -1:
self.rframe[self.hiLiteItem].rollover(False)
self.hiLiteItem = hLItem
if self.hiLiteItem > 0:
self.rframe[self.hiLiteItem].rollover(True)
count = 0
for skillId in self.radialSkillMap:
greyOut = 0
count += 1
if self.weaponMode in (WeaponGlobals.FIREARM, WeaponGlobals.THROWING, WeaponGlobals.CANNON, WeaponGlobals.GRENADE):
inv = localAvatar.getInventory()
maxQuant = WeaponGlobals.getSkillMaxQuantity(skillId)
if maxQuant == WeaponGlobals.INF_QUANT and WeaponGlobals.canUseInfiniteAmmo(localAvatar.currentWeaponId, skillId) or WeaponGlobals.canUseInfiniteAmmo(localAvatar.getCurrentCharm(), skillId):
greyOut = 0
else:
ammoInvId = WeaponGlobals.getSkillAmmoInventoryId(skillId)
ammoAmt = inv.getStackQuantity(ammoInvId)
if ammoAmt <= 0:
greyOut = 1
if localAvatar.mojo < -1 * WeaponGlobals.getMojoCost(skillId):
greyOut = 1
if skillId == InventoryType.SailBroadsideLeft or skillId == InventoryType.SailBroadsideRight:
if not localAvatar.ship.broadside:
greyOut = 1
range = localAvatar.cr.battleMgr.getModifiedRechargeTime(localAvatar, skillId)
value = localAvatar.skillDiary.getTimeSpentRecharging(skillId)
if not value:
value = range
elif value >= range:
if self.rstatus[count] == 3:
startScale = self.rframe[count].getScale()
startColor = Vec4(1, 1, 1, 1)
glowColor = Vec4(0.0, 0.75, 0.0, 1.0)
buttomFrame = self.rframe[count]
self.rframe[count].update(value, range)
if value < range:
greyOut = 3
if self.rep == InventoryType.DollRep:
haveFriendly = localAvatar.getFriendlyStickyTargets()
haveHostile = localAvatar.getHostileStickyTargets()
if haveFriendly and not haveHostile:
if not WeaponGlobals.isFriendlyFire(self.radialSkillMap[count - 1]):
greyOut = 1
elif not haveFriendly and haveHostile:
if WeaponGlobals.isFriendlyFire(self.radialSkillMap[count - 1]):
greyOut = 1
if self.rstatus[count] != greyOut:
self.rstatus[count] = greyOut
if greyOut == 2:
self.radial[count].setColorScale(0.69999999999999996, 0.69999999999999996, 0.69999999999999996, 1.0)
elif greyOut == 1:
self.radial[count].setColorScale(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1.0)
self.rframe[count].meterFaceHalf1.setColorScale(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1.0)
self.rframe[count].meterFaceHalf2.setColorScale(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1.0)
elif greyOut == 3:
self.radial[count].setColorScale(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1.0)
else:
self.radial[count].setColorScale(1, 1, 1, 1)
self.radial[count].setAlphaScale(1)
self.rframe[count].meterFaceHalf1.setColorScale(1, 1, 1, 1.0)
self.rframe[count].meterFaceHalf2.setColorScale(1, 1, 1, 1.0)
greyOut == 2
return Task.cont
示例4: doAttack
# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import isFriendlyFire [as 别名]
def doAttack(self, attacker, skillId, ammoSkillId, targetId, areaIdList, pos, combo = 0, charge = 0):
attacker.battleRandom.advanceAttackSeed()
if targetId:
if WeaponGlobals.getIsShipSkill(skillId):
target = base.cr.doId2do.get(targetId)
elif WeaponGlobals.getIsDollAttackSkill(skillId):
target = base.cr.doId2do.get(targetId)
else:
target = base.cr.doId2do.get(targetId)
if hasattr(target, 'getSkillEffects'):
if WeaponGlobals.C_SPAWN in set(target.getSkillEffects()):
return WeaponGlobals.RESULT_MISS
if target and not TeamUtils.damageAllowed(localAvatar, target) and not WeaponGlobals.isFriendlyFire(skillId, ammoSkillId):
return WeaponGlobals.RESULT_NOT_AVAILABLE
else:
target = None
weaponHit = self.willWeaponHit(attacker, target, skillId, ammoSkillId, charge)
if combo == -1:
if localAvatar.wantComboTiming:
return WeaponGlobals.RESULT_MISS
if not WeaponGlobals.getNeedTarget(skillId, ammoSkillId):
return WeaponGlobals.RESULT_HIT
if not target and not areaIdList:
messenger.send('tooFar')
return WeaponGlobals.RESULT_MISS
if target and not self.obeysPirateCode(attacker, target):
if ItemGlobals.getSubtype(localAvatar.currentWeaponId) == ItemGlobals.BAYONET:
pass
if not (WeaponGlobals.getAttackClass(skillId) == WeaponGlobals.AC_COMBAT):
return WeaponGlobals.RESULT_AGAINST_PIRATE_CODE
if target and not self.targetInRange(attacker, target, skillId, ammoSkillId, pos):
return WeaponGlobals.RESULT_OUT_OF_RANGE
if target and isinstance(target, DistributedBattleNPC.DistributedBattleNPC):
if target.getGameState()[0] == 'BreakCombat':
return WeaponGlobals.RESULT_MISS
if target:
skillEffects = target.getSkillEffects()
if WeaponGlobals.C_SPAWN in skillEffects:
return WeaponGlobals.RESULT_MISS
messenger.send('properHit')
return weaponHit