本文整理汇总了Python中inventory.Inventory.equip_main_hand方法的典型用法代码示例。如果您正苦于以下问题:Python Inventory.equip_main_hand方法的具体用法?Python Inventory.equip_main_hand怎么用?Python Inventory.equip_main_hand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类inventory.Inventory
的用法示例。
在下文中一共展示了Inventory.equip_main_hand方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Game
# 需要导入模块: from inventory import Inventory [as 别名]
# 或者: from inventory.Inventory import equip_main_hand [as 别名]
#.........这里部分代码省略.........
pickupMssg = ''
toAppend = toAppend[1:]
pickupMssg += toAppend
# If Space still in inventory, display "Add to inventory"
if self.inventory.has_inventory_space():
validOptions.append('8')
toAppend = ' [8: Add to inventory]'
if self._isMssgTooLong(pickupMssg, toAppend):
self.messages.append(pickupMssg)
pickupMssg = ''
toAppend = toAppend[1:]
pickupMssg += toAppend
# Always allowed to ignore items
validOptions.append('9')
toAppend = ' [9: Ignore]'
if self._isMssgTooLong(pickupMssg, toAppend):
self.messages.append(pickupMssg)
pickupMssg = ''
toAppend = toAppend[1:]
pickupMssg += toAppend
# self.messages.append("[1: Pick up with MH] [2: Pick up with OH] [3: Don't pick up]")
self.messages.append(pickupMssg)
self.printScreen()
y_or_n = self.user.__move__(self.getDataForAI("ITEM"))
while y_or_n not in validOptions:
self.messages.append("Please enter " + '/'.join(validOptions))
self.printScreen()
y_or_n = self.user.__move__(self.getDataForAI("ITEM"))
if y_or_n == '1':
# pick up item
self.inventory.equip_main_hand(self.current_enemy.item)
self.printScreen()
if not USE_AI:
time.sleep(2)
elif y_or_n == '2':
self.inventory.equip_offhand(self.current_enemy.item)
self.printScreen()
if not USE_AI:
time.sleep(2)
elif y_or_n == '8':
self.inventory.add_to_pack(self.current_enemy.item)
elif y_or_n != '9':
# Items in inventory are keys 3-7
self.inventory.replace_item(int(y_or_n) - 3, self.current_enemy.item)
elif self.player.isDead():
self.printScreen()
if not USE_AI: time.sleep(2)
raise Defeat("You have been defeated.")
def checkEvent(self):
pass
random.seed()
event_value = random.uniform(0, 1)
encounter_chance = 0.03 + BASE_ENEMY_ENCOUNTER_CHANCE * self.danger
if self.player.hiding:
h_event_value = random.uniform(0, 1)
h_encounter_chance = 0.03 + BASE_HIDE_ENCOUNTER_CHANCE * self.hide_danger
if h_event_value <= h_encounter_chance:
encounter_chance = 1