def test_effective(self): fit = Fit() item = ModuleHigh(self.mktype(attrs={ AttrId.dmg_mult: 2.5, AttrId.capacity: 2.0, self.cycle_attr.id: 500, AttrId.charge_rate: 1.0, AttrId.reload_time: 5000 }, effects=[self.effect], default_effect=self.effect).id, state=State.active) item.charge = Charge( self.mktype( attrs={ AttrId.volume: 0.2, AttrId.em_dmg: 5.2, AttrId.therm_dmg: 6.3, AttrId.kin_dmg: 7.4, AttrId.expl_dmg: 8.5 }).id) fit.modules.high.append(item) # Verification profile = ResistProfile(0.2, 0.2, 0.8, 1) dps = item.get_dps(tgt_resists=profile) self.assertAlmostEqual(dps.em, 20.8) self.assertAlmostEqual(dps.thermal, 25.2) self.assertAlmostEqual(dps.kinetic, 7.4) self.assertAlmostEqual(dps.explosive, 0) self.assertAlmostEqual(dps.total, 53.4) # Cleanup self.assert_solsys_buffers_empty(fit.solar_system) self.assert_log_entries(0)
def test_arguments_custom_profile(self): item = ModuleHigh(self.mktype(attrs={ AttrId.capacity: 2.0, AttrId.charge_rate: 1.0, AttrId.dmg_mult: 2 }, effects=[self.dd_effect], default_effect=self.dd_effect).id, state=State.active) item.charge = Charge( self.mktype( attrs={ AttrId.volume: 1.0, AttrId.em_dmg: 1.2, AttrId.therm_dmg: 2.4, AttrId.kin_dmg: 4.8, AttrId.expl_dmg: 9.6 }).id) self.fit.modules.high.append(item) # Action resists = ResistProfile(0, 1, 1, 1) stats_volley = self.fit.stats.get_volley(tgt_resists=resists) # Verification self.assertAlmostEqual(stats_volley.em, 2.4) self.assertAlmostEqual(stats_volley.thermal, 0) self.assertAlmostEqual(stats_volley.kinetic, 0) self.assertAlmostEqual(stats_volley.explosive, 0) self.assertAlmostEqual(stats_volley.total, 2.4) # Cleanup self.assert_solsys_buffers_empty(self.fit.solar_system) self.assert_log_entries(0)
def test_effective_attr_single_expl_zero(self): fit = Fit() item = ModuleHigh(self.mktype(attrs={ AttrId.dmg_mult: 2.5, AttrId.capacity: 2.0, self.cycle_attr.id: 500, AttrId.charge_rate: 1.0, AttrId.reload_time: 5000 }, effects=[self.effect], default_effect=self.effect).id, state=State.active) item.charge = Charge( self.mktype(attrs={ AttrId.volume: 0.2, AttrId.expl_dmg: 0 }).id) fit.modules.high.append(item) # Verification profile = ResistProfile(0.2, 0.2, 0.8, 1) volley = item.get_volley(tgt_resists=profile) self.assertAlmostEqual(volley.em, 0) self.assertAlmostEqual(volley.thermal, 0) self.assertAlmostEqual(volley.kinetic, 0) self.assertAlmostEqual(volley.explosive, 0) self.assertAlmostEqual(volley.total, 0) # Cleanup self.assert_solsys_buffers_empty(fit.solar_system) self.assert_log_entries(0)
def test_effective_item_not_loaded(self): fit = Fit() item = ModuleHigh(self.allocate_type_id(), state=State.active) fit.modules.high.append(item) # Verification profile = ResistProfile(0.2, 0.2, 0.8, 1) volley = item.get_volley(tgt_resists=profile) self.assertAlmostEqual(volley.em, 0) self.assertAlmostEqual(volley.thermal, 0) self.assertAlmostEqual(volley.kinetic, 0) self.assertAlmostEqual(volley.explosive, 0) self.assertAlmostEqual(volley.total, 0) # Cleanup self.assert_solsys_buffers_empty(fit.solar_system) self.assert_log_entries(0)