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


Python Player.init_inventory方法代码示例

本文整理汇总了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))
开发者ID:MitsuharuEishi,项目名称:Tale,代码行数:25,代码来源:test_mudobjects.py


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