コード例 #1
0
 def playAttackEffect(self, pos):
     effect = BulletEffect.getEffect()
     if effect:
         effect.reparentTo(base.effectsRoot)
         effect.setPos(self, pos)
         effect.loadObjects(6)
         effect.play()
     sfx = random.choice(self.sharkChompSfxs)
     base.playSfx(sfx, node=self.getModelRoot(), cutoff=2000)
コード例 #2
0
    def basicHitEffect(self, hitObject, pos, skillId, ammoSkillId):
        from pirates.battle import WeaponGlobals
        if self.cr:
            attacker = self.cr.doId2do.get(self.attackerId)
            aoeRadius = self.cr.battleMgr.getModifiedAttackAreaRadius(
                attacker, skillId, ammoSkillId)
        else:
            attacker = None
            aoeRadius = 0
        unlimited = bool(attacker and attacker.isLocal())
        if config.GetBool('show-aoe-radius', 0):
            s = loader.loadModel('models/misc/smiley')
            s.reparentTo(render)
            s.setPos(hitObject, pos)
            s.setScale(aoeRadius)
            s.setTransparency(1)
            s.setColorScale(1.0, 0.5, 0.5, 0.4)
        if ammoSkillId in [
                InventoryType.DefenseCannonRoundShot,
                InventoryType.DefenseCannonHotShot,
                InventoryType.DefenseCannonBomb,
                InventoryType.DefenseCannonScatterShot,
                InventoryType.DefenseCannonPowderKeg,
                InventoryType.DefenseCannonMine,
                InventoryType.DefenseCannonTargetedShot
        ]:
            if base.options.getSpecialEffectsSetting(
            ) >= base.options.SpecialEffectsLow:
                explosionEffect = ExplosionFlip.getEffect(unlimited)
                if explosionEffect:
                    explosionEffect.reparentTo(base.effectsRoot)
                    self.setEffectPos(explosionEffect, hitObject, pos)
                    explosionEffect.setScale(0.8)
                    explosionEffect.play()
            if base.options.getSpecialEffectsSetting(
            ) >= base.options.SpecialEffectsMedium:
                smokeCloudEffect = SimpleSmokeCloud.getEffect(unlimited)
                if smokeCloudEffect:
                    smokeCloudEffect.reparentTo(hitObject)
                    self.setEffectPos(smokeCloudEffect, hitObject, pos)
                    smokeCloudEffect.setEffectScale(1.0)
                    smokeCloudEffect.play()
                if localAvatar.ship and hitObject == localAvatar.ship:
                    cameraShakerEffect = CameraShaker()
                    cameraShakerEffect.wrtReparentTo(hitObject)
                    cameraShakerEffect.setPos(hitObject, pos)
                    cameraShakerEffect.shakeSpeed = 0.04
                    cameraShakerEffect.shakePower = 6.0
                    cameraShakerEffect.numShakes = 2
                    cameraShakerEffect.scalePower = 1
                    cameraShakerEffect.play(120.0)
        if ammoSkillId in [
                InventoryType.DefenseCannonBomb,
                InventoryType.DefenseCannonMineInWater
        ]:
            if base.options.getSpecialEffectsSetting(
            ) >= base.options.SpecialEffectsLow:
                effect = Explosion.getEffect(unlimited)
                if effect:
                    effect.wrtReparentTo(hitObject)
                    self.setEffectPos(effect, hitObject, pos)
                    effect.setEffectScale(1.0)
                    effect.setEffectRadius(aoeRadius / 3.0)
                    effect.play()
            if base.options.getSpecialEffectsSetting(
            ) >= base.options.SpecialEffectsMedium:
                for i in range(2):
                    effect = FlamingDebris.getEffect(unlimited)
                    if effect:
                        effect.wrtReparentTo(base.effectsRoot)
                        self.setEffectPos(effect, hitObject, pos)
                        effect.duration = 4
                        effect.velocityX = self.projVelocity[i][0]
                        effect.velocityY = self.projVelocity[i][1]
                        effect.play()

                if localAvatar.ship and hitObject == localAvatar.ship:
                    cameraShakerEffect = CameraShaker()
                    cameraShakerEffect.wrtReparentTo(hitObject)
                    cameraShakerEffect.setPos(hitObject, pos)
                    cameraShakerEffect.shakeSpeed = 0.04
                    cameraShakerEffect.shakePower = 6.0
                    cameraShakerEffect.numShakes = 2
                    cameraShakerEffect.scalePower = 1
                    cameraShakerEffect.play(300.0)
            if base.options.getSpecialEffectsSetting(
            ) >= base.options.SpecialEffectsHigh:
                effect = FlamingDebris.getEffect(unlimited)
                if effect:
                    effect.wrtReparentTo(base.effectsRoot)
                    self.setEffectPos(effect, hitObject, pos)
                    effect.duration = 4
                    effect.velocityX = self.projVelocity[i][0]
                    effect.velocityY = self.projVelocity[i][1]
                    effect.play()
        if ammoSkillId == InventoryType.DefenseCannonFireStorm:
            if base.options.getSpecialEffectsSetting(
            ) >= base.options.SpecialEffectsLow:
                for i in range(2):
                    effect = FlamingDebris.getEffect(unlimited)
                    if effect:
                        effect.wrtReparentTo(base.effectsRoot)
                        self.setEffectPos(effect, hitObject, pos)
                        effect.duration = 4
                        effect.velocityX = self.projVelocity[i][
                            0] * random.choice([-1, 1])
                        effect.velocityY = self.projVelocity[i][
                            1] * random.choice([-1, 1])
                        effect.play()

            if base.options.getSpecialEffectsSetting(
            ) >= base.options.SpecialEffectsMedium:
                for i in range(3):
                    effect = FlamingDebris.getEffect(unlimited)
                    if effect:
                        effect.wrtReparentTo(base.effectsRoot)
                        self.setEffectPos(effect, hitObject, pos)
                        effect.duration = 4
                        effect.velocityX = self.projVelocity[i][
                            0] * 2 * random.choice([-1, 1])
                        effect.velocityY = self.projVelocity[i][
                            1] * 3 * random.choice([-1, 1])
                        effect.play()

                effect = FireStormRingEffect.getEffect(unlimited)
                if effect:
                    effect.wrtReparentTo(base.effectsRoot)
                    self.setEffectPos(effect, hitObject, pos)
                    effect.setEffectScale(1.5)
                    effect.setRadius(30.0)
                    effect.setEffectColor(Vec4(0.8, 0.4, 0.2, 1.0))
                    effect.play()
            if base.options.getSpecialEffectsSetting(
            ) >= base.options.SpecialEffectsHigh:
                for i in range(4):
                    effect = FlamingDebris.getEffect(unlimited)
                    if effect:
                        effect.wrtReparentTo(base.effectsRoot)
                        self.setEffectPos(effect, hitObject, pos)
                        effect.duration = 4
                        effect.velocityX = self.projVelocity[i][
                            0] * 3 * random.choice([-1, 1])
                        effect.velocityY = self.projVelocity[i][
                            1] * 4 * random.choice([-1, 1])
                        effect.play()

        if ammoSkillId == InventoryType.DefenseCannonBullet:
            if base.options.getSpecialEffectsSetting(
            ) >= base.options.SpecialEffectsLow:
                shipDebris = BulletEffect.getEffect()
                if shipDebris:
                    shipDebris.reparentTo(base.effectsRoot)
                    shipDebris.setPos(hitObject, pos)
                    shipDebris.setScale(1.0)
                    shipDebris.loadObjects(6)
                    shipDebris.play()
        return
 def basicHitEffect(self, hitObject, pos, skillId, ammoSkillId):
     WeaponGlobals = WeaponGlobals
     import pirates.battle
     if self.cr:
         attacker = self.cr.doId2do.get(self.attackerId)
         aoeRadius = self.cr.battleMgr.getModifiedAttackAreaRadius(attacker, skillId, ammoSkillId)
     else:
         attacker = None
         aoeRadius = 0
     if attacker:
         pass
     unlimited = bool(attacker.isLocal())
     if config.GetBool('show-aoe-radius', 0):
         s = loader.loadModel('models/misc/smiley')
         s.reparentTo(render)
         s.setPos(hitObject, pos)
         s.setScale(aoeRadius)
         s.setTransparency(1)
         s.setColorScale(1.0, 0.5, 0.5, 0.40000000000000002)
     
     if ammoSkillId in [
         InventoryType.DefenseCannonRoundShot,
         InventoryType.DefenseCannonHotShot,
         InventoryType.DefenseCannonBomb,
         InventoryType.DefenseCannonScatterShot,
         InventoryType.DefenseCannonPowderKeg,
         InventoryType.DefenseCannonMine,
         InventoryType.DefenseCannonTargetedShot]:
         if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsLow:
             explosionEffect = ExplosionFlip.getEffect(unlimited)
             if explosionEffect:
                 explosionEffect.reparentTo(base.effectsRoot)
                 self.setEffectPos(explosionEffect, hitObject, pos)
                 explosionEffect.setScale(0.80000000000000004)
                 explosionEffect.play()
             
         
         if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsMedium:
             smokeCloudEffect = SimpleSmokeCloud.getEffect(unlimited)
             if smokeCloudEffect:
                 smokeCloudEffect.reparentTo(hitObject)
                 self.setEffectPos(smokeCloudEffect, hitObject, pos)
                 smokeCloudEffect.setEffectScale(1.0)
                 smokeCloudEffect.play()
             
             if localAvatar.ship and hitObject == localAvatar.ship:
                 cameraShakerEffect = CameraShaker()
                 cameraShakerEffect.wrtReparentTo(hitObject)
                 cameraShakerEffect.setPos(hitObject, pos)
                 cameraShakerEffect.shakeSpeed = 0.040000000000000001
                 cameraShakerEffect.shakePower = 6.0
                 cameraShakerEffect.numShakes = 2
                 cameraShakerEffect.scalePower = 1
                 cameraShakerEffect.play(120.0)
             
         
     
     if ammoSkillId in [
         InventoryType.DefenseCannonBomb,
         InventoryType.DefenseCannonMineInWater]:
         if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsLow:
             effect = Explosion.getEffect(unlimited)
             if effect:
                 effect.wrtReparentTo(hitObject)
                 self.setEffectPos(effect, hitObject, pos)
                 effect.setEffectScale(1.0)
                 effect.setEffectRadius(aoeRadius / 3.0)
                 effect.play()
             
         
         if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsMedium:
             for i in range(2):
                 effect = FlamingDebris.getEffect(unlimited)
                 if effect:
                     effect.wrtReparentTo(base.effectsRoot)
                     self.setEffectPos(effect, hitObject, pos)
                     effect.duration = 4
                     effect.velocityX = self.projVelocity[i][0]
                     effect.velocityY = self.projVelocity[i][1]
                     effect.play()
                     continue
             
             if localAvatar.ship and hitObject == localAvatar.ship:
                 cameraShakerEffect = CameraShaker()
                 cameraShakerEffect.wrtReparentTo(hitObject)
                 cameraShakerEffect.setPos(hitObject, pos)
                 cameraShakerEffect.shakeSpeed = 0.040000000000000001
                 cameraShakerEffect.shakePower = 6.0
                 cameraShakerEffect.numShakes = 2
                 cameraShakerEffect.scalePower = 1
                 cameraShakerEffect.play(300.0)
             
         
         if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsHigh:
             effect = FlamingDebris.getEffect(unlimited)
             if effect:
                 effect.wrtReparentTo(base.effectsRoot)
                 self.setEffectPos(effect, hitObject, pos)
                 effect.duration = 4
                 effect.velocityX = self.projVelocity[i][0]
                 effect.velocityY = self.projVelocity[i][1]
                 effect.play()
             
         
     
     if ammoSkillId == InventoryType.DefenseCannonFireStorm:
         if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsLow:
             for i in range(2):
                 effect = FlamingDebris.getEffect(unlimited)
                 if effect:
                     effect.wrtReparentTo(base.effectsRoot)
                     self.setEffectPos(effect, hitObject, pos)
                     effect.duration = 4
                     effect.velocityX = self.projVelocity[i][0] * random.choice([
                         -1,
                         1])
                     effect.velocityY = self.projVelocity[i][1] * random.choice([
                         -1,
                         1])
                     effect.play()
                     continue
             
         
         if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsMedium:
             for i in range(3):
                 effect = FlamingDebris.getEffect(unlimited)
                 if effect:
                     effect.wrtReparentTo(base.effectsRoot)
                     self.setEffectPos(effect, hitObject, pos)
                     effect.duration = 4
                     effect.velocityX = self.projVelocity[i][0] * 2 * random.choice([
                         -1,
                         1])
                     effect.velocityY = self.projVelocity[i][1] * 3 * random.choice([
                         -1,
                         1])
                     effect.play()
                     continue
             
             effect = FireStormRingEffect.getEffect(unlimited)
             if effect:
                 effect.wrtReparentTo(base.effectsRoot)
                 self.setEffectPos(effect, hitObject, pos)
                 effect.setEffectScale(1.5)
                 effect.setRadius(30.0)
                 effect.setEffectColor(Vec4(0.80000000000000004, 0.40000000000000002, 0.20000000000000001, 1.0))
                 effect.play()
             
         
         if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsHigh:
             for i in range(4):
                 effect = FlamingDebris.getEffect(unlimited)
                 if effect:
                     effect.wrtReparentTo(base.effectsRoot)
                     self.setEffectPos(effect, hitObject, pos)
                     effect.duration = 4
                     effect.velocityX = self.projVelocity[i][0] * 3 * random.choice([
                         -1,
                         1])
                     effect.velocityY = self.projVelocity[i][1] * 4 * random.choice([
                         -1,
                         1])
                     effect.play()
                     continue
             
         
     
     if ammoSkillId == InventoryType.DefenseCannonBullet:
         if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsLow:
             shipDebris = BulletEffect.getEffect()
             if shipDebris:
                 shipDebris.reparentTo(base.effectsRoot)
                 shipDebris.setPos(hitObject, pos)
                 shipDebris.setScale(1.0)
                 shipDebris.loadObjects(6)
                 shipDebris.play()