def setLevel(self, lvl = None): attributes = SuitBattleGlobals.SuitAttributes[self.dna.name] if lvl is not None: self.level = lvl - attributes['level'] - 1 else: self.level = SuitBattleGlobals.pickFromFreqList(attributes['freq']) self.notify.debug('Assigning level ' + str(lvl)) if hasattr(self, 'doId'): self.d_setLevelDist(self.level) hp = attributes['hp'][self.level] self.maxHP = hp self.currHP = hp
def pickLevelTypeAndTrack(self, level=None, type=None, track=None): if level is None: level = random.choice(self.SuitHoodInfo[self.hoodInfoIdx][self.SUIT_HOOD_INFO_LVL]) if type is None: typeChoices = range(max(level - 4, 1), min(level, self.MAX_SUIT_TYPES) + 1) type = random.choice(typeChoices) else: level = min(max(level, type), type + 4) if track is None: track = SuitDNA.suitDepts[SuitBattleGlobals.pickFromFreqList(self.SuitHoodInfo[self.hoodInfoIdx][self.SUIT_HOOD_INFO_TRACK])] self.notify.debug('pickLevelTypeAndTrack: %s %s %s' % (level, type, track)) return (level, type, track)
def setLevel(self, lvl = None): attributes = SuitBattleGlobals.SuitAttributes[self.dna.name] if lvl: self.level = lvl - attributes['level'] - 1 else: self.level = SuitBattleGlobals.pickFromFreqList(attributes['freq']) self.notify.debug('Assigning level ' + str(lvl)) if hasattr(self, 'doId'): self.d_setLevelDist(self.level) hp = attributes['hp'][self.level] self.maxHP = hp self.currHP = hp
def pickLevelTypeAndTrack(self, level=None, type=None, track=None): if level is None: level = random.choice(self.SuitHoodInfo[self.hoodInfoIdx][self.SUIT_HOOD_INFO_LVL]) if type is None: typeChoices = range(max(level - 4, 1), min(level, self.MAX_SUIT_TYPES) + 1) type = random.choice(typeChoices) else: level = min(max(level, type), type + 4) if track is None: track = SuitDNA.suitDepts[SuitBattleGlobals.pickFromFreqList(self.SuitHoodInfo[self.hoodInfoIdx][self.SUIT_HOOD_INFO_TRACK])] self.notify.debug('pickLevelTypeAndTrack: %s %s %s' % (level, type, track)) return (level, type, track)
def setLevel(self, lvl=None): attributes = SuitBattleGlobals.SuitAttributes[self.dna.name] if lvl is not None: self.level = lvl - attributes["level"] - 1 else: self.level = SuitBattleGlobals.pickFromFreqList(attributes["freq"]) self.notify.debug("Assigning level " + str(lvl)) if hasattr(self, "doId"): self.d_setLevelDist(self.level) hp = attributes["hp"][self.level] self.maxHP = hp self.currHP = hp
def setLevel(self, lvl = None): attributes = SuitBattleGlobals.SuitAttributes[self.dna.name] if lvl is not None: self.level = lvl - attributes['level'] - 1 else: self.level = SuitBattleGlobals.pickFromFreqList(attributes['freq']) self.notify.debug('Assigning level ' + str(lvl)) if hasattr(self, 'doId'): self.d_setLevelDist(self.level) if len(attributes['hp'])<=self.level: print "HP is less then level, Oops!" raise Exception("invalid list index: len(attributes['hp') = %d, self.level=%d" % (len(attributes['hp']), self.level)) hp = attributes['hp'][self.level] self.maxHP = hp self.currHP = hp
def setLevel(self, lvl=None): attributes = SuitBattleGlobals.SuitAttributes[self.dna.name] if lvl is not None: self.level = lvl - attributes['level'] - 1 else: self.level = SuitBattleGlobals.pickFromFreqList(attributes['freq']) self.notify.debug('Assigning level ' + str(lvl)) if hasattr(self, 'doId'): self.d_setLevelDist(self.level) if len(attributes['hp']) <= self.level: print "HP is less then level, Oops!" raise Exception( "invalid list index: len(attributes['hp') = %d, self.level=%d" % (len(attributes['hp']), self.level)) hp = attributes['hp'][self.level] self.maxHP = hp self.currHP = hp
def setLevel(self, lvl=None): attributes = SuitBattleGlobals.SuitAttributes[self.dna.name] if lvl is not None: self.level = lvl - attributes['level'] - 1 else: self.level = SuitBattleGlobals.pickFromFreqList(attributes['freq']) self.notify.debug('Assigning level ' + str(lvl)) if hasattr(self, 'doId'): self.d_setLevelDist(self.level) try: hp = attributes['hp'][self.level] except: self.notify.warning( ("We're going down! Tried to spawn a {0} level {1}").format( self.dna.name, self.level)) raise IndexError( 'An issue with Extra Cogs has occured! DNA Name: %s, Level: %d' % (self.dna.name, self.level)) self.maxHP = hp self.currHP = hp return
def setLevel(self, lvl=None): """ Function: randomly choose a level for this suit based on the type of the suit (such as yesman, flunky, etc) or set the level to be the one specified Parameters: lvl, level the suit should be """ attributes = SuitBattleGlobals.SuitAttributes[self.dna.name] if lvl: self.level = lvl - attributes['level'] - 1 else: self.level = SuitBattleGlobals.pickFromFreqList(attributes['freq']) self.notify.debug("Assigning level " + str(lvl)) if hasattr(self, "doId"): self.d_setLevelDist(self.level) # be sure to set the hp to proper values based on the suit's # new level # hp = attributes['hp'][self.level] self.maxHP = hp self.currHP = hp assert self.notify.debug("Assigning hp " + str(self.currHP))