Possible to sell/buy units at SAM location and in airports.

This commit is contained in:
Khopa
2020-09-19 17:11:43 +02:00
parent 65dd9bc286
commit 4031c9b978
33 changed files with 274 additions and 45 deletions

View File

@@ -11,10 +11,11 @@ class BoforsGenerator(GroupGenerator):
"""
name = "Bofors AAA"
price = 75
def generate(self):
grid_x = random.randint(2, 4)
grid_y = random.randint(2, 4)
grid_x = random.randint(2, 3)
grid_y = random.randint(2, 3)
spacing = random.randint(10,40)

View File

@@ -12,12 +12,13 @@ class FlakGenerator(GroupGenerator):
"""
name = "Flak Site"
price = 135
def generate(self):
grid_x = random.randint(2, 4)
grid_y = random.randint(2, 4)
grid_x = random.randint(2, 3)
grid_y = random.randint(2, 3)
spacing = random.randint(30,60)
spacing = random.randint(30, 60)
index = 0
mixed = random.choice([True, False])
@@ -34,7 +35,7 @@ class FlakGenerator(GroupGenerator):
unit_type = random.choice(GFLAK)
# Search lights
search_pos = self.get_circular_position(random.randint(2,5), 90)
search_pos = self.get_circular_position(random.randint(2,3), 90)
for index, pos in enumerate(search_pos):
self.add_unit(AirDefence.Flak_Searchlight_37, "SearchLight#" + str(index), pos[0], pos[1], self.heading)

View File

@@ -11,10 +11,11 @@ class ZU23InsurgentGenerator(GroupGenerator):
"""
name = "Zu-23 Site"
price = 56
def generate(self):
grid_x = random.randint(2, 4)
grid_y = random.randint(2, 4)
grid_x = random.randint(2, 3)
grid_y = random.randint(2, 3)
spacing = random.randint(10,40)

View File

@@ -11,6 +11,7 @@ class AvengerGenerator(GroupGenerator):
"""
name = "Avenger Group"
price = 62
def generate(self):
num_launchers = random.randint(2, 3)

View File

@@ -11,6 +11,7 @@ class ChaparralGenerator(GroupGenerator):
"""
name = "Chaparral Group"
price = 66
def generate(self):
num_launchers = random.randint(2, 4)

View File

@@ -11,6 +11,7 @@ class GepardGenerator(GroupGenerator):
"""
name = "Gepard Group"
price = 50
def generate(self):
self.add_unit(AirDefence.SPAAA_Gepard, "SPAAA", self.position.x, self.position.y, self.heading)

View File

@@ -101,16 +101,22 @@ SAM_PRICES = {
AirDefence.HQ_7_Self_Propelled_LN: 35
}
def get_faction_possible_sams_units(faction: str) -> List[UnitType]:
"""
Return the list
:param faction: Faction to search units for
:return:
"""
return [u for u in db.FACTIONS[faction]["units"] if u in AirDefence.__dict__.values()]
def get_sam_names():
pass
def get_faction_possible_sams_generator(faction: str) -> List[UnitType]:
"""
Return the list of possible SAM generator for the given faction
:param faction: Faction to search units for
"""
return [SAM_MAP[u] for u in get_faction_possible_sams_units(faction)]
def generate_anti_air_group(game, parent_cp, ground_object, faction:str):
"""

View File

@@ -11,6 +11,7 @@ class HawkGenerator(GroupGenerator):
"""
name = "Hawk Site"
price = 115
def generate(self):
self.add_unit(AirDefence.SAM_Hawk_PCP, "PCP", self.position.x, self.position.y, self.heading)

View File

@@ -11,6 +11,7 @@ class HQ7Generator(GroupGenerator):
"""
name = "HQ-7 Site"
price = 120
def generate(self):
self.add_unit(AirDefence.HQ_7_Self_Propelled_STR, "STR", self.position.x, self.position.y, self.heading)

View File

@@ -11,6 +11,7 @@ class LinebackerGenerator(GroupGenerator):
"""
name = "Linebacker Group"
price = 75
def generate(self):
num_launchers = random.randint(2, 4)

View File

@@ -11,6 +11,7 @@ class PatriotGenerator(GroupGenerator):
"""
name = "Patriot Battery"
price = 240
def generate(self):
# Command Post
@@ -20,13 +21,13 @@ class PatriotGenerator(GroupGenerator):
self.add_unit(AirDefence.SAM_Patriot_EPP_III, "EPP", self.position.x, self.position.y + 30, self.heading)
self.add_unit(AirDefence.SAM_Patriot_STR_AN_MPQ_53, "ICC", self.position.x + 30, self.position.y + 30, self.heading)
num_launchers = random.randint(2, 4)
num_launchers = random.randint(3, 4)
positions = self.get_circular_position(num_launchers, launcher_distance=120, coverage=360)
for i, position in enumerate(positions):
self.add_unit(AirDefence.SAM_Patriot_LN_M901, "LN#" + str(i), position[0], position[1], position[2])
# Short range protection for high value site
num_launchers = random.randint(2, 4)
num_launchers = random.randint(3, 4)
positions = self.get_circular_position(num_launchers, launcher_distance=300, coverage=360)
for i, position in enumerate(positions):
self.add_unit(AirDefence.AAA_Vulcan_M163, "SPAAA#" + str(i), position[0], position[1], position[2])

View File

@@ -11,6 +11,7 @@ class RapierGenerator(GroupGenerator):
"""
name = "Rapier AA Site"
price = 50
def generate(self):
self.add_unit(AirDefence.Rapier_FSA_Blindfire_Tracker, "BT", self.position.x, self.position.y, self.heading)

View File

@@ -9,6 +9,7 @@ class RolandGenerator(GroupGenerator):
"""
name = "Roland Site"
price = 40
def generate(self):
self.add_unit(AirDefence.SAM_Roland_ADS, "ADS", self.position.x, self.position.y, self.heading)

View File

@@ -11,6 +11,7 @@ class SA10Generator(GroupGenerator):
"""
name = "SA-10/S-300PS Battery"
price = 450
def generate(self):
# Command Post

View File

@@ -11,6 +11,7 @@ class SA11Generator(GroupGenerator):
"""
name = "SA-11 Buk Battery"
price = 180
def generate(self):
self.add_unit(AirDefence.SAM_SA_11_Buk_CC_9S470M1, "CC", self.position.x, self.position.y, self.heading)

View File

@@ -11,6 +11,7 @@ class SA13Generator(GroupGenerator):
"""
name = "SA-13 Strela Group"
price = 50
def generate(self):
self.add_unit(Unarmed.Transport_UAZ_469, "UAZ", self.position.x, self.position.y, self.heading)

View File

@@ -9,6 +9,7 @@ class SA15Generator(GroupGenerator):
"""
name = "SA-15 Tor Group"
price = 55
def generate(self):
self.add_unit(AirDefence.SAM_SA_15_Tor_9A331, "ADS", self.position.x, self.position.y, self.heading)

View File

@@ -11,6 +11,7 @@ class SA19Generator(GroupGenerator):
"""
name = "SA-19 Tunguska Group"
price = 90
def generate(self):
num_launchers = random.randint(1, 3)

View File

@@ -11,6 +11,7 @@ class SA2Generator(GroupGenerator):
"""
name = "SA-2/S-75 Site"
price = 74
def generate(self):
self.add_unit(AirDefence.SAM_SR_P_19, "SR", self.position.x, self.position.y, self.heading)

View File

@@ -11,6 +11,7 @@ class SA3Generator(GroupGenerator):
"""
name = "SA-3/S-125 Site"
price = 80
def generate(self):
self.add_unit(AirDefence.SAM_SR_P_19, "SR", self.position.x, self.position.y, self.heading)

View File

@@ -11,6 +11,7 @@ class SA6Generator(GroupGenerator):
"""
name = "SA-6 Kub Site"
price = 102
def generate(self):
self.add_unit(AirDefence.SAM_SA_6_Kub_STR_9S91, "STR", self.position.x, self.position.y, self.heading)

View File

@@ -11,6 +11,7 @@ class SA8Generator(GroupGenerator):
"""
name = "SA-8 OSA Site"
price = 55
def generate(self):
self.add_unit(AirDefence.SAM_SA_8_Osa_9A33, "OSA", self.position.x, self.position.y, self.heading)

View File

@@ -11,6 +11,7 @@ class SA9Generator(GroupGenerator):
"""
name = "SA-9 Group"
price = 40
def generate(self):
self.add_unit(Unarmed.Transport_UAZ_469, "UAZ", self.position.x, self.position.y, self.heading)

View File

@@ -11,6 +11,7 @@ class VulcanGenerator(GroupGenerator):
"""
name = "Vulcan Group"
price = 25
def generate(self):
self.add_unit(AirDefence.AAA_Vulcan_M163, "SPAAA", self.position.x, self.position.y, self.heading)

View File

@@ -11,9 +11,10 @@ class ZSU23Generator(GroupGenerator):
"""
name = "ZSU-23 Group"
price = 50
def generate(self):
num_launchers = random.randint(2, 5)
num_launchers = random.randint(4, 5)
positions = self.get_circular_position(num_launchers, launcher_distance=120, coverage=180)
for i, position in enumerate(positions):

View File

@@ -11,10 +11,11 @@ class ZU23Generator(GroupGenerator):
"""
name = "ZU-23 Group"
price = 54
def generate(self):
grid_x = random.randint(2, 4)
grid_y = random.randint(2, 4)
grid_x = random.randint(2, 3)
grid_y = random.randint(2, 3)
spacing = random.randint(10,40)

View File

@@ -11,6 +11,7 @@ class ZU23UralGenerator(GroupGenerator):
"""
name = "ZU-23 Ural Group"
price = 64
def generate(self):
num_launchers = random.randint(2, 8)

View File

@@ -11,6 +11,7 @@ class ZU23UralInsurgentGenerator(GroupGenerator):
"""
name = "ZU-23 Ural Insurgent Group"
price = 64
def generate(self):
num_launchers = random.randint(2, 8)