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)
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)
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)
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)
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)
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)
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)