Add destructible beacons to projected effects

This commit is contained in:
DarkPhoenix
2020-06-17 17:07:34 +03:00
parent c3f1824a84
commit 3094fd32fc
6 changed files with 210 additions and 123 deletions

View File

@@ -60,6 +60,7 @@ class Effect10(BaseEffect):
targetAttack
Used by:
Celestials from group: Destructible Effect Beacon (6 of 6)
Drones from group: Combat Drone (75 of 75)
Modules from group: Energy Weapon (212 of 214)
"""
@@ -12419,6 +12420,8 @@ class Effect3992(BaseEffect):
Used by:
Celestials named like: Class Pulsar Effects (6 of 6)
Celestial: Republic Stellar Observatory
Celestial: State Stellar Observatory
"""
runTime = 'early'
@@ -13212,6 +13215,7 @@ class Effect4088(BaseEffect):
Used by:
Celestials named like: Class Cataclysmic Variable Effects (6 of 6)
Celestial: Dazh Liminality Locus
"""
runTime = 'early'
@@ -13230,6 +13234,7 @@ class Effect4089(BaseEffect):
Used by:
Celestials named like: Class Cataclysmic Variable Effects (6 of 6)
Celestial: Dazh Liminality Locus
"""
runTime = 'early'
@@ -23144,6 +23149,8 @@ class Effect5913(BaseEffect):
Used by:
Celestials named like: Class Wolf Rayet Effects (6 of 6)
Celestial: Federal Stellar Observatory
Celestial: Imperial Stellar Observatory
"""
runTime = 'early'
@@ -23160,6 +23167,7 @@ class Effect5914(BaseEffect):
Used by:
Celestials named like: Class Pulsar Effects (6 of 6)
Celestial: Imperial Stellar Observatory
"""
runTime = 'early'
@@ -23179,6 +23187,7 @@ class Effect5915(BaseEffect):
Used by:
Celestials named like: Class Pulsar Effects (6 of 6)
Celestial: Imperial Stellar Observatory
"""
runTime = 'early'
@@ -23306,6 +23315,7 @@ class Effect5922(BaseEffect):
Used by:
Celestials named like: Class Black Hole Effects (6 of 6)
Celestial: Republic Stellar Observatory
"""
runTime = 'early'
@@ -35838,6 +35848,7 @@ class Effect7193(BaseEffect):
systemMiningCycleTimeBonus
Used by:
Celestials named like: Stellar Observatory (4 of 4)
Celestials named like: Triglavian Invasion System Effects (3 of 3)
"""
@@ -35846,8 +35857,8 @@ class Effect7193(BaseEffect):
@staticmethod
def handler(fit, beacon, context, projectionRange, **kwargs):
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill('Mining'),
'duration', beacon.getModifiedItemAttr('miningDurationMultiplier'), **kwargs)
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill('Mining'), 'duration',
beacon.getModifiedItemAttr('miningDurationMultiplier'), **kwargs)
class Effect7202(BaseEffect):
@@ -36151,6 +36162,23 @@ class Effect7234(BaseEffect):
implant.getModifiedItemAttr('setBonusMimesis'), **kwargs)
class Effect7237(BaseEffect):
"""
systemWarpSpeed
Used by:
Celestial: Dazh Liminality Locus
"""
runTime = 'early'
type = ('projected', 'passive')
@staticmethod
def handler(fit, beacon, context, projectionRange, **kwargs):
fit.ship.boostItemAttr('warpSpeedMultiplier', beacon.getModifiedItemAttr('warpSpeedBonus'),
stackingPenalties=True, **kwargs)
class Effect7238(BaseEffect):
"""
shipBonusDreadnoughtPC1DamageMultMax
@@ -36423,6 +36451,58 @@ class Effect8029(BaseEffect):
attr, ship.getModifiedItemAttr('shipBonusRole7'), **kwargs)
class Effect8031(BaseEffect):
"""
systemMaxTargets
Used by:
Celestial: Dazh Liminality Locus
"""
runTime = 'early'
type = ('projected', 'passive')
@staticmethod
def handler(fit, beacon, context, projectionRange, **kwargs):
fit.ship.multiplyItemAttr('maxLockedTargets', beacon.getModifiedItemAttr('maxLockedTargetsMultiplier'), **kwargs)
class Effect8032(BaseEffect):
"""
systemWarpScrambleStrengthBonus
Used by:
Celestial: Federal Stellar Observatory
"""
runTime = 'early'
type = ('projected', 'passive')
@staticmethod
def handler(fit, beacon, context, projectionRange, **kwargs):
fit.modules.filteredItemIncrease(
lambda mod: mod.item.group.name == 'Warp Scrambler',
'warpScrambleStrength', beacon.getModifiedItemAttr('warpScrambleStrengthBonus'), **kwargs)
class Effect8033(BaseEffect):
"""
systemEcmRangeMultiplier
Used by:
Celestial: State Stellar Observatory
"""
runTime = 'early'
type = ('projected', 'passive')
@staticmethod
def handler(fit, beacon, context, projectionRange, **kwargs):
fit.modules.filteredItemMultiply(
lambda mod: mod.item.group.name == 'ECM', 'maxRange',
beacon.getModifiedItemAttr('ecmRangeBonus'), stackingPenalties=True, **kwargs)
class Effect8034(BaseEffect):
"""
smallUpwellWeaponDmgBonusRequiredSkill

View File

@@ -21,7 +21,7 @@ import datetime
import time
from copy import deepcopy
from itertools import chain
from math import log, sqrt
from math import floor, log, sqrt
from logbook import Logger
from sqlalchemy.orm import reconstructor, validates
@@ -39,6 +39,7 @@ from eos.saveddata.damagePattern import DamagePattern
from eos.saveddata.module import Module
from eos.saveddata.ship import Ship
from eos.saveddata.targetProfile import TargetProfile
from eos.utils.float import floatUnerr
from eos.utils.stats import DmgTypes, RRTypes
@@ -378,8 +379,9 @@ class Fit:
@property
def maxTargets(self):
return min(self.extraAttributes["maxTargetsLockedFromSkills"],
self.ship.getModifiedItemAttr("maxLockedTargets"))
maxTargets = min(self.extraAttributes["maxTargetsLockedFromSkills"],
self.ship.getModifiedItemAttr("maxLockedTargets"))
return floor(floatUnerr(maxTargets))
@property
def maxTargetRange(self):

View File

@@ -64,7 +64,9 @@ ProjectedSystem = {
class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
"""An instance of this class represents a module together with its charge and modified attributes"""
MINING_ATTRIBUTES = ("miningAmount",)
SYSTEM_GROUPS = ("Effect Beacon", "MassiveEnvironments", "Abyssal Hazards", "Non-Interactable Object")
SYSTEM_GROUPS = (
"Effect Beacon", "MassiveEnvironments", "Abyssal Hazards",
"Non-Interactable Object", "Destructible Effect Beacon")
def __init__(self, item, baseItem=None, mutaplasmid=None):
"""Initialize a module from the program"""
@@ -726,6 +728,9 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
return False
elif state == FittingModuleState.OVERHEATED and not self.item.isType("overheat"):
return False
# Some destructible effect beacons contain active effects, hardcap those at online state
elif state > FittingModuleState.ONLINE and self.slot == FittingSlot.SYSTEM:
return False
else:
return True
@@ -1051,7 +1056,10 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
elif click == "ctrl":
state = FittingModuleState.OFFLINE
else:
state = transitionMap[currState]
try:
state = transitionMap[currState]
except KeyError:
state = min(transitionMap)
# If passive module tries to transition into online and fails,
# put it to passive instead
if not mod.isValidState(state) and currState == FittingModuleState.ONLINE: