def __init__(self, air, mg):
     DistributedSuitAI.__init__(self, air)
     self.mg = mg
     self.truck = random.choice(self.mg.trucks)
     self.truckIndex = self.mg.trucks.index(self.truck)
     self.spawnPoint = None
     return
 def __init__(self, air, index, tut, avatarId):
     DistributedSuitAI.__init__(self, air)
     self.tutPartIndex = index
     self.tutorial = tut
     self.avatarId = avatarId
     self.currentPath = None
     self.walkTrack = None
Esempio n. 3
0
 def __init__(self, air):
     DistributedSuitAI.__init__(self, air)
     self.mg = None
     self.flyTrack = None
     self.currentFlyPoint = None
     self.flySpeed = 0.0
     return
 def delete(self):
     del self.isChair
     self.fsm.requestFinalState()
     del self.fsm
     del self.battle
     del self.stateExtraArgs
     DistributedSuitAI.delete(self)
 def __init__(self, air, index, tut, avatarId):
     DistributedSuitAI.__init__(self, air)
     self.tutPartIndex = index
     self.tutorial = tut
     self.avatarId = avatarId
     self.currentPath = None
     self.walkTrack = None
     return
 def delete(self):
     del self.currentFlyPoint
     del self.mg
     if self.flyTrack:
         self.ignore(self.flyTrack.getDoneEvent())
         self.flyTrack.pause()
         self.flyTrack = None
     DistributedSuitAI.delete(self)
Esempio n. 7
0
 def delete(self):
     del self.currentFlyPoint
     del self.mg
     if self.flyTrack:
         self.ignore(self.flyTrack.getDoneEvent())
         self.flyTrack.pause()
         self.flyTrack = None
     DistributedSuitAI.delete(self)
     return
 def delete(self):
     base.taskMgr.remove(self.uniqueName('finishSuit'))
     if hasattr(self, 'walkTrack') and self.walkTrack:
         self.ignore(self.walkTrack.getDoneEvent())
         self.walkTrack.finish()
         self.walkTrack = None
     self.mg = None
     self.truck = None
     self.truckIndex = None
     self.spawnPoint = None
     DistributedSuitAI.delete(self)
 def delete(self):
     base.taskMgr.remove(self.uniqueName('finishSuit'))
     if hasattr(self, 'walkTrack') and self.walkTrack:
         self.ignore(self.walkTrack.getDoneEvent())
         self.walkTrack.finish()
         self.walkTrack = None
     self.mg = None
     self.truck = None
     self.truckIndex = None
     self.spawnPoint = None
     DistributedSuitAI.delete(self)
     return
 def delete(self):
     base.taskMgr.remove(self.uniqueName('monitorHealth'))
     base.taskMgr.remove(self.uniqueName('doAttack'))
     base.taskMgr.remove(self.uniqueName('scwaa'))
     self.stopAttacks()
     if self.track:
         self.track.pause()
         self.track = None
     if self.walkTrack:
         self.walkTrack.pause()
         self.walkTrack = None
     if self.currentPath:
         self.currentPath = None
     self.tutorial = None
     self.tutPartIndex = None
     self.avatarId = None
     DistributedSuitAI.delete(self)
    def monitorHealth(self, task):
        if not hasattr(self, 'battle') or hasattr(
                self, 'battle') and self.battle is None:
            return task.done

        if self.isDead():
            self.battle.suitHPAtZero(self.doId)
        return DistributedSuitAI.monitorHealth(self, task)
Esempio n. 12
0
 def delete(self):
     base.taskMgr.remove(self.uniqueName('monitorHealth'))
     base.taskMgr.remove(self.uniqueName('doAttack'))
     base.taskMgr.remove(self.uniqueName('scwaa'))
     self.stopAttacks()
     if self.track:
         self.track.pause()
         self.track = None
     if self.walkTrack:
         self.walkTrack.pause()
         self.walkTrack = None
     if self.currentPath:
         self.currentPath = None
     self.tutorial = None
     self.tutPartIndex = None
     self.avatarId = None
     DistributedSuitAI.delete(self)
     return
 def __init__(self, air, battle, initPointData, isChair, hood):
     DistributedSuitAI.__init__(self, air)
     self.hood = hood
     self.battle = battle
     self.battleDoId = self.battle.doId
     self.flyToPoint = None
     self.initPointIndex = initPointData[0]
     initPoint = initPointData[1]
     self.floorSection = initPoint[0]
     self.initPoint = initPoint[1]
     if isChair:
         self.flyToPoint = initPoint[2]
     self.isChair = isChair
     self.fsm = ClassicFSM.ClassicFSM('DistributedCogOfficeSuitAI', [
         State.State('off', self.enterOff, self.exitOff),
         State.State('guard', self.enterGuard, self.exitGuard, ['think']),
         State.State('think', self.enterThink, self.exitThink, ['off']),
         State.State('chair', self.enterChair, self.exitChair,
                     ['chair2battle']),
         State.State('chair2battle', self.enterChair2Battle,
                     self.exitChair2Battle, ['think'])
     ], 'off', 'off')
     self.fsm.enterInitialState()
     self.stateExtraArgs = []
 def setSuit(self, plan, variant=0):
     DistributedSuitAI.setSuit(self, plan, variant, self.tutorial)
 def closeSuit(self):
     DistributedSuitAI.closeSuit(self)
     self.tutorial.sendUpdateToAvatarId(self.avatarId, 'suitExploded',
                                        [self.tutPartIndex])
Esempio n. 16
0
 def setSuit(self, plan, variant = 0):
     DistributedSuitAI.setSuit(self, plan, variant, self.tutorial)
 def __init__(self, air):
     DistributedSuitAI.__init__(self, air)
     self.mg = None
     self.flyTrack = None
     self.currentFlyPoint = None
     self.flySpeed = 0.0
Esempio n. 18
0
 def closeSuit(self):
     DistributedSuitAI.closeSuit(self)
     self.tutorial.sendUpdateToAvatarId(self.avatarId, 'suitExploded', [self.tutPartIndex])
Esempio n. 19
0
    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 __init__(self, air, mg):
     DistributedSuitAI.__init__(self, air)
     self.mg = mg
     self.truck = random.choice(self.mg.trucks)
     self.truckIndex = self.mg.trucks.index(self.truck)
     self.spawnPoint = None
 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