Merge branch 'master' into singularity

This commit is contained in:
DarkPhoenix
2019-08-27 11:34:17 +03:00
19 changed files with 111 additions and 50 deletions

View File

@@ -148,6 +148,7 @@ class CapSimulator:
stability_precision = self.stability_precision
period = self.period
activation = None
iterations = 0
capCapacity = self.capacitorCapacity
@@ -162,7 +163,12 @@ class CapSimulator:
t_max = self.t_max
while 1:
activation = pop(state)
# Nothing to pop - might happen when no mods are activated, or when
# only cap injectors are active (and are postponed by code below)
try:
activation = pop(state)
except IndexError:
break
t_now, duration, capNeed, shot, clipSize, reloadTime, isInjector = activation
# Max time reached, stop simulation - we're stable
@@ -275,7 +281,8 @@ class CapSimulator:
activation[3] = shot
push(state, activation)
push(state, activation)
if activation is not None:
push(state, activation)
# update instance with relevant results.
self.t = t_last

View File

@@ -4261,7 +4261,7 @@ class Effect1434(BaseEffect):
for sensorType in ('Gravimetric', 'Ladar', 'Magnetometric', 'Radar'):
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill('Electronic Warfare'),
'scan{0}StrengthBonus'.format(sensorType),
ship.getModifiedItemAttr('shipBonusCB'), stackingPenalties=True,
ship.getModifiedItemAttr('shipBonusCB'),
skill='Caldari Battleship', **kwargs)
@@ -5967,8 +5967,10 @@ class Effect2019(BaseEffect):
@staticmethod
def handler(fit, container, context, **kwargs):
level = container.level if 'skill' in context else 1
penalized = False if 'skill' in context else True
fit.drones.filteredItemBoost(lambda drone: drone.item.group.name == 'Logistic Drone',
'shieldBonus', container.getModifiedItemAttr('damageHP') * level, **kwargs)
'shieldBonus', container.getModifiedItemAttr('damageHP') * level,
stackingPenalties=penalized, **kwargs)
class Effect2020(BaseEffect):
@@ -6721,10 +6723,10 @@ class Effect2251(BaseEffect):
@staticmethod
def handler(fit, src, context, **kwargs):
fit.modules.filteredItemIncrease(lambda mod: mod.item.requiresSkill('Leadership'), 'maxGroupActive',
src.getModifiedItemAttr('maxGangModules'), **kwargs)
fit.modules.filteredItemIncrease(lambda mod: mod.item.requiresSkill('Leadership'), 'maxGroupOnline',
src.getModifiedItemAttr('maxGangModules'), **kwargs)
fit.modules.filteredItemIncrease(lambda mod: mod.item.requiresSkill('Leadership'), 'maxGroupActive',
src.getModifiedItemAttr('maxGangModules'), **kwargs)
class Effect2252(BaseEffect):
@@ -29503,6 +29505,8 @@ class Effect6613(BaseEffect):
@staticmethod
def handler(fit, src, context, **kwargs):
fit.modules.filteredItemIncrease(lambda mod: mod.item.requiresSkill('Leadership'), 'maxGroupOnline',
src.getModifiedItemAttr('shipBonusRole1'), **kwargs)
fit.modules.filteredItemIncrease(lambda mod: mod.item.requiresSkill('Leadership'), 'maxGroupActive',
src.getModifiedItemAttr('shipBonusRole1'), **kwargs)
@@ -29605,6 +29609,8 @@ class Effect6619(BaseEffect):
@staticmethod
def handler(fit, src, context, **kwargs):
fit.modules.filteredItemIncrease(lambda mod: mod.item.requiresSkill('Leadership'), 'maxGroupOnline',
src.getModifiedItemAttr('shipBonusRole1'), **kwargs)
fit.modules.filteredItemIncrease(lambda mod: mod.item.requiresSkill('Leadership'), 'maxGroupActive',
src.getModifiedItemAttr('shipBonusRole1'), **kwargs)
@@ -29917,6 +29923,8 @@ class Effect6640(BaseEffect):
@staticmethod
def handler(fit, src, context, **kwargs):
fit.modules.filteredItemIncrease(lambda mod: mod.item.requiresSkill('Leadership'), 'maxGroupOnline',
src.getModifiedItemAttr('shipBonusRole1'), **kwargs)
fit.modules.filteredItemIncrease(lambda mod: mod.item.requiresSkill('Leadership'), 'maxGroupActive',
src.getModifiedItemAttr('shipBonusRole1'), **kwargs)

View File

@@ -29,6 +29,7 @@ from eos.db.gamedata.queries import getAttributeInfo
defaultValuesCache = {}
cappingAttrKeyCache = {}
resistanceCache = {}
def getAttrDefault(key, fallback=None):
@@ -46,19 +47,23 @@ def getAttrDefault(key, fallback=None):
def getResistanceAttrID(modifyingItem, effect):
# If it doesn't exist on the effect, check the modifying modules attributes. If it's there, set it on the
# effect for this session so that we don't have to look here again (won't always work when it's None, but
# will catch most)
if not effect.getattr('resistanceCalculated'):
# If it doesn't exist on the effect, check the modifying module's attributes.
# If it's there, cache it and return
if effect.resistanceID:
return effect.resistanceID
cacheKey = (modifyingItem.item.ID, effect.ID)
try:
return resistanceCache[cacheKey]
except KeyError:
attrPrefix = effect.getattr('prefix')
if attrPrefix:
effect.resistanceID = int(modifyingItem.getModifiedItemAttr('{}ResistanceID'.format(attrPrefix))) or None
if not effect.resistanceID:
effect.resistanceID = int(modifyingItem.getModifiedItemAttr('{}RemoteResistanceID'.format(attrPrefix))) or None
resistanceID = int(modifyingItem.getModifiedItemAttr('{}ResistanceID'.format(attrPrefix))) or None
if not resistanceID:
resistanceID = int(modifyingItem.getModifiedItemAttr('{}RemoteResistanceID'.format(attrPrefix))) or None
else:
effect.resistanceID = int(modifyingItem.getModifiedItemAttr("remoteResistanceID")) or None
effect.resistanceCalculated = True
return effect.resistanceID
resistanceID = int(modifyingItem.getModifiedItemAttr("remoteResistanceID")) or None
resistanceCache[cacheKey] = resistanceID
return resistanceID
class ItemAttrShortcut:
@@ -553,10 +558,12 @@ class ModifiedAttributeDict(collections.MutableMapping):
if 'projected' not in effectType:
return 1
remoteResistID = getResistanceAttrID(modifyingItem=fit.getModifier(), effect=effect)
if not remoteResistID:
return 1
attrInfo = getAttributeInfo(remoteResistID)
# Get the attribute of the resist
resist = fit.ship.itemModifiedAttributes[attrInfo.attributeName] or None
return resist or 1.0
return resist or 1
class Affliction: