Beispiel #1
0
 def createGui(self):
     self.shipcard = loader.loadModel('models/gui/ship_battle')
     tex = self.shipcard.find('**/ship_battle_speed_bar*')
     self.hpFrame = DirectFrame(parent = self, pos = (0.26900000000000002, 0, -0.0050000000000000001), relief = None, image = tex, image_scale = (0.29999999999999999, 1, 0.59999999999999998))
     self.hpMeter = DirectWaitBar(parent = self.hpFrame, relief = DGG.RAISED, borderWidth = (0.002, 0.002), range = self.ship.maxHp, value = self.ship.Hp, frameColor = (0, 0, 0, 1), barColor = (0.10000000000000001, 0.69999999999999996, 0.10000000000000001, 1), frameSize = (-0.27000000000000002, 0.13100000000000001, -0.01, 0.01), pos = (0.069000000000000006, 0, 0.0), text = PLocalizer.Hull, text_scale = PiratesGuiGlobals.TextScaleLarge * 0.75, text_align = TextNode.ALeft, text_pos = (0.16, -0.012), text_fg = PiratesGuiGlobals.TextFG1, text_shadow = (0, 0, 0, 1), text_font = PiratesGlobals.getInterfaceFont())
     self.spFrame = DirectFrame(parent = self, pos = (0.26600000000000001, 0, -0.029999999999999999), relief = None, image = tex, image_scale = (0.29999999999999999, 1, 0.52000000000000002))
     self.speedMeter = DirectWaitBar(parent = self.spFrame, relief = DGG.RAISED, borderWidth = (0.002, 0.002), range = self.ship.maxSp, value = self.ship.Sp, frameColor = (0, 0, 0, 1), barColor = (0.69999999999999996, 0.69999999999999996, 0.10000000000000001, 1), frameSize = (-0.27000000000000002, 0.13200000000000001, -0.0080000000000000002, 0.0080000000000000002), pos = (0.069000000000000006, 0, 0.0), text = PLocalizer.Speed, text_scale = PiratesGuiGlobals.TextScaleLarge * 0.75, text_align = TextNode.ALeft, text_pos = (0.16, -0.0080000000000000002), text_fg = PiratesGuiGlobals.TextFG1, text_shadow = (0, 0, 0, 1), text_font = PiratesGlobals.getInterfaceFont())
     tex = self.shipcard.find('**/ship_battle_dish02*')
     self.nameBox = DirectFrame(parent = self, relief = None, text = self.ship.getName(), text_align = TextNode.ALeft, text_scale = 0.044999999999999998, text_pos = (0.074999999999999997, -0.085000000000000006), text_fg = (1, 0, 0, 1), text_shadow = (0, 0, 0, 1), text_font = PiratesGlobals.getInterfaceFont())
     color = EnemyGlobals.getShipNametagColor(self.ship.getTeam())
     self.nameBox['text_fg'] = color
     if self.ship.getSiegeTeam():
         gui = loader.loadModel('models/gui/toplevel_gui')
         if self.ship.getSiegeTeam() == 1:
             flagPath = '**/ship_pvp_icon_french'
         else:
             flagPath = '**/ship_pvp_icon_spanish'
         flag = gui.find(flagPath)
         flag.setScale(0.050000000000000003)
     else:
         flagPath = EnemyGlobals.getTeamIconModelPath(self.ship.getTeam())
         flagModel = loader.loadModel('models/gui/flag_icons')
         if flagPath:
             flag = flagModel.find(flagPath)
             flag.setScale(0.25)
         
     if flagPath:
         flag.flattenStrong()
         flag.reparentTo(self.nameBox)
         flag.setPos(0.11, 0, 0.055)
     
     self.armorGui = ShipArmorGui(self, pos = (0.0, 0.0, 0.0), scale = 0.69999999999999996)
def CreateCreature(species = None):
    if not species:
        species = 'Crab'

    exec 'creature = %s()' % CREATURE_CLASS_DICT[species]
    creature.show()
    avatarTypeFunc = AvatarTypes.NPC_SPAWNABLES[species][AvatarTypes.AVATAR_TYPE_IDX]
    avatarType = avatarTypeFunc()
    creature.height = EnemyGlobals.getHeight(avatarType)
    baseStats = EnemyGlobals.getBaseStats(avatarType)
    enemyScale = EnemyGlobals.getEnemyScaleByType(avatarType, baseStats[1])
    creature.height *= enemyScale
    creature.setAvatarScale(enemyScale)
    creature.setAvatarType(avatarType)
    return creature
 def setAvatarType(self, avatarType):
     self.avatarType = avatarType
     self.height = EnemyGlobals.getHeight(avatarType)
     self.initializeDropShadow()
     if base.options.terrain_detail_level == PiratesGlobals.CD_LOW:
         self.shadowPlacer.off()
     self.initializeNametag3d()
    def getDescriptionText(self):
        goldAmt = EnemyGlobals.getMaxGoldDrop(None, self.amount, 5)
        text = PLocalizer.GoldRewardDesc % goldAmt
        if GOLDFACTOR_HOLIDAY == 2:
            text = +'\\ + ' + PLocalizer.LootGoldDouble % goldAmt

        return text
Beispiel #5
0
 def setAvatarType(self, avatarType):
     if self.avatarType:
         self.initializeNametag3d()
         return None
     else:
         self.avatarType = avatarType
         self.height = EnemyGlobals.getHeight(avatarType)
         self.initializeDropShadow()
         self.initializeNametag3d()
 def doAntiEffect(self):
     if self.antiIval and self.antiIval.isPlaying():
         return None
     
     antiEffect = Drown.getEffect()
     if antiEffect:
         effectScale = EnemyGlobals.getEffectScale(self)
         antiEffect.reparentTo(self)
         antiEffect.setScale(effectScale)
         antiEffect.play()
 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()
    def applyTo(self, trade, av):
        avId = av.getDoId()
        goldAmt = EnemyGlobals.getMaxGoldDrop(None, self.amount, 5)
        if Freebooter.getPaidStatusAI(avId):
            if REWARD_TO == 2 or REWARD_TO == 3:
                goldAmt *= GOLDFACTOR_HOLIDAY
            elif not Freebooter.getPaidStatusAI(avId):
                if REWARD_TO == 1 or REWARD_TO == 3:
                    goldAmt *= GOLDFACTOR_HOLIDAY

        trade.giveGoldInPocket(goldAmt)
 def startVFX():
     effectScale = EnemyGlobals.getEffectScale(self)
     offset = Vec3(0.0, 0.0, -5.0)
     root = av
     deathEffect = LightningStrike.getEffect(unlimited = True)
     if deathEffect:
         deathEffect.reparentTo(render)
         deathEffect.setPos(root, offset)
         deathEffect.fadeColor = Vec4(0.5, 1, 0.5, 1)
         deathEffect.setScale(effectScale * 0.40000000000000002)
         deathEffect.play()
    def adjustAnimScale(self, state, moveSpeed, slideSpeed = 0):
        self.fsmLock.acquire()

        try:
            currAnimName = self.av.getCurrentAnim()
            if (self.av.isNpc == False or currAnimName != 'walk') and currAnimName != 'run' and currAnimName != 'bayonet_walk' and currAnimName != 'bayonet_run':
                return None

            style = self.av.style
            scale = None
            if hasattr(self.av, 'walkAnimScale'):
                scale = self.av.walkAnimScale

            if self.av is not localAvatar or style or scale:
                if scale:
                    newScale = moveSpeed * scale
                elif type(style) is not types.StringType:
                    style = style.getBodyShape()

                animFileName = self.av.getAnimFilename(self.av.getCurrentAnim())
                animSpeedScale = PiratesGlobals.GetAnimScale(animFileName)
                if animSpeedScale == None:
                    if currAnimName == 'walk' or currAnimName == 'bayonet_walk':
                        animSpeedScale = 0.24399999999999999
                    else:
                        animSpeedScale = 0.029999999999999999

                newScale = moveSpeed * animSpeedScale
                avScale = EnemyGlobals.getEnemyScale(self.av)
                if avScale:
                    newScale /= avScale

                newScale = max(newScale, 0.25)
                if currAnimName == 'walk' or currAnimName == 'bayonet_walk':
                    animIdx = PiratesGlobals.WALK_INDEX
                else:
                    animIdx = PiratesGlobals.RUN_INDEX
                currPlayRate = self.av.getPlayRate(self.animInfo[animIdx][0])
                if currPlayRate == None or abs(currPlayRate - newScale) < 0.074999999999999997:
                    return None

                if animIdx == PiratesGlobals.WALK_INDEX:
                    newAnimInfo = ((self.animInfo[PiratesGlobals.STAND_INDEX][0], self.animInfo[PiratesGlobals.STAND_INDEX][1]), (self.animInfo[PiratesGlobals.WALK_INDEX][0], newScale)) + self.animInfo[2:]
                else:
                    newAnimInfo = ((self.animInfo[PiratesGlobals.STAND_INDEX][0], self.animInfo[PiratesGlobals.STAND_INDEX][1]), (self.animInfo[PiratesGlobals.WALK_INDEX][0], self.animInfo[PiratesGlobals.WALK_INDEX][1]), (self.animInfo[PiratesGlobals.RUN_INDEX][0], newScale)) + self.animInfo[3:]
                if slideSpeed:
                    slideSpeed = max(slideSpeed, 0.45000000000000001)
                    newAnimInfo = ((self.animInfo[PiratesGlobals.STAND_INDEX][0], self.animInfo[PiratesGlobals.STAND_INDEX][1]), (self.animInfo[PiratesGlobals.WALK_INDEX][0], self.animInfo[PiratesGlobals.WALK_INDEX][1]), (self.animInfo[PiratesGlobals.RUN_INDEX][0], self.animInfo[PiratesGlobals.RUN_INDEX][1]), (self.animInfo[PiratesGlobals.REVERSE_INDEX][0], self.animInfo[PiratesGlobals.REVERSE_INDEX][1]), (self.animInfo[PiratesGlobals.STRAFE_LEFT_INDEX][0], slideSpeed), (self.animInfo[PiratesGlobals.STRAFE_RIGHT_INDEX][0], slideSpeed)) + self.animInfo[6:]

                self.av.motionFSM.setAnimInfo(newAnimInfo, reset = False)
                self.av.setPlayRate(newScale, self.animInfo[animIdx][0])
        finally:
            self.fsmLock.release()
    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
Beispiel #12
0
 def getEnemyScale(self):
     return EnemyGlobals.getEnemyScale(self, self._getBossModelScale())
    def __createBossGhost(self, objType, objectData, parent, parentUid, objKey, dynamic, zoneId):
        ghost = DistributedBossGhostAI(self.air)

        self.__setAvatarPosition(ghost, objectData, parent, parentUid, objKey)
        ghost.setScale(objectData.get('Scale'))
        ghost.setUniqueId(objKey)

        avId = objectData.get('AvId', 1)
        avTrack = objectData.get('AvTrack', 0)
        factionName = objectData.get('NavyFaction', 'Navy')
        if not hasattr(AvatarTypes, factionName):
            self.notify.warning('Failed to generate %s (%s); %s is not a valid faction' % (objType, objKey, factionName))
            return
        faction = getattr(AvatarTypes, factionName, AvatarTypes.Ghost)

        avatarType = AvatarType(faction=faction.faction, track=avTrack, id=avId)
        avatarType = avatarType.getBossType()
        ghost.setAvatarType(avatarType)
        try:
            ghost.loadBossData(objKey, avatarType)
        except:
            self.notify.warning('Failed to load %s (%s); An error occured while loading boss data' % (objType, objKey))
            return None

        ghost.setName(ghost.bossData['Name'])
        ghost.setLevel(ghost.bossData['Level'] or EnemyGlobals.getRandomEnemyLevel(avatarType))

        animSet = objectData.get('AnimSet', 'default')
        noticeAnim1 = objectData.get('Notice Animation 1', '')
        noticeAnim2 = objectData.get('Notice Animation 2', '')
        greetingAnim = objectData.get('Greeting Animation', '')
        ghost.setActorAnims(animSet, noticeAnim1, noticeAnim2, greetingAnim)

        enemyHp, enemyMp = EnemyGlobals.getEnemyStats(avatarType, ghost.getLevel())
        enemyHp = enemyHp * ghost.bossData.get('HpScale', 1)
        enemyMp = enemyMp * ghost.bossData.get('MpScale', 1)

        ghost.setMaxHp(enemyHp)
        ghost.setHp(ghost.getMaxHp(), True)

        ghost.setMaxMojo(enemyMp)
        ghost.setMojo(enemyMp)

        weapons = EnemyGlobals.getEnemyWeapons(avatarType, ghost.getLevel()).keys()
        ghost.setCurrentWeapon(weapons[0], False)

        ghost.setIsGhost(2)

        dnaId = objectData.get('DNA', objKey)
        if dnaId:
            ghost.setDNAId(dnaId)

        if 'Start State' in objectData:
            ghost.setStartState(objectData['Start State'])

        self._enemies[objKey] = ghost

        parent.generateChildWithRequired(ghost, zoneId)
        ghost.b_setVisZone(objectData.get('VisZone', ''))
        ghost.b_setGhostColor(13)

        locationName = parent.getLocalizerName()
        self.notify.debug('Generating %s (%s) under zone %d in %s at %s with doId %d' % (ghost.getName(), objKey, ghost.zoneId, locationName, ghost.getPos(), ghost.doId))

        return ghost
    def __createEnemy(self, objType, objectData, parent, parentUid, objKey, dynamic, zoneId):
        
        spawnable = objectData.get('Spawnables', '')
        if spawnable not in AvatarTypes.NPC_SPAWNABLES:
            self.notify.warning('Failed to spawn %s (%s); Not a valid spawnable.' % (spawnable, objKey))

        avatarType = random.choice(AvatarTypes.NPC_SPAWNABLES[spawnable])()
        bossType = avatarType.getRandomBossType()

        if bossType and self.wantRandomBosses:
            if random.randint(1, 100) <= self.randomBossChance:
                if bossType not in self.randomBosses or self.ignoreDoubleRandom:
                    self.randomBosses.append(bossType)
                    avatarType = bossType
            elif config.GetBool('force-random-bosses', False):
                if bossType not in self.randomBosses or self.ignoreDoubleRandom:
                    self.randomBosses.append(bossType)
                    avatarType = bossType
        
        enemyCls = None
        if avatarType.isA(AvatarTypes.Undead):
            if avatarType.getBoss():
                enemyCls = DistributedBossSkeletonAI
            else:
                enemyCls = DistributedNPCSkeletonAI
        elif avatarType.isA(AvatarTypes.TradingCo) or avatarType.isA(AvatarTypes.Navy):
            if avatarType.getBoss():
                enemyCls = DistributedBossNavySailorAI
            else:
                enemyCls = DistributedNPCNavySailorAI
        elif avatarType.isA(AvatarTypes.LandCreature) or avatarType.isA(AvatarTypes.AirCreature):
            if avatarType.getBoss():
                enemyCls = DistributedBossCreatureAI
            else:
                enemyCls = DistributedCreatureAI
        elif avatarType.isA(AvatarTypes.RageGhost):
            enemyCls = DistributedKillerGhostAI
        elif avatarType.isA(AvatarTypes.Ghost):
            enemyCls = DistributedGhostAI
        else:
            self.notify.warning('Received unknown AvatarType: %s' % avatarType)
            return

        if enemyCls is None:
            self.notify.warning('No Enemy class defined for AvatarType: %s' % avatarType)
            return

        enemy = enemyCls(self.air)
        self.__setAvatarPosition(enemy, objectData, parent, parentUid, objKey)
        enemy.setScale(objectData.get('Scale'))

        if avatarType.getBoss():
            enemy.setUniqueId('')
        else:
            enemy.setUniqueId(objKey)

        enemy.setAvatarType(avatarType)

        if avatarType.getBoss() and hasattr(enemy, 'loadBossData'):
            enemy.loadBossData(enemy.getUniqueId(), avatarType)

        animSet = objectData.get('AnimSet', 'default')
        noticeAnim1 = objectData.get('Notice Animation 1', '')
        noticeAnim2 = objectData.get('Notice Animation 2', '')
        greetingAnim = objectData.get('Greeting Animation', '')
        enemy.setActorAnims(animSet, noticeAnim1, noticeAnim2, greetingAnim)

        enemy.setLevel(EnemyGlobals.getRandomEnemyLevel(avatarType))

        enemyHp, enemyMp = EnemyGlobals.getEnemyStats(avatarType, enemy.getLevel())

        if avatarType.getBoss() and hasattr(enemy, 'bossData'):
            enemyHp = enemyHp * enemy.bossData['HpScale']
            enemyMp = enemyMp * enemy.bossData['MpScale']

        enemy.setMaxHp(enemyHp)
        enemy.setHp(enemy.getMaxHp(), True)

        enemy.setMaxMojo(enemyMp)
        enemy.setMojo(enemyMp)

        weapons = EnemyGlobals.getEnemyWeapons(avatarType, enemy.getLevel()).keys()
        enemy.setCurrentWeapon(weapons[0], False)

        enemy.setIsGhost(int(objectData.get('GhostFX', 0)))
        if 'GhostColor' in objectData and objectData['GhostColor'].isdigit():
            enemy.setGhostColor(int(objectData.get('GhostColor', 0)))

        dnaId = objKey
        if dnaId and hasattr(enemy,'setDNAId'):
            enemy.setDNAId(dnaId)

        name = avatarType.getName()
        if dnaId and dnaId in NPCList.NPC_LIST:
            name = NPCList.NPC_LIST[dnaId][NPCList.setName]

        if avatarType.getBoss():
            name = PLocalizer.BossNames[avatarType.faction][avatarType.track][avatarType.id][0]
        enemy.setName(name)  

        if 'Start State' in objectData:
            enemy.setStartState(objectData['Start State'])

        self._enemies[objKey] = enemy

        parent.generateChildWithRequired(enemy, zoneId)
        enemy.b_setVisZone(objectData.get('VisZone', ''))

        locationName = parent.getLocalizerName()
        self.notify.debug('Generating %s (%s) under zone %d in %s at %s with doId %d' % (enemy.getName(), objKey, enemy.zoneId, locationName, enemy.getPos(), enemy.doId))

        if avatarType.getBoss():
            self.notify.debug('Spawning boss %s (%s) on %s!' % (enemy.getName(), objKey, locationName))

        return enemy
Beispiel #15
0
 def getEnemyScale(self):
     return EnemyGlobals.getEnemyScale(self, self._getBossModelScale())
Beispiel #16
0
 def createGui(self):
     self.shipcard = loader.loadModel('models/gui/ship_battle')
     tex = self.shipcard.find('**/ship_battle_speed_bar*')
     self.hpFrame = DirectFrame(parent=self, pos=(0.269, 0, -0.005), relief=None, image=tex, image_scale=(0.3,
                                                                                                          1,
                                                                                                          0.6))
     self.hpMeter = DirectWaitBar(parent=self.hpFrame, relief=DGG.RAISED, borderWidth=(0.002,
                                                                                       0.002), range=self.ship.maxHp, value=self.ship.Hp, frameColor=(0,
                                                                                                                                                      0,
                                                                                                                                                      0,
                                                                                                                                                      1), barColor=(0.1,
                                                                                                                                                                    0.7,
                                                                                                                                                                    0.1,
                                                                                                                                                                    1), frameSize=(-0.27, 0.131, -0.01, 0.01), pos=(0.069,
                                                                                                                                                                                                                    0,
                                                                                                                                                                                                                    0.0), text=PLocalizer.Hull, text_scale=PiratesGuiGlobals.TextScaleLarge * 0.75, text_align=TextNode.ALeft, text_pos=(0.16, -0.012), text_fg=PiratesGuiGlobals.TextFG1, text_shadow=(0,
                                                                                                                                                                                                                                                                                                                                                                                                        0,
                                                                                                                                                                                                                                                                                                                                                                                                        0,
                                                                                                                                                                                                                                                                                                                                                                                                        1), text_font=PiratesGlobals.getInterfaceFont())
     self.spFrame = DirectFrame(parent=self, pos=(0.266, 0, -0.03), relief=None, image=tex, image_scale=(0.3,
                                                                                                         1,
                                                                                                         0.52))
     self.speedMeter = DirectWaitBar(parent=self.spFrame, relief=DGG.RAISED, borderWidth=(0.002,
                                                                                          0.002), range=self.ship.maxSp, value=self.ship.Sp, frameColor=(0,
                                                                                                                                                         0,
                                                                                                                                                         0,
                                                                                                                                                         1), barColor=(0.7,
                                                                                                                                                                       0.7,
                                                                                                                                                                       0.1,
                                                                                                                                                                       1), frameSize=(-0.27, 0.132, -0.008, 0.008), pos=(0.069,
                                                                                                                                                                                                                         0,
                                                                                                                                                                                                                         0.0), text=PLocalizer.Speed, text_scale=PiratesGuiGlobals.TextScaleLarge * 0.75, text_align=TextNode.ALeft, text_pos=(0.16, -0.008), text_fg=PiratesGuiGlobals.TextFG1, text_shadow=(0,
                                                                                                                                                                                                                                                                                                                                                                                                              0,
                                                                                                                                                                                                                                                                                                                                                                                                              0,
                                                                                                                                                                                                                                                                                                                                                                                                              1), text_font=PiratesGlobals.getInterfaceFont())
     tex = self.shipcard.find('**/ship_battle_dish02*')
     self.nameBox = DirectFrame(parent=self, relief=None, text=self.ship.getName(), text_align=TextNode.ALeft, text_scale=0.045, text_pos=(0.075, -0.085), text_fg=(1,
                                                                                                                                                                    0,
                                                                                                                                                                    0,
                                                                                                                                                                    1), text_shadow=(0,
                                                                                                                                                                                     0,
                                                                                                                                                                                     0,
                                                                                                                                                                                     1), text_font=PiratesGlobals.getInterfaceFont())
     color = EnemyGlobals.getShipNametagColor(self.ship.getTeam())
     self.nameBox['text_fg'] = color
     if self.ship.getSiegeTeam():
         gui = loader.loadModel('models/gui/toplevel_gui')
         if self.ship.getSiegeTeam() == 1:
             flagPath = '**/ship_pvp_icon_french'
         else:
             flagPath = '**/ship_pvp_icon_spanish'
         flag = gui.find(flagPath)
         flag.setScale(0.05)
     else:
         flagPath = EnemyGlobals.getTeamIconModelPath(self.ship.getTeam())
         flagModel = loader.loadModel('models/gui/flag_icons')
         if flagPath:
             flag = flagModel.find(flagPath)
             flag.setScale(0.25)
     if flagPath:
         flag.flattenStrong()
         flag.reparentTo(self.nameBox)
         flag.setPos(0.11, 0, 0.055)
     self.armorGui = ShipArmorGui(self, pos=(0.0, 0.0, 0.0), scale=0.7)
     return
Beispiel #17
0
    def adjustAnimScale(self, state, moveSpeed, slideSpeed=0):
        self.fsmLock.acquire()

        try:
            currAnimName = self.av.getCurrentAnim()
            if (
                    self.av.isNpc == False or currAnimName != 'walk'
            ) and currAnimName != 'run' and currAnimName != 'bayonet_walk' and currAnimName != 'bayonet_run':
                return None

            style = self.av.style
            scale = None
            if hasattr(self.av, 'walkAnimScale'):
                scale = self.av.walkAnimScale

            if self.av is not localAvatar or style or scale:
                if scale:
                    newScale = moveSpeed * scale
                elif type(style) is not types.StringType:
                    style = style.getBodyShape()

                animFileName = self.av.getAnimFilename(
                    self.av.getCurrentAnim())
                animSpeedScale = PiratesGlobals.GetAnimScale(animFileName)
                if animSpeedScale == None:
                    if currAnimName == 'walk' or currAnimName == 'bayonet_walk':
                        animSpeedScale = 0.24399999999999999
                    else:
                        animSpeedScale = 0.029999999999999999

                newScale = moveSpeed * animSpeedScale
                avScale = EnemyGlobals.getEnemyScale(self.av)
                if avScale:
                    newScale /= avScale

                newScale = max(newScale, 0.25)
                if currAnimName == 'walk' or currAnimName == 'bayonet_walk':
                    animIdx = PiratesGlobals.WALK_INDEX
                else:
                    animIdx = PiratesGlobals.RUN_INDEX
                currPlayRate = self.av.getPlayRate(self.animInfo[animIdx][0])
                if currPlayRate == None or abs(
                        currPlayRate - newScale) < 0.074999999999999997:
                    return None

                if animIdx == PiratesGlobals.WALK_INDEX:
                    newAnimInfo = (
                        (self.animInfo[PiratesGlobals.STAND_INDEX][0],
                         self.animInfo[PiratesGlobals.STAND_INDEX][1]),
                        (self.animInfo[PiratesGlobals.WALK_INDEX][0],
                         newScale)) + self.animInfo[2:]
                else:
                    newAnimInfo = (
                        (self.animInfo[PiratesGlobals.STAND_INDEX][0],
                         self.animInfo[PiratesGlobals.STAND_INDEX][1]),
                        (self.animInfo[PiratesGlobals.WALK_INDEX][0],
                         self.animInfo[PiratesGlobals.WALK_INDEX][1]),
                        (self.animInfo[PiratesGlobals.RUN_INDEX][0],
                         newScale)) + self.animInfo[3:]
                if slideSpeed:
                    slideSpeed = max(slideSpeed, 0.45000000000000001)
                    newAnimInfo = (
                        (self.animInfo[PiratesGlobals.STAND_INDEX][0],
                         self.animInfo[PiratesGlobals.STAND_INDEX][1]),
                        (self.animInfo[PiratesGlobals.WALK_INDEX][0],
                         self.animInfo[PiratesGlobals.WALK_INDEX][1]),
                        (self.animInfo[PiratesGlobals.RUN_INDEX][0],
                         self.animInfo[PiratesGlobals.RUN_INDEX][1]),
                        (self.animInfo[PiratesGlobals.REVERSE_INDEX][0],
                         self.animInfo[PiratesGlobals.REVERSE_INDEX][1]),
                        (self.animInfo[PiratesGlobals.STRAFE_LEFT_INDEX][0],
                         slideSpeed),
                        (self.animInfo[PiratesGlobals.STRAFE_RIGHT_INDEX][0],
                         slideSpeed)) + self.animInfo[6:]

                self.av.motionFSM.setAnimInfo(newAnimInfo, reset=False)
                self.av.setPlayRate(newScale, self.animInfo[animIdx][0])
        finally:
            self.fsmLock.release()