本文整理汇总了Python中tale.player.Player.verbs["xywobble"]方法的典型用法代码示例。如果您正苦于以下问题:Python Player.verbs["xywobble"]方法的具体用法?Python Player.verbs["xywobble"]怎么用?Python Player.verbs["xywobble"]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tale.player.Player
的用法示例。
在下文中一共展示了Player.verbs["xywobble"]方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_custom_verbs
# 需要导入模块: from tale.player import Player [as 别名]
# 或者: from tale.player.Player import verbs["xywobble"] [as 别名]
def test_custom_verbs(self):
player = Player("julie", "f")
player.verbs["xywobble"] = "p1"
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"
room.init_inventory([chair1, player, chair2])
# check inventory NOT affecting player custom verbs, but DOES affect location verbs
self.assertEqual({"xywobble": "p1"}, player.verbs)
self.assertEqual({"frobnitz": "c2", "xywobble": "p1"}, room.verbs)
player.insert(chair_in_inventory, player)
self.assertEqual({"xywobble": "p1"}, player.verbs)
self.assertEqual({"frobnitz": "c2", "xywobble": "p1", "kowabooga": "c3"}, room.verbs)
player.remove(chair_in_inventory, player)
self.assertEqual({"frobnitz": "c2", "xywobble": "p1"}, room.verbs)
player.insert(chair_in_inventory, player)
self.assertEqual({"frobnitz": "c2", "xywobble": "p1", "kowabooga": "c3" }, room.verbs)
room2 = Location("room2")
self.assertEqual({}, room2.verbs)
chair1.move(room2, player)
self.assertEqual({"xywobble": "p1", "kowabooga": "c3" }, room.verbs)
self.assertEqual({"frobnitz": "c1"}, room2.verbs)
chair2.move(room2, player)
self.assertEqual({"xywobble": "p1", "kowabooga": "c3"}, room.verbs)
self.assertEqual({"frobnitz": "c2"}, room2.verbs)
player.move(room2)
self.assertEqual({}, room.verbs)
self.assertEqual({"frobnitz": "c2", "xywobble": "p1", "kowabooga": "c3"}, room2.verbs)
示例2: test_custom_verbs
# 需要导入模块: from tale.player import Player [as 别名]
# 或者: from tale.player.Player import verbs["xywobble"] [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))