当前位置: 首页>>代码示例>>Python>>正文


Python Player.setXp方法代码示例

本文整理汇总了Python中Player.setXp方法的典型用法代码示例。如果您正苦于以下问题:Python Player.setXp方法的具体用法?Python Player.setXp怎么用?Python Player.setXp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Player的用法示例。


在下文中一共展示了Player.setXp方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: checkXp

# 需要导入模块: import Player [as 别名]
# 或者: from Player import setXp [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())
开发者ID:ForgetfulMuffin,项目名称:The-Shades,代码行数:16,代码来源:GameFR.py

示例2: useItem

# 需要导入模块: import Player [as 别名]
# 或者: from Player import setXp [as 别名]
def useItem(index): #Utilise un objet
	global use, levelUp
	use = 0
	item = Player.getItem(index)
	if item["type"] == 0 :
		Player.editHealth(item["Modifier"])
		descript = "Vous mangez " + Player.getItemName(index)
		Player.removeItem(index)
	elif item["type"] == 1 :
		Player.equip(item)
		descript = "Vous equipez " + Player.getItemName(index)
	elif item['type'] == 2 :
		for i in range (item['Modifier']):
			Player.setXp(levelUp)
			checkXp()
		descript = "Vous mangez " + Player.getItemName(index)
		Player.removeItem(index)
	return descript
开发者ID:ForgetfulMuffin,项目名称:The-Shades,代码行数:20,代码来源:GameFR.py

示例3: getAction

# 需要导入模块: import Player [as 别名]
# 或者: from Player import setXp [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 !"
开发者ID:ForgetfulMuffin,项目名称:The-Shades,代码行数:104,代码来源:GameFR.py

示例4: getAction

# 需要导入模块: import Player [as 别名]
# 或者: from Player import setXp [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!"
开发者ID:ForgetfulMuffin,项目名称:The-Shades,代码行数:104,代码来源:GameEN.py


注:本文中的Player.setXp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。