def __init__(self, suit):
     doneEvent = "suit%s-flyToRandSpot" % str(suit.doId)
     SuitHabitualBehavior.__init__(self, suit, doneEvent)
     self.canFly = True
     self.isAirborne = False
     self.flyIval = None
     return
示例#2
0
 def __init__(self, suit):
     doneEvent = 'suit%s-flyToRandSpot' % str(suit.doId)
     SuitHabitualBehavior.__init__(self, suit, doneEvent)
     self.canFly = True
     self.isAirborne = False
     self.flyIval = None
     return
示例#3
0
 def unload(self):
     SuitHabitualBehavior.unload(self)
     if self.flyIval:
         self.flyIval.pause()
         self.flyIval = None
     del self.flyIval
     del self.canFly
     del self.isAirborne
示例#4
0
 def exit(self):
     SuitHabitualBehavior.exit(self)
     if self.suitHealTrack:
         self.suitHealTrack.pause()
         self.suitHealTrack = None
     self.cooldownTrack = Sequence(Wait(self.HEAL_COOLDOWN), Func(self.__toggleCanHeal))
     self.cooldownTrack.start()
     return
 def unload(self):
     SuitHabitualBehavior.unload(self)
     if self.backupCooldown:
         self.backupCooldown.pause()
         self.backupCooldown = None
     del self.backupLevel
     del self.backup_levels
     del self.backupAvailable
     return
 def enter(self):
     SuitHabitualBehavior.enter(self)
     self.__toggleBackupAvailable()
     self.backupLevel += 1
     backupCooldown = random.randint(16, 20)
     self.backupCooldown = Sequence(Wait(backupCooldown), Func(self.__toggleBackupAvailable))
     taskMgr.doMethodLater(6, self.__spawnBackupGroup, self.suit.uniqueName('Spawn Backup Group'))
     self.suit.getManager().sendSysMessage('%s is calling in backup!' % self.suit.getName())
     self.exit()
 def unload(self):
     SuitHabitualBehavior.unload(self)
     if self.flyIval:
         self.flyIval.pause()
         self.flyIval = None
     del self.flyIval
     del self.canFly
     del self.isAirborne
     return
 def exit(self):
     SuitHabitualBehavior.exit(self)
     if not hasattr(self.suit, "DELETED"):
         self.ignore(self.suit.healthChangeEvent)
         if self.flyIval:
             self.flyIval.pause()
             self.flyIval = None
         self.standSuit()
     return
示例#9
0
 def exit(self):
     SuitHabitualBehavior.exit(self)
     if self.flyIval:
         self.flyIval.pause()
         self.flyIval = None
     if hasattr(self, 'suit') and not hasattr(
             self.suit,
             'DELETED') and self.suit and not self.suit.isEmpty():
         self.ignore(self.suit.healthChangeEvent)
         self.standSuit()
示例#10
0
 def __init__(self, suit, boss):
     doneEvent = 'suit%s-healBoss' % suit.doId
     SuitHabitualBehavior.__init__(self, suit, doneEvent)
     self.boss = boss
     self.maxHeal = int(self.suit.getLevel() * 7)
     self.minHeal = int(self.suit.getLevel() * 2.5)
     self.suitHealTrack = None
     self.cooldownTrack = None
     self.canHeal = True
     return
示例#11
0
 def __init__(self, suit):
     doneEvent = 'suit%s-callInBackup'
     SuitHabitualBehavior.__init__(self, suit, doneEvent)
     self.backup_levels = {1: range(1, 5),
      2: range(5, 9),
      3: range(9, 13)}
     self.backupLevel = -1
     self.backupAvailable = True
     self.backupCooldown = None
     self.calledInBackup = 0
     return
示例#12
0
 def unload(self):
     SuitHabitualBehavior.exit(self)
     self.avatarsInRange = None
     self.origHealth = None
     del self.isAttacking
     del self.origHealth
     del self.avatarsInRange
     del self.maxAttacksPerSession
     del self.attacksThisSession
     del self.attacksDone
     del self.target
     del self.canAttack
     return
 def enter(self):
     SuitHabitualBehavior.enter(self)
     self.accept(self.suit.healthChangeEvent, self.__healthChange)
     pathKeys = CIGlobals.SuitSpawnPoints[self.suit.getHood()].keys()
     pathKey = random.choice(pathKeys)
     endIndex = pathKeys.index(pathKey)
     if not self.suit.getCurrentPath():
         startIndex = -1
     else:
         startIndex = pathKeys.index(self.suit.getCurrentPath())
     self.suit.setCurrentPath(pathKey)
     self.suit.b_setSuitState(0, startIndex, endIndex)
     Sequence(Wait(0.5), Func(self.flyToNewSpot, pathKey)).start()
示例#14
0
 def unload(self):
     SuitHabitualBehavior.unload(self)
     if self.suitHealTrack:
         self.suitHealTrack.pause()
         self.suitHealTrack = None
     if self.cooldownTrack:
         self.cooldownTrack.pause()
         self.cooldownTrack = None
     del self.suitHealTrack
     del self.cooldownTrack
     del self.maxHeal
     del self.minHeal
     del self.boss
     return
示例#15
0
 def enter(self):
     SuitHabitualBehavior.enter(self)
     if not hasattr(self, 'suit') or not self.suit or self.suit.isEmpty():
         self.exit()
         return
     self.accept(self.suit.healthChangeEvent, self.__healthChange)
     pathKeys = CIGlobals.SuitSpawnPoints[self.suit.getHood()].keys()
     pathKey = random.choice(pathKeys)
     endIndex = pathKeys.index(pathKey)
     if not self.suit.getCurrentPath():
         startIndex = -1
     else:
         startIndex = pathKeys.index(self.suit.getCurrentPath())
     self.suit.setCurrentPath(pathKey)
     self.suit.b_setSuitState(0, startIndex, endIndex)
     Sequence(Wait(0.5), Func(self.flyToNewSpot, pathKey)).start()
示例#16
0
 def __init__(self, suit):
     SuitHabitualBehavior.__init__(self, suit, doneEvent='suit%s-attackDone' % suit.doId)
     self.avatarsInRange = []
     self.maxAttacksPerSession = 3
     self.attacksThisSession = 0
     self.attacksDone = 0
     self.target = None
     self.canAttack = True
     self.origHealth = None
     self.isAttacking = False
     level = self.suit.getLevel()
     if 1 <= level <= 5:
         self.maxAttacksPerSession = 3
     elif 5 <= level <= 10:
         self.maxAttacksPerSession = 4
     elif 9 <= level <= 12:
         self.maxAttacksPerSession = 5
     return
示例#17
0
 def enter(self):
     SuitHabitualBehavior.enter(self)
     self.__toggleCanHeal()
     attack = random.randint(0, 6)
     attackName = SuitAttacks.SuitAttackLengths.keys()[attack]
     timestamp = globalClockDelta.getFrameNetworkTime()
     self.suit.sendUpdate('doAttack', [attack, self.boss.doId, timestamp])
     distance = self.suit.getDistance(self.boss)
     timeUntilHeal = distance / self.HEAL_SPEED
     timeUntilRelease = 1.0
     self.suit.d_setChat(CIGlobals.SuitHealTaunt)
     hp = random.randint(self.minHeal, self.maxHeal)
     if self.boss.getHealth() + hp > self.boss.getMaxHealth():
         hp = self.boss.getMaxHealth() - self.boss.getHealth()
     if attackName != 'glowerpower':
         if self.suit.suitPlan.getSuitType() == 'C':
             timeUntilRelease = 2.2
         else:
             timeUntilRelease = 3.0
     self.suitHealTrack = Sequence(Func(self.__disableBoss), Wait(timeUntilRelease + timeUntilHeal), Func(self.__attemptToHealBoss, hp), Func(self.__enableBoss), Func(self.exit))
     self.suitHealTrack.start()
示例#18
0
 def exit(self):
     SuitHabitualBehavior.exit(self)
     if hasattr(self, 'isAttacking') and hasattr(self, 'suit'):
         if self.isAttacking and self.suit:
             self.suit.d_interruptAttack()
示例#19
0
 def shouldStart(self):
     SuitHabitualBehavior.shouldStart(self)
     if self.suit.getDistance(self.boss) <= self.HEAL_DISTANCE:
         if not hasattr(self.suit, 'DELETED') and not hasattr(self.boss, 'DELETED'):
             return self.canHeal
     return False
示例#20
0
 def enter(self):
     SuitHabitualBehavior.enter(self)
     self.origHealth = self.suit.getHealth()
     self.attacksThisSession = 0
     self.startAttacking()