本文整理汇总了Python中World.equipment方法的典型用法代码示例。如果您正苦于以下问题:Python World.equipment方法的具体用法?Python World.equipment怎么用?Python World.equipment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类World
的用法示例。
在下文中一共展示了World.equipment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: buildEquipmentFromFile
# 需要导入模块: import World [as 别名]
# 或者: from World import equipment [as 别名]
def buildEquipmentFromFile(file, location):
print file
if str(file).endswith('~'):
print "\n"
return
path = location + file
with open(path, 'r') as f:
fileData = f.readlines()
newWeapon = None
newArmor = None
equipmentType = None
slot = None
durability = None
maxDurability = None
worth = None
description = None
longDescription = None
hp = None
pp = None
offense = None
defense = None
speed = None
guts = None
luck = None
vitality = None
IQ = None
battleCommands = None
statusEffect = None
onUse = None
isVisible = None
spawnContainer = None
isCarryable = None
respawns = None
itemGrabHandler = None
objectSpawner = None
notDroppable = None
container = None
spawnOdds = None
time = None
active = None
repeat = None
cycles = None
for Data in fileData:
if Data.startswith('type='):
equipmentType = Data[5:-1]
if Data.startswith('ID='):
ID = Data[3:-1]
if Data.startswith('name='):
name = Data[5:-1]
if Data.startswith('slot='):
slot = Data[5:-1]
if Data.startswith('durability='):
durability = Data[11:-1]
if Data.startswith('maxDurability='):
maxDurability = Data[14:-1]
if Data.startswith('worth='):
worth = Data[6:-1]
if Data.startswith('description='):
description = Data[12:-1]
if Data.startswith('longDescription='):
longDescription = Data[16:-1]
if Data.startswith('hp='):
hp = int(Data[3:-1])
if Data.startswith('pp='):
pp = int(Data[3:-1])
if Data.startswith('offense='):
offense = int(Data[8:-1])
if Data.startswith('defense='):
defense = int(Data[8:-1])
if Data.startswith('speed='):
speed = int(Data[6:-1])
if Data.startswith('guts='):
guts = int(Data[5:-1])
if Data.startswith('luck='):
luck = int(Data[5:-1])
if Data.startswith('vitality='):
vitality = int(Data[9:-1])
if Data.startswith('IQ='):
IQ = int(Data[3:-1])
if Data.startswith('battleCommands='):
battleCommands = Data[15:-1]
battleCommands = battleCommands.split(",")
if Data.startswith('statusEffect='):
statusEffect = Data[13:-1]
if Data.startswith('onUse='):
onUse = Data[6:-1]
if Data.startswith('isVisible='):
isVisible = Data[10:-1]
if isVisible == 'True':
isVisible = True
elif isVisible == 'False':
isVisible = False
if Data.startswith('kind.isCarryable='):
#.........这里部分代码省略.........