From 62a696cc4bacca725f14607d935d25c0a11aa407 Mon Sep 17 00:00:00 2001 From: blitzman Date: Sun, 20 Nov 2016 12:45:08 -0500 Subject: [PATCH] Only apply command boosts when command module is active, and add t2 command burst effect --- eos/effects/chargebonuswarfarecharge.py | 2 +- eos/effects/modulebonuswarfarelinkarmor.py | 3 +++ eos/effects/modulebonuswarfarelinkinfo.py | 3 +++ eos/effects/modulebonuswarfarelinkshield.py | 3 +++ eos/effects/modulebonuswarfarelinkskirmish.py | 3 +++ eos/effects/moduletitaneffectgenerator.py | 2 +- eos/effects/techtwocommandburstbonus.py | 6 ++++++ eos/saveddata/module.py | 14 +++++++++----- 8 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 eos/effects/modulebonuswarfarelinkarmor.py create mode 100644 eos/effects/modulebonuswarfarelinkinfo.py create mode 100644 eos/effects/modulebonuswarfarelinkshield.py create mode 100644 eos/effects/modulebonuswarfarelinkskirmish.py create mode 100644 eos/effects/techtwocommandburstbonus.py diff --git a/eos/effects/chargebonuswarfarecharge.py b/eos/effects/chargebonuswarfarecharge.py index 78959a980..06880766e 100644 --- a/eos/effects/chargebonuswarfarecharge.py +++ b/eos/effects/chargebonuswarfarecharge.py @@ -10,7 +10,7 @@ bonuses and actually run the effect. To do this, we have a special argument pass which warfareBuffID to run (shouldn't need this right now, but better safe than sorry) ''' -type = "passive", "gang" +type = "active", "gang" def handler(fit, module, context, **kwargs): print "In chargeBonusWarfareEffect, context: ", context diff --git a/eos/effects/modulebonuswarfarelinkarmor.py b/eos/effects/modulebonuswarfarelinkarmor.py new file mode 100644 index 000000000..65f0e4fb7 --- /dev/null +++ b/eos/effects/modulebonuswarfarelinkarmor.py @@ -0,0 +1,3 @@ +type = "active" +def handler(fit, module, context): + pass diff --git a/eos/effects/modulebonuswarfarelinkinfo.py b/eos/effects/modulebonuswarfarelinkinfo.py new file mode 100644 index 000000000..65f0e4fb7 --- /dev/null +++ b/eos/effects/modulebonuswarfarelinkinfo.py @@ -0,0 +1,3 @@ +type = "active" +def handler(fit, module, context): + pass diff --git a/eos/effects/modulebonuswarfarelinkshield.py b/eos/effects/modulebonuswarfarelinkshield.py new file mode 100644 index 000000000..65f0e4fb7 --- /dev/null +++ b/eos/effects/modulebonuswarfarelinkshield.py @@ -0,0 +1,3 @@ +type = "active" +def handler(fit, module, context): + pass diff --git a/eos/effects/modulebonuswarfarelinkskirmish.py b/eos/effects/modulebonuswarfarelinkskirmish.py new file mode 100644 index 000000000..65f0e4fb7 --- /dev/null +++ b/eos/effects/modulebonuswarfarelinkskirmish.py @@ -0,0 +1,3 @@ +type = "active" +def handler(fit, module, context): + pass diff --git a/eos/effects/moduletitaneffectgenerator.py b/eos/effects/moduletitaneffectgenerator.py index 78990328e..925064381 100644 --- a/eos/effects/moduletitaneffectgenerator.py +++ b/eos/effects/moduletitaneffectgenerator.py @@ -1,5 +1,5 @@ -type = "passive", "gang" +type = "active", "gang" def handler(fit, module, context, **kwargs): def runEffect(id, value): if id == 39: # Avatar Effect Generator : Capacitor Recharge bonus diff --git a/eos/effects/techtwocommandburstbonus.py b/eos/effects/techtwocommandburstbonus.py new file mode 100644 index 000000000..f9de87322 --- /dev/null +++ b/eos/effects/techtwocommandburstbonus.py @@ -0,0 +1,6 @@ +type = "passive" +runTime = "late" + +def handler(fit, module, context): + for x in xrange(1, 4): + module.boostChargeAttr("warfareBuff{}Value".format(x), module.getModifiedItemAttr("commandBurstStrengthBonus")) diff --git a/eos/saveddata/module.py b/eos/saveddata/module.py index ee7999637..8314165c4 100644 --- a/eos/saveddata/module.py +++ b/eos/saveddata/module.py @@ -597,16 +597,20 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): # fix for #82 and it's regression #106 if not projected or (self.projected and not forceProjected) or gang: for effect in self.charge.effects.itervalues(): - if effect.runTime == runTime and (not gang or (gang and effect.isType("gang"))): - # todo: ensure that these are run when the module is active only - thing = ("moduleCharge",) + if effect.runTime == runTime and \ + (effect.isType("offline") or + (effect.isType("passive") and self.state >= State.ONLINE) or + (effect.isType("active") and self.state >= State.ACTIVE)) and \ + (not gang or (gang and effect.isType("gang"))): + + chargeContext = ("moduleCharge",) # For gang effects, we pass in the effect itself as an argument. However, to avoid going through # all the effect files and defining this argument, do a simple try/catch here and be done with it. # @todo: possibly fix this try: - effect.handler(fit, self, thing, effect=effect) + effect.handler(fit, self, chargeContext, effect=effect) except: - effect.handler(fit, self, thing) + effect.handler(fit, self, chargeContext) if self.item: if self.state >= State.OVERHEATED: