def test(self): ctx = dogma.Context() slot = ctx.add_module(TYPE_125mmGatlingAutoCannonII) loc = dogma.Location.module(slot) affectors = ctx.get_affectors(loc) ctx.set_ship(TYPE_Rifter) affectors_with_ship = ctx.get_affectors(loc) self.assertTrue(dogma.type_has_effect(TYPE_125mmGatlingAutoCannonII, dogma.State.ONLINE, EFFECT_HiPower)) self.assertTrue(dogma.type_has_active_effects(TYPE_125mmGatlingAutoCannonII)) self.assertTrue(dogma.type_has_overload_effects(TYPE_125mmGatlingAutoCannonII)) self.assertTrue(dogma.type_has_projectable_effects(TYPE_StasisWebifierI)) self.assertEqual(dogma.type_base_attribute(TYPE_Rifter, ATT_LauncherSlotsLeft), 2) ctx.add_charge(slot, TYPE_BarrageS) self.assertEqual(ctx.get_number_of_module_cycles_before_reload(slot), 200) effect = dogma.get_nth_type_effect_with_attributes(TYPE_125mmGatlingAutoCannonII, 0) (duration, tracking, discharge, att_range, falloff, usagechance, ) = ctx.get_location_effect_attributes(loc, effect) self.assertEqual(falloff, 7500) self.assertEqual(att_range, 1200) self.assertEqual(discharge, 0) capacitors = ctx.get_capacitor_all(False) self.assertEqual(len(capacitors), 1) self.assertIn(ctx, capacitors)
def calculateAttribs(self): """ This creates a dogma Context object and fits modules that are in self.fittedIDs. Active effect modules will automatically be online and active. All other modules will just be set to be online. Calculated parameters will be output to the GUI. """ # Define Context object and fit the modules in self.fittedIDs self.ctx = dogma.Context() self.ctx.set_default_skill_level(5) shipIdx = self.shipCombo.current() shipID = self.ships[0][shipIdx] self.ctx.set_ship(shipID) for i in range(0, len(self.fittedIDs)): if dogma.type_has_active_effects(self.fittedIDs[i]): self.ctx.add_module( self.fittedIDs[i], state=dogma.State.ACTIVE, charge=None) else: self.ctx.add_module( self.fittedIDs[i], state=dogma.State.ONLINE, charge=None) # Now, update calculated attributes in the GUI self.maxSpeedVar.set("%.3f" % self.ctx.get_ship_attribute(37)) self.agilityVar.set("%.5f" % self.ctx.get_ship_attribute(70)) self.massVar.set("%.2f" % (self.ctx.get_ship_attribute(4) / 1000000)) self.parent.update_idletasks()
def get_states(typeid): if dogma.type_has_overload_effects(typeid): return (True, True) return (dogma.type_has_active_effects(typeid), False)