Esempio n. 1
0
def create_def_list_item(mech, i, var):
    """
    Compile info used by print_default()
    """
    name_str = mech.name + " " + mech.model + i.get_name()
    batt_val = mech.get_bv(i)
    weight = mech.weight
    source = i.source
    prod_era = conv_era(i.get_prod_era())
    rules = conv_rules(mech.get_rules_level(i), 0)
    year = mech.get_year(i)
    return (name_str, weight, batt_val, source, rules, prod_era, year)
Esempio n. 2
0
def create_selector_list(args):
    """
    Builds select lists from arguments
    """
    # Create lists
    select = lambda x, y: True
    select_l = []
    select_l.append(select)
    header_l = []

    # TAG
    if args.tag:
        select_l.append(lambda x, y: ("TAG" in y.specials or "LTAG" in y.specials))
        header_l.append("with TAG")
    # C3 Slave
    if args.c3s:
        select_l.append(lambda x, y: ("C3S" in y.specials or "C3BSS" in y.specials))
        header_l.append("with C3 Slave")
    # C3 Master
    if args.c3m:
        select_l.append(lambda x, y: ("C3M" in y.specials or "C3BSM" in y.specials))
        header_l.append("with C3 Master")
    # C3i
    if args.c3i:
        select_l.append(lambda x, y: "C3I" in y.specials)
        header_l.append("with C3i")
    # Narc
    if args.narc:
        select_l.append(lambda x, y: ("SNARC" in y.specials or "INARC" in y.specials))
        header_l.append("with Narc")
    # ECM
    if args.ecm:
        select_l.append(lambda x, y: ("ECM" in y.specials or "AECM" in y.specials or "WAT" in y.specials))
        header_l.append("with ECM")
    # Active Probe
    if args.probe:
        select_l.append(
            lambda x, y: ("PRB" in y.specials or "BH" in y.specials or "LPRB" in y.specials or "WAT" in y.specials)
        )
        header_l.append("with Active Probe")
    # Taser
    if args.taser:
        select_l.append(lambda x, y: "MTAS" in y.specials)
        header_l.append("with Battlemech Taser")
    # Inner Sphere
    if args.i:
        select_l.append(lambda x, y: (x.techbase == "Inner Sphere" and not y.mixed))
        header_l.append("Inner Sphere-tech")
    # Clan
    if args.cl:
        select_l.append(lambda x, y: (x.techbase == "Clan" and not y.mixed))
        header_l.append("Clan-tech")
    # Command Console
    if args.cc:
        select_l.append(lambda x, y: x.cockpit.console == "TRUE")
        header_l.append("with Command Console")
    # Era
    if args.e < 99:
        era = args.e
        select_l.append(lambda x, y: (y.get_prod_era() <= era))
        header_l.append(("available at era %s" % conv_era(era)))
    # Year
    if args.y > 0:
        select_l.append(lambda x, y: (x.get_year(y) <= args.y))
        header_l.append(("available at year %d" % args.y))
    # Speed
    if args.se > 0:
        spd = args.se
        select_l.append(lambda x, y: (max(x.get_walk(), y.get_jump()) == spd))
        header_l.append(("with speed %d" % spd))
    # Speed
    if args.sf > 0:
        spd = args.sf
        select_l.append(lambda x, y: (max(x.get_walk(), y.get_jump()) >= spd))
        header_l.append(("with at least speed %d" % spd))
    # Jumping
    if args.j:
        select_l.append(lambda x, y: (y.get_jump() > 0))
        header_l.append("can jump")
    # Armor
    if args.af > 0:
        select_l.append(lambda x, y: (x.armor.total.arm >= args.af))
        header_l.append(("with at least armor %d" % args.af))
    # LRMs
    if args.lrm > 0:
        lrm = args.lrm
        select_l.append(lambda x, y: (y.gear.weaponlist.lrms >= lrm))
        header_l.append(("with at least %d lrm tubes" % lrm))
    # non-primitive
    if args.npr:
        select_l.append(lambda x, y: x.engine.etype != "Primitive Fusion Engine")
        header_l.append("Non-primitive")
    # Weight
    if args.wgt > 0:
        select_l.append(lambda x, y: (x.weight == args.wgt))
        header_l.append(("of weight %d" % args.wgt))
    # Rules level
    if args.rule < 99:
        select_l.append(lambda x, y: (x.get_rules_level(y) <= args.rule))
        header_l.append(("with highest rules level %s" % conv_rules(args.rule, 1)))
    # VTOL
    if args.vtol:
        select_l.append(lambda x, y: (x.type == "CV" and x.mot_type == "VTOL"))
        header_l.append("VTOL")
    # Light
    if args.light:
        select_l.append(lambda x, y: (x.weight < 40))
        header_l.append("of light weight")
    # Medium
    if args.medium:
        select_l.append(lambda x, y: (x.weight >= 40 and x.weight < 60))
        header_l.append("of medium weight")
    # Heavy
    if args.heavy:
        select_l.append(lambda x, y: (x.weight >= 60 and x.weight < 80))
        header_l.append("of heavy weight")
    # Assault
    if args.assault:
        select_l.append(lambda x, y: (x.weight >= 80))
        header_l.append("of assault weight")

    return (select_l, header_l)