def startLavaEruption(self): self.stopLavaEruption() duration = random.randint(10, 20) base.playSfx(self.eruptionSfx[0], node=self, cutoff=5000) self.eruption = LavaEruption() self.eruption.duration = duration self.eruption.setEffectScale(1.0) self.eruption.reparentTo(self) self.eruption.play() if self.inEditor or base.options.getSpecialEffectsSetting( ) >= base.options.SpecialEffectsMedium: self.cameraShaker = CameraShaker() self.cameraShaker.reparentTo(self) self.cameraShaker.shakeSpeed = 0.05 self.cameraShaker.shakePower = 0.2 self.cameraShaker.scalePower = True self.cameraShaker.numShakes = duration * 10 self.cameraShaker.play(2200.0) if self.inEditor or base.options.getSpecialEffectsSetting( ) >= base.options.SpecialEffectsHigh: self.eruptionSmoke = EruptionSmoke() self.eruptionSmoke.duration = duration self.eruptionSmoke.reparentTo(self) self.eruptionSmoke.setEffectScale(1.0) self.eruptionSmoke.play() self.splats = LavaSplats() self.splats.duration = duration self.splats.setEffectScale(1.0) self.splats.reparentTo(self) self.splats.play() taskMgr.doMethodLater(duration + 10.0, self.stopLavaEruption, 'stopLavaEruptionTask')
def start(self): self._shootTaskString = 'TutorialInteriorCannonShoot' self._hitTaskString = 'TutorialInteriorCannonHit' if self._cannonDelay is None: self._shootTask() else: taskMgr.doMethodLater(self._cannonDelay, self._shootTask, uniqueName(self._shootTaskString)) CameraShaker.setTutorialInteriorScale(0.20000000000000001)
def _startCutscene(self): if not base.win.getGsg(): self.skipNow() return if self.cr: localAvatar.stopCombatMusic() base.musicMgr.requestCurMusicFadeOut(1.0, 0.0) aspect2d.hide() for actor in self._actors: actor.startCutscene(self._locators) CameraShaker.setCutsceneScale(0.1) self.acceptOnce('escape', self._skip) if self.startedCallback: self.startedCallback() render.prepareScene(base.win.getGsg())
def startLavaEruption(self): self.stopLavaEruption() duration = random.randint(10, 20) base.playSfx(self.eruptionSfx[0], node = self, cutoff = 5000) self.eruption = LavaEruption() self.eruption.duration = duration self.eruption.setEffectScale(1.0) self.eruption.reparentTo(self) self.eruption.play() if self.inEditor or base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsMedium: self.cameraShaker = CameraShaker() self.cameraShaker.reparentTo(self) self.cameraShaker.shakeSpeed = 0.050000000000000003 self.cameraShaker.shakePower = 0.20000000000000001 self.cameraShaker.scalePower = True self.cameraShaker.numShakes = duration * 10 self.cameraShaker.play(2200.0) if self.inEditor or base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsHigh: self.eruptionSmoke = EruptionSmoke() self.eruptionSmoke.duration = duration self.eruptionSmoke.reparentTo(self) self.eruptionSmoke.setEffectScale(1.0) self.eruptionSmoke.play() self.splats = LavaSplats() self.splats.duration = duration self.splats.setEffectScale(1.0) self.splats.reparentTo(self) self.splats.play() taskMgr.doMethodLater(duration + 10.0, self.stopLavaEruption, 'stopLavaEruptionTask')
def explode(self): base.playSfx(self.explosionSfx, node = self, cutoff = 200) if self.sparks: self.sparks.stopLoop() self.sparks = None self.prop.stash() self.explosionVfx = ExplosionFlip.getEffect(unlimited = True) if self.explosionVfx: self.explosionVfx.reparentTo(self) self.explosionVfx.setScale(1.5) self.explosionVfx.play() self.smokeVfx = SimpleSmokeCloud.getEffect(unlimited = True) if self.smokeVfx: self.smokeVfx.reparentTo(self) self.smokeVfx.setPos(0, 0, 1) self.smokeVfx.setEffectScale(1.0) self.smokeVfx.play() self.dustRingVfx = DustRing.getEffect(unlimited = True) if self.dustRingVfx: self.dustRingVfx.reparentTo(self) self.dustRingVfx.setPos(0, 0, -2) self.dustRingVfx.play() cameraShakerEffect = CameraShaker() cameraShakerEffect.reparentTo(self) cameraShakerEffect.shakeSpeed = 0.059999999999999998 cameraShakerEffect.shakePower = 4.0 cameraShakerEffect.scalePower = True cameraShakerEffect.numShakes = 2 cameraShakerEffect.scalePower = 1.0 cameraShakerEffect.play(120.0) self.splintersVfx = ShipSplintersA.getEffect(unlimited = True) if self.splintersVfx: self.splintersVfx.reparentTo(self) self.splintersVfx.setPos(0, 0, -2) self.splintersVfx.play() shockwaveRingEffect = ShockwaveRing.getEffect(unlimited = True) if shockwaveRingEffect: shockwaveRingEffect.reparentTo(self) shockwaveRingEffect.setPos(0, 0, -2) shockwaveRingEffect.size = 80 shockwaveRingEffect.play()
def _finishCutscene(self): if self.cr: if base.musicMgr.current: vol = base.musicMgr.current.volume base.musicMgr.requestCurMusicFadeIn(3.0, vol) self.ignore('escape') CameraShaker.clearCutsceneScale() for actor in self._actors: actor.finishCutscene() base.sfxManagerList[0].stopAllSounds() aspect2d.show() if self.oldTodState: if self.cr: self.cr.timeOfDayManager.setEnvironment(self.oldTodState) else: base.pe.changeTimeOfDay() messenger.send('cutscene-finish')
def _startCutscene(self): if not base.win.getGsg(): self.skipNow() return None if self.cr: localAvatar.stopCombatMusic() base.musicMgr.requestCurMusicFadeOut(1.0, 0.0) aspect2d.hide() for actor in self._actors: actor.startCutscene(self._locators) CameraShaker.setCutsceneScale(0.10000000000000001) self.acceptOnce('escape', self._skip) if self.startedCallback: self.startedCallback() render.prepareScene(base.win.getGsg())
def _playHitEffect(pos, hitObject, skillId, task=None): attackerId = 0 objType = None ProjectileEffect(base.cr, attackerId, hitObject, objType, pos, skillId, InventoryType.GrenadeExplosion) shakeCamera = False if localAvatar.ship: shakeCamera = False if localAvatar.style.tutorial >= PiratesGlobals.TUT_GOT_SEACHEST: if localAvatar.gameFSM.lockFSM: shakeCamera = False if shakeCamera: cameraShaker = CameraShaker() cameraShaker.reparentTo(render) cameraShaker.shakeSpeed = 0.04 cameraShaker.shakePower = 1.0 cameraShaker.numShakes = 3 cameraShaker.scalePower = 1 cameraShaker.play(400.0) messenger.send(CannonballHitEvent) return
def _playHitEffect(pos, hitObject, skillId, task = None): attackerId = 0 objType = None ProjectileEffect(base.cr, attackerId, hitObject, objType, pos, skillId, InventoryType.GrenadeExplosion) shakeCamera = False if localAvatar.ship: shakeCamera = False if localAvatar.style.tutorial >= PiratesGlobals.TUT_GOT_SEACHEST: if localAvatar.gameFSM.lockFSM: shakeCamera = False if shakeCamera: cameraShaker = CameraShaker() cameraShaker.reparentTo(render) cameraShaker.shakeSpeed = 0.040000000000000001 cameraShaker.shakePower = 1.0 cameraShaker.numShakes = 3 cameraShaker.scalePower = 1 cameraShaker.play(400.0) messenger.send(CannonballHitEvent)
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.CannonRoundShot, InventoryType.CannonChainShot, InventoryType.CannonBullet, InventoryType.CannonSkull, InventoryType.CannonBarShot, InventoryType.CannonFury, InventoryType.CannonFirebrand, InventoryType.CannonFlamingSkull, InventoryType.CannonThunderbolt ]: hitSfxNames = [ SoundGlobals.SFX_FX_WOOD_IMPACT_01, SoundGlobals.SFX_FX_WOOD_IMPACT_02, SoundGlobals.SFX_FX_WOOD_IMPACT_03, SoundGlobals.SFX_FX_WOOD_IMPACT_04, SoundGlobals.SFX_FX_WOOD_SHATTER_02, SoundGlobals.SFX_FX_WOOD_SHATTER_03 ] sfx = loadSfx(random.choice(hitSfxNames)) base.playSfx(sfx, node=hitObject, cutoff=1500) if base.options.getSpecialEffectsSetting( ) >= base.options.SpecialEffectsLow: explosionEffect = ExplosionFlip.getEffect(unlimited) if explosionEffect: explosionEffect.reparentTo(base.effectsRoot) explosionEffect.setPos(hitObject, pos) explosionEffect.setScale(0.80000000000000004) explosionEffect.play() if base.options.getSpecialEffectsSetting( ) >= base.options.SpecialEffectsMedium: smokeCloudEffect = SimpleSmokeCloud.getEffect(unlimited) if smokeCloudEffect: smokeCloudEffect.reparentTo(hitObject) smokeCloudEffect.setPos(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 == InventoryType.CannonExplosive: if base.options.getSpecialEffectsSetting( ) >= base.options.SpecialEffectsLow: effect = Explosion.getEffect(unlimited) if effect: effect.wrtReparentTo(hitObject) effect.setPos(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) effect.setPos(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) effect.setPos(hitObject, pos) effect.duration = 4 effect.velocityX = self.projVelocity[i][0] effect.velocityY = self.projVelocity[i][1] effect.play() if ammoSkillId == InventoryType.CannonThunderbolt: if base.options.getSpecialEffectsSetting( ) >= base.options.SpecialEffectsLow: effect = LightningStrike.getEffect(unlimited) if effect: effect.wrtReparentTo(base.effectsRoot) effect.setPos(hitObject, pos) effect.play() if base.options.getSpecialEffectsSetting( ) >= base.options.SpecialEffectsMedium: flashEffect = FlashEffect() flashEffect.wrtReparentTo(base.effectsRoot) flashEffect.setScale(600) flashEffect.setPos(hitObject, pos) flashEffect.effectColor = Vec4(0.5, 0.80000000000000004, 1, 1) flashEffect.fadeTime = 0.29999999999999999 flashEffect.play() if localAvatar.ship and hitObject == localAvatar.ship: cameraShakerEffect = CameraShaker() cameraShakerEffect.wrtReparentTo(hitObject) cameraShakerEffect.setPos(hitObject, pos) cameraShakerEffect.shakeSpeed = 0.059999999999999998 cameraShakerEffect.shakePower = 4.0 cameraShakerEffect.numShakes = 2 cameraShakerEffect.scalePower = 1 cameraShakerEffect.play(300.0) if base.options.getSpecialEffectsSetting( ) >= base.options.SpecialEffectsHigh: shipSplintersAEffect = ShipSplintersA.getEffect(unlimited) if shipSplintersAEffect: shipSplintersAEffect.wrtReparentTo(hitObject) shipSplintersAEffect.setPos(hitObject, pos) shipSplintersAEffect.play() elif ammoSkillId == InventoryType.CannonFury: flashEffect = FlashEffect() flashEffect.wrtReparentTo(base.effectsRoot) flashEffect.setScale(300) flashEffect.setPos(hitObject, pos) flashEffect.effectColor = Vec4(0.5, 0.80000000000000004, 1, 1) flashEffect.fadeTime = 0.25 flashEffect.play() elif ammoSkillId == InventoryType.GrenadeExplosion: explosionEffect = ExplosionFlip.getEffect(unlimited) if explosionEffect: explosionEffect.reparentTo(base.effectsRoot) explosionEffect.setPos(hitObject, pos) explosionEffect.setScale(1.0) explosionEffect.play() self.playSfx(ammoSkillId, explosionEffect) smokeCloudEffect = SmokeCloud.getEffect(unlimited) if smokeCloudEffect: smokeCloudEffect.reparentTo(hitObject) smokeCloudEffect.setPos(hitObject, pos) smokeCloudEffect.setScale(1.0) smokeCloudEffect.spriteScale = 1.0 smokeCloudEffect.radius = 7.0 smokeCloudEffect.play() if base.options.getSpecialEffectsSetting( ) >= base.options.SpecialEffectsMedium: shockwaveRingEffect = ShockwaveRing.getEffect(unlimited) if shockwaveRingEffect: shockwaveRingEffect.reparentTo(base.effectsRoot) shockwaveRingEffect.setPos(hitObject, pos) shockwaveRingEffect.size = aoeRadius * 4 shockwaveRingEffect.play() flashEffect = MuzzleFlash.getEffect(unlimited) if flashEffect: flashEffect.reparentTo(base.effectsRoot) flashEffect.flash.setScale(100) flashEffect.setPos(hitObject, pos) flashEffect.startCol = Vec4(0.69999999999999996, 0.69999999999999996, 0.69999999999999996, 1) flashEffect.fadeTime = 0.20000000000000001 flashEffect.play() cameraShakerEffect = CameraShaker() cameraShakerEffect.reparentTo(hitObject) cameraShakerEffect.setPos(hitObject, pos) cameraShakerEffect.shakeSpeed = 0.040000000000000001 cameraShakerEffect.shakePower = 6.0 cameraShakerEffect.numShakes = 2 cameraShakerEffect.scalePower = 1 cameraShakerEffect.play(80.0) if base.options.getSpecialEffectsSetting( ) >= base.options.SpecialEffectsHigh: rockShower = SmallRockShower.getEffect(unlimited) if rockShower: rockShower.reparentTo(hitObject) rockShower.setPos(hitObject, pos) rockShower.play() elif ammoSkillId == InventoryType.GrenadeShockBomb: explosionEffect = ExplosionFlip.getEffect(unlimited) if explosionEffect: explosionEffect.reparentTo(base.effectsRoot) explosionEffect.setPos(hitObject, pos) explosionEffect.setScale(1.0) explosionEffect.play() self.playSfx(ammoSkillId, explosionEffect) dustRingEffect = DustRing.getEffect(unlimited) if dustRingEffect: dustRingEffect.reparentTo(hitObject) dustRingEffect.setPos(hitObject, pos) dustRingEffect.play() if base.options.getSpecialEffectsSetting( ) >= base.options.SpecialEffectsMedium: shockwaveRingEffect = ShockwaveRing.getEffect(unlimited) if shockwaveRingEffect: shockwaveRingEffect.reparentTo(base.effectsRoot) shockwaveRingEffect.setPos(hitObject, pos) shockwaveRingEffect.size = aoeRadius * 4 shockwaveRingEffect.play() flashEffect = MuzzleFlash.getEffect(unlimited) if flashEffect: flashEffect.reparentTo(base.effectsRoot) flashEffect.flash.setScale(100) flashEffect.setPos(hitObject, pos) flashEffect.startCol = Vec4(0.69999999999999996, 0.69999999999999996, 0.69999999999999996, 1) flashEffect.fadeTime = 0.20000000000000001 flashEffect.play() cameraShakerEffect = CameraShaker() cameraShakerEffect.reparentTo(hitObject) cameraShakerEffect.setPos(hitObject, pos) cameraShakerEffect.shakeSpeed = 0.040000000000000001 cameraShakerEffect.shakePower = 3.0 cameraShakerEffect.numShakes = 2 cameraShakerEffect.scalePower = 1 cameraShakerEffect.play(80.0) elif ammoSkillId == InventoryType.GrenadeSiege: explosionEffect = ExplosionFlip.getEffect(unlimited) if explosionEffect: explosionEffect.reparentTo(base.effectsRoot) explosionEffect.setPos(hitObject, pos) explosionEffect.setScale(2.5) explosionEffect.play() self.playSfx(ammoSkillId, explosionEffect) smokePillarEffect = SmokePillar.getEffect(unlimited) if smokePillarEffect: smokePillarEffect.reparentTo(hitObject) smokePillarEffect.setPos(hitObject, pos) smokePillarEffect.setScale(1.0) smokePillarEffect.spriteScale = 1.0 smokePillarEffect.radius = 7.0 smokePillarEffect.play() if base.options.getSpecialEffectsSetting( ) >= base.options.SpecialEffectsMedium: dustRingEffect = DustRing.getEffect(unlimited) if dustRingEffect: dustRingEffect.reparentTo(hitObject) dustRingEffect.setPos(hitObject, pos) dustRingEffect.play() shockwaveRingEffect = ShockwaveRing.getEffect() if shockwaveRingEffect: shockwaveRingEffect.reparentTo(base.effectsRoot) shockwaveRingEffect.setPos(hitObject, pos) shockwaveRingEffect.size = aoeRadius * 4 shockwaveRingEffect.play() cameraShakerEffect = CameraShaker() cameraShakerEffect.wrtReparentTo(hitObject) cameraShakerEffect.setPos(hitObject, pos) cameraShakerEffect.shakeSpeed = 0.059999999999999998 cameraShakerEffect.shakePower = 4.0 cameraShakerEffect.numShakes = 2 cameraShakerEffect.scalePower = 1 cameraShakerEffect.play(80.0) if base.options.getSpecialEffectsSetting( ) >= base.options.SpecialEffectsHigh: shipSplintersAEffect = ShipSplintersA.getEffect(unlimited) if shipSplintersAEffect: shipSplintersAEffect.reparentTo(hitObject) shipSplintersAEffect.setPos(hitObject, pos) shipSplintersAEffect.play() for i in range(random.randint(3, 6)): debrisEffect = RockDebris.getEffect(unlimited) if debrisEffect: debrisEffect.reparentTo(base.effectsRoot) debrisEffect.setPos(hitObject, pos) debrisEffect.offsetEndPlaneZFrom(hitObject.getZ()) debrisEffect.debris.setScale(0.80000000000000004) debrisEffect.radiusDist = 30 debrisEffect.minHeight = 30 debrisEffect.maxHeight = 120 if debrisEffect.testTrajectory(): debrisEffect.play() else: debrisEffect.cleanUpEffect() debrisEffect.testTrajectory() flashEffect = MuzzleFlash.getEffect(unlimited) if flashEffect: flashEffect.reparentTo(base.effectsRoot) flashEffect.flash.setScale(200) flashEffect.setPos(hitObject, pos) flashEffect.startCol = Vec4(0.69999999999999996, 0.69999999999999996, 0.69999999999999996, 1) flashEffect.fadeTime = 0.20000000000000001 flashEffect.play() elif ammoSkillId == InventoryType.GrenadeFireBomb: fireEffect = Fire.getEffect(unlimited) if fireEffect: fireEffect.wrtReparentTo(base.effectsRoot) fireEffect.setPos(hitObject, pos + Vec3(0, 0, -1.5)) fireEffect.setScale(Vec3(0.75, 0.75, 0.75)) fireEffect.duration = 2.5 fireEffect.play() flashEffect = MuzzleFlash.getEffect(unlimited) if flashEffect: flashEffect.wrtReparentTo(base.effectsRoot) flashEffect.flash.setScale(100) flashEffect.setPos(hitObject, pos) flashEffect.startCol = Vec4(0.69999999999999996, 0.69999999999999996, 0.69999999999999996, 1) flashEffect.fadeTime = 0.20000000000000001 flashEffect.play() self.playSfx(ammoSkillId, flashEffect) if base.options.getSpecialEffectsSetting( ) >= base.options.SpecialEffectsMedium: shockwaveRingEffect = ShockwaveRing.getEffect(unlimited) if shockwaveRingEffect: shockwaveRingEffect.wrtReparentTo(base.effectsRoot) shockwaveRingEffect.setPos(hitObject, pos) shockwaveRingEffect.size = aoeRadius * 4 shockwaveRingEffect.play() cameraShakerEffect = CameraShaker() cameraShakerEffect.wrtReparentTo(hitObject) cameraShakerEffect.setPos(hitObject, pos) cameraShakerEffect.shakeSpeed = 0.040000000000000001 cameraShakerEffect.shakePower = 2.0 cameraShakerEffect.numShakes = 2 cameraShakerEffect.scalePower = 1 cameraShakerEffect.play(80.0) if base.options.getSpecialEffectsSetting( ) >= base.options.SpecialEffectsHigh: blackSmokeEffect = LightSmoke.getEffect(unlimited) if blackSmokeEffect: blackSmokeEffect.wrtReparentTo(base.effectsRoot) blackSmokeEffect.setPos(hitObject, pos) blackSmokeEffect.duration = 4.0 blackSmokeEffect.play() elif ammoSkillId == InventoryType.GrenadeSmokeCloud: explosionEffect = ExplosionFlip.getEffect(unlimited) if explosionEffect: explosionEffect.reparentTo(base.effectsRoot) explosionEffect.setPos(hitObject, pos) explosionEffect.setScale(1.0) explosionEffect.play() self.playSfx(ammoSkillId, explosionEffect) smokeCloudEffect = SmokeBomb.getEffect(unlimited) if smokeCloudEffect: smokeCloudEffect.reparentTo(hitObject) smokeCloudEffect.setPos(hitObject, pos) smokeCloudEffect.radius = aoeRadius / 1.5 smokeCloudEffect.play() self.playSfx(ammoSkillId, smokeCloudEffect) if base.options.getSpecialEffectsSetting( ) >= base.options.SpecialEffectsMedium: shockwaveRingEffect = ShockwaveRing.getEffect(unlimited) if shockwaveRingEffect: shockwaveRingEffect.wrtReparentTo(base.effectsRoot) shockwaveRingEffect.setPos(hitObject, pos) shockwaveRingEffect.size = aoeRadius * 4 shockwaveRingEffect.play() cameraShakerEffect = CameraShaker() cameraShakerEffect.wrtReparentTo(hitObject) cameraShakerEffect.setPos(hitObject, pos) cameraShakerEffect.shakeSpeed = 0.040000000000000001 cameraShakerEffect.shakePower = 2.0 cameraShakerEffect.numShakes = 2 cameraShakerEffect.scalePower = 1 cameraShakerEffect.play(80.0)
def explode(self): base.playSfx(self.explosionSfx, node=self, cutoff=200) if self.sparks: self.sparks.stopLoop() self.sparks = None self.model.stash() self.explosionVfx = ExplosionFlip.getEffect(unlimited=True) if self.explosionVfx: self.explosionVfx.reparentTo(self) self.explosionVfx.setScale(1.5) self.explosionVfx.play() self.smokeVfx = SimpleSmokeCloud.getEffect(unlimited=True) if self.smokeVfx: self.smokeVfx.reparentTo(self) self.smokeVfx.setPos(0, 0, 1) self.smokeVfx.setEffectScale(1.0) self.smokeVfx.play() self.dustRingVfx = DustRing.getEffect(unlimited=True) if self.dustRingVfx: self.dustRingVfx.reparentTo(self) self.dustRingVfx.setPos(0, 0, -2) self.dustRingVfx.play() cameraShakerEffect = CameraShaker() cameraShakerEffect.reparentTo(self) cameraShakerEffect.shakeSpeed = 0.06 cameraShakerEffect.shakePower = 4.0 cameraShakerEffect.scalePower = True cameraShakerEffect.numShakes = 2 cameraShakerEffect.scalePower = 1.0 cameraShakerEffect.play(120.0) self.splintersVfx = ShipSplintersA.getEffect(unlimited=True) if self.splintersVfx: self.splintersVfx.reparentTo(self) self.splintersVfx.setPos(0, 0, -2) self.splintersVfx.play() shockwaveRingEffect = ShockwaveRing.getEffect(unlimited=True) if shockwaveRingEffect: shockwaveRingEffect.reparentTo(self) shockwaveRingEffect.setPos(0, 0, -2) shockwaveRingEffect.size = 80 shockwaveRingEffect.play() return
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()
def playFireEffect(self, ammoSkillId = 0, buffs = []): self.playSoundEffect(ammoSkillId) if self.ship: effectParent = self.ship.getModelRoot() relativeNode = self.cannonExitPoint else: effectParent = self relativeNode = self.cannonExitPoint effectParent.clearColorScale() effectH = self.hNode.getH(effectParent) effectP = self.pivot.getP(effectParent) if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsLow: muzzleFlameEffect = MuzzleFlame.getEffect() if muzzleFlameEffect: muzzleFlameEffect.reparentTo(effectParent) muzzleFlameEffect.setHpr(relativeNode, 0, -90, 0) muzzleFlameEffect.setPos(relativeNode, 0, 0, 0) muzzleFlameEffect.setScale(1.0) muzzleFlameEffect.play() if not self.localAvatarUsingWeapon: if base.options.getSpecialEffectsSetting() == base.options.SpecialEffectsMedium: cannonSmokeEffect = CannonSmokeSimple.getEffect() if cannonSmokeEffect: cannonSmokeEffect.reparentTo(effectParent) cannonSmokeEffect.effectModel.unstash() cannonSmokeEffect.setHpr(relativeNode, 0, -90, 0) cannonSmokeEffect.setPos(relativeNode, 0, 1, 0) cannonSmokeEffect.setScale(1.0) cannonSmokeEffect.play() if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsHigh: cannonSmokeEffect = CannonBlastSmoke.getEffect() if cannonSmokeEffect: cannonSmokeEffect.reparentTo(effectParent) cannonSmokeEffect.particleDummy.reparentTo(effectParent) cannonSmokeEffect.setHpr(effectParent, effectH, effectP, 0) cannonSmokeEffect.particleDummy.setHpr(effectParent, effectH, effectP, 0) cannonSmokeEffect.setPos(relativeNode, 0, 0, 0) cannonSmokeEffect.setEffectScale(1.0) cannonSmokeEffect.play() elif base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsMedium: cannonSmokeEffect = CannonSmokeSimple.getEffect() if cannonSmokeEffect: cannonSmokeEffect.reparentTo(effectParent) cannonSmokeEffect.effectModel.stash() cannonSmokeEffect.setHpr(relativeNode, 0, -90, 0) cannonSmokeEffect.setPos(relativeNode, 0, 1, 0) cannonSmokeEffect.setScale(1.0) cannonSmokeEffect.play() if self.recoilIval: self.recoilIval.pause() self.recoilIval.start() if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsHigh: if WeaponConstants.C_OPENFIRE in buffs: cameraShakerEffect = CameraShaker() cameraShakerEffect.reparentTo(effectParent) cameraShakerEffect.shakeSpeed = 0.029999999999999999 cameraShakerEffect.shakePower = 0.69999999999999996 cameraShakerEffect.numShakes = 1 cameraShakerEffect.play(10.0)
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.CannonRoundShot, InventoryType.CannonChainShot, InventoryType.CannonBullet, InventoryType.CannonSkull, InventoryType.CannonBarShot, InventoryType.CannonFury, InventoryType.CannonFirebrand, InventoryType.CannonFlamingSkull, InventoryType.CannonThunderbolt]: hitSfxNames = [ SoundGlobals.SFX_FX_WOOD_IMPACT_01, SoundGlobals.SFX_FX_WOOD_IMPACT_02, SoundGlobals.SFX_FX_WOOD_IMPACT_03, SoundGlobals.SFX_FX_WOOD_IMPACT_04, SoundGlobals.SFX_FX_WOOD_SHATTER_02, SoundGlobals.SFX_FX_WOOD_SHATTER_03] sfx = loadSfx(random.choice(hitSfxNames)) base.playSfx(sfx, node = hitObject, cutoff = 1500) if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsLow: explosionEffect = ExplosionFlip.getEffect(unlimited) if explosionEffect: explosionEffect.reparentTo(base.effectsRoot) explosionEffect.setPos(hitObject, pos) explosionEffect.setScale(0.80000000000000004) explosionEffect.play() if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsMedium: smokeCloudEffect = SimpleSmokeCloud.getEffect(unlimited) if smokeCloudEffect: smokeCloudEffect.reparentTo(hitObject) smokeCloudEffect.setPos(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 == InventoryType.CannonExplosive: if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsLow: effect = Explosion.getEffect(unlimited) if effect: effect.wrtReparentTo(hitObject) effect.setPos(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) effect.setPos(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) effect.setPos(hitObject, pos) effect.duration = 4 effect.velocityX = self.projVelocity[i][0] effect.velocityY = self.projVelocity[i][1] effect.play() if ammoSkillId == InventoryType.CannonThunderbolt: if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsLow: effect = LightningStrike.getEffect(unlimited) if effect: effect.wrtReparentTo(base.effectsRoot) effect.setPos(hitObject, pos) effect.play() if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsMedium: flashEffect = FlashEffect() flashEffect.wrtReparentTo(base.effectsRoot) flashEffect.setScale(600) flashEffect.setPos(hitObject, pos) flashEffect.effectColor = Vec4(0.5, 0.80000000000000004, 1, 1) flashEffect.fadeTime = 0.29999999999999999 flashEffect.play() if localAvatar.ship and hitObject == localAvatar.ship: cameraShakerEffect = CameraShaker() cameraShakerEffect.wrtReparentTo(hitObject) cameraShakerEffect.setPos(hitObject, pos) cameraShakerEffect.shakeSpeed = 0.059999999999999998 cameraShakerEffect.shakePower = 4.0 cameraShakerEffect.numShakes = 2 cameraShakerEffect.scalePower = 1 cameraShakerEffect.play(300.0) if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsHigh: shipSplintersAEffect = ShipSplintersA.getEffect(unlimited) if shipSplintersAEffect: shipSplintersAEffect.wrtReparentTo(hitObject) shipSplintersAEffect.setPos(hitObject, pos) shipSplintersAEffect.play() elif ammoSkillId == InventoryType.CannonFury: flashEffect = FlashEffect() flashEffect.wrtReparentTo(base.effectsRoot) flashEffect.setScale(300) flashEffect.setPos(hitObject, pos) flashEffect.effectColor = Vec4(0.5, 0.80000000000000004, 1, 1) flashEffect.fadeTime = 0.25 flashEffect.play() elif ammoSkillId == InventoryType.GrenadeExplosion: explosionEffect = ExplosionFlip.getEffect(unlimited) if explosionEffect: explosionEffect.reparentTo(base.effectsRoot) explosionEffect.setPos(hitObject, pos) explosionEffect.setScale(1.0) explosionEffect.play() self.playSfx(ammoSkillId, explosionEffect) smokeCloudEffect = SmokeCloud.getEffect(unlimited) if smokeCloudEffect: smokeCloudEffect.reparentTo(hitObject) smokeCloudEffect.setPos(hitObject, pos) smokeCloudEffect.setScale(1.0) smokeCloudEffect.spriteScale = 1.0 smokeCloudEffect.radius = 7.0 smokeCloudEffect.play() if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsMedium: shockwaveRingEffect = ShockwaveRing.getEffect(unlimited) if shockwaveRingEffect: shockwaveRingEffect.reparentTo(base.effectsRoot) shockwaveRingEffect.setPos(hitObject, pos) shockwaveRingEffect.size = aoeRadius * 4 shockwaveRingEffect.play() flashEffect = MuzzleFlash.getEffect(unlimited) if flashEffect: flashEffect.reparentTo(base.effectsRoot) flashEffect.flash.setScale(100) flashEffect.setPos(hitObject, pos) flashEffect.startCol = Vec4(0.69999999999999996, 0.69999999999999996, 0.69999999999999996, 1) flashEffect.fadeTime = 0.20000000000000001 flashEffect.play() cameraShakerEffect = CameraShaker() cameraShakerEffect.reparentTo(hitObject) cameraShakerEffect.setPos(hitObject, pos) cameraShakerEffect.shakeSpeed = 0.040000000000000001 cameraShakerEffect.shakePower = 6.0 cameraShakerEffect.numShakes = 2 cameraShakerEffect.scalePower = 1 cameraShakerEffect.play(80.0) if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsHigh: rockShower = SmallRockShower.getEffect(unlimited) if rockShower: rockShower.reparentTo(hitObject) rockShower.setPos(hitObject, pos) rockShower.play() elif ammoSkillId == InventoryType.GrenadeShockBomb: explosionEffect = ExplosionFlip.getEffect(unlimited) if explosionEffect: explosionEffect.reparentTo(base.effectsRoot) explosionEffect.setPos(hitObject, pos) explosionEffect.setScale(1.0) explosionEffect.play() self.playSfx(ammoSkillId, explosionEffect) dustRingEffect = DustRing.getEffect(unlimited) if dustRingEffect: dustRingEffect.reparentTo(hitObject) dustRingEffect.setPos(hitObject, pos) dustRingEffect.play() if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsMedium: shockwaveRingEffect = ShockwaveRing.getEffect(unlimited) if shockwaveRingEffect: shockwaveRingEffect.reparentTo(base.effectsRoot) shockwaveRingEffect.setPos(hitObject, pos) shockwaveRingEffect.size = aoeRadius * 4 shockwaveRingEffect.play() flashEffect = MuzzleFlash.getEffect(unlimited) if flashEffect: flashEffect.reparentTo(base.effectsRoot) flashEffect.flash.setScale(100) flashEffect.setPos(hitObject, pos) flashEffect.startCol = Vec4(0.69999999999999996, 0.69999999999999996, 0.69999999999999996, 1) flashEffect.fadeTime = 0.20000000000000001 flashEffect.play() cameraShakerEffect = CameraShaker() cameraShakerEffect.reparentTo(hitObject) cameraShakerEffect.setPos(hitObject, pos) cameraShakerEffect.shakeSpeed = 0.040000000000000001 cameraShakerEffect.shakePower = 3.0 cameraShakerEffect.numShakes = 2 cameraShakerEffect.scalePower = 1 cameraShakerEffect.play(80.0) elif ammoSkillId == InventoryType.GrenadeSiege: explosionEffect = ExplosionFlip.getEffect(unlimited) if explosionEffect: explosionEffect.reparentTo(base.effectsRoot) explosionEffect.setPos(hitObject, pos) explosionEffect.setScale(2.5) explosionEffect.play() self.playSfx(ammoSkillId, explosionEffect) smokePillarEffect = SmokePillar.getEffect(unlimited) if smokePillarEffect: smokePillarEffect.reparentTo(hitObject) smokePillarEffect.setPos(hitObject, pos) smokePillarEffect.setScale(1.0) smokePillarEffect.spriteScale = 1.0 smokePillarEffect.radius = 7.0 smokePillarEffect.play() if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsMedium: dustRingEffect = DustRing.getEffect(unlimited) if dustRingEffect: dustRingEffect.reparentTo(hitObject) dustRingEffect.setPos(hitObject, pos) dustRingEffect.play() shockwaveRingEffect = ShockwaveRing.getEffect() if shockwaveRingEffect: shockwaveRingEffect.reparentTo(base.effectsRoot) shockwaveRingEffect.setPos(hitObject, pos) shockwaveRingEffect.size = aoeRadius * 4 shockwaveRingEffect.play() cameraShakerEffect = CameraShaker() cameraShakerEffect.wrtReparentTo(hitObject) cameraShakerEffect.setPos(hitObject, pos) cameraShakerEffect.shakeSpeed = 0.059999999999999998 cameraShakerEffect.shakePower = 4.0 cameraShakerEffect.numShakes = 2 cameraShakerEffect.scalePower = 1 cameraShakerEffect.play(80.0) if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsHigh: shipSplintersAEffect = ShipSplintersA.getEffect(unlimited) if shipSplintersAEffect: shipSplintersAEffect.reparentTo(hitObject) shipSplintersAEffect.setPos(hitObject, pos) shipSplintersAEffect.play() for i in range(random.randint(3, 6)): debrisEffect = RockDebris.getEffect(unlimited) if debrisEffect: debrisEffect.reparentTo(base.effectsRoot) debrisEffect.setPos(hitObject, pos) debrisEffect.offsetEndPlaneZFrom(hitObject.getZ()) debrisEffect.debris.setScale(0.80000000000000004) debrisEffect.radiusDist = 30 debrisEffect.minHeight = 30 debrisEffect.maxHeight = 120 if debrisEffect.testTrajectory(): debrisEffect.play() else: debrisEffect.cleanUpEffect() debrisEffect.testTrajectory() flashEffect = MuzzleFlash.getEffect(unlimited) if flashEffect: flashEffect.reparentTo(base.effectsRoot) flashEffect.flash.setScale(200) flashEffect.setPos(hitObject, pos) flashEffect.startCol = Vec4(0.69999999999999996, 0.69999999999999996, 0.69999999999999996, 1) flashEffect.fadeTime = 0.20000000000000001 flashEffect.play() elif ammoSkillId == InventoryType.GrenadeFireBomb: fireEffect = Fire.getEffect(unlimited) if fireEffect: fireEffect.wrtReparentTo(base.effectsRoot) fireEffect.setPos(hitObject, pos + Vec3(0, 0, -1.5)) fireEffect.setScale(Vec3(0.75, 0.75, 0.75)) fireEffect.duration = 2.5 fireEffect.play() flashEffect = MuzzleFlash.getEffect(unlimited) if flashEffect: flashEffect.wrtReparentTo(base.effectsRoot) flashEffect.flash.setScale(100) flashEffect.setPos(hitObject, pos) flashEffect.startCol = Vec4(0.69999999999999996, 0.69999999999999996, 0.69999999999999996, 1) flashEffect.fadeTime = 0.20000000000000001 flashEffect.play() self.playSfx(ammoSkillId, flashEffect) if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsMedium: shockwaveRingEffect = ShockwaveRing.getEffect(unlimited) if shockwaveRingEffect: shockwaveRingEffect.wrtReparentTo(base.effectsRoot) shockwaveRingEffect.setPos(hitObject, pos) shockwaveRingEffect.size = aoeRadius * 4 shockwaveRingEffect.play() cameraShakerEffect = CameraShaker() cameraShakerEffect.wrtReparentTo(hitObject) cameraShakerEffect.setPos(hitObject, pos) cameraShakerEffect.shakeSpeed = 0.040000000000000001 cameraShakerEffect.shakePower = 2.0 cameraShakerEffect.numShakes = 2 cameraShakerEffect.scalePower = 1 cameraShakerEffect.play(80.0) if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsHigh: blackSmokeEffect = LightSmoke.getEffect(unlimited) if blackSmokeEffect: blackSmokeEffect.wrtReparentTo(base.effectsRoot) blackSmokeEffect.setPos(hitObject, pos) blackSmokeEffect.duration = 4.0 blackSmokeEffect.play() elif ammoSkillId == InventoryType.GrenadeSmokeCloud: explosionEffect = ExplosionFlip.getEffect(unlimited) if explosionEffect: explosionEffect.reparentTo(base.effectsRoot) explosionEffect.setPos(hitObject, pos) explosionEffect.setScale(1.0) explosionEffect.play() self.playSfx(ammoSkillId, explosionEffect) smokeCloudEffect = SmokeBomb.getEffect(unlimited) if smokeCloudEffect: smokeCloudEffect.reparentTo(hitObject) smokeCloudEffect.setPos(hitObject, pos) smokeCloudEffect.radius = aoeRadius / 1.5 smokeCloudEffect.play() self.playSfx(ammoSkillId, smokeCloudEffect) if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsMedium: shockwaveRingEffect = ShockwaveRing.getEffect(unlimited) if shockwaveRingEffect: shockwaveRingEffect.wrtReparentTo(base.effectsRoot) shockwaveRingEffect.setPos(hitObject, pos) shockwaveRingEffect.size = aoeRadius * 4 shockwaveRingEffect.play() cameraShakerEffect = CameraShaker() cameraShakerEffect.wrtReparentTo(hitObject) cameraShakerEffect.setPos(hitObject, pos) cameraShakerEffect.shakeSpeed = 0.040000000000000001 cameraShakerEffect.shakePower = 2.0 cameraShakerEffect.numShakes = 2 cameraShakerEffect.scalePower = 1 cameraShakerEffect.play(80.0)
def stop(self): CameraShaker.clearTutorialInteriorScale() taskMgr.removeTasksMatching('*%s*' % self._shootTaskString) taskMgr.removeTasksMatching('*%s*' % self._hitTaskString) if hasattr(self, '_shootTaskName'): del self._shootTaskName
class VolcanoEffect(NodePath): __module__ = __name__ eruptionSfx = None def __init__(self): NodePath.__init__(self, 'VolcanoEffect') self.smoke = VolcanoSmoke() self.smoke.setEffectScale(1.0) self.smoke.reparentTo(self) self.eruptionSmoke = None self.eruption = None self.splats = None self.cameraShaker = None if not self.eruptionSfx: self.eruptionSfx = (loadSfx(SoundGlobals.SFX_FX_VOLCANO_ERUPT), ) self.inEditor = hasattr(base, 'pe') return def startLavaEruption(self): self.stopLavaEruption() duration = random.randint(10, 20) base.playSfx(self.eruptionSfx[0], node=self, cutoff=5000) self.eruption = LavaEruption() self.eruption.duration = duration self.eruption.setEffectScale(1.0) self.eruption.reparentTo(self) self.eruption.play() if self.inEditor or base.options.getSpecialEffectsSetting( ) >= base.options.SpecialEffectsMedium: self.cameraShaker = CameraShaker() self.cameraShaker.reparentTo(self) self.cameraShaker.shakeSpeed = 0.05 self.cameraShaker.shakePower = 0.2 self.cameraShaker.scalePower = True self.cameraShaker.numShakes = duration * 10 self.cameraShaker.play(2200.0) if self.inEditor or base.options.getSpecialEffectsSetting( ) >= base.options.SpecialEffectsHigh: self.eruptionSmoke = EruptionSmoke() self.eruptionSmoke.duration = duration self.eruptionSmoke.reparentTo(self) self.eruptionSmoke.setEffectScale(1.0) self.eruptionSmoke.play() self.splats = LavaSplats() self.splats.duration = duration self.splats.setEffectScale(1.0) self.splats.reparentTo(self) self.splats.play() taskMgr.doMethodLater(duration + 10.0, self.stopLavaEruption, 'stopLavaEruptionTask') def stopLavaEruption(self, task=None): if self.eruption: self.eruption.destroy() self.eruption = None if self.splats: self.splats.destroy() self.splats = None if self.eruptionSmoke: self.eruptionSmoke.destroy() self.eruptionSmoke = None return def enable(self): self.smoke.enableEffect() def disable(self): self.smoke.disableEffect() def destroy(self): self.disable() taskMgr.remove('stopLavataEruptionTask') if self.smoke: self.smoke.cleanUpEffect() self.smoke = None self.stopLavaEruption() return
def groundHitEffect(self, hitObject, pos, skillId, ammoSkillId): if ammoSkillId == InventoryType.CannonRoundShot and ammoSkillId == InventoryType.CannonChainShot and ammoSkillId == InventoryType.CannonBullet and ammoSkillId == InventoryType.CannonSkull or ammoSkillId == InventoryType.CannonBarShot: if self.cr: attacker = self.cr.doId2do.get(self.attackerId) else: attacker = None if attacker: pass unlimited = bool(attacker.isLocal()) if base.options.getSpecialEffectsSetting( ) >= base.options.SpecialEffectsLow: cannonExplosion = CannonExplosion.getEffect(unlimited) if cannonExplosion: cannonExplosion.wrtReparentTo(base.effectsRoot) cannonExplosion.setScale(1.0) cannonExplosion.setPos(hitObject, pos) cannonExplosion.play() rockShowerEffect = RockShower.getEffect(unlimited) if rockShowerEffect: rockShowerEffect.wrtReparentTo(hitObject) rockShowerEffect.setPos(hitObject, pos) rockShowerEffect.play() if base.options.getSpecialEffectsSetting( ) >= base.options.SpecialEffectsMedium: dustCloudEffect = DustCloud.getEffect(unlimited) if dustCloudEffect: dustCloudEffect.wrtReparentTo(hitObject) dustCloudEffect.setPos(hitObject, pos) dustCloudEffect.play() shockwaveRingEffect = ShockwaveRing.getEffect(unlimited) if shockwaveRingEffect: shockwaveRingEffect.wrtReparentTo(base.effectsRoot) shockwaveRingEffect.size = 40 shockwaveRingEffect.setPos(hitObject, pos) shockwaveRingEffect.play() cameraShakerEffect = CameraShaker() cameraShakerEffect.wrtReparentTo(hitObject) cameraShakerEffect.setPos(hitObject, pos) cameraShakerEffect.shakeSpeed = 0.059999999999999998 cameraShakerEffect.shakePower = 6.0 cameraShakerEffect.numShakes = 3 cameraShakerEffect.scalePower = 1 cameraShakerEffect.play(80.0) if base.options.getSpecialEffectsSetting( ) >= base.options.SpecialEffectsHigh: dirtClodEffect = DirtClod.getEffect(unlimited) if dirtClodEffect: dirtClodEffect.wrtReparentTo(hitObject) dirtClodEffect.setPos(hitObject, pos) dirtClodEffect.play() else: self.basicHitEffect(hitObject, pos, skillId, ammoSkillId)
def groundHitEffect(self, hitObject, pos, skillId, ammoSkillId): if ammoSkillId == InventoryType.CannonRoundShot and ammoSkillId == InventoryType.CannonChainShot and ammoSkillId == InventoryType.CannonBullet and ammoSkillId == InventoryType.CannonSkull or ammoSkillId == InventoryType.CannonBarShot: if self.cr: attacker = self.cr.doId2do.get(self.attackerId) else: attacker = None if attacker: pass unlimited = bool(attacker.isLocal()) if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsLow: cannonExplosion = CannonExplosion.getEffect(unlimited) if cannonExplosion: cannonExplosion.wrtReparentTo(base.effectsRoot) cannonExplosion.setScale(1.0) cannonExplosion.setPos(hitObject, pos) cannonExplosion.play() rockShowerEffect = RockShower.getEffect(unlimited) if rockShowerEffect: rockShowerEffect.wrtReparentTo(hitObject) rockShowerEffect.setPos(hitObject, pos) rockShowerEffect.play() if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsMedium: dustCloudEffect = DustCloud.getEffect(unlimited) if dustCloudEffect: dustCloudEffect.wrtReparentTo(hitObject) dustCloudEffect.setPos(hitObject, pos) dustCloudEffect.play() shockwaveRingEffect = ShockwaveRing.getEffect(unlimited) if shockwaveRingEffect: shockwaveRingEffect.wrtReparentTo(base.effectsRoot) shockwaveRingEffect.size = 40 shockwaveRingEffect.setPos(hitObject, pos) shockwaveRingEffect.play() cameraShakerEffect = CameraShaker() cameraShakerEffect.wrtReparentTo(hitObject) cameraShakerEffect.setPos(hitObject, pos) cameraShakerEffect.shakeSpeed = 0.059999999999999998 cameraShakerEffect.shakePower = 6.0 cameraShakerEffect.numShakes = 3 cameraShakerEffect.scalePower = 1 cameraShakerEffect.play(80.0) if base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsHigh: dirtClodEffect = DirtClod.getEffect(unlimited) if dirtClodEffect: dirtClodEffect.wrtReparentTo(hitObject) dirtClodEffect.setPos(hitObject, pos) dirtClodEffect.play() else: self.basicHitEffect(hitObject, pos, skillId, ammoSkillId)
class VolcanoEffect(NodePath): eruptionSfx = None def __init__(self): NodePath.__init__(self, 'VolcanoEffect') self.smoke = VolcanoSmoke() self.smoke.setEffectScale(1.0) self.smoke.reparentTo(self) self.eruptionSmoke = None self.eruption = None self.splats = None self.cameraShaker = None if not self.eruptionSfx: self.eruptionSfx = (loadSfx(SoundGlobals.SFX_FX_VOLCANO_ERUPT),) self.inEditor = hasattr(base, 'pe') def startLavaEruption(self): self.stopLavaEruption() duration = random.randint(10, 20) base.playSfx(self.eruptionSfx[0], node = self, cutoff = 5000) self.eruption = LavaEruption() self.eruption.duration = duration self.eruption.setEffectScale(1.0) self.eruption.reparentTo(self) self.eruption.play() if self.inEditor or base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsMedium: self.cameraShaker = CameraShaker() self.cameraShaker.reparentTo(self) self.cameraShaker.shakeSpeed = 0.050000000000000003 self.cameraShaker.shakePower = 0.20000000000000001 self.cameraShaker.scalePower = True self.cameraShaker.numShakes = duration * 10 self.cameraShaker.play(2200.0) if self.inEditor or base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsHigh: self.eruptionSmoke = EruptionSmoke() self.eruptionSmoke.duration = duration self.eruptionSmoke.reparentTo(self) self.eruptionSmoke.setEffectScale(1.0) self.eruptionSmoke.play() self.splats = LavaSplats() self.splats.duration = duration self.splats.setEffectScale(1.0) self.splats.reparentTo(self) self.splats.play() taskMgr.doMethodLater(duration + 10.0, self.stopLavaEruption, 'stopLavaEruptionTask') def stopLavaEruption(self, task = None): if self.eruption: self.eruption.destroy() self.eruption = None if self.splats: self.splats.destroy() self.splats = None if self.eruptionSmoke: self.eruptionSmoke.destroy() self.eruptionSmoke = None def enable(self): self.smoke.enableEffect() def disable(self): self.smoke.disableEffect() def destroy(self): self.disable() taskMgr.remove('stopLavataEruptionTask') if self.smoke: self.smoke.cleanUpEffect() self.smoke = None self.stopLavaEruption()