def __init__(self, cr): DistributedBattleNPC.__init__(self, cr) self.creature = None self.creatureTypeEffect = None self.needNoticeGroundTracking = 1 self.sfxList = [] return
def delete(self): if (self.creature and self).creatureTypeEffect: self.creatureTypeEffect.stopLoop() if self.creature: self.creature.detachNode() self.creature.delete() self.creature = None self.sfxList = [] DistributedBattleNPC.delete(self) return
def getSpawnTrack(self): if self.avatarType.isA(AvatarTypes.FireBat): if self.getAnimControl('intro'): introIval = self.actorInterval('intro') else: fadeIn = LerpFunctionInterval(self.setAlphaScale, 2.0, fromData=0.0, toData=1.0) introIval = Sequence(Func(self.setTransparency, 1), fadeIn, Func(self.clearTransparency), Func(self.clearColorScale)) introIval.append(Func(self.ambushIntroDone)) return introIval else: DistributedBattleNPC.getSpawnTrack(self)
def getSpawnTrack(self): if self.avatarType.isA(AvatarTypes.FireBat): if self.getAnimControl('intro'): introIval = self.actorInterval('intro') else: fadeIn = LerpFunctionInterval(self.setAlphaScale, 2.0, fromData = 0.0, toData = 1.0) introIval = Sequence(Func(self.setTransparency, 1), fadeIn, Func(self.clearTransparency), Func(self.clearColorScale)) introIval.append(Func(self.ambushIntroDone)) return introIval else: DistributedBattleNPC.getSpawnTrack(self)
def delete(self): if self.creature and self.creatureTypeEffect: self.creatureTypeEffect.stopLoop() if self.creature: self.creature.detachNode() self.creature.delete() self.creature = None self.sfxList = [] DistributedBattleNPC.delete(self)
def setName(self, name): DistributedBattleNPC.setName(self, name) self.refreshStatusTray() self.creature.nametag.setDisplayName(' ') nameText = self.getNameText() if nameText: if self.isNpc: self.accept('weaponChange', self.setMonsterNameTag) self.setMonsterNameTag() from pirates.battle import EnemyGlobals color2 = EnemyGlobals.getNametagColor(self.avatarType) if self.isBoss(): color2 = (0.95, 0.1, 0.1, 1) nameText['fg'] = color2
def setName(self, name): DistributedBattleNPC.setName(self, name) self.refreshStatusTray() self.creature.nametag.setDisplayName(' ') nameText = self.getNameText() if nameText: if self.isNpc: self.accept('weaponChange', self.setMonsterNameTag) self.setMonsterNameTag() EnemyGlobals = EnemyGlobals import pirates.battle color2 = EnemyGlobals.getNametagColor(self.avatarType) if self.isBoss(): color2 = (0.94999999999999996, 0.10000000000000001, 0.10000000000000001, 1) nameText['fg'] = color2
def getDeathTrack(self): if self.avatarType.isA(AvatarTypes.FireBat): av = self.creature animName = av.getDeathAnimName() duration = av.getDuration(animName) frames = av.getNumFrames(animName) delay = 0.0 def startSFX(): sfx = loadSfx(SoundGlobals.SFX_SKILL_HELLFIRE_HIT) pitchRate = 0.80000000000000004 + random.random() * 0.40000000000000002 sfx.setPlayRate(pitchRate) si = SoundInterval(sfx, node = self, volume = 1.0, seamlessLoop = False, cutOff = 150.0) self.sfxList.append(si) si.start() def stopSmooth(): if self.smoothStarted: taskName = self.taskName('smooth') taskMgr.remove(taskName) self.smoothStarted = 0 def startVFX(): offset = Vec3(0.0, 2.0, 5.0) root = av explosionEffect = ExplosionFlip.getEffect() if explosionEffect: explosionEffect.reparentTo(render) explosionEffect.setPos(root, offset) explosionEffect.setScale(0.5) explosionEffect.play() if self.creatureTypeEffect: self.creatureTypeEffect.stopLoop() self.creatureTypeEffect = None def startVFX2(): effectScale = EnemyGlobals.getEffectScale(self) offset = Vec3(0.0, 2.0, 5.0) root = av deathBlast = Immolate.getEffect() if deathBlast: deathBlast.reparentTo(render) deathBlast.setPos(root, offset) deathBlast.setScale(effectScale) deathBlast.play() deathIval = Parallel(Func(stopSmooth), Func(self.setTransparency, 1), Sequence(Func(startVFX), Wait(0.20000000000000001), Func(startVFX2)), Sequence(Func(startSFX), Wait(0.25), Func(startSFX)), av.actorInterval(animName, blendOutT = 0.0), Sequence(Wait(duration / 2.0), LerpColorScaleInterval(av, duration / 2.0, Vec4(1, 1, 1, 0), startColorScale = Vec4(1)), Func(self.hide, 0, PiratesGlobals.INVIS_DEATH), Func(self.clearColorScale), Func(self.clearTransparency))) return deathIval else: return DistributedBattleNPC.getDeathTrack(self)
def getDeathTrack(self): if self.avatarType.isA(AvatarTypes.FireBat): av = self.creature animName = av.getDeathAnimName() duration = av.getDuration(animName) frames = av.getNumFrames(animName) delay = 0.0 def startSFX(): sfx = loadSfx(SoundGlobals.SFX_SKILL_HELLFIRE_HIT) pitchRate = 0.8 + random.random() * 0.4 sfx.setPlayRate(pitchRate) si = SoundInterval(sfx, node=self, volume=1.0, seamlessLoop=False, cutOff=150.0) self.sfxList.append(si) si.start() def stopSmooth(): if self.smoothStarted: taskName = self.taskName('smooth') taskMgr.remove(taskName) self.smoothStarted = 0 def startVFX(): offset = Vec3(0.0, 2.0, 5.0) root = av explosionEffect = ExplosionFlip.getEffect() if explosionEffect: explosionEffect.reparentTo(render) explosionEffect.setPos(root, offset) explosionEffect.setScale(0.5) explosionEffect.play() if self.creatureTypeEffect: self.creatureTypeEffect.stopLoop() self.creatureTypeEffect = None return def startVFX2(): effectScale = EnemyGlobals.getEffectScale(self) offset = Vec3(0.0, 2.0, 5.0) root = av deathBlast = Immolate.getEffect() if deathBlast: deathBlast.reparentTo(render) deathBlast.setPos(root, offset) deathBlast.setScale(effectScale) deathBlast.play() deathIval = Parallel(Func(stopSmooth), Func(self.setTransparency, 1), Sequence(Func(startVFX), Wait(0.2), Func(startVFX2)), Sequence(Func(startSFX), Wait(0.25), Func(startSFX)), av.actorInterval(animName, blendOutT=0.0), Sequence(Wait(duration / 2.0), LerpColorScaleInterval(av, duration / 2.0, Vec4(1, 1, 1, 0), startColorScale=Vec4(1)), Func(self.hide, 0, PiratesGlobals.INVIS_DEATH), Func(self.clearColorScale), Func(self.clearTransparency))) return deathIval else: return DistributedBattleNPC.getDeathTrack(self)
def disable(self): self.removeActive() DistributedBattleNPC.disable(self)
def announceGenerate(self): DistributedBattleNPC.announceGenerate(self) self.addActive()
def generate(self): DistributedBattleNPC.generate(self) self.customInteractOptions()
def setLevel(self, level): DistributedBattleNPC.setLevel(self, level) self.creature.setLevel(level)
def setAvatarType(self, avatarType): DistributedBattleNPC.setAvatarType(self, avatarType) self.setupCreature(avatarType)
def setAvatarType(self, avatarType): DistributedBattleNPC.setAvatarType(self, avatarType) self.setupCreature(avatarType)
def setLevel(self, level): DistributedBattleNPC.setLevel(self, level) self.creature.setLevel(level)
def disable(self): self.removeActive() DistributedBattleNPC.disable(self)
def announceGenerate(self): DistributedBattleNPC.announceGenerate(self) self.addActive()
def generate(self): DistributedBattleNPC.generate(self) self.customInteractOptions()
def __init__(self, cr): DistributedBattleNPC.__init__(self, cr) self.creature = None self.creatureTypeEffect = None self.needNoticeGroundTracking = 1 self.sfxList = []