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


Python Orc.weapon方法代码示例

本文整理汇总了Python中orc.Orc.weapon方法的典型用法代码示例。如果您正苦于以下问题:Python Orc.weapon方法的具体用法?Python Orc.weapon怎么用?Python Orc.weapon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在orc.Orc的用法示例。


在下文中一共展示了Orc.weapon方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_battle

# 需要导入模块: from orc import Orc [as 别名]
# 或者: from orc.Orc import weapon [as 别名]
 def test_battle(self):
     orc = Orc("Bron", 100, 1.3)
     hero = Hero("Bron", 100, "DragonSlayer")
     axe = Weapon("Mighty Axe", 25, 0.2)
     orc.weapon = axe
     self.my_map.spawn("player_1", orc)
     self.my_map.spawn("player_2", hero)
     self.my_map.move("player_1", "right")
     self.my_map.move("player_1", "left")
     self.my_map.move("player_1", "right")
     self.my_map.move("player_2", "up")
     self.my_map.move("player_1", "down")
     self.my_map.move("player_1", "down")
     self.my_map.move("player_1", "down")
     for i in range(0, 4):
         self.my_map.move("player_2", "up")
     for i in range(0, 4):
         self.my_map.move("player_2", "left")
     self.my_map.move("player_2", "down")
     self.my_map.move("player_2", "down")
     self.my_map.move("player_2", "down")
     self.my_map.move("player_1", "right")
     self.my_map.move("player_2", "left")
     self.my_map.move("player_2", "left")
     self.my_map.move("player_1", "right")
     self.assertEqual(self.my_map.print_map(), "..##......\n#.##..###.\n#.###.###.\n#..O..###.\n###.#####.\n")
开发者ID:AlexanderTankov,项目名称:HackBulgaria-Programming-101,代码行数:28,代码来源:dungeon_test.py

示例2: test_fight_equal

# 需要导入模块: from orc import Orc [as 别名]
# 或者: from orc.Orc import weapon [as 别名]
 def test_fight_equal(self):
     hero_one = Hero("Bron", 100, "DragonSlayer")
     orc_one = Orc("Orcy", 150, 1.5)
     hero_one.weapon = Weapon("Axe", 20, 0.5)
     orc_one.weapon = Weapon("Axe", 20, 0.5)
     self.fight_one.simulate_battle()
     # both has the same weapon, but the orc has berserc_factor,\
     # he should be alive at the end
     self.assertTrue(self.orc_one.is_alive())
开发者ID:GalinaDimitrova,项目名称:Hack,代码行数:11,代码来源:fight_test.py

示例3: test__fail_move_on_map

# 需要导入模块: from orc import Orc [as 别名]
# 或者: from orc.Orc import weapon [as 别名]
 def test__fail_move_on_map(self):
     bron_orc = Orc("Bron", 100, 1.3)
     bron_hero = Hero("Bron", 100, "DragonSlayer")
     axe = Weapon("Mighty Axe", 25, 0.2)
     bron_orc.weapon = axe
     self.my_map.spawn("player_1", bron_orc)
     self.my_map.spawn("player_2", bron_hero)
     self.assertFalse(self.my_map.move("player_1", "left"))
     self.assertTrue(self.my_map.move("player_1", "right"))
     self.assertFalse(self.my_map.move("player_1", "up"))
     self.assertFalse(self.my_map.move("player_1", "right"))
     self.assertFalse(self.my_map.move("player_2", "down"))
开发者ID:AlexanderTankov,项目名称:HackBulgaria-Programming-101,代码行数:14,代码来源:dungeon_test.py

示例4: spawn_npcs

# 需要导入模块: from orc import Orc [as 别名]
# 或者: from orc.Orc import weapon [as 别名]
 def spawn_npcs(self):
     """Spawns NPCs into the Dungeon field"""
     free_spaces = True
     counter = 1
     while free_spaces:
         if "N" in self.map:
             npc = Orc("NPC" + str(counter), 250, 1.4)
             wep = Weapon("Axe" + str(counter), 15, 0.7)
             npc.weapon = wep
             self.npcs[npc.name] = npc
             self.ingame[npc.name] = npc
             npc.location = self.get_position_in_map("N")
             self.map = (self.map[:self.map.find("N")] + "O" +
                         self.map[self.map.find("N") + 1:])
             counter += 1
         else:
             free_spaces = False
开发者ID:sslavov93,项目名称:TreasureDungeon,代码行数:19,代码来源:dungeon.py


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