• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python weapon.Weapon类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: test_weapon_critical

 def test_weapon_critical(self):
     new_weapon = Weapon("Ico", 100, 0.2)
     self.assertEqual(new_weapon.name, "Ico")
     self.assertEqual(new_weapon.damage, 100)
     self.assertEqual(new_weapon.critical_strike_percent, 0.2)
     weapontests = []
     for n in range(1, 11):
         weapontests.append(new_weapon.critical_hit())
     self.assertIn(200, weapontests)
     self.assertIn(False, weapontests)
开发者ID:hconkov,项目名称:HackBulgaria-101-solutions,代码行数:10,代码来源:weapon_tests.py


示例17: test_critical_hit

 def test_critical_hit(self):
     test_weapon = Weapon("axe", 20, 0.2)
     is_False = False
     is_True = False
     for i in range(100):
         if test_weapon.critical_hit():
             is_True = True
         else:
             is_False = True
     self.assertTrue(is_True)
     self.assertTrue(is_False)
开发者ID:kkashev,项目名称:hackbulgaria,代码行数:11,代码来源:test_weapon.py


示例18: update

    def update(self, *args):
        Weapon.update(self, *args)

        if self.cooldown > 0:
            self.cooldown -= 1
            return

        self.cooldown = 5

        if self.engaged:
            bp = self.pos
            bv = (self.target_pos - bp).normal * 1400
            if bv.x != 0 or bv.y != 0:
                self.fire_sound.play()
                bullet.pool.fire(bp.x, bp.y, bv.x, bv.y) 
开发者ID:mjard,项目名称:nanobiotics,代码行数:15,代码来源:basicturret.py


示例19: test_boltgun

def test_boltgun():
    boltgun = Weapon("Boltgun", 24, 4, 5, ["rapid fire"])
    expected  = "        Range S  AP Type\n"
    expected += "Boltgun  24\"  4  5  rapid fire"

    output = boltgun.print_statline()

    result = output == expected

    if not result:
        print "expected:"
        print expected
        print output
        print "^- output"

    assert result
开发者ID:hoylemd,项目名称:Warhelper,代码行数:16,代码来源:test_mathhammer.py


示例20: cartridge_lighting

	def cartridge_lighting(self):
		'''
		26 мм патрон осветительный.
		26 мм патроны красного, зеленого, желтого огня каждого вида.
		:return: int
		'''
		return int(Weapon.signal_pistol(self) * 5)
开发者ID:karidon,项目名称:Tabel,代码行数:7,代码来源:ammunition.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python define.common_page_end函数代码示例发布时间:2022-05-26
下一篇:
Python weakref.WeakValueDictionary类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap