本文整理汇总了Python中pirates.battle.WeaponGlobals.getAttackProjectilePower方法的典型用法代码示例。如果您正苦于以下问题:Python WeaponGlobals.getAttackProjectilePower方法的具体用法?Python WeaponGlobals.getAttackProjectilePower怎么用?Python WeaponGlobals.getAttackProjectilePower使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pirates.battle.WeaponGlobals
的用法示例。
在下文中一共展示了WeaponGlobals.getAttackProjectilePower方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _DistributedShipBroadside__requestAttack
# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getAttackProjectilePower [as 别名]
def _DistributedShipBroadside__requestAttack(self, index, side, targetPos, flightTime):
if side == 0:
if self.leftBroadside and self.leftBroadsideConfig:
cannonList = self.leftBroadside
cannonConfig = self.leftBroadsideConfig
skillId = EnemySkills.LEFT_BROADSIDE
elif side == 1:
if self.rightBroadside and self.rightBroadsideConfig:
cannonList = self.rightBroadside
cannonConfig = self.rightBroadsideConfig
skillId = EnemySkills.RIGHT_BROADSIDE
ammoSkillId = self.ammoType
if cannonList and cannonConfig:
cannonList[index].playFire()
cballSpawnPoint = cannonList[index].locator
cballSpawnPoint.setP(render, 0)
self.playFireEffect(cballSpawnPoint, ammoSkillId)
if not WeaponGlobals.isProjectileSkill(skillId, ammoSkillId):
return None
pos = cballSpawnPoint.getPos(render) + Vec3(0, -25, 0)
if targetPos:
self.playAttack(skillId, ammoSkillId, pos, targetPos = targetPos, flightTime = flightTime)
else:
m = cballSpawnPoint.getMat(self)
power = WeaponGlobals.getAttackProjectilePower(ammoSkillId) * CannonGlobals.BROADSIDE_POWERMOD
if side == 1:
startVel = m.xformVec(Vec3(0, -power, 90))
else:
startVel = m.xformVec(Vec3(0, -power, 90))
self.playAttack(skillId, ammoSkillId, pos, startVel)
示例2: playAttack
# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getAttackProjectilePower [as 别名]
def playAttack(self, skillId, ammoSkillId, projectileHitEvent, targetPos = None, wantCollisions = 0, flightTime = None, preciseHit = False, buffs = [], timestamp = None, numShots = 1, shotNum = -1):
if base.cr.wantSpecialEffects != 0:
self.playFireEffect(ammoSkillId, buffs)
if ammoSkillId == InventoryType.CannonGrapeShot:
numShots = 7
disperseAmount = (35, 0.0)
else:
disperseAmount = (40, 20.0)
wantCollisions = 1
self.ammoSequence = self.ammoSequence + 1 & 255
if ammoSkillId in (InventoryType.DefenseCannonScatterShot, InventoryType.CannonGrapeShot):
scatterOffset = random.uniform(0, 360)
for i in range(numShots):
ammo = self.getProjectile(ammoSkillId, projectileHitEvent, buffs)
collNode = None
if self.localAvatarUsingWeapon or wantCollisions:
collNode = ammo.getCollNode()
collNode.reparentTo(render)
if shotNum > -1:
self.shotNum = shotNum
else:
self.shotNum += 1
if self.shotNum > 100000:
self.shotNum = 0
ammo.setTag('shotNum', str(self.shotNum))
ammo.setTag('ammoSequence', str(self.ammoSequence))
ammo.setTag('skillId', str(int(skillId)))
ammo.setTag('ammoSkillId', str(int(ammoSkillId)))
if self.av:
ammo.setTag('attackerId', str(self.av.doId))
if hasattr(self, 'fortId'):
ammo.setTag('fortId', str(self.fortId))
if hasattr(self, 'ship') and self.ship and hasattr(self.ship, 'doId'):
setShipTag = True
if setShipTag:
ammo.setTag('shipId', str(self.ship.doId))
startPos = self.cannonExitPoint.getPos(render)
ammo.setPos(startPos)
ammo.setH(self.hNode.getH(render))
ammo.setP(self.pivot.getP(render))
endPlaneZ = -100
if startPos[2] < endPlaneZ:
self.notify.warning('bad startPos Z: %s' % startPos[2])
return None
m = ammo.getMat(render)
curPower = WeaponGlobals.getAttackProjectilePower(skillId, ammoSkillId) * 0.59999999999999998
if targetPos is None:
if ammoSkillId in (InventoryType.DefenseCannonScatterShot, InventoryType.CannonGrapeShot) and i > 0:
dist = Vec3(math.fabs(random.gauss(0, disperseAmount[0])) + disperseAmount[1], curPower, 0.0)
angle = Mat3.rotateMatNormaxis(random.uniform(0, 360 / numShots) + i * 360 / (numShots - 1) + scatterOffset, Vec3.forward())
dist = angle.xform(dist)
startVel = m.xformVec(dist)
else:
startVel = m.xformVec(Vec3(0, curPower, 0))
if self.ship:
fvel = self.ship.smoother.getSmoothForwardVelocity() * 0.5
faxis = self.ship.smoother.getForwardAxis()
self.baseVel = faxis * fvel
startVel += self.baseVel
else:
startVel = m.xformVec(Vec3(0, 20, 2))
def attachRope():
if ammoSkillId == InventoryType.CannonGrappleHook and self.cannonPost:
rope = self.getRope()
rope.reparentTo(ammo)
rope.setup(3, ((None, Point3(0, 0, 0)), (self.cannonPost, Point3(2, 5, 10)), (self.cannonPost, Point3(2, 0, 0))))
if preciseHit:
if flightTime is None:
flightTime = CannonGlobals.AI_FIRE_TIME
pi = ProjectileInterval(ammo, startPos = startPos, endPos = targetPos, duration = flightTime, collNode = collNode)
elif targetPos:
if flightTime is None:
flightTime = CannonGlobals.getCannonballFlightTime(startPos, targetPos, curPower)
pi = ProjectileInterval(ammo, endZ = endPlaneZ, startPos = startPos, wayPoint = targetPos, timeToWayPoint = flightTime, gravityMult = 2.5, collNode = collNode)
else:
pi = ProjectileInterval(ammo, startPos = startPos, startVel = startVel, endZ = endPlaneZ, gravityMult = 4.0, collNode = collNode)
if self.localAvatarUsingWeapon or wantCollisions:
if base.cr.cannonballCollisionDebug == 1 or base.cr.cannonballCollisionDebug == 3:
addFunc = Func(base.cTrav.addCollider, collNode, ammo.collHandler)
delFunc = Func(base.cTrav.removeCollider, collNode)
else:
addFunc = Wait(0)
delFunc = Wait(0)
s = Sequence(addFunc, Func(attachRope), pi, Func(ammo.destroy), delFunc)
else:
#.........这里部分代码省略.........