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


Python World.expirator方法代码示例

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


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

示例1: loadMobFromFile

# 需要导入模块: import World [as 别名]
# 或者: from World import expirator [as 别名]
def loadMobFromFile(file):
	'''
	handles loading a single mob from a given mob definition file into the world
	'''
	print file

	if str(file).endswith('~'):
		print '\n'
		return

	path = 'blueprints/mob/' + file
	with open(path, 'r') as f:
		fileData = f.readlines()



	newMob = World.Mob('none', 'none', 'none')
	newMob.mobID = ''

	print fileData

	splitFile = file.split("/")
	mobID = None
	name = 'none'
	species = None
	currentRoom = None
	region = None
	description = ''
	longDescription = ''
	hp = 0
	exp = 0
	inventory = []
	inventorySize = 0
	equipment = {}
	kind = None
	expirator = None
	inventoryItems = []
	currentRoomString = ''
	moveAI = None
	battleAI = None

	newMob.kind = World.mortal(hp=0,maxHp=0,pp=0,maxPp=0,level=0,exp=0,money=0,offense=0,defense=0,speed=0,guts=0,luck=0,vitality=0,IQ=0,inventory=[],inventorySize=0,equipment={})
	newMob.region = splitFile[0]

	for Data in fileData:

		if Data.startswith('mobID='):
			IDstring = Data[6:-1]
			if IDstring != '':
				newMob.mobID = int(IDstring)
		if Data.startswith('name='):
			newMob.name = Data[5:-1]
		if Data.startswith('species='):
			newMob.species = Data[8:-1]

		if Data.startswith('currentRoom='):
			currentRoomString = Data[12:-1]

		if Data.startswith('description='):
			newMob.description = Data[12:-1]

		if Data.startswith('longDescription='):
			newMob.longDescription = Data[16:-1]

		if Data.startswith('speech='):
			newMob.speech = Data[7:-1]

		if Data.startswith('expirator='):
			expirator = Data[10:-1]
			if expirator != '':
				expirator = int(expirator)
		if Data.startswith('moveAI='):
			text = Data[7:-1]
			moveAI = text.split(":")
		if Data.startswith('battleAI='):
			text = Data[9:-1]
			if text == 'basicBash':
				battleAI = aiBattle.basicBash
			else:
				battleAI = ''

		if Data.startswith('kind.hp='):
			newMob.kind.hp = int(Data[8:-1])
		if Data.startswith('kind.maxHp='):
			newMob.kind.maxHp = int(Data[11:-1])
		if Data.startswith('kind.pp='):
			newMob.kind.pp = int(Data[8:-1])
		if Data.startswith('kind.maxPp='):
			newMob.kind.maxPp = int(Data[11:-1])
		if Data.startswith('kind.level='):
			newMob.kind.level = int(Data[11:-1])
		if Data.startswith('kind.exp='):
			newMob.kind.exp = int(Data[9:-1])
		if Data.startswith('kind.money='):
			newMob.kind.money = int(Data[11:-1])
		if Data.startswith('kind.offense='):
			newMob.kind.offense = int(Data[13:-1])
		if Data.startswith('kind.defense='):
			newMob.kind.defense = int(Data[13:-1])
		if Data.startswith('kind.speed='):
#.........这里部分代码省略.........
开发者ID:buckets1337,项目名称:MotherMUD,代码行数:103,代码来源:MobInit.py


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