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


Python Orc.take_healing方法代码示例

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


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

示例1: OrcTest

# 需要导入模块: from orc import Orc [as 别名]
# 或者: from orc.Orc import take_healing [as 别名]
class OrcTest (unittest.TestCase):
    def setUp(self):
        self.orc = Orc("Gosho", 100, 1.25)

    def test_orc_init(self):

        self.assertEqual(self.orc.name, "Gosho")
        self.assertEqual(self.orc.health, 100)
        self.assertEqual(self.orc.berserk_factor, 1.25)

    def test_get_health(self):

        self.assertEqual(self.orc.get_health(), 100)

    def test_is_alive_return_false(self):

        self.orc.fight_health = 0
        self.assertFalse(self.orc.is_alive())

    def test_is_alive(self):

        self.assertTrue(self.orc.is_alive())

    def test_take_damage(self):

        self.assertEqual(80, self.orc.take_damage(20))

    def test_take_damage_more_than_health(self):

        self.assertEqual(0, self.orc.take_damage(120))

    def test_take_healing_to_dead_person(self):

        self.orc.health = 0
        self.assertFalse(self.orc.take_healing(20))

    def test_take_healing_more_than_full_health(self):

        self.orc.health = 90
        self.assertFalse(self.orc.take_healing(100))

    def test_take_healing_true(self):

        self.orc.health = 40

    def test_berserk_factor_below_one(self):
        self.orc.berserk_factor = 0.4
        self.assertEqual(self.orc.berserk_factor_check(), 1)

    def test_berserk_factor_over_two(self):
        self.orc.berserk_factor = 2.14
        self.assertEqual(self.orc.berserk_factor_check(), 2)

    def test_orc_attack_with_weapon(self):
        self.orc.equip_weapon(Weapon("Pipe", 35, 0.5))
        self.assertEqual(self.orc.attack(), 70)

    def test_orc_attack_without_weapon(self):
        self.assertEqual(self.orc.attack(), 0)
开发者ID:JusttRelaxx,项目名称:HackBulgaria,代码行数:61,代码来源:the_orc_test.py

示例2: OrcTest

# 需要导入模块: from orc import Orc [as 别名]
# 或者: from orc.Orc import take_healing [as 别名]
class OrcTest (unittest.TestCase):
    def setUp(self):
        self.orc = Orc("The DragonSlayer killer", 100, 1.5)

    def test_hero_init(self):

        self.assertEqual(self.orc.name, "The DragonSlayer killer")
        self.assertEqual(self.orc.maxhealth, 100)
        self.assertEqual(self.orc.berserk_factor, 1.5)

    def test_get_health(self):

        self.assertEqual(self.orc.get_health(), 100)

    def test_is_alive_return_false(self):

        self.orc.maxhealth = 0
        self.assertFalse(self.orc.is_alive())

    def test_is_alive(self):

        self.assertTrue(self.orc.is_alive())

    def test_take_damage(self):

        self.assertEqual(80, self.orc.take_damage(20))

    def test_take_damage_more_than_health(self):

        self.assertEqual(0,self.orc.take_damage(120))

    def test_take_healing_to_dead_person(self):

        self.orc.maxhealth = 0
        self.assertFalse(self.orc.take_healing(20))

    def test_take_healing_more_than_enough(self):

        self.orc.maxhealth = 90
        self.assertFalse(self.orc.take_healing(100))

    def test_take_healing_true(self):

        self.orc.maxhealth = 40

    def test_berserk_factor_below_one(self):
        self.orc.berserk_factor = 0.5
        self.assertEqual(self.orc.berserk_factor_check(), 1)

    def test_berserk_factor_above_two(self):
        self.orc.berserk_factor = 2.15
        self.assertEqual(self.orc.berserk_factor_check(), 2)
开发者ID:modzozo,项目名称:hack101,代码行数:54,代码来源:orcTest.py

示例3: TestOrc

# 需要导入模块: from orc import Orc [as 别名]
# 或者: from orc.Orc import take_healing [as 别名]
class TestOrc(unittest.TestCase):

    def setUp(self):
        self.pesho = Orc("Pesho", 100, 2.2)

    def test_orc_init(self):
        self.assertEqual(self.pesho.name, "Pesho")
        self.assertEqual(self.pesho.health, 100)
        self.assertEqual(self.pesho.berserk_factor, 2)

    def test_get_health(self):
        self.assertEqual(100, self.pesho.get_health())

    def test_is_alive(self):
        self.assertTrue(self.pesho.is_alive())

    def test_is_alive_dead(self):
        self.pesho.health = 0
        self.assertFalse(self.pesho.is_alive())

    def test_take_demage(self):
        self.pesho.take_demage(10)
        self.assertEqual(90, self.pesho.health)

    def test_take_demage_two(self):
        self.pesho.take_demage(110)
        self.assertEqual(0, self.pesho.health)

    def test_take_healing(self):
        self.pesho.take_demage(100)
        self.assertFalse(self.pesho.take_healing(10))

    def test_take_healing_two(self):
        self.pesho.take_demage(10)
        self.pesho.take_healing(200)
        self.assertEqual(100, self.pesho.health)

    def test_take_healing_three(self):
        self.pesho.take_demage(10)
        self.pesho.take_healing(200)
        self.assertTrue(self.pesho.is_alive())
开发者ID:kal0ian,项目名称:HackBulgaria,代码行数:43,代码来源:orc-test.py

示例4: TestOrc

# 需要导入模块: from orc import Orc [as 别名]
# 或者: from orc.Orc import take_healing [as 别名]
class TestOrc(unittest.TestCase):
	def setUp(self):
		self.orc = Orc("Monster", 100, 2)

	def test_orc_init(self):
		self.assertEqual(self.orc.name, "Monster")
		self.assertEqual(self.orc.health, 100)
		self.assertEqual(self.orc.berserk_factor, 2)

	def test_orc_limit_bf_more(self):
		orc = Orc("Monster", 100, 5)
		with self.assertRaises(ValueError):
			Orc(2)

	def test_orc_limit_bf_more(self):
		orc = Orc("Monster", 100, 1)
		self.assertEqual(orc.berserk_factor, 1)

	def test_orc_limit_bf_more(self):
		orc = Orc("Monster", 100, 2)
		self.assertEqual(orc.berserk_factor, 2)
	
	def test_get_health(self):
		self.assertEqual(100, self.orc.get_health())

	def test_is_alive(self):
		self.assertTrue(self.orc.is_alive())

	def test_is_alive_death(self):
		self.orc.health = 0
		self.assertFalse(self.orc.is_alive())

	def test_take_damage(self):
		self.assertEqual(self.orc.take_damage(80),20)

	def test_take_damage_more(self):
		self.assertEqual(self.orc.take_damage(123),0)
		
	def test_take_healing_deathed_hero(self):
		self.orc.health = 0
		self.assertFalse(self.orc.take_healing(10))

	def test_take_healing(self):
		self.assertTrue(self.orc.take_healing(10))

	def test_take_healing_limit_health_invalid(self):
		self.orc.take_healing(10)
		self.assertEqual(100, self.orc.health)

	def test_take_healing_limit_health_valid(self):
		self.orc.health = 80
		self.orc.take_healing(10)
		self.assertEqual(90, self.orc.health)
开发者ID:kalpak44,项目名称:Program101,代码行数:55,代码来源:test_orc.py

示例5: TestOrc

# 需要导入模块: from orc import Orc [as 别名]
# 或者: from orc.Orc import take_healing [as 别名]
class TestOrc(unittest.TestCase):

    def setUp(self):
        self.orc = Orc("orc", 90, 1.4)

    def test_orc_init(self):
        self.assertEqual(self.orc.name, "orc")
        self.assertEqual(self.orc.health, 90)
        self.assertEqual(self.orc.berserk_factor, 1.4)

    def test_orc_init_weak_orc(self):
        weak_orc = Orc("orc", 20, 0.2)
        self.assertEqual(weak_orc.name, "orc")
        self.assertEqual(weak_orc.health, 20)
        self.assertEqual(weak_orc.berserk_factor, 1)

    def test_orc_init_strong_orc(self):
        strong_orc = Orc("orcc", 200, 20)
        self.assertEqual(strong_orc.name, "orcc")
        self.assertEqual(strong_orc.health, 200)
        self.assertEqual(strong_orc.berserk_factor, 2)

    def test_get_health(self):
        self.assertEqual(self.orc.get_health(), 90)

    def test_is_alive(self):
        self.assertTrue(self.orc.is_alive())

    def test_is_alive_with_dead(self):
        self.orc.health = 0
        self.assertFalse(self.orc.is_alive())

    def test_take_damage(self):
        self.orc.take_damage(50)
        self.assertEqual(self.orc.health, 40)

    def test_take_damage_max_dmg(self):
        self.orc.take_damage(200)
        self.assertEqual(self.orc.health, 0)
        self.orc.take_damage(20)
        self.assertEqual(self.orc.health, 0)

    def test_take_healing_on_dead(self):
        self.orc.health = 0
        self.assertFalse(self.orc.take_healing(100))

    def test_take_healing_above_maximum_health(self):
        self.orc.take_healing(1 + self.orc._MAX_HEALTH)
        self.assertTrue(self.orc.take_healing(1 + self.orc._MAX_HEALTH))
        self.assertEqual(self.orc.health, self.orc._MAX_HEALTH)

    def test_take_healing(self):
        self.orc.health = 20
        self.assertTrue(self.orc.take_healing(20))
        self.assertEqual(self.orc.health, 40)

    def test_attack(self):
        weapon = Weapon("Mighty Axe", 25, 0.2)
        self.orc.equip_weapon(weapon)
        if self.orc.weapon.critical_hit():
            self.assertEqual(self.orc.attack(), self.orc.weapon.damage * self.orc.berserk_factor *2)
        else:
            self.assertEqual(self.orc.attack(), self.orc.weapon.damage * self.orc.berserk_factor)
开发者ID:svetlio2,项目名称:hackbg,代码行数:65,代码来源:orc_test.py

示例6: Hero_tests

# 需要导入模块: from orc import Orc [as 别名]
# 或者: from orc.Orc import take_healing [as 别名]
class Hero_tests(unittest.TestCase):

    def setUp(self):
        self.entity = Entity("Gosho", 100)
        self.bron_hero = Hero("Ivan", 100, "Magician")
        self.bron_orc = Orc("Pesho", 100, 1.40)

    def test_initialisation(self):
        self.assertEqual(self.bron_hero.name, "Ivan")
        self.assertEqual(self.bron_hero.health, 100)
        self.assertEqual(self.bron_hero.nickName, "Magician")

    def test_known_as(self):
        self.assertEqual("Ivan the Magician", self.bron_hero.known_as())

    def test_get_health(self):
        self.assertEqual(100, self.bron_hero.get_health())

    def test_is_alive_with_max_health(self):
        self.bron_hero.health -= 100
        self.assertFalse(self.bron_hero.is_alive())

    def test_is_alive_when_hit(self):
        self.bron_hero.health += 20
        self.assertTrue(self.bron_hero.is_alive())

    def test_take_dmg(self):
        self.bron_hero.take_dmg(80)
        self.assertEqual(20, self.bron_hero.health)

    def test_take_more_dmg_than_health(self):
        self.bron_hero.take_dmg(120)
        self.assertEqual(0, self.bron_hero.health)

    def test_take_healing_on_dead_hero(self):
        self.bron_hero.take_dmg(120)
        self.assertFalse(self.bron_hero.take_healing(20))

    def test_take_more_healing_than_the_max_health(self):
        self.bron_hero.take_dmg(50)
        self.bron_hero.take_healing(100)
        self.assertEqual(100, self.bron_hero.health)

    def test_take_successful_heal(self):
        self.bron_hero.take_dmg(20)
        self.assertTrue(self.bron_hero.take_healing(40))

    def test_Orc_initialization(self):
        self.assertEqual(self.bron_orc.name, "Pesho")
        self.assertEqual(self.bron_orc.health, 100)
        self.assertEqual(self.bron_orc.berserk_factor, 1.40)

    def test_Orc_initialization2(self):
        self.bron_orc_big = Orc("Pesho", 100, 2.40)
        self.assertEqual(self.bron_orc_big.berserk_factor, 2)

    def test_Orc_initialization3(self):
        self.bron_orc_small = Orc("Pesho", 100, 0.40)
        self.assertEqual(self.bron_orc_small.berserk_factor, 1)

    def test_Orc_get_healt(self):
        self.assertEqual(self.bron_orc.get_health(), 100)

    def test_if_orc_is_alive_when_created(self):
        self.assertTrue(self.bron_orc.is_alive())

    def test_if_orc_is_alive_when_hit(self):
        self.bron_orc.health -= 30
        self.assertTrue(self.bron_orc.is_alive())

    def test_orc_take_dmg(self):
        self.bron_orc.take_dmg(30)
        self.assertEqual(70, self.bron_orc.get_health())

    def test_orc_take_more_dmg(self):
        self.bron_orc.take_dmg(110)
        self.assertEqual(0, self.bron_orc.get_health())

    def test_take_normal_heal(self):
        self.bron_orc.take_dmg(50)
        self.bron_orc.take_healing(40)
        self.assertEqual(90, self.bron_orc.health)

    def test_take_overload_heal(self):
        self.bron_orc.take_dmg(50)
        self.bron_orc.take_healing(100)
        self.assertEqual(100, self.bron_orc.health)
开发者ID:golfdman,项目名称:HackBulgaria,代码行数:89,代码来源:test_hero.py

示例7: test_Orc_take_healing_maxhealing

# 需要导入模块: from orc import Orc [as 别名]
# 或者: from orc.Orc import take_healing [as 别名]
 def test_Orc_take_healing_maxhealing(self):
     my_Orc = Orc("Ivan", 100, 1.5)
     my_Orc.health = 100
     my_Orc.take_healing(10)
     self.assertEqual(my_Orc.get_health(), 100)
开发者ID:Hristiyan-Andreev,项目名称:HackBuglaria,代码行数:7,代码来源:orcTest.py

示例8: test_Orc_take_healing_dead

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

示例9: test_Orc_take_healing

# 需要导入模块: from orc import Orc [as 别名]
# 或者: from orc.Orc import take_healing [as 别名]
 def test_Orc_take_healing(self):
     my_Orc = Orc("Ivan", 100, 1.5)
     my_Orc.health = 50
     my_Orc.take_healing(30)
     self.assertEqual(my_Orc.get_health(), 80)
开发者ID:Hristiyan-Andreev,项目名称:HackBuglaria,代码行数:7,代码来源:orcTest.py


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