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


Python eos.Fit类代码示例

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


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

示例1: test_worst_em

 def test_worst_em(self):
     fit = Fit()
     item = Ship(self.mktype(attrs={
         AttrId.hp: 1,
         AttrId.em_dmg_resonance: 0.8,
         AttrId.therm_dmg_resonance: 0.7,
         AttrId.kin_dmg_resonance: 0.7,
         AttrId.expl_dmg_resonance: 0.7,
         AttrId.armor_hp: 10,
         AttrId.armor_em_dmg_resonance: 0.4,
         AttrId.armor_therm_dmg_resonance: 0.3,
         AttrId.armor_kin_dmg_resonance: 0.3,
         AttrId.armor_expl_dmg_resonance: 0.3,
         AttrId.shield_capacity: 100,
         AttrId.shield_em_dmg_resonance: 0.2,
         AttrId.shield_therm_dmg_resonance: 0.1,
         AttrId.shield_kin_dmg_resonance: 0.1,
         AttrId.shield_expl_dmg_resonance: 0.1}).id)
     fit.ship = item
     # Verification
     self.assertAlmostEqual(item.worst_case_ehp.hull, 1.25)
     self.assertAlmostEqual(item.worst_case_ehp.armor, 25)
     self.assertAlmostEqual(item.worst_case_ehp.shield, 500)
     self.assertAlmostEqual(item.worst_case_ehp.total, 526.25)
     # Cleanup
     self.assert_solsys_buffers_empty(fit.solar_system)
     self.assert_log_entries(0)
开发者ID:DarkFenX,项目名称:eos,代码行数:27,代码来源:test_worst_case_ehp.py

示例2: test_non_uniform

 def test_non_uniform(self):
     fit = Fit()
     item = Ship(self.mktype(attrs={
         AttrId.hp: 10,
         AttrId.em_dmg_resonance: 0.9,
         AttrId.therm_dmg_resonance: 0.8,
         AttrId.kin_dmg_resonance: 0.7,
         AttrId.expl_dmg_resonance: 0.6,
         AttrId.armor_hp: 50,
         AttrId.armor_em_dmg_resonance: 0.4,
         AttrId.armor_therm_dmg_resonance: 0.6,
         AttrId.armor_kin_dmg_resonance: 0.8,
         AttrId.armor_expl_dmg_resonance: 0.9,
         AttrId.shield_capacity: 600,
         AttrId.shield_em_dmg_resonance: 1.0,
         AttrId.shield_therm_dmg_resonance: 0.8,
         AttrId.shield_kin_dmg_resonance: 0.6,
         AttrId.shield_expl_dmg_resonance: 0.5}).id)
     fit.ship = item
     # Verification
     results = item.get_ehp(DmgProfile(25, 6, 8.333, 1))
     self.assertAlmostEqual(results.hull, 11.957, places=3)
     self.assertAlmostEqual(results.armor, 95.276, places=3)
     self.assertAlmostEqual(results.shield, 685.551, places=3)
     self.assertAlmostEqual(results.total, 792.783, places=3)
     # Cleanup
     self.assert_solsys_buffers_empty(fit.solar_system)
     self.assert_log_entries(0)
开发者ID:DarkFenX,项目名称:eos,代码行数:28,代码来源:test_ehp.py

示例3: test_uniform

 def test_uniform(self):
     fit = Fit()
     item = Ship(self.mktype(attrs={
         AttrId.hp: 1,
         AttrId.em_dmg_resonance: 0.8,
         AttrId.therm_dmg_resonance: 0.8,
         AttrId.kin_dmg_resonance: 0.8,
         AttrId.expl_dmg_resonance: 0.8,
         AttrId.armor_hp: 10,
         AttrId.armor_em_dmg_resonance: 0.4,
         AttrId.armor_therm_dmg_resonance: 0.4,
         AttrId.armor_kin_dmg_resonance: 0.4,
         AttrId.armor_expl_dmg_resonance: 0.4,
         AttrId.shield_capacity: 100,
         AttrId.shield_em_dmg_resonance: 0.2,
         AttrId.shield_therm_dmg_resonance: 0.2,
         AttrId.shield_kin_dmg_resonance: 0.2,
         AttrId.shield_expl_dmg_resonance: 0.2}).id)
     fit.ship = item
     # Verification
     results = item.get_ehp(DmgProfile(1, 1, 1, 1))
     self.assertAlmostEqual(results.hull, 1.25)
     self.assertAlmostEqual(results.armor, 25)
     self.assertAlmostEqual(results.shield, 500)
     self.assertAlmostEqual(results.total, 526.25)
     # Cleanup
     self.assert_solsys_buffers_empty(fit.solar_system)
     self.assert_log_entries(0)
开发者ID:DarkFenX,项目名称:eos,代码行数:28,代码来源:test_ehp.py

示例4: test_item_attr_hp_all_absent

 def test_item_attr_hp_all_absent(self):
     fit = Fit()
     item = Ship(self.mktype(attrs={
         AttrId.em_dmg_resonance: 0.9,
         AttrId.therm_dmg_resonance: 0.8,
         AttrId.kin_dmg_resonance: 0.7,
         AttrId.expl_dmg_resonance: 0.6,
         AttrId.armor_em_dmg_resonance: 0.4,
         AttrId.armor_therm_dmg_resonance: 0.6,
         AttrId.armor_kin_dmg_resonance: 0.8,
         AttrId.armor_expl_dmg_resonance: 0.9,
         AttrId.shield_em_dmg_resonance: 1.0,
         AttrId.shield_therm_dmg_resonance: 0.8,
         AttrId.shield_kin_dmg_resonance: 0.6,
         AttrId.shield_expl_dmg_resonance: 0.5}).id)
     fit.ship = item
     # Verification
     results = item.get_ehp(DmgProfile(25, 6, 8.333, 1))
     self.assertAlmostEqual(results.hull, 0)
     self.assertAlmostEqual(results.armor, 0)
     self.assertAlmostEqual(results.shield, 0)
     self.assertAlmostEqual(results.total, 0)
     # Cleanup
     self.assert_solsys_buffers_empty(fit.solar_system)
     self.assert_log_entries(0)
开发者ID:DarkFenX,项目名称:eos,代码行数:25,代码来源:test_ehp.py

示例5: test_switch_item

 def test_switch_item(self):
     # Here we create 2 separate fits with ships; each ship affects module
     # with different strength. When we pass module from one fit to another,
     # its internal attribute storage should be cleared. If it wasn't
     # cleared, we wouldn't be able to get refreshed value of attribute
     # Setup
     src_attr_id = self.allocate_attr_id('src1', 'src2')
     self.mkattr(src='src1', attr_id=src_attr_id)
     self.mkattr(src='src2', attr_id=src_attr_id)
     tgt_attr_id = self.allocate_attr_id('src1', 'src2')
     self.mkattr(src='src1', attr_id=tgt_attr_id)
     self.mkattr(src='src2', attr_id=tgt_attr_id)
     modifier = self.mkmod(
         affectee_filter=ModAffecteeFilter.domain,
         affectee_domain=ModDomain.ship,
         affectee_attr_id=tgt_attr_id,
         operator=ModOperator.post_percent,
         affector_attr_id=src_attr_id)
     effect_id = self.allocate_effect_id('src1', 'src2')
     effect_src1 = self.mkeffect(
         src='src1',
         effect_id=effect_id,
         category_id=EffectCategoryId.passive,
         modifiers=[modifier])
     effect_src2 = self.mkeffect(
         src='src2',
         effect_id=effect_id,
         category_id=EffectCategoryId.passive,
         modifiers=[modifier])
     ship_type_id = self.allocate_type_id('src1', 'src2')
     ship1 = Ship(self.mktype(
         src='src1',
         type_id=ship_type_id,
         attrs={src_attr_id: 10},
         effects=[effect_src1]).id)
     ship2 = Ship(self.mktype(
         src='src2',
         type_id=ship_type_id,
         attrs={src_attr_id: 20},
         effects=[effect_src2]).id)
     item_type_id = self.allocate_type_id('src1', 'src2')
     self.mktype(src='src1', type_id=item_type_id, attrs={tgt_attr_id: 50})
     self.mktype(src='src2', type_id=item_type_id, attrs={tgt_attr_id: 50})
     item = Rig(item_type_id)
     fit1 = Fit(SolarSystem('src1'))
     fit1.ship = ship1
     fit2 = Fit(SolarSystem('src2'))
     fit2.ship = ship2
     fit1.rigs.add(item)
     self.assertAlmostEqual(item.attrs.get(tgt_attr_id), 55)
     # Action
     fit1.rigs.remove(item)
     fit2.rigs.add(item)
     # Verification
     self.assertAlmostEqual(item.attrs.get(tgt_attr_id), 60)
     # Cleanup
     self.assert_solsys_buffers_empty(fit1.solar_system)
     self.assert_solsys_buffers_empty(fit2.solar_system)
     self.assert_log_entries(0)
开发者ID:DarkFenX,项目名称:eos,代码行数:59,代码来源:test_calculator.py

示例6: test_switch_fit

 def test_switch_fit(self):
     # Here we check if attributes are updated if fit gets new source
     # instance
     # Setup
     src_attr_id = self.allocate_attr_id('src1', 'src2')
     self.mkattr(src='src1', attr_id=src_attr_id)
     self.mkattr(src='src2', attr_id=src_attr_id)
     tgt_attr_id = self.allocate_attr_id('src1', 'src2')
     max_attr_id = self.allocate_attr_id('src1', 'src2')
     self.mkattr(src='src1', attr_id=tgt_attr_id, max_attr_id=max_attr_id)
     self.mkattr(src='src2', attr_id=tgt_attr_id, max_attr_id=max_attr_id)
     self.mkattr(src='src1', attr_id=max_attr_id, default_value=54.5)
     self.mkattr(src='src2', attr_id=max_attr_id, default_value=88)
     modifier = self.mkmod(
         affectee_filter=ModAffecteeFilter.domain,
         affectee_domain=ModDomain.ship,
         affectee_attr_id=tgt_attr_id,
         operator=ModOperator.post_percent,
         affector_attr_id=src_attr_id)
     effect_id = self.allocate_effect_id('src1', 'src2')
     effect_src1 = self.mkeffect(
         src='src1',
         effect_id=effect_id,
         category_id=EffectCategoryId.passive,
         modifiers=[modifier])
     effect_src2 = self.mkeffect(
         src='src2',
         effect_id=effect_id,
         category_id=EffectCategoryId.passive,
         modifiers=[modifier])
     ship_type_id = self.allocate_type_id('src1', 'src2')
     self.mktype(
         src='src1',
         type_id=ship_type_id,
         attrs={src_attr_id: 10},
         effects=[effect_src1])
     self.mktype(
         src='src2',
         type_id=ship_type_id,
         attrs={src_attr_id: 20},
         effects=[effect_src2])
     item_type_id = self.allocate_type_id('src1', 'src2')
     self.mktype(src='src1', type_id=item_type_id, attrs={tgt_attr_id: 50})
     self.mktype(src='src2', type_id=item_type_id, attrs={tgt_attr_id: 75})
     fit = Fit()
     ship = Ship(ship_type_id)
     item = Rig(item_type_id)
     fit.ship = ship
     fit.rigs.add(item)
     # 50 * 1.1, but capped at 54.5
     self.assertAlmostEqual(item.attrs.get(tgt_attr_id), 54.5)
     # Action
     fit.solar_system.source = 'src2'
     # Verification
     # 75 * 1.2, but capped at 88
     self.assertAlmostEqual(item.attrs.get(tgt_attr_id), 88)
     # Cleanup
     self.assert_solsys_buffers_empty(fit.solar_system)
     self.assert_log_entries(0)
开发者ID:DarkFenX,项目名称:eos,代码行数:59,代码来源:test_calculator.py

示例7: test_none_to_none

 def test_none_to_none(self):
     fit = Fit()
     # Action
     fit.ship = None
     # Verification
     self.assertIsNone(fit.ship)
     # Cleanup
     self.assert_solsys_buffers_empty(fit.solar_system)
     self.assert_log_entries(0)
开发者ID:DarkFenX,项目名称:eos,代码行数:9,代码来源:test_ship.py

示例8: test_none_to_item

 def test_none_to_item(self):
     fit = Fit()
     item = Ship(self.mktype().id)
     # Action
     fit.ship = item
     # Verification
     self.assertIs(fit.ship, item)
     # Cleanup
     self.assert_item_buffers_empty(item)
     self.assert_solsys_buffers_empty(fit.solar_system)
     self.assert_log_entries(0)
开发者ID:DarkFenX,项目名称:eos,代码行数:11,代码来源:test_ship.py

示例9: test_item_not_loaded

 def test_item_not_loaded(self):
     fit = Fit()
     item = Ship(self.allocate_type_id())
     fit.ship = item
     # Verification
     self.assertAlmostEqual(item.worst_case_ehp.hull, 0)
     self.assertAlmostEqual(item.worst_case_ehp.armor, 0)
     self.assertAlmostEqual(item.worst_case_ehp.shield, 0)
     self.assertAlmostEqual(item.worst_case_ehp.total, 0)
     # Cleanup
     self.assert_solsys_buffers_empty(fit.solar_system)
     self.assert_log_entries(0)
开发者ID:DarkFenX,项目名称:eos,代码行数:12,代码来源:test_worst_case_ehp.py

示例10: test_item_attr_all_absent

 def test_item_attr_all_absent(self):
     fit = Fit()
     item = Ship(self.mktype().id)
     fit.ship = item
     # Verification
     self.assertAlmostEqual(item.hp.hull, 0)
     self.assertAlmostEqual(item.hp.armor, 0)
     self.assertAlmostEqual(item.hp.shield, 0)
     self.assertAlmostEqual(item.hp.total, 0)
     # Cleanup
     self.assert_solsys_buffers_empty(fit.solar_system)
     self.assert_log_entries(0)
开发者ID:DarkFenX,项目名称:eos,代码行数:12,代码来源:test_hp.py

示例11: test_item_not_loaded

 def test_item_not_loaded(self):
     fit = Fit()
     item = Ship(self.allocate_type_id())
     fit.ship = item
     # Verification
     results = item.get_ehp(DmgProfile(1, 1, 1, 1))
     self.assertAlmostEqual(results.hull, 0)
     self.assertAlmostEqual(results.armor, 0)
     self.assertAlmostEqual(results.shield, 0)
     self.assertAlmostEqual(results.total, 0)
     # Cleanup
     self.assert_solsys_buffers_empty(fit.solar_system)
     self.assert_log_entries(0)
开发者ID:DarkFenX,项目名称:eos,代码行数:13,代码来源:test_ehp.py

示例12: test_item_to_item

 def test_item_to_item(self):
     fit = Fit()
     ship_type = self.mktype()
     item1 = Ship(ship_type.id)
     item2 = Ship(ship_type.id)
     fit.ship = item1
     # Action
     fit.ship = item2
     # Verification
     self.assertIs(fit.ship, item2)
     # Cleanup
     self.assert_item_buffers_empty(item1)
     self.assert_item_buffers_empty(item2)
     self.assert_solsys_buffers_empty(fit.solar_system)
     self.assert_log_entries(0)
开发者ID:DarkFenX,项目名称:eos,代码行数:15,代码来源:test_ship.py

示例13: test_none_to_item_type_failure

 def test_none_to_item_type_failure(self):
     fit = Fit()
     item = Stance(self.mktype().id)
     # Action
     with self.assertRaises(TypeError):
         fit.ship = item
     # Verification
     self.assertIsNone(fit.ship)
     # Check that item which failed to be added can be assigned to other
     # field
     fit.stance = item
     # Cleanup
     self.assert_item_buffers_empty(item)
     self.assert_solsys_buffers_empty(fit.solar_system)
     self.assert_log_entries(0)
开发者ID:DarkFenX,项目名称:eos,代码行数:15,代码来源:test_ship.py

示例14: test_generic

 def test_generic(self):
     fit = Fit()
     item = Ship(self.mktype(attrs={
         AttrId.hp: 8,
         AttrId.armor_hp: 10,
         AttrId.shield_capacity: 12}).id)
     fit.ship = item
     # Verification
     self.assertAlmostEqual(item.hp.hull, 8)
     self.assertAlmostEqual(item.hp.armor, 10)
     self.assertAlmostEqual(item.hp.shield, 12)
     self.assertAlmostEqual(item.hp.total, 30)
     # Cleanup
     self.assert_solsys_buffers_empty(fit.solar_system)
     self.assert_log_entries(0)
开发者ID:DarkFenX,项目名称:eos,代码行数:15,代码来源:test_hp.py

示例15: test_fit_none_to_non_charge

 def test_fit_none_to_non_charge(self):
     fit = Fit()
     module = ModuleHigh(self.mktype().id, state=State.active, charge=None)
     non_charge = Stance(self.mktype().id)
     fit.modules.high.append(module)
     # Action
     with self.assertRaises(TypeError):
         module.charge = non_charge
     # Verification
     self.assertIsNone(module.charge)
     fit.stance = non_charge
     # Cleanup
     self.assert_item_buffers_empty(module)
     self.assert_item_buffers_empty(non_charge)
     self.assert_solsys_buffers_empty(fit.solar_system)
     self.assert_log_entries(0)
开发者ID:DarkFenX,项目名称:eos,代码行数:16,代码来源:test_charge.py


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