Beispiel #1
0
    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 makeSuit(self, spawnData, hangoutData, isChair, boss=False):
        bldgInfo = SuitBuildingGlobals.buildingInfo[self.hood]
        if self.currentFloor < self.numFloors - 1:
            levelRange = bldgInfo[SuitBuildingGlobals.LEVEL_RANGE]
        else:
            levelRange = bldgInfo[SuitBuildingGlobals.BOSS_LEVEL_RANGE]
        battlePoint = None
        level, availableSuits = SuitBank.chooseLevelAndGetAvailableSuits(
            levelRange, self.deptClass, boss)

        plan = random.choice(availableSuits)
        suit = DistributedCogOfficeSuitAI(self.air, self, spawnData,
                                          hangoutData, isChair, self.hood)
        suit.setBattleZone(self)
        variant = Variant.NORMAL
        hood = self.hood
        if self.hood == ZoneUtil.ToontownCentral:
            hood = ZoneUtil.BattleTTC
        if CogBattleGlobals.hi2hi[hood] == CogBattleGlobals.WaiterHoodIndex:
            variant = Variant.WAITER
        suit.setLevel(level)
        suit.setSuit(plan, variant)
        suit.generateWithRequired(self.zoneId)
        suit.d_setHood(suit.hood)
        suit.battleZone = self

        suit.b_setPlace(self.zoneId)
        suit.b_setName(plan.getName())
        return suit
Beispiel #3
0
    def spawnDoorSuit(self, rearOrFront):

        import random

        if self.version == 1:
            suitOrGoon = 1
        elif self.version == 2:
            # 25% chance of goon on version 2
            suitOrGoon = random.randint(0, 3)
        elif self.version == 3:
            # 33% on version 3
            suitOrGoon = random.randint(0, 2)
        else:
            suitOrGoon = 1

        if suitOrGoon != 0:
            from src.coginvasion.cog.DistributedSuitAI import DistributedSuitAI
            from src.coginvasion.cog import Dept, SuitBank, Variant
            from src.coginvasion.attack.Attacks import ATTACK_BOMB, ATTACK_FIRED

            level, availableSuits = SuitBank.chooseLevelAndGetAvailableSuits(
                self.getVersionSuitLevels(), Dept.SALES, False)

            plan = random.choice(availableSuits)
            suit = VPSuitAI(self.air, self)
            if level >= 5:
                suit.attackIds.append(ATTACK_FIRED)
            if level >= 10:
                suit.attackIds.append(ATTACK_BOMB)
            suit.rearOrFront = rearOrFront
            suit.setNPCState(STATE_SCRIPT)
            suit.setPos(self.getPos())
            suit.setHpr(self.getHpr())
            suit.setBattleZone(self.dispatch)
            variant = Variant.NORMAL
            suit.setLevel(level)
            suit.setSuit(plan, variant)
            suit.generateWithRequired(self.dispatch.zoneId)
            suit.b_setPlace(self.dispatch.zoneId)
            suit.b_setName(plan.getName())
            suit.spawnGeneric()
            self.numSuits += 1
            suit.changeSchedule(suit.getScheduleByName("VP_EXIT"), False)

        else:
            goon = VPGoonAI(self.air, self)
            goon.rearOrFront = rearOrFront
            goon.setNPCState(STATE_IDLE)
            goon.setPos(self.getPos())
            goon.setHpr(self.getHpr())
            goon.setBattleZone(self.dispatch)
            goon.generateWithRequired(self.dispatch.zoneId)
            self.numSuits += 1
            goon.changeSchedule(goon.getScheduleByName("VP_EXIT"), False)
Beispiel #4
0
    def __spawnNewBuilding(self, task):
        number = random.randint(1, 100)
        if number <= self.spawnChance and self.numCogBuildings < self.maxBuildings:
            # Let's spawn one!!!
            bldg = random.choice(self.getToonBuildingsList())
            # This building belongs to us!
            bldg.takenBySuit = True
            bldg.door.b_setSuitTakingOver(1)

            hoodName = self.hoodClass.hood
            if hoodName == ZoneUtil.ToontownCentral:
                hoodName = ZoneUtil.BattleTTC

            levelRange = CogBattleGlobals.HoodIndex2LevelRange[CogBattleGlobals.HoodId2HoodIndex[hoodName]]

            level, planList = SuitBank.chooseLevelAndGetAvailableSuits(levelRange,
                                                                       random.choice([Dept.SALES, Dept.CASH, Dept.LAW, Dept.BOSS]))

            plan = random.choice(planList)

            suit = DistributedTakeOverSuitAI(base.air, self, bldg, bldg.door.doId)
            #suit.setManager(self)
            suit.generateWithRequired(bldg.zoneId)
            suit.b_setHood(self.hoodClass.hood)
            suit.b_setLevel(level)
            variant = Variant.NORMAL
            if CogBattleGlobals.hi2hi[hoodName] == CogBattleGlobals.WaiterHoodIndex:
                variant = Variant.WAITER
            suit.b_setSuit(plan, variant)
            suit.b_setPlace(bldg.zoneId)
            suit.b_setName(plan.getName())
            suit.initiateTakeOver()
            self.suitsTakingOver.append(suit)

        task.delayTime = random.randint(SuitBuildingGlobals.SPAWN_TIME_RANGE[0], SuitBuildingGlobals.SPAWN_TIME_RANGE[1])
        return task.again