def start_of_space_combat(att_units, def_units, options): # Mentak Ambush if options["att_faction"] == "Mentak" or options["def_faction"] == "Mentak": att_hits, def_hits = faction_abilities.mentak_ambush( att_units, def_units, options) att_units, options = assign.assign_hits(att_units, def_hits, options["att_riskdirecthit"], options["att_faction"], options, True) def_units, options = assign.assign_hits(def_units, att_hits, options["def_riskdirecthit"], options["def_faction"], options, False) # Assault Cannon if options["att_assault"] and len( list(filter(lambda x: x.non_fighter_ship, att_units))) >= 3: def_units = tech_abilities.assault(def_units) if options["def_assault"] and len( list(filter(lambda x: x.non_fighter_ship, def_units))) >= 3: att_units = tech_abilities.assault(att_units) # Creuss Dimensional Splicer if options["att_creuss_dimensionalsplicer_nekro_hide"] \ and any(map(lambda x: x.fighter or x.non_fighter_ship, att_units)): def_units = tech_abilities.dimensional_splicer(def_units) if options["def_creuss_dimensionalsplicer_nekro_hide"] \ and any(map(lambda x: x.fighter or x.non_fighter_ship, def_units)): att_units = tech_abilities.dimensional_splicer(att_units) return att_units, def_units, options
def antifighter(att_units, def_units, options): att_afb_hits, att_swa2_infantry_hits = generate_antifighter_hits(att_units, options["att_faction"] == "Argent" and options["att_destroyer2"], options, attacker=True) def_afb_hits, def_swa2_infantry_hits = generate_antifighter_hits(def_units, options["def_faction"] == "Argent" and options["att_destroyer2"], options, attacker=False) # Strike Wing Alpha II infantry hits if att_swa2_infantry_hits > 0: def_units = faction_abilities.assign_swa2(def_units, att_swa2_infantry_hits) if def_swa2_infantry_hits > 0: att_units = faction_abilities.assign_swa2(att_units, def_swa2_infantry_hits) # Argent Flight Raid Formation if options["att_faction"] == "Argent" or options["def_faction"] == "Argent": att_units, def_units = faction_abilities.raid_formation(att_units, def_units, att_afb_hits, def_afb_hits, options) # Assign hits, depending on Waylay if options["def_waylay"]: att_units, options = assign.assign_hits(att_units, def_afb_hits, options["att_riskdirecthit"], options["att_faction"], options, True) else: att_units = assign.assign_fighters_only(att_units, def_afb_hits) if options["att_waylay"]: def_units, options = assign.assign_hits(def_units, att_afb_hits, options["def_riskdirecthit"], options["def_faction"], options, False) else: def_units = assign.assign_fighters_only(def_units, att_afb_hits) return att_units, def_units, options
def bombardment(att_units, def_units, options): jolnar_commander = options[ "att_jolnar_commander"] # Bobmardment is exclusively done by the attacker bombard_hits = 0 best_dice = 11 for u in att_units: if u.bombard: for val in u.bombard: best_dice = min(best_dice, val) bombard_hits += bombard_roll(val, options, jolnar_commander) # Plasma Scoring if options["att_plasma"]: bombard_hits += bombard_roll(best_dice, options, jolnar_commander) # Argent Commander if options["att_argent_commander"]: bombard_hits += bombard_roll(best_dice, options, jolnar_commander) if not options["att_x89"]: def_units, options = assign.assign_hits(def_units, bombard_hits, options["def_riskdirecthit"], options["def_faction"], options, False) else: def_units = tech_abilities.x89(def_units, bombard_hits) att_units, harrow_bombarders = filters.filter_bombardment( att_units, options["att_faction"]) return att_units, def_units, harrow_bombarders, options
def space_cannon_offense(att_units, def_units, options): # Experimental Battlestation if options["def_experimental"]: def_units = [units.experimental_battlestation(options["def_faction"]) ] + def_units att_cannon_hits = generate_space_cannon_hits(att_units, options, attacker=True) def_cannon_hits = generate_space_cannon_hits(def_units, options, attacker=False) # Maneuvering Jets if options["def_maneuvering"]: att_cannon_hits = max(0, att_cannon_hits - 1) if options["att_maneuvering"]: def_cannon_hits = max(0, def_cannon_hits - 1) if options["def_graviton"]: att_units, options = assign.assign_nonfighters_first( att_units, def_cannon_hits, options["att_riskdirecthit"], options["att_faction"], options, True) else: att_units, options = assign.assign_hits(att_units, def_cannon_hits, options["att_riskdirecthit"], options["att_faction"], options, True) if options["att_graviton"]: def_units, options = assign.assign_nonfighters_first( def_units, att_cannon_hits, options["def_riskdirecthit"], options["def_faction"], options, False) else: def_units, options = assign.assign_hits(def_units, att_cannon_hits, options["def_riskdirecthit"], options["def_faction"], options, False) return att_units, def_units, options
def space_cannon_defense(att_units, def_units, options): cannon_hits = generate_space_cannon_hits(def_units, options, attacker=False) # Maneuvering Jets if options["att_maneuvering"]: cannon_hits = max(0, cannon_hits - 1) att_units, options = assign.assign_hits(att_units, cannon_hits, options["att_riskdirecthit"], options["att_faction"], options, False) return att_units, def_units, options
def combat_round(att_units, def_units, first_round, options): # Winnu flagship if options["att_faction"] == "Winnu" or options["def_faction"] == "Winnu": att_units, def_units = faction_abilities.winnu_flagship( att_units, def_units, options) att_bonus, def_bonus = 0, 0 if first_round: if options["att_morale"]: att_bonus += 1 # Naaz-Rokha Supercharge if options["att_naazrokha_supercharge_nekro_hide"]: att_bonus += 1 if options["def_morale"]: def_bonus += 1 # Naaz-Rokha Supercharge if options["def_naazrokha_supercharge_nekro_hide"]: def_bonus += 1 att_options = { "faction": options["att_faction"], "bonus": att_bonus, "prototype": first_round and options["att_prototype"], "fire_team": options["att_fireteam"] and first_round and options["ground_combat"], "war_funding": options["att_warfunding"] and first_round and not options["ground_combat"], "war_funding_o": options["att_warfunding_omega"] and first_round and not options["ground_combat"], "sol_agent": first_round and options["att_sol_agent"] and options["ground_combat"], "letnev_agent": first_round and options["att_letnev_agent"] and not options["ground_combat"] } def_options = { "faction": options["def_faction"], "bonus": def_bonus, "prototype": first_round and options["def_prototype"], "fire_team": options["def_fireteam"] and first_round and options["ground_combat"], "war_funding": options["def_warfunding"] and first_round and not options["ground_combat"], "war_funding_o": options["def_warfunding_omega"] and first_round and not options["ground_combat"], "sol_agent": first_round and options["def_sol_agent"] and options["ground_combat"], "letnev_agent": first_round and options["def_letnev_agent"] and not options["ground_combat"] } att_hits, att_nonfighter_hits = generate_hits(att_units, **att_options) def_hits, def_nonfighter_hits = generate_hits(def_units, **def_options) # War Funding Omega if options["att_warfunding_omega"] and util.above_average( def_units, def_hits): def_hits, def_nonfighter_hits = generate_hits(def_units, **def_options) if options["def_warfunding_omega"] and util.above_average( att_units, att_hits): att_hits, att_nonfighter_hits = generate_hits(att_units, **att_options) # Magen Defense Grid if first_round and options["def_magen"] and options["ground_combat"] and \ len(list(filter(lambda x: x.shield, def_units))) > 0: att_hits = 0 # remove PDS as they do not participate in combat (cannot be assigned hits) if first_round: att_units = list(filter(lambda x: not x.pds or x.ground, att_units)) def_units = list(filter(lambda x: not x.pds or x.ground, def_units)) # Letnev flagship (repair) if options["att_faction"] == "Letnev" or options["def_faction"] == "Letnev": att_units, def_units = faction_abilities.letnev_flagship_repair( att_units, def_units, options) # Sardakk mech if options["att_faction"] == "Sardakk" or options[ "def_faction"] == "Sardakk": att_hits, def_hits = faction_abilities.sardakk_mechs( att_units, def_units, att_hits, def_hits, options) # Valkyrie Particle Weave if options["att_sardakk_valkyrie_nekro_hide"] and options["ground_combat"]: # The part after the "or" is in case opponent also has VPW - it is mandatory to use if def_hits > 0 or (options["def_sardakk_valkyrie_nekro_hide"] and options["ground_combat"] and att_hits > 0): att_hits += 1 if options["def_sardakk_valkyrie_nekro_hide"] and options["ground_combat"]: if att_hits > 0: def_hits += 1 att_units, options = assign.assign_hits(att_units, def_hits, options["att_riskdirecthit"], options["att_faction"], options, True) att_units, options = assign.assign_nonfighters_first( att_units, def_nonfighter_hits, options["att_riskdirecthit"], options["att_faction"], options, True) def_units, options = assign.assign_hits(def_units, att_hits, options["def_riskdirecthit"], options["def_faction"], options, False) def_units, options = assign.assign_nonfighters_first( def_units, att_nonfighter_hits, options["def_riskdirecthit"], options["def_faction"], options, False) # Duranium Armor if options["att_duranium"]: tech_abilities.duranium(att_units) if options["def_duranium"]: tech_abilities.duranium(def_units) return att_units, def_units