Exemplo n.º 1
0
 def test_rep_amount_recalc_aar_attr_mult_changed(self):
     multmod_src_attr = self.mkattr()
     multmod_mod = self.mkmod(
         affectee_filter=ModAffecteeFilter.domain,
         affectee_domain=ModDomain.ship,
         affectee_attr_id=AttrId.charged_armor_dmg_mult,
         operator=ModOperator.post_percent,
         affector_attr_id=multmod_src_attr.id)
     multmod_effect = self.mkeffect(
         category_id=EffectCategoryId.passive,
         modifiers=[multmod_mod])
     multmod = ModuleLow(self.mktype(
         attrs={multmod_src_attr.id: 50},
         effects=[multmod_effect]).id)
     effect = self.mkeffect(
         effect_id=EffectId.fueled_armor_repair,
         category_id=EffectCategoryId.active)
     aar = ModuleLow(
         self.mktype(
             attrs={
                 AttrId.armor_dmg_amount: 50,
                 AttrId.charged_armor_dmg_mult: 3},
             effects=[effect],
             default_effect=effect).id,
         state=State.active)
     aar.charge = Charge(self.mktype(type_id=TypeId.nanite_repair_paste).id)
     self.fit.modules.low.append(aar)
     self.assertAlmostEqual(aar.attrs[AttrId.armor_dmg_amount], 150)
     # Action
     self.fit.modules.low.append(multmod)
     # Verification
     self.assertAlmostEqual(aar.attrs[AttrId.armor_dmg_amount], 225)
     # Cleanup
     self.assert_solsys_buffers_empty(self.fit.solar_system)
     self.assert_log_entries(0)
Exemplo n.º 2
0
 def test_rep_amount_recalc_charge_to_charge_absent(self):
     effect = self.mkeffect(
         effect_id=EffectId.fueled_armor_repair,
         category_id=EffectCategoryId.active)
     aar = ModuleLow(
         self.mktype(
             attrs={
                 AttrId.armor_dmg_amount: 50,
                 AttrId.charged_armor_dmg_mult: 3},
             effects=[effect],
             default_effect=effect).id,
         state=State.active)
     aar.charge = Charge(self.mktype(type_id=TypeId.nanite_repair_paste).id)
     self.fit.modules.low.append(aar)
     self.assertAlmostEqual(aar.attrs[AttrId.armor_dmg_amount], 150)
     # Action
     aar.charge = None
     # Verification
     self.assertAlmostEqual(aar.attrs[AttrId.armor_dmg_amount], 50)
     # Cleanup
     self.assert_solsys_buffers_empty(self.fit.solar_system)
     self.assert_log_entries(0)
Exemplo n.º 3
0
 def test_rep_amount_aar_attr_rep_amount_absent(self):
     effect = self.mkeffect(
         effect_id=EffectId.fueled_armor_repair,
         category_id=EffectCategoryId.active)
     aar = ModuleLow(
         self.mktype(
             attrs={AttrId.charged_armor_dmg_mult: 3},
             effects=[effect],
             default_effect=effect).id,
         state=State.active)
     aar.charge = Charge(self.mktype(type_id=TypeId.nanite_repair_paste).id)
     self.fit.modules.low.append(aar)
     # Verification
     with self.assertRaises(KeyError):
         aar.attrs[AttrId.armor_dmg_amount]
     # Cleanup
     self.assert_solsys_buffers_empty(self.fit.solar_system)
     self.assert_log_entries(0)
Exemplo n.º 4
0
 def test_remote_aar(self):
     effect = self.mkeffect(
         effect_id=EffectId.ship_module_ancillary_remote_armor_repairer,
         category_id=EffectCategoryId.target)
     raar = ModuleLow(
         self.mktype(
             attrs={
                 AttrId.armor_dmg_amount: 50,
                 AttrId.charged_armor_dmg_mult: 3},
             effects=[effect],
             default_effect=effect).id,
         state=State.active)
     raar.charge = Charge(self.mktype(type_id=TypeId.nanite_repair_paste).id)
     self.fit.modules.low.append(raar)
     # Verification
     self.assertAlmostEqual(raar.attrs[AttrId.armor_dmg_amount], 150)
     # Cleanup
     self.assert_solsys_buffers_empty(self.fit.solar_system)
     self.assert_log_entries(0)
Exemplo n.º 5
0
 def test_rep_amount_state(self):
     # Multiplier should be applied even when module is offline
     effect = self.mkeffect(
         effect_id=EffectId.fueled_armor_repair,
         category_id=EffectCategoryId.active)
     aar = ModuleLow(
         self.mktype(
             attrs={
                 AttrId.armor_dmg_amount: 50,
                 AttrId.charged_armor_dmg_mult: 3},
             effects=[effect],
             default_effect=effect).id,
         state=State.offline)
     aar.charge = Charge(self.mktype(type_id=TypeId.nanite_repair_paste).id)
     self.fit.modules.low.append(aar)
     # Verification
     self.assertAlmostEqual(aar.attrs[AttrId.armor_dmg_amount], 150)
     # Cleanup
     self.assert_solsys_buffers_empty(self.fit.solar_system)
     self.assert_log_entries(0)
Exemplo n.º 6
0
 def test_rep_amount_stacking(self):
     # Multiplier shouldn't be stacking penalized against any other
     # multiplicative modifications
     multmod_src_attr_mul = self.mkattr()
     multmod_src_attr_div = self.mkattr()
     multmod_src_attr_perc = self.mkattr()
     multmod_mod_premul = self.mkmod(
         affectee_filter=ModAffecteeFilter.domain,
         affectee_domain=ModDomain.ship,
         affectee_attr_id=AttrId.armor_dmg_amount,
         operator=ModOperator.pre_mul,
         affector_attr_id=multmod_src_attr_mul.id)
     multmod_mod_prediv = self.mkmod(
         affectee_filter=ModAffecteeFilter.domain,
         affectee_domain=ModDomain.ship,
         affectee_attr_id=AttrId.armor_dmg_amount,
         operator=ModOperator.pre_div,
         affector_attr_id=multmod_src_attr_div.id)
     multmod_mod_postmul = self.mkmod(
         affectee_filter=ModAffecteeFilter.domain,
         affectee_domain=ModDomain.ship,
         affectee_attr_id=AttrId.armor_dmg_amount,
         operator=ModOperator.post_mul,
         affector_attr_id=multmod_src_attr_mul.id)
     multmod_mod_postdiv = self.mkmod(
         affectee_filter=ModAffecteeFilter.domain,
         affectee_domain=ModDomain.ship,
         affectee_attr_id=AttrId.armor_dmg_amount,
         operator=ModOperator.post_div,
         affector_attr_id=multmod_src_attr_div.id)
     multmod_mod_postperc = self.mkmod(
         affectee_filter=ModAffecteeFilter.domain,
         affectee_domain=ModDomain.ship,
         affectee_attr_id=AttrId.armor_dmg_amount,
         operator=ModOperator.post_percent,
         affector_attr_id=multmod_src_attr_perc.id)
     multmod_effect = self.mkeffect(
         category_id=EffectCategoryId.passive,
         modifiers=[
             multmod_mod_premul,
             multmod_mod_prediv,
             multmod_mod_postmul,
             multmod_mod_postdiv,
             multmod_mod_postperc])
     multmod = ModuleLow(self.mktype(
         attrs={
             multmod_src_attr_mul.id: 2,
             multmod_src_attr_div.id: 0.5,
             multmod_src_attr_perc.id: 100},
         effects=[multmod_effect]).id)
     effect = self.mkeffect(
         effect_id=EffectId.fueled_armor_repair,
         category_id=EffectCategoryId.active)
     aar = ModuleLow(
         self.mktype(
             attrs={
                 AttrId.armor_dmg_amount: 50,
                 AttrId.charged_armor_dmg_mult: 3},
             effects=[effect],
             default_effect=effect).id,
         state=State.active)
     aar.charge = Charge(self.mktype(type_id=TypeId.nanite_repair_paste).id)
     self.fit.modules.low.append(aar)
     self.fit.modules.low.append(multmod)
     # Verification
     # If paste multiplier is not stacking penalized against any mods, final
     # result will be 50 * 3 * 2 ^ 5
     self.assertAlmostEqual(aar.attrs[AttrId.armor_dmg_amount], 4800)
     # Cleanup
     self.assert_solsys_buffers_empty(self.fit.solar_system)
     self.assert_log_entries(0)