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


Python weapon.Weapon类代码示例

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


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

示例1: test_critical_hit_true_and_false

 def test_critical_hit_true_and_false(self):
     new_weapon = Weapon("Mighty Axe", 25, 0.2)
     results = []
     for i in range(10):
         results.append(new_weapon.critical_hit())
     self.assertIn(True, results)
     self.assertIn(False, results)
开发者ID:dsspasov,项目名称:HackBulgaria,代码行数:7,代码来源:weapon_test.py

示例2: rubber_bullet

	def rubber_bullet(self):
		'''
		Патрон с резиновой пулей.
		:return: int
		'''
		return int(
			(Weapon.special_carbine(self) * 250) + (Weapon.guns(self) * 48))
开发者ID:karidon,项目名称:Tabel,代码行数:7,代码来源:ammunition.py

示例3: __init__

	def __init__(self, pos = (0,0), **images) :
		Projectile.__init__ (self, pos, **images)
		Weapon.__init__ (self, pos, **images)
		self._has_been_launched = False
		self.set_knockback_factor (5)
		self._damage = 5
		self._name = "Bomb"
开发者ID:ccl2of4,项目名称:Zombie-Hunting,代码行数:7,代码来源:bomb.py

示例4: automat_catridges

	def automat_catridges(self):
		'''
		5,45 и 7,62 мм автоматные патроны.
		:return: int
		'''
		return int(
			(Weapon.automat(self) * 246) + (Weapon.hand_gun(self) * 750))
开发者ID:karidon,项目名称:Tabel,代码行数:7,代码来源:ammunition.py

示例5: TestWeapon

class TestWeapon(unittest.TestCase):

    def setUp(self):
        self.sword = Weapon('Sword', 15, 0.4)

    def test_init_weapon(self):
        self.assertEqual(self.sword.type, 'Sword')
        self.assertEqual(self.sword.damage, 15)
        self.assertEqual(self.sword.critical_strike_percent, 0.4)

    def test_critical_hit(self):
        critical_hit_used = False
        critical_hit_not_used = False
        while True:
            if self.sword.critical_hit():
                critical_hit_used = True
                return
        while True:
            if not self.sword.critical_hit():
                critical_hit_not_used = True
                return
        self.assertTrue(critical_hit_used)
        self.assertFalse(critical_hit_not_used)

    def test_critical_raises_error(self):
        with self.assertRaises(ValueError):
            axe = Weapon('Axe', 25, 2)
开发者ID:stoyaneft,项目名称:HackBulgariaProgramming-101,代码行数:27,代码来源:test_weapon.py

示例6: pistol_catridges

	def pistol_catridges(self):
		'''
		Пистолетные патроны.
		:return: int
		'''
		return int((Weapon.guns(self) * 24) + (
			Weapon.pistol_gun(self) * 100))
开发者ID:karidon,项目名称:Tabel,代码行数:7,代码来源:ammunition.py

示例7: WeaponTest

class WeaponTest(unittest.TestCase):

    def setUp(self):
        self.weapon = Weapon("Spike", 200)

    def test_is_instance(self):
        self.assertTrue(isinstance(self.weapon, Weapon))

    def test_valid_members(self):
        self.assertEqual(self.weapon.name, "Spike")
        self.assertEqual(self.weapon.damage, 200)

    def test_str(self):
        expected = "{} with damage = {}"
        expected = expected.format(self.weapon.name, self.weapon.damage)
        self.assertEqual(str(self.weapon), expected)

    def test_get_functions(self):
        self.assertEqual(self.weapon.get_name(), "Spike")
        self.assertEqual(self.weapon.get_damage(), 200)

    def test_prepare_json(self):
        data = {
            "name": "Spike",
            "damage": 200
        }
        self.assertEqual(self.weapon.prepare_json(), data)
开发者ID:stilyantanev,项目名称:Dungeons-And-Pythons,代码行数:27,代码来源:weapon_test.py

示例8: test_critical_hit

 def test_critical_hit(self):
     weapon = Weapon("axe", 10, 0.5)
     results = []
     for x in range(1000):
         results.append(weapon.critical_hit())
     self.assertTrue(True in results)
     self.assertTrue(False in results)
开发者ID:mihail-nikolov,项目名称:hackBG,代码行数:7,代码来源:test_weapon.py

示例9: test_weapon_no_crit

 def test_weapon_no_crit(self):
     new_weapon = Weapon("alwayscrit", 10, 0)
     for i in range(0, 1000):
         iscrit = new_weapon.critical_hit()
         if iscrit:
             break
     self.assertFalse(iscrit)
开发者ID:didoman,项目名称:prog101tasks,代码行数:7,代码来源:dnp_tests.py

示例10: test_weapon_critical_hit

 def test_weapon_critical_hit(self):
     new_weapon = Weapon("alwayscrit", 10, 1)
     for i in range(0, 10):
         iscrit = new_weapon.critical_hit()
         if not iscrit:
             break
     self.assertTrue(iscrit)
开发者ID:didoman,项目名称:prog101tasks,代码行数:7,代码来源:dnp_tests.py

示例11: update

	def update (self) :
		assert (self._cooldown_frames_left >= 0)

		if self._cooldown_frames_left > 0 :
			self._cooldown_frames_left -= 1

		Weapon.update (self)
开发者ID:ccl2of4,项目名称:Zombie-Hunting,代码行数:7,代码来源:firearm.py

示例12: __init__

 def __init__(self):
    Weapon.__init__(self)
    self.enhancement = 2
    self.damageDie = 'd8'
    self.numDie = 0
    self.extraCrit = '2d6'
    self.weaponType = 'implement'
    self.keywords = ['implement',]
开发者ID:bpittman,项目名称:pydnd,代码行数:8,代码来源:gravis.py

示例13: WeaponTest

class WeaponTest(unittest.TestCase):
    def setUp(self):
        self.weapon = Weapon("gun", 40)

    def test_damage(self):
        self.assertEqual(self.weapon.get_damage(), 40)

    def test_name(self):
        self.assertEqual(self.weapon.get_name(), 'gun')
开发者ID:petrunka,项目名称:dungeons-pythons,代码行数:9,代码来源:weapontest.py

示例14: __init__

	def __init__(self, pos = (0,0), **images) :
		Weapon.__init__ (self, pos,**images)
		self._firing_velocity = 20
		self._magazine = []
		self._cooldown = 30
		self._name = "Firearm"

		#used for timing
		self._cooldown_frames_left = 0
开发者ID:ccl2of4,项目名称:Zombie-Hunting,代码行数:9,代码来源:firearm.py

示例15: __init__

 def __init__(self):
     Weapon.__init__(self)
     self.enhancement = 3
     self.damageDie = "d8"
     self.numDie = 1
     self.critDamage = "3d6"
     self.damageType = "str"
     self.weaponType = "dagger"
     self.keywords = ["dagger", "lightBlade", "radiant"]
     self.extraCrit = "3d6"
开发者ID:bpittman,项目名称:pydnd,代码行数:10,代码来源:linder.py


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