def distributeReward(self): #need to do this after battle after temporary stat changes have been reversed numOfChar = len(self.char) reward = [self.Reward[0]/numOfChar, self.Reward[1]/numOfChar, self.Reward[2]] self.report('Recieved:\n-->%d gold\n-->%d exp\n-->%s' %(reward[0], reward[1], reward[2])) hp = 0 for x in self.char: hp = x.stats['hp'] x.stats.update(self.originalStats[x]) x.stats['hp'] = hp x.statModifier({ 'gol': reward[0], 'exp': reward[1] }) if not x.inventory: item = makeItem(reward[2]) x.inventory.append(item) else: for y in x.inventory: if y.name == reward[2]: y.quantity += 1 y.makeDescrip() else: item = Item(reward[2]) x.inventory.append(item)
def __init__(self, **kwargs): for base in Player.__bases__: base.__init__(self) self.gui = gui self.curEquip = [] self.avaEquip = [] self.itemAtk = '' self.enemyNames = None self.charNames = None self.responce = None self.arenaInstance = None self.question = '' self.tF = True self.info = info if not classLvlHist: self.classLvlHist = { self.info['class']: 1 } else: self.classLvlHist = classLvlHist self.stats = { 'hp': 12, 'sp': 5, 'fullHP': 12, 'fullSP': 5, 'atk': 5, 'def': 5, 'ma': 5, 'md': 5, 'spe': 5, 'lck': 5, 'exp': exp, 'gol': gol, 'elem': ['none'] } self.upStats = { 'fullHP': [1, -.0002, .5, 45], 'fullSP': [1, -.0002, .02, 5], 'atk': [1, -.0001, .03, 2], 'def': [1, -.0001, .03, 2], 'ma': [1, -.0001, .03, 2], 'md': [1, -.0001, .03, 2], 'lck': [1, -.00015, .02, 2], 'spe': [1, -.00015, .02, 2], } for s in statsUp: self.stats[s] = statsUp[s][0] if s in self.upStats: self.upStats[s][0] = statsUp[s][1] self.inventory = [] self.weapon = [] self.armour = [] self.equipment = [] for i in inventoryNames: item = makeItem(i) item.quantity = inventoryNames[i] item.makeDescrip() self.inventory.append(item) #for w in weaponNames: #item = makeItem(w) #item.makeDescrip() #self.weapon.append(item) #for a in armourNames: #item = makeItem(w) #item.makeDescrip() #self.armour.append(item) #for e in equipmentNames: #item = makeItem(e) #item.quantity = equipmentNames[e] #item.makeDescrip() #self.equipment.append(item) self.updateBase()