本文整理汇总了Python中dungeon.Dungeon._check_for_equal_player_coordinates方法的典型用法代码示例。如果您正苦于以下问题:Python Dungeon._check_for_equal_player_coordinates方法的具体用法?Python Dungeon._check_for_equal_player_coordinates怎么用?Python Dungeon._check_for_equal_player_coordinates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dungeon.Dungeon
的用法示例。
在下文中一共展示了Dungeon._check_for_equal_player_coordinates方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DungeonTests
# 需要导入模块: from dungeon import Dungeon [as 别名]
# 或者: from dungeon.Dungeon import _check_for_equal_player_coordinates [as 别名]
#.........这里部分代码省略.........
def test_move_left_right(self):
self.assertFalse(self.single_loc_map._move_left_right("player_1", "left"))
expected_arr = [['.', 'H', '#', '#', '.', '.', '.', '.', '.', '.'],
['#', '.', '#', '#', '.', '.', '#', '#', '#', '.'],
['#', '.', '#', '#', '#', 'S', '#', '#', '#', '.'],
['#', '.', '.', '.', '.', '.', '#', '#', '#', '.'],
['#', '#', '#', '.', '#', '#', '#', '#', '#', '#']]
self.single_loc_map._move_left_right("player_1", "right")
self.assertEqual(self.single_loc_map.map_array, expected_arr)
tmp_arr = self.single_loc_map.entities_dic["player_1"]
x = tmp_arr[0]
y = tmp_arr[1]
self.assertEqual(x, 1)
self.assertEqual(y, 0)
def test_move_up_down(self):
self.assertFalse(self.single_loc_map._move_up_down("player_1", "down"))
self.assertFalse(self.single_loc_map._move_up_down("player_1", "up"))
expected_arr = [['.', '.', '#', '#', '.', '.', '.', '.', '.', '.'],
['#', 'H', '#', '#', '.', '.', '#', '#', '#', '.'],
['#', '.', '#', '#', '#', 'S', '#', '#', '#', '.'],
['#', '.', '.', '.', '.', '.', '#', '#', '#', '.'],
['#', '#', '#', '.', '#', '#', '#', '#', '#', '#']]
self.single_loc_map._move_left_right("player_1", "right")
self.single_loc_map._move_up_down("player_1", "down")
self.assertEqual(self.single_loc_map.map_array, expected_arr)
tmp_arr = self.single_loc_map.entities_dic["player_1"]
x = tmp_arr[1]
y = tmp_arr[1]
self.assertEqual(x, 1)
self.assertEqual(y, 1)
def test_check_for_equal_player_coordinates(self):
blademaster = Orc("Yurnero", 120, 1.2)
self.single_loc_map.spawn("player_2", blademaster)
answer1 = self.single_loc_map._check_for_equal_player_coordinates("player_1")
self.assertFalse(answer1)
self.single_loc_map.move("player_1", "right")
self.single_loc_map.move("player_2", "down")
self.single_loc_map.move("player_1", "down")
self.single_loc_map.move("player_2", "left")
self.single_loc_map.move("player_1", "down")
self.single_loc_map.move("player_2", "left")
self.single_loc_map.move("player_1", "down")
self.single_loc_map.move("player_2", "left")
self.single_loc_map.move("player_2", "left")
answer2 = self.single_loc_map._check_for_equal_player_coordinates("player_1")
answer3 = self.single_loc_map._check_for_equal_player_coordinates("player_2")
self.assertEqual(answer2, "player_2")
self.assertEqual(answer3, "player_1")
def test_give_me_random_coordinates(self):
matrix = self.single_loc_map.map_array
a, b = self.single_loc_map._give_me_random_coordinates(matrix)
self.assertIn(a, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
self.assertIn(b, [0, 1, 2, 3, 4])
def test_check_for_equal_weapon_coordinates_false1(self):
answer = self.single_loc_map._check_for_equal_player_coordinates("player_1")
self.assertFalse(answer)
def test_check_for_equal_weapon_coordinates_false2(self):
axe = Weapon("axe", 10, 0.5)
self.paladin.equip_weapon(axe)
answer = self.single_loc_map._check_for_equal_player_coordinates("player_1")