def Spawn(self, dept = None): from src.coginvasion.cog.DistributedSuitAI import DistributedSuitAI from src.coginvasion.cog import Dept, SuitBank, Variant from src.coginvasion.arcade.BatchCogSpawnerAI import BatchCogSpawnerAI import random level, availableSuits = SuitBank.chooseLevelAndGetAvailableSuits( [1, 4], random.choice([Dept.BOSS, Dept.SALES, Dept.CASH, Dept.LAW]) if not dept else dept, False) plan = random.choice(availableSuits) suit = DistributedSuitAI(self.air) suit.setPos(self.cEntity.getOrigin()) suit.setHpr(self.cEntity.getAngles()) suit.setBattleZone(self.dispatch) variant = Variant.NORMAL suit.setLevel(level) suit.setSuit(plan, variant) suit.generateWithRequired(self.dispatch.zoneId) #suit.d_setHood(suit.hood) suit.b_setPlace(self.dispatch.zoneId) suit.b_setName(plan.getName()) suit.spawnGeneric() self.spawned.append(suit) if self.hasSpawnFlags(self.DoSupaFlyIn): suit.changeSchedule(suit.getScheduleByName("SUPA_FLY_IN_MOVE")) if self.spawnScript: self.spawnScript.ExecuteScript(suit) BatchCogSpawnerAI.NumSuits += 1 self.dispatchOutput("OnSpawnCog") 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