本文整理汇总了Python中Person.Person.has_item方法的典型用法代码示例。如果您正苦于以下问题:Python Person.has_item方法的具体用法?Python Person.has_item怎么用?Python Person.has_item使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Person.Person
的用法示例。
在下文中一共展示了Person.has_item方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Scene
# 需要导入模块: from Person import Person [as 别名]
# 或者: from Person.Person import has_item [as 别名]
class Scene(object):
def __init__(self):
self.person = Person()
def enter(self):
print "This scene is not yet configured. Subclass it amd implement enter()."
exit(1)
def get_action(self):
action = raw_input("> ")
if (action == "exit"):
exit(0)
self.get_action()
elif (action == "read map" and self.person.has_item("map")):
print " _~_ ___ "
print "|_L_|---|_r_|"
print " ___ _|_ "
print "|_S_|---|_r_|"
print " _|_ "
print " |_x_|"
return self.get_action()
elif (action == "read paper" and self.person.has_item("paper")):
print "*******"
print "Hurry to the passage, the machines have"
print "found us! If you encounter one then use the"
print "trap we put in place by shouting the password"
print "*******"
return self.get_action()
elif (action == "inventory"):
print self.person.items
return self.get_action()
else:
return action