def removeStatusEffect(self, effectId, attackerId):
     DistributedNPCSimpleShip.removeStatusEffect(self, effectId, attackerId)
     if effectId == WeaponGlobals.C_CANNON_DEFENSE_FIRE:
         if not self.isSinkingWhileOnFire:
             while len(self.flameEffects) > 0:
                 effect = self.flameEffects.pop()
                 effect.stopLoop()
Exemple #2
0
    def destroy(self):
        if self.goldStolenlbl:
            self.goldStolenlbl.destroy()
            self.goldStolenlbl = None

        if self.hasGoldlbl:
            self.hasGoldlbl.destroy()
            self.hasGoldlbl = None

        if self.textureCard:
            self.textureCard.removeNode()
            self.textureCard = None
            self.goldIcon = None

        if self.healthBar:
            self.healthBar.destroy()

        if self.sharkActor:
            self.sharkActor.cleanUp()
            self.sharkActor.removeNode()

        if self.sharkParallel:
            self.sharkParallel.pause()
            self.sharkParallel = None

        DistributedNPCSimpleShip.destroy(self)
 def __init__(self, cr):
     DistributedNPCSimpleShip.__init__(self, cr)
     self.goldStolenlbl = None
     self.hasGoldlbl = None
     self.hasBNote = None
     self.textureCard = None
     self.goldIcon = None
     self.flameEffects = []
     self.isSinkingWhileOnFire = False
     self.healthModifier = 0
     self.modifierSet = False
     self.shipStatsSet = False
     self.shipStatIndex = None
     self.initHealthBar()
     self.initIndicatorIcons()
     self.sinkTimeScale = CannonDefenseGlobals.SHIP_SINK_DURATION_SCALE
     self.sharkActor = Actor('models/char/pir_r_gam_fsh_lgComTshark.bam', {
         'attack': 'models/char/pir_a_gam_fsh_lgComTshark_attack.bam' })
     self.sharkParallel = None
     self.fader = None
     if not self.coldShotHitSfx:
         DistributedCannonDefenseShip.specialHitSfx = {
             InventoryType.DefenseCannonMineInWater: loadSfx(SoundGlobals.SFX_MINIGAME_CANNON_MINE_HIT),
             InventoryType.DefenseCannonBomb: loadSfx(SoundGlobals.SFX_MINIGAME_CANNON_BOMB_HIT),
             InventoryType.DefenseCannonHotShot: loadSfx(SoundGlobals.SFX_MINIGAME_CANNON_HOTSHOT_HIT),
             InventoryType.DefenseCannonFireStorm: loadSfx(SoundGlobals.SFX_MINIGAME_CANNON_FIRESTORM_HIT),
             InventoryType.DefenseCannonChumShot: loadSfx(SoundGlobals.SFX_MINIGAME_CANNON_SHARK) }
         DistributedCannonDefenseShip.coldShotHitSfx = loadSfx(SoundGlobals.SFX_MINIGAME_CANNON_ICE_HIT)
         DistributedCannonDefenseShip.sharkChompSfxs = [
             loadSfx(SoundGlobals.SFX_MONSTER_SMASH_01),
             loadSfx(SoundGlobals.SFX_MONSTER_SMASH_02),
             loadSfx(SoundGlobals.SFX_MONSTER_SMASH_03)]
 def addStatusEffect(self, effectId, attackerId, duration = 0, timeLeft = 0, timestamp = 0, buffData = [
     0]):
     if effectId == WeaponGlobals.C_CANNON_DEFENSE_FIRE:
         self.addFireEffect(self.getModelRoot().getPos())
     
     if effectId == WeaponGlobals.C_CANNON_DEFENSE_ICE:
         base.playSfx(self.coldShotHitSfx, node = self, cutoff = 2000)
     
     DistributedNPCSimpleShip.addStatusEffect(self, effectId, attackerId, duration, timeLeft, timestamp, buffData)
 def playProjectileHitSfx(self, ammoSkillId, hitSail):
     if ammoSkillId in [
             InventoryType.DefenseCannonColdShotInWater,
             InventoryType.DefenseCannonSmokePowder
     ]:
         return
     if ammoSkillId in self.specialHitSfx:
         sfx = self.specialHitSfx[ammoSkillId]
         base.playSfx(sfx, node=self, cutoff=2000)
         return
     DistributedNPCSimpleShip.playProjectileHitSfx(self, ammoSkillId,
                                                   hitSail)
 def projectileWeaponHit(self,
                         skillId,
                         ammoSkillId,
                         skillResult,
                         targetEffects,
                         pos,
                         normal,
                         codes,
                         attacker,
                         itemEffects=[]):
     DistributedNPCSimpleShip.projectileWeaponHit(self, skillId,
                                                  ammoSkillId, skillResult,
                                                  targetEffects, pos,
                                                  normal, codes, attacker,
                                                  itemEffects)
 def announceGenerate(self):
     DistributedNPCSimpleShip.announceGenerate(self)
     rad = (self.model.dimensions / 2.0).length()
     cn = NodePath(CollisionNode('c'))
     cs = CollisionSphere(0, 0, 0, rad)
     cn.node().addSolid(cs)
     cn.reparentTo(self.model.modelCollisions)
     cn.setTransform(self.model.center.getTransform(self))
     cn.node().setIntoCollideMask(PiratesGlobals.GenericShipBitmask)
     self.model.defendSphere = cn
     self.model.modelRoot.setScale(CannonDefenseGlobals.SHIP_SCALE)
     self.fadeIn(CannonDefenseGlobals.SHIP_FADEIN)
     self.smoother.setExpectedBroadcastPeriod(0.3)
     self.smoother.setDelay(2)
     self.healthBar.reparentTo(self.model.modelRoot)
 def setupLocalStats(self):
     DistributedNPCSimpleShip.setupLocalStats(self)
 def buildShip(self):
     DistributedNPCSimpleShip.buildShip(self)
     self.model.sfxAlternativeStyle = True
 def delete(self):
     if self.fader:
         self.fader.pause()
         self.fader = None
     DistributedNPCSimpleShip.delete(self)
     return
    def sinkingEnd(self):
        while len(self.flameEffects) > 0:
            effect = self.flameEffects.pop()
            effect.stopLoop()

        DistributedNPCSimpleShip.sinkingEnd(self)
 def sinkingBegin(self):
     self.healthBar.reparentTo(hidden)
     if len(self.flameEffects) > 0:
         self.isSinkingWhileOnFire = True
     DistributedNPCSimpleShip.sinkingBegin(self)
 def setHealthState(self, health):
     DistributedNPCSimpleShip.setHealthState(self, health)
     self.healthBar['value'] = health
     self.healthBar['barColor'] = self.getHealthBarColor(health)