Example #1
0
    def __init__(self, eng, unit):
        Item.__init__(self)
        self.erating = int(eng.attributes["rating"].value)
        self.e_base = int(eng.attributes["techbase"].value)
        self.etype = gettext(eng.childNodes)
        self.speed = self.erating / unit.weight
        self.unit = unit  # Reference to parent unit
        # A note on primitive engines:
        # It seems like using engine rating directly does give
        # the right speed, even if rules says otherwise
        # This looks like an internal SSW issue, so
        # assume that the weight of these engines are incorrect

        # Check for legal engine type, save data
        ident = False
        for i in ENGINE:
            if (i[0] == self.etype and i[1] == self.e_base):
                ident = True
                self.eng_bv = i[2]
                if self.unit.type == "CV":
                    self.eweight = i[3](ceil_5(self.erating -
                                               self.get_suspension_factor()))
                else:
                    self.eweight = i[3](ceil_5(self.erating))
                self.r_level = i[4]
                self.cost = i[5]
                self.short = i[6]
        if not ident:
            error_exit((self.etype, self.e_base))
Example #2
0
    def __init__(self, gyr, etype, erating):
        Item.__init__(self)
        # We need engine info for calculations
        self.gtype = gettext(gyr.childNodes)
        self.g_base = int(gyr.attributes["techbase"].value)

        # Check for legal gyro type, save data
        ident = False
        for i in GYRO:
            if (i[0] == self.gtype and i[1] == self.g_base):
                ident = True
                self.gyro_bv = i[2]
                gweightm = i[3]
                self.r_level = i[4]
                self.cost = i[5]
        if not ident:
            error_exit((self.gtype, self.g_base))

        # Calculate weight
        rating = erating
        # Hack: Make sure Primitive Engines get right gyro weight
        if etype == "Primitive Fusion Engine":
            rating *= 1.2
            rating = ceil_5(rating)
        base_weight = ceil(float(rating) / 100.0)
        self.weight = gweightm * base_weight
Example #3
0
 def get_cost(self):
     """
     Return cost of engine
     """
     erating = self.erating
     if self.etype == "Primitive Fusion Engine":
         erating = ceil_5(self.erating * 1.2)
     cost = (self.cost * erating * self.unit.weight) / 75
     # Large engines have double cost compared to a comparable normal
     if self.erating > 400:
         cost *= 2
     return cost
Example #4
0
ENGINE = [["I.C.E. Engine", 2, 1.0, (lambda x: ICE_ENGINE[x]), 1, 1250, "ICE"],
          ["Fusion Engine", 2, 1.0, (lambda x: STD_ENGINE[x]), 0, 5000, ""],
          ["XL Engine", 0, 0.5, (lambda x: XL_ENGINE[x]), 1, 20000, "XL"],
          ["XL Engine", 1, 0.75, (lambda x: XL_ENGINE[x]), 1, 20000, "XL"],
          ["Light Fusion Engine", 0, 0.75,
           (lambda x: LGT_ENGINE[x]), 1, 15000, "L"],
          ["Compact Fusion Engine", 0, 1.0,
           (lambda x: CMP_ENGINE[x]), 1, 10000, "C"],
          ["No Engine", 2, 0.0, (lambda x: 0.0), 1, 0, "---"],
          # Advanced
          ["XXL Engine", 0, 0.25,
           (lambda x: ceil_05(STD_ENGINE[x] * 0.333)), 3, 100000, "XXL"],
          ["XXL Engine", 1, 0.5,
           (lambda x: ceil_05(STD_ENGINE[x] * 0.333)), 3, 100000, "XXL"],
          ["Primitive Fusion Engine", 2, 1.0,
           (lambda x: STD_ENGINE[ceil_5(x * 1.2)]), 4, 5000, "Pri"]]

# Gyro types
#
# Name, techbase, BV multiplier, weight multiplier, rules level, cost factor
#
# Where techbase 0 = IS, 1 = Clan, 2 = Both, 10 = unknown
# Where rules level is: 0 = intro, 1 = TL, 2 = advanced, 3 = experimental
#
GYRO = [["Standard Gyro", 2, 0.5, 1.0, 0, 300000],
        ["Extra-Light Gyro", 0, 0.5, 0.5, 1, 750000],
        ["Heavy-Duty Gyro", 0, 1.0, 2.0, 1, 500000],
        ["Compact Gyro", 0, 0.5, 1.5, 1, 400000]]

# Myomer enhancement types
#