示例#1
0
 def getAreaList(self, skillId, ammoSkillId, target, pos, attackerId, isBoss = False):
     targets = []
     areaShape = WeaponGlobals.getAttackAreaShape(skillId, ammoSkillId)
     if areaShape == WeaponGlobals.AREA_SPHERE:
         self.runSphereAreaCollisions(skillId, ammoSkillId, target, pos)
     elif areaShape == WeaponGlobals.AREA_TUBE:
         self.runTubeAreaCollisions(skillId, ammoSkillId, target, pos)
     elif areaShape == WeaponGlobals.AREA_CONE:
         self.runConeAreaCollisions(skillId, ammoSkillId, target, pos)
     elif areaShape == WeaponGlobals.AREA_OFF:
         return targets
     
     numEntries = self.areaCollQueue.getNumEntries()
     if numEntries == 0:
         return targets
     
     if isBoss and numEntries > WeaponGlobals.BOSS_AREA_TARGETS:
         numEntries = WeaponGlobals.BOSS_AREA_TARGETS
     elif numEntries > WeaponGlobals.MAX_AREA_TARGETS:
         numEntries = WeaponGlobals.MAX_AREA_TARGETS
     
     avTeam = self.avatar.getTeam()
     for i in range(numEntries):
         entry = self.areaCollQueue.getEntry(i)
         potentialTargetColl = entry.getIntoNodePath()
         if potentialTargetColl in self.avatar.aimTubeNodePaths:
             potentialTarget = self.avatar
         else:
             potentialTarget = self.repository.targetMgr.getObjectFromNodepath(potentialTargetColl)
         if potentialTarget:
             potentialTargetId = potentialTarget.getDoId()
             if potentialTargetId == target.getDoId():
                 continue
             
             if potentialTargetId in targets:
                 continue
             
             if not WeaponGlobals.isFriendlyFire(skillId, ammoSkillId):
                 if not TeamUtils.damageAllowed(potentialTarget, self.avatar):
                     if attackerId and potentialTargetId == attackerId:
                         if not WeaponGlobals.isAttackAreaSelfDamaging(skillId, ammoSkillId):
                             continue
                         
                     
                 
             elif attackerId and potentialTargetId == attackerId:
                 if not WeaponGlobals.isAttackAreaSelfDamaging(skillId, ammoSkillId):
                     continue
                 
             
             if TeamUtils.damageAllowed(potentialTarget, self.avatar):
                 skillEffect = WeaponGlobals.getSkillEffectFlag(skillId)
                 if skillEffect != WeaponGlobals.C_ATTUNE:
                     continue
                 
             
             if potentialTarget.gameFSM.state == 'Death':
                 continue
             
             if potentialTarget.gameFSM.state in ('BenchRepair', 'PotionCrafting', 'Fishing'):
                 continue
             
             if not self.repository.battleMgr.obeysPirateCode(self.avatar, potentialTarget):
                 if ItemGlobals.getSubtype(localAvatar.currentWeaponId) == ItemGlobals.BAYONET:
                     pass
                 if not (WeaponGlobals.getAttackClass(skillId) == WeaponGlobals.AC_COMBAT):
                     continue
                 
             targets.append(potentialTargetId)
             continue
         continue
     
     return targets
    def getAreaList(self,
                    skillId,
                    ammoSkillId,
                    target,
                    pos,
                    attackerId,
                    isBoss=False):
        targets = []
        areaShape = WeaponGlobals.getAttackAreaShape(skillId, ammoSkillId)
        if areaShape == WeaponGlobals.AREA_SPHERE:
            self.runSphereAreaCollisions(skillId, ammoSkillId, target, pos)
        elif areaShape == WeaponGlobals.AREA_TUBE:
            self.runTubeAreaCollisions(skillId, ammoSkillId, target, pos)
        elif areaShape == WeaponGlobals.AREA_CONE:
            self.runConeAreaCollisions(skillId, ammoSkillId, target, pos)
        elif areaShape == WeaponGlobals.AREA_OFF:
            return targets

        numEntries = self.areaCollQueue.getNumEntries()
        if numEntries == 0:
            return targets

        if isBoss and numEntries > WeaponGlobals.BOSS_AREA_TARGETS:
            numEntries = WeaponGlobals.BOSS_AREA_TARGETS
        elif numEntries > WeaponGlobals.MAX_AREA_TARGETS:
            numEntries = WeaponGlobals.MAX_AREA_TARGETS

        avTeam = self.avatar.getTeam()
        for i in range(numEntries):
            entry = self.areaCollQueue.getEntry(i)
            potentialTargetColl = entry.getIntoNodePath()
            if potentialTargetColl in self.avatar.aimTubeNodePaths:
                potentialTarget = self.avatar
            else:
                potentialTarget = self.repository.targetMgr.getObjectFromNodepath(
                    potentialTargetColl)
            if potentialTarget:
                potentialTargetId = potentialTarget.getDoId()
                if potentialTargetId == target.getDoId():
                    continue

                if potentialTargetId in targets:
                    continue

                if not WeaponGlobals.isFriendlyFire(skillId, ammoSkillId):
                    if not TeamUtils.damageAllowed(potentialTarget,
                                                   self.avatar):
                        if attackerId and potentialTargetId == attackerId:
                            if not WeaponGlobals.isAttackAreaSelfDamaging(
                                    skillId, ammoSkillId):
                                continue

                elif attackerId and potentialTargetId == attackerId:
                    if not WeaponGlobals.isAttackAreaSelfDamaging(
                            skillId, ammoSkillId):
                        continue

                if TeamUtils.damageAllowed(potentialTarget, self.avatar):
                    skillEffect = WeaponGlobals.getSkillEffectFlag(skillId)
                    if skillEffect != WeaponGlobals.C_ATTUNE:
                        continue

                if potentialTarget.gameFSM.state == 'Death':
                    continue

                if potentialTarget.gameFSM.state in ('BenchRepair',
                                                     'PotionCrafting',
                                                     'Fishing'):
                    continue

                if not self.repository.battleMgr.obeysPirateCode(
                        self.avatar, potentialTarget):
                    if ItemGlobals.getSubtype(localAvatar.currentWeaponId
                                              ) == ItemGlobals.BAYONET:
                        pass
                    if not (WeaponGlobals.getAttackClass(skillId)
                            == WeaponGlobals.AC_COMBAT):
                        continue

                targets.append(potentialTargetId)
                continue
            continue

        return targets