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


Python Hero.health方法代码示例

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


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

示例1: test_is_alive_death

# 需要导入模块: from hero import Hero [as 别名]
# 或者: from hero.Hero import health [as 别名]
	def test_is_alive_death(self):
		hero = Hero("Bron", 100, "DragonSlayer")
		hero.health = 0
		self.assertFalse(hero.is_alive())
开发者ID:kalpak44,项目名称:Program101,代码行数:6,代码来源:test_hero.py

示例2: test_take_healing_deathed_hero

# 需要导入模块: from hero import Hero [as 别名]
# 或者: from hero.Hero import health [as 别名]
	def test_take_healing_deathed_hero(self):
		hero = Hero("Bron", 100, "DragonSlayer")
		hero.health = 0
		self.assertFalse(hero.take_healing(10))
开发者ID:kalpak44,项目名称:Program101,代码行数:6,代码来源:test_hero.py

示例3: start

# 需要导入模块: from hero import Hero [as 别名]
# 或者: from hero.Hero import health [as 别名]
def start():
    print("Welcome. Type 'help' for available commands")
    exit = False
    created = False
    loaded_map = False
    while exit is False:
        full_command = input('--> ').strip().split(' ')
        if full_command[0] == 'load_map':
            dungeon = Dungeon(full_command[1])
            if dungeon.map:
                loaded_map = True
        elif full_command[0] == 'show_map' and loaded_map:
            print(dungeon.print_map())
        elif full_command[0] == 'create_hero' and loaded_map:
            my_hero = Hero(
                full_command[1], int(full_command[2]), full_command[3])
            my_hero.weapon = Weapon('Ashbringer', 40, 0.8)
            created = True
        elif full_command[0] == 'spawn_hero' and loaded_map:
            if created is True:
                dungeon.spawn(full_command[1], my_hero)
                dungeon.spawn_npcs()
            else:
                print('No created characters.')
        elif full_command[0] == 'move' and loaded_map:
            if full_command[1] not in dungeon.ingame:
                print ('Player name is incorrect.')

            elif not dungeon.ingame[full_command[1]].is_alive():
                exit = True
                return 'Your character is dead. Game over.'
            else:
                if dungeon.unlocked:
                    exit = True
                    return 'Game Over. You have won.'
                print(dungeon.move_player(full_command[1], full_command[2]))
                to_move = dungeon.get_random_npc()
                if not dungeon.ingame[to_move].is_alive():
                    dungeon.ingame = {
                        i: dungeon.ingame[i] for i in dungeon.ingame if i != 0}
                    dungeon.npcs = {i: dungeon.npcs[i]
                                    for i in dungeon.npcs if i != 0}
                else:
                    print(dungeon.move_npc(to_move))
                print(dungeon.print_map())
        elif full_command[0] == 'heal':
            if created and loaded_map:
                my_hero.health = my_hero.max_health
            else:
                print('No created characters.')
        elif full_command[0] == 'known_as':
            if created and loaded_map:
                print (my_hero.known_as())
            else:
                print('No created characters.')
        elif full_command[0] == 'help':
            print(helper)
        elif full_command[0] == 'exit':
            exit = True
        else:
            print("Invalid command. Type 'help' for available commands.")
开发者ID:sslavov93,项目名称:TreasureDungeon,代码行数:63,代码来源:CLI-deprecate.py

示例4: test_Hero_take_healing_maxhealing

# 需要导入模块: from hero import Hero [as 别名]
# 或者: from hero.Hero import health [as 别名]
 def test_Hero_take_healing_maxhealing(self):
     my_Hero = Hero("Ivan", 100, "bad ass")
     my_Hero.health = 100
     my_Hero.take_healing(10)
     self.assertEqual(my_Hero.get_health(), 100)
开发者ID:Hristiyan-Andreev,项目名称:HackBuglaria,代码行数:7,代码来源:heroTest.py

示例5: test_Hero_take_healing_dead

# 需要导入模块: from hero import Hero [as 别名]
# 或者: from hero.Hero import health [as 别名]
 def test_Hero_take_healing_dead(self):
     my_Hero = Hero("Ivan", 100, "bad ass")
     my_Hero.health = 0
     self.assertFalse(my_Hero.take_healing(30))
     self.assertEqual(my_Hero.get_health(), 0)
开发者ID:Hristiyan-Andreev,项目名称:HackBuglaria,代码行数:7,代码来源:heroTest.py

示例6: test_Hero_is_alive_dead

# 需要导入模块: from hero import Hero [as 别名]
# 或者: from hero.Hero import health [as 别名]
 def test_Hero_is_alive_dead(self):
     my_Hero = Hero("Ivan", 100, "bad ass")
     my_Hero.health = 0
     self.assertFalse(my_Hero.is_alive())
开发者ID:Hristiyan-Andreev,项目名称:HackBuglaria,代码行数:6,代码来源:heroTest.py

示例7: test_is_alive_dead

# 需要导入模块: from hero import Hero [as 别名]
# 或者: from hero.Hero import health [as 别名]
 def test_is_alive_dead(self):
     bron_hero = Hero("Bron", 100, "DragonSyler")
     bron_hero.health = 0
     self.assertFalse(bron_hero.is_alive())
开发者ID:kal0ian,项目名称:HackBulgaria,代码行数:6,代码来源:hero-test.py


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