本文整理汇总了Python中tale.player.Player.init_inventory方法的典型用法代码示例。如果您正苦于以下问题:Python Player.init_inventory方法的具体用法?Python Player.init_inventory怎么用?Python Player.init_inventory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tale.player.Player
的用法示例。
在下文中一共展示了Player.init_inventory方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_custom_verbs
# 需要导入模块: from tale.player import Player [as 别名]
# 或者: from tale.player.Player import init_inventory [as 别名]
def test_custom_verbs(self):
player = Player("julie", "f")
player.verbs["xywobble"] = "p1"
monster = NPC("snake", "f")
monster.verbs["snakeverb"] = "s1"
room = Location("room")
chair1 = Item("chair1")
chair1.verbs["frobnitz"] = "c1"
chair2 = Item("chair2")
chair2.verbs["frobnitz"] = "c2"
chair_in_inventory = Item("chair3")
chair_in_inventory.verbs["kowabooga"] = "c3"
box_in_inventory = Item("box")
box_in_inventory.verbs["boxverb"] = "c4"
player.init_inventory([box_in_inventory, chair_in_inventory])
exit = Exit("e", "dummy", None, None)
exit.verbs["exitverb"] = "c5"
room.init_inventory([chair1, player, chair2, monster])
room.add_exits([exit])
custom_verbs = mud_context.driver.current_custom_verbs(player)
all_verbs = mud_context.driver.current_verbs(player)
self.assertEqual({"xywobble", "snakeverb", "frobnitz", "kowabooga", "boxverb", "exitverb"}, set(custom_verbs))
self.assertEqual(set(), set(custom_verbs) - set(all_verbs))