Trying to flesh out how command boosts are gonna work.
This commit is contained in:
@@ -1,16 +1,43 @@
|
||||
# We should probably have something a little less hacky in place, but time is money!
|
||||
|
||||
|
||||
'''
|
||||
Some documentation:
|
||||
When the fit is calculated, we gather up all the gang effects and stick them onto the fit. We don't run the actual
|
||||
effect yet, only give the fit details so that it can run the effect at a later time. We need to do this so that we can
|
||||
only run the strongest effect. When we are done, one of the last things that we do with the fit is to loop through those
|
||||
bonuses and actually run the effect. To do this, we have a special argument passed into the effect handler that tells it
|
||||
which warfareBuffID to run (shouldn't need this right now, but better safe than sorry)
|
||||
'''
|
||||
|
||||
|
||||
type = "passive"
|
||||
def handler(fit, module, context):
|
||||
def handler(fit, module, context, warfareBuffID = None):
|
||||
print "In chargeBonusWarfareEffect, context: ", context
|
||||
|
||||
def runEffect(id, value):
|
||||
print "RUN EFFECT: ",
|
||||
if id == 21: # Skirmish Burst: Interdiction Maneuvers: Tackle Range
|
||||
print "Tackle Range"
|
||||
return
|
||||
groups = ("Stasis Web", "Warp Scrambler")
|
||||
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name in groups,
|
||||
"maxRange", value,
|
||||
"maxRange", value,
|
||||
stackingPenalties=True)
|
||||
if id == 10:
|
||||
print "Shield Resists"
|
||||
|
||||
print "Inside the CHARGE"
|
||||
|
||||
for x in xrange(1, 4):
|
||||
if module.getModifiedChargeAttr("warfareBuff{}ID".format(x)):
|
||||
runEffect(module.getModifiedChargeAttr("warfareBuff{}ID".format(x)), module.getModifiedChargeAttr("warfareBuff{}Value".format(x)))
|
||||
value = module.getModifiedChargeAttr("warfareBuff{}Value".format(x))
|
||||
id = module.getModifiedChargeAttr("warfareBuff{}ID".format(x))
|
||||
|
||||
if 'commandRun' not in context:
|
||||
print "Add buffID", warfareBuffID, " to ", fit
|
||||
fit.addCommandBonus(id, value, module)
|
||||
elif warfareBuffID is not None and warfareBuffID == id:
|
||||
print "Running buffID ", warfareBuffID, " on ", fit
|
||||
runEffect(warfareBuffID, value)
|
||||
|
||||
|
||||
@@ -79,6 +79,14 @@ class Fit(object):
|
||||
|
||||
self.build()
|
||||
|
||||
def addCommandBonus(self, warfareBuffID, value, module):
|
||||
# oh fuck this is so janky
|
||||
# @todo should we pass in min/max to this function, or is abs okay? (abs is old method, ccp now provides the aggregate function in their data)
|
||||
print "Add command bonus: ", warfareBuffID, " - value: ", value
|
||||
|
||||
if warfareBuffID not in self.commandBonuses or abs(self.commandBonuses[warfareBuffID][0]) > abs(value):
|
||||
self.commandBonuses[warfareBuffID] = (value, module)
|
||||
|
||||
@reconstructor
|
||||
def init(self):
|
||||
"""Initialize a fit from the database and validate"""
|
||||
@@ -136,6 +144,7 @@ class Fit(object):
|
||||
self.boostsFits = set()
|
||||
self.gangBoosts = None
|
||||
self.ecmProjectedStr = 1
|
||||
self.commandBonuses = {}
|
||||
|
||||
@property
|
||||
def targetResists(self):
|
||||
@@ -559,6 +568,9 @@ class Fit(object):
|
||||
|
||||
timer.checkpoint('Done with runtime: %s'%runTime)
|
||||
|
||||
print "Command: "
|
||||
print self.commandBonuses
|
||||
|
||||
# Mark fit as calculated
|
||||
self.__calculated = True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user