本文整理汇总了Python中Player.getLevel方法的典型用法代码示例。如果您正苦于以下问题:Python Player.getLevel方法的具体用法?Python Player.getLevel怎么用?Python Player.getLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Player
的用法示例。
在下文中一共展示了Player.getLevel方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: checkXp
# 需要导入模块: import Player [as 别名]
# 或者: from Player import getLevel [as 别名]
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())
示例2: display
# 需要导入模块: import Player [as 别名]
# 或者: from Player import getLevel [as 别名]
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()
示例3: move
# 需要导入模块: import Player [as 别名]
# 或者: from Player import getLevel [as 别名]
def move(direction): # Deplace le joueur si possible
global visited
flee = random.randint(1,6)
if Map.isMonster(Player.getPosition()) == 0 or flee == 6:
answer = Map.check(Player.getPosition(),direction)
if answer == 0:
return 'Il y a un mur dans cette direction'
elif answer == 1 :
Player.move(direction)
Player.editTime(10)
if Map.getVisited(Player.getPosition()) == 0:
Map.setMonster(Player.getPosition(),Player.getLevel())
Map.setVisited(Player.getPosition())
visited += 1
return Map.getDescript(Player.getPosition())
else :
win()
exitGame()
else:
Player.editHealth(-1)
Player.editTime(1)
return "Votre adversaire vous attrappe par le col et frappe a l'estomac. Battez-vous que diable!"
示例4: move
# 需要导入模块: import Player [as 别名]
# 或者: from Player import getLevel [as 别名]
def move(direction): # Deplace le joueur si possible
global visited
flee = random.randint(1,6)
if Map.isMonster(Player.getPosition()) == 0 or flee == 6:
answer = Map.check(Player.getPosition(),direction)
if answer == 0:
return 'There is a wall in this direction.'
elif answer == 1 :
Player.move(direction)
Player.editTime(10)
if Map.getVisited(Player.getPosition()) == 0:
Map.setMonster(Player.getPosition(),Player.getLevel())
Map.setVisited(Player.getPosition())
visited += 1
return Map.getDescript(Player.getPosition())
else :
win()
exitGame()
else:
Player.editHealth(-1)
Player.editTime(1)
return "You opponent pulls you by the collar and punches you in the stomach. Fight for heaven's sake!"
示例5: getAction
# 需要导入模块: import Player [as 别名]
# 或者: from Player import getLevel [as 别名]
#.........这里部分代码省略.........
return throwItem(Player.getPosition(),0)
elif use == 1:
return useItem(0)
elif key == '2' :
if int(key) > items:
return "Cet objet n'existe pas!"
elif pick == 1:
return pickItem(Player.getPosition(),1)
elif throw == 1:
return throwItem(Player.getPosition(),1)
elif use == 1:
return useItem(1)
elif key == '3' :
if int(key) > items:
return "Cet objet n'existe pas!"
elif pick == 1:
return pickItem(Player.getPosition(),2)
elif throw == 1:
return throwItem(Player.getPosition(),2)
elif use == 1:
return useItem(2)
elif key == '4' :
if int(key) > items:
return "Cet objet n'existe pas!"
elif pick == 1:
return pickItem(Player.getPosition(),3)
elif throw == 1:
return throwItem(Player.getPosition(),3)
elif use == 1:
return useItem(3)
elif key == '5' :
if int(key) > items:
return "Cet objet n'existe pas!"
elif pick == 1:
return pickItem(Player.getPosition(),4)
elif throw == 1:
return throwItem(Player.getPosition(),4)
elif use == 1:
return useItem(4)
elif key == '6' :
if int(key) > items:
return "Cet objet n'existe pas!"
elif pick == 1:
return pickItem(Player.getPosition(),5)
elif throw == 1:
return throwItem(Player.getPosition(),5)
elif use == 1:
return useItem(5)
elif key == 'z' :
pick, throw, use = 0,0,0
return move('north')
elif key == 'q' :
pick, throw, use = 0,0,0
return move('west')
elif key == 's' :
pick, throw, use = 0,0,0
return move('south')
elif key == 'd' :
pick, throw, use = 0,0,0
return move('east')
elif key == 'o' :
pick, throw, use = 0,0,0
return altDescript()
elif key == 'r' :
pick, throw, use = 0,0,0
return pickList()
elif key == 'j' :
pick, throw, use = 0,0,0
return throwList()
elif key == 'e' :
pick, throw, use = 0,0,0
return useList()
elif key == 'a' :
pick, throw, use = 0,0,0
return attack()
elif key == '\x1b' :
exitGame()
time.sleep(0.2)
elif key == 'c' :
termios.tcsetattr(sys.stdin, termios.TCSADRAIN, defaultTerminal)
cheat = raw_input("Enter cheat code : ")
tty.setcbreak(sys.stdin.fileno())
if cheat == "doppel":
Map.addDoppel(Player.getPosition())
return "Il y a desormais un Doppelganger devant vous!"
elif cheat == "pepperonipizza":
Player.addItem({"name" : "une Pizza" , "rate" : 9 , "type" : 0 , "Modifier" : 100 , "liste" : "Une Pizza Pepperoni -- "})
return "Une Pizza Pepperoni se materialise dons votre inventaire!"
elif cheat == "konami":
while Player.getLevel()<10:
Player.setXp(levelUp)
checkXp()
if Player.isItem() <= 5:
Player.addItem({"name" : "le NES Zapper" , "rate" : 0 , "type" : 1 , "Modifier" : 10 , "liste" : "Le NES Zapper ---+10 "})
return "KONAMI vous monte au niveau maximal et vous donne un NES Zapper!"
else :
return "KONAMI vous monte au niveau maximal!"
else:
return "Ne trichez pas si vous ne savez pas comment le faire !"
示例6: getAction
# 需要导入模块: import Player [as 别名]
# 或者: from Player import getLevel [as 别名]
#.........这里部分代码省略.........
elif throw == 1:
return throwItem(Player.getPosition(),0)
elif use == 1:
return useItem(0)
elif key == '2' :
if int(key) > items:
return "This item doesn't exist!"
elif pick == 1:
return pickItem(Player.getPosition(),1)
elif throw == 1:
return throwItem(Player.getPosition(),1)
elif use == 1:
return useItem(1)
elif key == '3' :
if int(key) > items:
return "This item doesn't exist!"
elif pick == 1:
return pickItem(Player.getPosition(),2)
elif throw == 1:
return throwItem(Player.getPosition(),2)
elif use == 1:
return useItem(2)
elif key == '4' :
if int(key) > items:
return "This item doesn't exist!"
elif pick == 1:
return pickItem(Player.getPosition(),3)
elif throw == 1:
return throwItem(Player.getPosition(),3)
elif use == 1:
return useItem(3)
elif key == '5' :
if int(key) > items:
return "This item doesn't exist!"
elif pick == 1:
return pickItem(Player.getPosition(),4)
elif throw == 1:
return throwItem(Player.getPosition(),4)
elif use == 1:
return useItem(4)
elif key == '6' :
if int(key) > items:
return "This item doesn't exist!"
elif pick == 1:
return pickItem(Player.getPosition(),5)
elif throw == 1:
return throwItem(Player.getPosition(),5)
elif use == 1:
return useItem(5)
elif key == 'w' :
pick, throw, use = 0,0,0
return move('north')
elif key == 'a' :
pick, throw, use = 0,0,0
return move('west')
elif key == 's' :
pick, throw, use = 0,0,0
return move('south')
elif key == 'd' :
pick, throw, use = 0,0,0
return move('east')
elif key == 'o' :
pick, throw, use = 0,0,0
return altDescript()
elif key == 'p' :
pick, throw, use = 0,0,0
return pickList()
elif key == 't' :
pick, throw, use = 0,0,0
return throwList()
elif key == 'e' :
pick, throw, use = 0,0,0
return useList()
elif key == 'f' :
pick, throw, use = 0,0,0
return attack()
elif key == '\x1b' :
exitGame()
time.sleep(0.2)
elif key == 'c' :
termios.tcsetattr(sys.stdin, termios.TCSADRAIN, defaultTerminal)
cheat = raw_input("Enter cheat code : ")
tty.setcbreak(sys.stdin.fileno())
if cheat == "doppel":
Map.addDoppel(Player.getPosition())
return "There is now a Doppelganger in front of you!"
elif cheat == "pepperonipizza":
Player.addItem({"name" : "a Pizza" , "rate" : 9 , "type" : 0 , "Modifier" : 100 , "liste" : "A Pepperoni Pizza ---- "})
return "A Pepperoni Pizza materialises in your inventory!"
elif cheat == "konami":
while Player.getLevel()<10:
Player.setXp(levelUp)
checkXp()
if Player.isItem() <= 5:
Player.addItem({"name" : "the NES Zapper" , "rate" : 0 , "type" : 1 , "Modifier" : 10 , "liste" : "The NES Zapper --+10 "})
return "KONAMI Levels you up to the maximum level and gives you NES Zapper!"
else:
return "KONAMI Levels you up to the maximum level!"
else:
return "Don't cheat if you don't know how to!"