| 905 | self.chargeModifiedAttributes.clear() |
| 906 | |
| 907 | def calculateModifiedAttributes(self, fit, runTime, forceProjected=False, gang=False, forcedProjRange=DEFAULT): |
| 908 | # We will run the effect when two conditions are met: |
| 909 | # 1: It makes sense to run the effect |
| 910 | # The effect is either offline |
| 911 | # or the effect is passive and the module is in the online state (or higher) |
| 912 | |
| 913 | # or the effect is active and the module is in the active state (or higher) |
| 914 | # or the effect is overheat and the module is in the overheated state (or higher) |
| 915 | # 2: the runtimes match |
| 916 | |
| 917 | if self.projected or forceProjected: |
| 918 | context = "projected", "module" |
| 919 | projected = True |
| 920 | else: |
| 921 | context = ("module",) |
| 922 | projected = False |
| 923 | |
| 924 | projectionRange = self.projectionRange if forcedProjRange is DEFAULT else forcedProjRange |
| 925 | |
| 926 | if self.charge is not None: |
| 927 | # fix for #82 and it's regression #106 |
| 928 | if not projected or (self.projected and not forceProjected) or gang: |
| 929 | for effect in self.charge.effects.values(): |
| 930 | if ( |
| 931 | effect.runTime == runTime and |
| 932 | effect.activeByDefault and ( |
| 933 | effect.isType("offline") or |
| 934 | (effect.isType("passive") and self.state >= FittingModuleState.ONLINE) or |
| 935 | (effect.isType("active") and self.state >= FittingModuleState.ACTIVE)) and |
| 936 | (not gang or (gang and effect.isType("gang"))) |
| 937 | ): |
| 938 | contexts = ("moduleCharge",) |
| 939 | effect.handler(fit, self, contexts, projectionRange, effect=effect) |
| 940 | |
| 941 | if self.item: |
| 942 | if self.state >= FittingModuleState.OVERHEATED: |
| 943 | for effect in self.item.effects.values(): |
| 944 | if effect.runTime == runTime and \ |
| 945 | effect.isType("overheat") \ |
| 946 | and not forceProjected \ |
| 947 | and effect.activeByDefault \ |
| 948 | and ((gang and effect.isType("gang")) or not gang): |
| 949 | effect.handler(fit, self, context, projectionRange, effect=effect) |
| 950 | |
| 951 | for effect in self.item.effects.values(): |
| 952 | if effect.runTime == runTime and \ |
| 953 | effect.activeByDefault and \ |
| 954 | (effect.isType("offline") or |
| 955 | (effect.isType("passive") and self.state >= FittingModuleState.ONLINE) or |
| 956 | (effect.isType("active") and self.state >= FittingModuleState.ACTIVE)) \ |
| 957 | and ((projected and effect.isType("projected")) or not projected) \ |
| 958 | and ((gang and effect.isType("gang")) or not gang): |
| 959 | effect.handler(fit, self, context, projectionRange, effect=effect) |
| 960 | |
| 961 | def getCycleParametersForDps(self, reloadOverride=None): |
| 962 | # Special hack for breachers, since those are DoT and work independently of gun cycle |