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


Python Fit.ship方法代码示例

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


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

示例1: test_switch_item

# 需要导入模块: from eos import Fit [as 别名]
# 或者: from eos.Fit import ship [as 别名]
 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,代码行数:61,代码来源:test_calculator.py

示例2: test_item_to_none

# 需要导入模块: from eos import Fit [as 别名]
# 或者: from eos.Fit import ship [as 别名]
 def test_item_to_none(self):
     fit = Fit()
     item = Ship(self.mktype().id)
     fit.ship = item
     # Action
     fit.ship = None
     # Verification
     self.assertIsNone(fit.ship)
     # Cleanup
     self.assert_item_buffers_empty(item)
     self.assert_solsys_buffers_empty(fit.solar_system)
     self.assert_log_entries(0)
开发者ID:DarkFenX,项目名称:eos,代码行数:14,代码来源:test_ship.py

示例3: test_item_to_item

# 需要导入模块: from eos import Fit [as 别名]
# 或者: from eos.Fit import ship [as 别名]
 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,代码行数:17,代码来源:test_ship.py

示例4: test_worst_em

# 需要导入模块: from eos import Fit [as 别名]
# 或者: from eos.Fit import ship [as 别名]
 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,代码行数:29,代码来源:test_worst_case_ehp.py

示例5: test_item_to_item_type_failure

# 需要导入模块: from eos import Fit [as 别名]
# 或者: from eos.Fit import ship [as 别名]
 def test_item_to_item_type_failure(self):
     fit = Fit()
     item1 = Ship(self.mktype().id)
     item2 = Stance(self.mktype().id)
     fit.ship = item1
     # Action
     with self.assertRaises(TypeError):
         fit.ship = item2
     # Verification
     self.assertIs(fit.ship, item1)
     fit.stance = 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,代码行数:18,代码来源:test_ship.py

示例6: test_non_uniform

# 需要导入模块: from eos import Fit [as 别名]
# 或者: from eos.Fit import ship [as 别名]
 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,代码行数:30,代码来源:test_ehp.py

示例7: test_uniform

# 需要导入模块: from eos import Fit [as 别名]
# 或者: from eos.Fit import ship [as 别名]
 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,代码行数:30,代码来源:test_ehp.py

示例8: test_item_attr_hp_all_absent

# 需要导入模块: from eos import Fit [as 别名]
# 或者: from eos.Fit import ship [as 别名]
 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,代码行数:27,代码来源:test_ehp.py

示例9: test_none_to_item_value_failure

# 需要导入模块: from eos import Fit [as 别名]
# 或者: from eos.Fit import ship [as 别名]
 def test_none_to_item_value_failure(self):
     fit = Fit()
     fit_other = Fit()
     item = Ship(self.mktype().id)
     fit_other.ship = item
     # Action
     with self.assertRaises(ValueError):
         fit.ship = item
     # Verification
     self.assertIsNone(fit.ship)
     self.assertIs(fit_other.ship, item)
     # Cleanup
     self.assert_item_buffers_empty(item)
     self.assert_solsys_buffers_empty(fit.solar_system)
     self.assert_solsys_buffers_empty(fit_other.solar_system)
     self.assert_log_entries(0)
开发者ID:DarkFenX,项目名称:eos,代码行数:18,代码来源:test_ship.py

示例10: test_switch_fit

# 需要导入模块: from eos import Fit [as 别名]
# 或者: from eos.Fit import ship [as 别名]
 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,代码行数:61,代码来源:test_calculator.py

示例11: test_none_to_none

# 需要导入模块: from eos import Fit [as 别名]
# 或者: from eos.Fit import ship [as 别名]
 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,代码行数:11,代码来源:test_ship.py

示例12: test_item_to_item_value_failure

# 需要导入模块: from eos import Fit [as 别名]
# 或者: from eos.Fit import ship [as 别名]
 def test_item_to_item_value_failure(self):
     fit = Fit()
     fit_other = Fit()
     ship_type = self.mktype()
     item1 = Ship(ship_type.id)
     item2 = Ship(ship_type.id)
     fit.ship = item1
     fit_other.ship = item2
     # Action
     with self.assertRaises(ValueError):
         fit.ship = item2
     # Verification
     self.assertIs(fit.ship, item1)
     self.assertIs(fit_other.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_solsys_buffers_empty(fit_other.solar_system)
     self.assert_log_entries(0)
开发者ID:DarkFenX,项目名称:eos,代码行数:22,代码来源:test_ship.py

示例13: test_item_not_loaded

# 需要导入模块: from eos import Fit [as 别名]
# 或者: from eos.Fit import ship [as 别名]
 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,代码行数:14,代码来源:test_worst_case_ehp.py

示例14: test_item_attr_all_absent

# 需要导入模块: from eos import Fit [as 别名]
# 或者: from eos.Fit import ship [as 别名]
 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,代码行数:14,代码来源:test_hp.py

示例15: test_item_not_loaded

# 需要导入模块: from eos import Fit [as 别名]
# 或者: from eos.Fit import ship [as 别名]
 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,代码行数:15,代码来源:test_ehp.py


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