Пример #1
0
    def exportPatterns(self):
        patterns = self.getDamagePatternList()
        for i in xrange(len(patterns) - 1, -1, -1):
            if patterns[i].name in ("Uniform", "Selected Ammo"):
                del patterns[i]

        patterns.sort(key=lambda p: p.name)
        return es_DamagePattern.exportPatterns(*patterns)
Пример #2
0
    def exportPatterns(self):
        patterns = getDamagePatternList()
        for i in xrange(len(patterns) - 1, -1, -1):
            if patterns[i].name in ("Uniform", "Selected Ammo"):
                del patterns[i]

        patterns.sort(key=lambda p: p.name)
        return es_DamagePattern.exportPatterns(*patterns)
Пример #3
0
    def importPatterns(self, text):
        imports, num = es_DamagePattern.importPatterns(text)
        lenImports = len(imports)

        if lenImports == 0:
            raise ImportError("No patterns found for import")
        if lenImports != num:
            raise ImportError(
                "%d patterns imported from clipboard; %d had errors" %
                (num, num - lenImports))
Пример #4
0
    def importPatterns(self, text):
        lookup = {}
        current = self.getDamagePatternList()
        for pattern in current:
            lookup[pattern.name] = pattern

        imports, num = es_DamagePattern.importPatterns(text)
        for pattern in imports:
            if pattern.name in lookup:
                match = lookup[pattern.name]
                match.__dict__.update(pattern.__dict__)
            else:
                eos.db.save(pattern)
        eos.db.commit()

        lenImports = len(imports)
        if lenImports == 0:
            raise ImportError("No patterns found for import")
        if lenImports != num:
            raise ImportError("%d patterns imported from clipboard; %d had errors" % (num, num - lenImports))
Пример #5
0
from functools import reduce
from eos.saveddata.damagePattern import DamagePattern
from gui.utils.numberFormatter import formatAmount

tankTypes = ("shield", "armor", "hull")
damageTypes = ("em", "thermal", "kinetic", "explosive")
damagePatterns = [DamagePattern.oneType(damageType) for damageType in damageTypes]
damageTypeResonanceNames = [damageType.capitalize() + "DamageResonance" for damageType in damageTypes]
resonanceNames = {"shield": ["shield" + s for s in damageTypeResonanceNames],
                  "armor": ["armor" + s for s in damageTypeResonanceNames],
                  "hull": [s[0].lower() + s[1:] for s in damageTypeResonanceNames]}


def firepowerSection(fit):
    """ Returns the text of the firepower section"""
    totalDps = fit.getTotalDps().total
    weaponDps = fit.getWeaponDps().total
    droneDps = fit.getDroneDps().total
    totalVolley = fit.getTotalVolley().total
    firepower = [totalDps, weaponDps, droneDps, totalVolley]

    firepowerStr = [formatAmount(dps, 3, 0, 0) for dps in firepower]
    # showWeaponAndDroneDps = (weaponDps > 0) and (droneDps > 0)
    if sum(firepower) == 0:
        return ""

    return "DPS: {} (".format(firepowerStr[0]) + \
           ("Weapon: {}, Drone: {}, ".format(*firepowerStr[1:3])) + \
           ("Volley: {})\n".format(firepowerStr[3]))

Пример #6
0
def _getAutoResists(fit):
    # Get all the data
    # HP / EHP
    hpData = fit.hp
    shieldHp = hpData['shield']
    armorHp = hpData['armor']
    hullHp = hpData['hull']
    uniformDamagePattern = DamagePattern(emAmount=25,
                                         thermalAmount=25,
                                         kineticAmount=25,
                                         explosiveAmount=25)
    ehpData = uniformDamagePattern.calculateEhp(fit)
    shieldEhp = ehpData['shield']
    armorEhp = ehpData['armor']
    hullEhp = ehpData['hull']
    totalEhp = shieldEhp + armorEhp + hullEhp
    # Resist factors
    try:
        shieldResFactor = shieldEhp / shieldHp
    except ZeroDivisionError:
        shieldResFactor = 1
    try:
        armorResFactor = armorEhp / armorHp
    except ZeroDivisionError:
        armorResFactor = 1
    try:
        hullResFactor = hullEhp / hullHp
    except ZeroDivisionError:
        hullResFactor = 1
    # Tank
    tankData = fit.tank
    shieldTank = tankData['shieldRepair']
    armorTank = tankData['armorRepair']
    hullTank = tankData['hullRepair']
    shieldRegen = tankData['passiveShield']

    shieldScore = 0
    armorScore = 0
    hullScore = 0
    # EHP scoring
    ehpWeight = 100
    shieldScore += ehpWeight * (shieldEhp / totalEhp)**1.5
    armorScore += ehpWeight * (armorEhp / totalEhp)**1.5
    hullScore += ehpWeight * (hullEhp / totalEhp)**1.5
    # Resists scoring
    # We include it to have some extra points for receiving better reps from the outside
    resistWeight = 25
    bestResFactor = max(shieldResFactor, armorResFactor, hullResFactor)
    shieldScore += resistWeight * (shieldResFactor / bestResFactor)**1.5
    armorScore += resistWeight * (armorResFactor / bestResFactor)**1.5
    hullScore += resistWeight * (hullResFactor / bestResFactor)**1.5
    # Active tank
    activeWeight = 10000
    shieldScore += activeWeight * shieldTank * shieldResFactor / totalEhp
    armorScore += activeWeight * armorTank * armorResFactor / totalEhp
    hullScore += activeWeight * hullTank * hullResFactor / totalEhp
    # Shield regen
    regenWeight = 5000
    shieldScore += regenWeight * shieldRegen * shieldResFactor / totalEhp
    maxScore = max(shieldScore, armorScore, hullScore)
    if maxScore == shieldScore:
        return (*_getShieldResists(fit.ship), 'shield')
    if maxScore == armorScore:
        return (*_getArmorResists(fit.ship), 'armor')
    if maxScore == hullScore:
        return (*_getHullResists(fit.ship), 'hull')
    return 0, 0, 0, 0, None
Пример #7
0
 def getBuiltinDamagePatternList():
     return es_DamagePattern.getBuiltinList()