Example #1
0
def checkXp(): # Verifie si le joueur change de niveau)
	global levelUp, levelPrev
	if Player.getXp() >= levelUp :
		if Player.getLevel() < 10:
			Player.editLevel(1)
			Player.editMaxHealth(2)
			if Player.getLevel()%2 == 0:
				Player.editPower(1)
			Player.setXp(Player.getXp()-levelUp)
			temp = levelUp
			levelUp += Player.getLevel()*100-levelPrev
			levelPrev = temp
			Map.doppel(Player.getMaxHealth(),Player.getPower()+Player.getEquipModifier())	
		Player.setHealth(Player.getMaxHealth())
Example #2
0
def display(description,difficulty): # Affiche la description correspondant a la derniere action effectuee
	global visited
	Background.show(myBackground,"bg")
	description = description.split()
	descript = [""]
	word, line = 0, 0
	while word < len(description):
		if len(descript[line]) + len(description[word]) + 1 <= 27:
			descript[line] += " " + description[word]
			word += 1
		elif word < len(description):
			descript.append("")
			line +=1
	for line in range (len(descript)):
		sys.stdout.write("\x1b7\x1b[%d;%df%s\x1b8" % (6+line, 10, descript[line]))
        sys.stdout.write("\033[1;34m") 
	sys.stdout.write("\x1b7\x1b[%d;%df%s\x1b8" % (22,67,Player.getName()))
	sys.stdout.write("\x1b7\x1b[%d;%df%s\x1b8" % (22,98,str(Player.getLevel())))
	sys.stdout.write("\x1b7\x1b[%d;%df%s\x1b8" % (23,71,str(Player.getMaxHealth())))
	sys.stdout.write("\x1b7\x1b[%d;%df%s\x1b8" % (23,97,str(Player.getPower()+Player.getEquipModifier())))
	sys.stdout.write("\x1b7\x1b[%d;%df%s\x1b8" % (27,77,str(levelUp)))
	sys.stdout.write("\x1b7\x1b[%d;%df%s\x1b8" % (25,76,str(difficulty*difficulty*14)))
	sys.stdout.write("\x1b7\x1b[%d;%df%s\x1b8" % (24,97,str(difficulty*difficulty)))
        if Player.getXp() >= levelUp*80/100:
                sys.stdout.write("\033[1;32m")
	sys.stdout.write("\x1b7\x1b[%d;%df%s\x1b8" % (26,74,str(Player.getXp())))
	if Player.getHealth() > Player.getMaxHealth()*20/100:
                sys.stdout.write("\033[1;32m")
        else:   
                sys.stdout.write("\033[1;31m")
	sys.stdout.write("\x1b7\x1b[%d;%df%s\x1b8" % (23,83,str(Player.getHealth())))
	if Player.getTime() < difficulty*difficulty*14*80/100:
                sys.stdout.write("\033[1;32m")
        else:   
                sys.stdout.write("\033[1;31m")
	sys.stdout.write("\x1b7\x1b[%d;%df%s\x1b8" % (24,76,str(Player.getTime())))
	if visited < difficulty*difficulty*80/100:
                sys.stdout.write("\033[1;32m")
        else:   
                sys.stdout.write("\033[1;31m")
	sys.stdout.write("\x1b7\x1b[%d;%df%s\x1b8" % (25,96,str(visited)))
	sys.stdout.flush()