当前位置: 首页>>代码示例>>Python>>正文


Python WeaponGlobals.getAttackProjectilePower方法代码示例

本文整理汇总了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)
开发者ID:Puggyblue999,项目名称:PiratesOfTheCarribeanOnline,代码行数:36,代码来源:DistributedShipBroadside.py

示例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:
#.........这里部分代码省略.........
开发者ID:XamarinDeveloper,项目名称:Pirates-Online-Source,代码行数:103,代码来源:Cannon.py


注:本文中的pirates.battle.WeaponGlobals.getAttackProjectilePower方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。