Add titan gang bonuses, along with other things

This commit is contained in:
blitzmann
2016-04-29 18:47:53 -04:00
parent 1669a5434c
commit cfd82a6ad4
8 changed files with 57 additions and 15 deletions

View File

@@ -1,4 +1,4 @@
type = "passive"
type = "active"
def handler(fit, src, context):
fit.ship.increaseItemAttr("maxLockedTargets", src.getModifiedItemAttr("maxLockedTargetsBonus"))
fit.ship.multiplyItemAttr("maxTargetRange", src.getModifiedItemAttr("maxTargetRangeMultiplier"), stackingPenalties=True, penaltyGroup="postMul")

View File

@@ -0,0 +1,9 @@
type = "gang"
gangBoost = "rechargeRate"
gangBonus = "shipBonusTitanA4"
runTime = "late"
def handler(fit, src, context):
if "gang" not in context: return
fit.ship.boostItemAttr(gangBoost, src.getModifiedItemAttr(gangBonus) * src.parent.character.getSkill("Amarr Titan").level)

View File

@@ -0,0 +1,9 @@
type = "gang"
gangBoost = "shieldCapacity"
gangBonus = "shipBonusTitanC4"
runTime = "late"
def handler(fit, src, context):
if "gang" not in context: return
fit.ship.boostItemAttr(gangBoost, src.getModifiedItemAttr(gangBonus) * src.parent.character.getSkill("Caldari Titan").level)

View File

@@ -0,0 +1,9 @@
type = "gang"
gangBoost = "armorHP"
gangBonus = "shipBonusTitanG4"
runTime = "late"
def handler(fit, src, context):
if "gang" not in context: return
fit.ship.boostItemAttr(gangBoost, src.getModifiedItemAttr(gangBonus) * src.parent.character.getSkill("Gallente Titan").level)

View File

@@ -0,0 +1,9 @@
type = "gang"
gangBoost = "signatureRadius"
gangBonus = "shipBonusTitanM4"
runTime = "late"
def handler(fit, src, context):
if "gang" not in context: return
fit.ship.boostItemAttr(gangBoost, src.getModifiedItemAttr(gangBonus) * src.parent.character.getSkill("Minmatar Titan").level)

View File

@@ -56,6 +56,7 @@ class Fit(object):
"""Initialize a fit from the program"""
# use @mode.setter's to set __attr and IDs. This will set mode as well
self.ship = ship
self.ship.parent = self
self.__modules = HandledModuleList()
self.__drones = HandledDroneCargoList()
@@ -89,7 +90,7 @@ class Fit(object):
return
try:
self.__ship = Ship(item)
self.__ship = Ship(item, self)
# @todo extra attributes is now useless, however it set to be
# the same as ship attributes for ease (so we don't have to
# change all instances in source). Remove this at some point
@@ -462,6 +463,7 @@ class Fit(object):
if self.fleet is not None and withBoosters is True:
logger.debug("Fleet is set, gathering gang boosts")
self.gangBoosts = self.fleet.recalculateLinear(withBoosters=withBoosters)
timer.checkpoint("Done calculating gang boosts for %r"%self)
elif self.fleet is None:
self.gangBoosts = None

View File

@@ -41,7 +41,7 @@ class Ship(ItemAttrShortcut, HandledItem):
# as None unless the Entosis effect sets it.
}
def __init__(self, item):
def __init__(self, item, parent=None):
if item.category.name != "Ship":
raise ValueError('Passed item "%s" (category: (%s)) is not under Ship category'%(item.name, item.category.name))
@@ -53,6 +53,9 @@ class Ship(ItemAttrShortcut, HandledItem):
self.__itemModifiedAttributes.original.update(self.EXTRA_ATTRIBUTES)
self.__itemModifiedAttributes.overrides = self.item.overrides
# there are occasions when we need to get to the parent fit of the ship, such as when we need the character
# skills for ship-role gang boosts (Titans)
self.parent = parent
self.commandBonus = 0
@property

View File

@@ -85,21 +85,22 @@ class FighterView(wx.Panel):
activeFitID = self.mainFrame.getActiveFit()
fit = sFit.getFit(activeFitID)
for x in self.labels:
slot = getattr(Slot, "F_{}".format(x.upper()))
used = fit.getSlotsUsed(slot)
total = fit.getNumSlots(slot)
color = wx.Colour(204, 51, 51) if used > total else wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOWTEXT)
if fit:
for x in self.labels:
slot = getattr(Slot, "F_{}".format(x.upper()))
used = fit.getSlotsUsed(slot)
total = fit.getNumSlots(slot)
color = wx.Colour(204, 51, 51) if used > total else wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOWTEXT)
lbl = getattr(self, "label%sUsed" % x.capitalize())
lbl.SetLabel(str(int(used)))
lbl.SetForegroundColour(color)
lbl = getattr(self, "label%sUsed" % x.capitalize())
lbl.SetLabel(str(int(used)))
lbl.SetForegroundColour(color)
lbl = getattr(self, "label%sTotal" % x.capitalize())
lbl.SetLabel(str(int(total)))
lbl.SetForegroundColour(color)
lbl = getattr(self, "label%sTotal" % x.capitalize())
lbl.SetLabel(str(int(total)))
lbl.SetForegroundColour(color)
self.Refresh()
self.Refresh()
class FighterDisplay(d.Display):