def get_weight(self): """ Get weight of AES """ if self.type == "None": return 0.0 if self.motive == "Quad": return ceil_05(self.weight / 50.0) elif self.motive == "Biped": return ceil_05(self.weight / 35.0) else: error_exit(self.motive)
def get_weight(self): """ Get weight of partial wing :return: Weight of partial wing :rtype: float """ # Clan if self.wing and self.tech == 1: return ceil_05(0.05 * self.weight) # IS elif self.wing and self.tech == 0: return ceil_05(0.07 * self.weight) else: return 0.0
def get_weight(self): """ Get weight of supercharger """ if self.supercharger: return ceil_05(self.eng_weight / 10.0) else: return 0
def get_weight(self): """ Get weight """ if self.mot_type == "VTOL" or self.mot_type == "Hovercraft": return ceil_05(0.1 * self.weight) else: return 0
def get_weight(self): """ Get weight of jump-boosters :return: weight :rtype: float """ return ceil_05(0.05 * self.weight * self.jump)
def get_weight(self): """ Get weight of booby trap """ if self.booby: return ceil_05(0.1 * self.weight) else: return 0
def get_weight(self): """ Return power amplifier weight """ if self.ene_weight > 0.0: return ceil_05(self.ene_weight * 0.1) else: return 0.0
def get_weight(self): """ Return armor weight """ wgt = self.total.arm / (16 * self.armor_multipler) # hack to get half-ton rounding up wgt = ceil_05(wgt) return wgt
def get_weight(self): """ Return weight of engine """ wgt = self.eweight # Add shielding if self.unit.type == "CV" and self.etype != "I.C.E. Engine": wgt *= 1.5 wgt = ceil_05(wgt) # Hovercraft minimum weight if self.unit.type == "CV" and self.unit.mot_type == "Hovercraft": wgt = max(wgt, self.unit.weight * 0.2) return wgt
def __init__(self, stru, weight, motive): Item.__init__(self) self.tech_base = int(stru.attributes["techbase"].value) self.type = get_child_data(stru, "type") wgt = weight # Check for legal structure type, save data ident = False for i in STRUCTURE: if (i[0] == self.type and i[1] == self.tech_base): ident = True self.is_bv = i[2] wgtf = i[3] self.r_level = i[4] costf = i[5] self.short = i[6] if not ident: error_exit((self.type, self.tech_base)) # Calculate IS weight wgt *= wgtf # hack to get half-ton rounding up wgt = ceil_05(wgt) self.wgt = wgt # Calculate IS points self.points = 0 # Head always have 3 IS self.points += 3 # Otherwise get from table self.points += CT_IS[weight] self.points += ST_IS[weight] * 2 self.points += LEG_IS[weight] * 2 # The arms/front legs need to check if mech is Biped or Quad if motive == "Quad": self.points += LEG_IS[weight] * 2 elif motive == "Biped": self.points += ARM_IS[weight] * 2 else: error_exit(motive) # Calculate cost self.cost = weight * costf
def __init__(self, stru, weight, mot_type, turrets): Item.__init__(self) self.tech_base = int(stru.attributes["techbase"].value) self.type = get_child_data(stru, "type") wgt = weight # Check for legal structure type, save data ident = False for i in STRUCTURE: if (i[0] == self.type and i[1] == self.tech_base): ident = True self.is_bv = i[2] wgtf = i[3] self.r_level = i[4] self.short = i[6] if not ident: error_exit((self.type, self.tech_base)) # Calculate IS weight wgt *= wgtf # hack to get half-ton rounding up wgt = ceil_05(wgt) self.wgt = wgt # Calculate IS points, start with the four basic sides base = ceil(weight * 0.1) self.points = base * 4 # Add rotor, max 3 points if mot_type == "VTOL": self.points += min(base, 3) if turrets == "Single Turret": self.points += base # TODO: Dual turret # Calculate cost self.cost = self.wgt * 10000
def __init__(self, mech, art4, art5, apollo, equip, clan_case): self.equip = equip self.c_case = clan_case # Clan CASE # We need to create local lists for avoid trouble with Omni-mechs self.weaponlist = Weaponlist(art4, art5, apollo) self.equiplist = Equiplist() self.physicallist = Physicallist(mech.weight) self.ammolist = Ammolist() self.supercharger = Supercharger(mech.engine.erating, mech.engine.get_weight()) # Keep track of tarcomp self.tarcomp = 0 # Gear weight self.a_weight = 0.0 self.e_weight = 0.0 self.tc_weight = 0.0 self.mod_weight = 0.0 self.tur_weight = 0.0 # Track explosive ammo by locations self.exp_ammo = {} # Save reference to explosive weapon count self.exp_weapon = self.weaponlist.exp_weapon self.case = {} # Track coolant pods self.coolant = 0 # Track modular armor self.mod_armor = {} self.has_mod_armor = False # Track CASE rules level self.case_rule = 0 ### Count gear ### for name in self.equip: ### Weapons ### # Go through weapon list ident = False # A weapon if (name.typ == 'ballistic' or name.typ == 'energy' or name.typ == 'missile' or name.typ == 'artillery' or name.typ == 'mgarray'): found = self.weaponlist.add(name.name, name.loc, name.rear, name.turret) if found: ident = True # Handle non-weapon equipment elif (name.typ == 'equipment'): for equip in self.equiplist.list: if (name.name == equip.name): equip.addone(name.wgt, name.turret) self.e_weight += equip.get_weight() ident = True # Hack, coolant pods if name.name == "Coolant Pod": self.coolant += 1 # Add explosive equipment to location if equip.expl > 0: self.exp_weapon.add_weapon(name.loc, equip.expl) # Hack, CASE elif (name.typ == 'CASE' or name.typ == 'CASEII'): for cas in CASE.keys(): if (name.name == cas): # Hack SSW store fixed CASE on omnis twice if not name.loc in self.case: self.e_weight += CASE[cas][1] ident = True # Save CASE status self.case[name.loc] = name.typ # Hack CASE rules level if self.case_rule < CASE[cas][0]: self.case_rule = CASE[cas][0] # Hack, handle targeting computer elif (name.name == "(IS) Targeting Computer" and name.typ == 'TargetingComputer'): self.tarcomp = 1 ident = True elif (name.name == "(CL) Targeting Computer" and name.typ == 'TargetingComputer'): self.tarcomp = 2 ident = True # Hack, supercharger elif (name.name == "Supercharger" and name.typ == "Supercharger"): self.supercharger.add() ident = True # A possible physical weapon elif (name.typ == 'physical'): found = self.physicallist.add(name.name, name.loc, name.turret) if found: ident = True # Modular armor elif (name.typ == 'miscellaneous'): if name.name == "Modular Armor": ident = True mod = self.mod_armor.get(name.loc, 0) mod += 10 self.mod_armor[name.loc] = mod self.mod_weight = 1.0 self.has_mod_armor = True # Ignore Hitches for now if name.name == "Hitch": ident = True # Ammunition elif (name.typ == 'ammunition'): for ammo in self.ammolist.list: if (name.name == ammo.name): ammo.addone() self.a_weight += ammo.get_weight() ident = True # Add explosive ammo to location if ammo.explosive == "X": expl = self.exp_ammo.get(name.loc, 0) expl += 1 self.exp_ammo[name.loc] = expl # Not found if not ident: print "Unidentified:", name.name, ":", name.typ error_exit("gear") # Calculate tarcomp weight if self.tarcomp == 1: # IS self.tc_weight = ceil(self.weaponlist.tcw_weight / 4.0) if self.tarcomp == 2: # Clan self.tc_weight = ceil(self.weaponlist.tcw_weight / 5.0) # Calculate turret weight self.tur_weight = ceil_05((self.weaponlist.tur_weight + self.equiplist.get_turret_weight() + self.physicallist.get_turret_weight()) / 10.0) # Add ammo to weapon for ammo in self.ammolist.list: if ammo.count > 0: ident = False for weap in self.weaponlist.list.itervalues(): for i in ammo.wname: if weap.name == i: weap.add_ammo(ammo.count * ammo.weight, ammo.count * ammo.amount) ident = True # We need to do defensive equipment also due to AMS for equip in self.equiplist.list: for i in ammo.wname: if equip.name == i: equip.add_ammo(ammo.count * ammo.weight, ammo.count * ammo.amount) ident = True if (not ident): print "ERROR: Unknown weapon:", ammo.wname error_exit("weapon")
def get_weight(self): """ Get weight """ return ceil_05(0.05 * self.weight)
# # Where rules level is: # 0 = Intro-tech, # 1 = Tournament legal, # 2 = Advanced, # 3 = Experimental, # 4 = Primitive (special) # # TODO: Medium Shield, industrial equipment # PHYSICAL = { # Total Warfare "Hatchet": [(lambda x: x * 1.5), 0, (lambda x: ceil(x / 5.0)), (lambda x: ceil(x / 15.0)), 0, 0, (lambda x, y: x * 5000)], "Sword": [(lambda x: x * 1.725), 0, (lambda x: ceil(x / 10.0) + 1), (lambda x: ceil_05(x / 20.0)), 0, 1, (lambda x, y: x * 10000)], "Retractable Blade": [(lambda x: x * 1.725), 0, (lambda x: ceil(x / 10.0)), (lambda x: ceil_05(x / 20.0) + 0.5), 0, 1, (lambda x, y: x * 10000 + 10000)], "Backhoe": [(lambda x: 8), 0, (lambda x: 6), (lambda x: 5), 0, 1, (lambda x, y: 50000)], "Spot Welder": [(lambda x: 5), 0, (lambda x: 5), (lambda x: 2), 2, 1, (lambda x, y: 75000)], # Advanced stuff "Claws": [(lambda x: x * 1.275), 0, (lambda x: ceil(x / 7.0)), (lambda x: ceil(x / 15.0)), 0, 2, (lambda x, y: y * 200)], "Mace": [(lambda x: x * 1.0), 0, (lambda x: ceil(x / 4.0)), (lambda x: ceil(x / 10.0)), 0, 1, (lambda x, y: 130000)], "Lance": [(lambda x: x * 1.0), 0, (lambda x: ceil(x / 5.0)),
# Where rules level is: 0 = intro, 1 = TL, 2 = advanced, 3 = experimental, # 4 = primitive # # Missing: Fuel Cell, Fission 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],