def __spawnSuit(self, task):
     plan = random.choice(SuitBank.getSuits())
     level = 0
     variant = Variant.NORMAL
     suit = DistributedDeliveryGameSuitAI(self.air, self)
     suit.generateWithRequired(self.zoneId)
     suit.b_setLevel(level)
     suit.b_setSuit(plan, variant)
     suit.b_setPlace(self.zoneId)
     suit.b_setName(plan.getName())
     suit.b_setParent(CIGlobals.SPHidden)
     self.suits.append(suit)
     task.delayTime = self.getSuitSpawnTime()
     return task.again
示例#2
0
 def __spawnSuit(self, task):
     plan = random.choice(SuitBank.getSuits())
     level = 0
     variant = Variant.NORMAL
     suit = DistributedDeliveryGameSuitAI(self.air, self)
     suit.generateWithRequired(self.zoneId)
     suit.b_setLevel(level)
     suit.b_setSuit(plan, variant)
     suit.b_setPlace(self.zoneId)
     suit.b_setName(plan.getName())
     suit.b_setParent(CIGlobals.SPHidden)
     self.suits.append(suit)
     task.delayTime = self.getSuitSpawnTime()
     return task.again
    def createSuit(self, anySuit = 0, levelRange = None, variant = Variant.NORMAL, plan = None):
        if self.isCogCountFull():
            return
        if anySuit:
            if not levelRange:
                levelRange = CogBattleGlobals.HoodIndex2LevelRange[self.battle.getHoodIndex()]
            availableSuits = []
            level = random.randint(levelRange[0], levelRange[1])
            for suit in SuitBank.getSuits():
                if level >= suit.getLevelRange()[0] and level <= suit.getLevelRange()[1]:
                    availableSuits.append(suit)

            plan = random.choice(availableSuits)
        else:
            if not plan:
                return
            level = random.randint(plan.getLevelRange()[0], plan.getLevelRange()[1])
        if self.battle.getHoodIndex() == CogBattleGlobals.SkeletonHoodIndex:
            variant = Variant.SKELETON
        suit = DistributedSuitAI(self.air)
        suit.setManager(self)
        suit.generateWithRequired(self.zoneId)
        suit.d_setHood(suit.hood)
        suit.b_setLevel(level)
        suit.b_setSuit(plan, variant)
        suit.b_setPlace(self.zoneId)
        if variant == Variant.SKELETON:
            suit.b_setName(CIGlobals.Skelesuit)
        else:
            suit.b_setName(plan.getName())
        suit.b_setParent(CIGlobals.SPHidden)
        self.suits[suit.doId] = suit
        self.numSuits += 1
        if self.numSuits == 1:
            if self.tournament.inTournament and self.tournament.getRound() == 1 or not self.tournament.inTournament:
                self.sendUpdate('newSuit', [])
                if self.tournament.inTournament and self.tournament.getRound() == 1:
                    self.sendUpdate('tournamentSpawned', [])
        if self.getActiveInvasion():
            self.suitsSpawnedThisInvasion += 1
            if self.suitsSpawnedThisInvasion == 1:
                if not self.tournament.inTournament:
                    self.sendUpdate('invasionSpawned', [])
        if plan == SuitBank.VicePresident or plan == SuitBank.LucyCrossbill:
            self.sendUpdate('bossSpawned', [])
        return suit
 def createSuit(self,
                anySuit=0,
                levelRange=None,
                variant=Variant.NORMAL,
                plan=None):
     if self.isCogCountFull():
         return
     if anySuit:
         if not levelRange:
             levelRange = CogBattleGlobals.HoodIndex2LevelRange[
                 self.battle.getHoodIndex()]
         availableSuits = []
         level = random.choice(levelRange)
         for suit in SuitBank.getSuits():
             if level >= suit.getLevelRange(
             )[0] and level <= suit.getLevelRange()[1]:
                 availableSuits.append(suit)
         plan = random.choice(availableSuits)
     else:
         if not plan:
             return
         level = random.randint(plan.getLevelRange()[0],
                                plan.getLevelRange()[1])
     if self.battle.getHoodIndex(
     ) == CogBattleGlobals.SkeletonHoodIndex and variant == Variant.NORMAL:
         variant = Variant.SKELETON
     elif self.battle.getHoodIndex(
     ) == CogBattleGlobals.WaiterHoodIndex and variant == Variant.NORMAL:
         variant = Variant.WAITER
     suit = DistributedSuitAI(self.air)
     suit.setManager(self)
     suit.generateWithRequired(self.zoneId)
     suit.d_setHood(suit.hood)
     suit.b_setLevel(level)
     suit.b_setSuit(plan, variant)
     suit.b_setPlace(self.zoneId)
     if variant == Variant.SKELETON:
         suit.b_setName(CIGlobals.Skelesuit)
     else:
         suit.b_setName(plan.getName())
     #suit.startPosHprBroadcast()
     #suit.d_clearSmoothing()
     #suit.d_broadcastPosHpr()
     suit.b_setParent(CIGlobals.SPHidden)
     self.suits[suit.doId] = suit
     self.numSuits += 1
     if self.numSuits == 1:
         if (self.tournament.inTournament
                 and self.tournament.getRound() == 1
                 or not self.tournament.inTournament):
             self.sendUpdate('newSuit', [])
             if self.tournament.inTournament and self.tournament.getRound(
             ) == 1:
                 self.sendUpdate('tournamentSpawned', [])
     if self.getActiveInvasion():
         self.suitsSpawnedThisInvasion += 1
         if self.suitsSpawnedThisInvasion == 1:
             if not self.tournament.inTournament:
                 self.sendUpdate('invasionSpawned', [])
     if plan in [SuitBank.VicePresident, SuitBank.LucyCrossbill]:
         self.sendUpdate('bossSpawned', [])
     return suit