diff --git a/docs/tutorials/custom_building_placements.md b/docs/tutorials/custom_building_placements.md index 2abd470..16c0b89 100644 --- a/docs/tutorials/custom_building_placements.md +++ b/docs/tutorials/custom_building_placements.md @@ -18,6 +18,7 @@ into this file like below. Protoss: AbyssalReef: VsZergNatWall: + AvailableVsRaces: ["Zerg", "Random"] UpperSpawn: FirstPylon: [[64., 105.]] Pylons: [[63., 112.]] @@ -32,6 +33,7 @@ Protoss: GateKeeper: [[137.25, 38.6]] Acropolis: VsZergNatWall: + AvailableVsRaces: ["Zerg", "Random"] UpperSpawn: FirstPylon: [ [ 35., 109. ] ] Pylons: [ [ 32., 109. ] ] @@ -42,10 +44,11 @@ Protoss: FirstPylon: [ [ 141., 63. ] ] Pylons: [ [ 144., 63. ] ] ThreeByThrees: [ [ 137.5, 66.5 ], [ 141.5, 66.5 ], [ 144.5, 66.5 ] ] - StaticDefences: [ [ 137., 64. ] ] + StaticDefences: [ [ 137., 63. ] ] GateKeeper: [ [ 139.3, 67.4 ] ] Automaton: VsZergNatWall: + AvailableVsRaces: ["Zerg", "Random"] UpperSpawn: FirstPylon: [ [ 141., 139. ] ] Pylons: [ [ 140., 142. ] ] @@ -60,6 +63,7 @@ Protoss: GateKeeper: [ [ 47.15, 45.3 ] ] Ephemeron: VsZergNatWall: + AvailableVsRaces: ["Zerg", "Random"] UpperSpawn: FirstPylon: [ [ 37., 112. ] ] Pylons: [ [ 37., 109. ] ] @@ -74,6 +78,7 @@ Protoss: GateKeeper: [ [ 119.7, 47.4 ] ] Interloper: VsZergNatWall: + AvailableVsRaces: ["Zerg", "Random"] UpperSpawn: FirstPylon: [ [ 31., 112. ] ] Pylons: [ [ 31., 109. ] ] @@ -88,6 +93,7 @@ Protoss: GateKeeper: [ [ 115.78, 55.75 ] ] Thunderbird: VsZergNatWall: + AvailableVsRaces: ["Zerg", "Random"] UpperSpawn: FirstPylon: [ [ 46., 106. ] ] Pylons: [ [ 46., 103. ] ] @@ -101,6 +107,7 @@ Protoss: StaticDefences: [ [ 144., 48. ] ] GateKeeper: [ [ 138.64, 48.49 ] ] + ``` The values shown above are the default settings in ares, so there's no need to diff --git a/src/ares/building_placements.yml b/src/ares/building_placements.yml index 111e4ce..f303b5a 100644 --- a/src/ares/building_placements.yml +++ b/src/ares/building_placements.yml @@ -1,6 +1,7 @@ Protoss: AbyssalReef: VsZergNatWall: + AvailableVsRaces: ["Zerg", "Random"] UpperSpawn: FirstPylon: [[64., 105.]] Pylons: [[63., 112.]] @@ -15,6 +16,7 @@ Protoss: GateKeeper: [[137.25, 38.6]] Acropolis: VsZergNatWall: + AvailableVsRaces: ["Zerg", "Random"] UpperSpawn: FirstPylon: [ [ 35., 109. ] ] Pylons: [ [ 32., 109. ] ] @@ -25,10 +27,11 @@ Protoss: FirstPylon: [ [ 141., 63. ] ] Pylons: [ [ 144., 63. ] ] ThreeByThrees: [ [ 137.5, 66.5 ], [ 141.5, 66.5 ], [ 144.5, 66.5 ] ] - StaticDefences: [ [ 137., 64. ] ] + StaticDefences: [ [ 137., 63. ] ] GateKeeper: [ [ 139.3, 67.4 ] ] Automaton: VsZergNatWall: + AvailableVsRaces: ["Zerg", "Random"] UpperSpawn: FirstPylon: [ [ 141., 139. ] ] Pylons: [ [ 140., 142. ] ] @@ -43,6 +46,7 @@ Protoss: GateKeeper: [ [ 47.15, 45.3 ] ] Ephemeron: VsZergNatWall: + AvailableVsRaces: ["Zerg", "Random"] UpperSpawn: FirstPylon: [ [ 37., 112. ] ] Pylons: [ [ 37., 109. ] ] @@ -57,6 +61,7 @@ Protoss: GateKeeper: [ [ 119.7, 47.4 ] ] Interloper: VsZergNatWall: + AvailableVsRaces: ["Zerg", "Random"] UpperSpawn: FirstPylon: [ [ 31., 112. ] ] Pylons: [ [ 31., 109. ] ] @@ -71,6 +76,7 @@ Protoss: GateKeeper: [ [ 115.78, 55.75 ] ] Thunderbird: VsZergNatWall: + AvailableVsRaces: ["Zerg", "Random"] UpperSpawn: FirstPylon: [ [ 46., 106. ] ] Pylons: [ [ 46., 103. ] ] diff --git a/src/ares/consts.py b/src/ares/consts.py index 9b18e04..529536f 100644 --- a/src/ares/consts.py +++ b/src/ares/consts.py @@ -144,6 +144,7 @@ class BuildingPlacementOptions(str, Enum): + AVAILABLE_VS_RACES = "AvailableVsRaces" LOWER_SPAWN = "LowerSpawn" UPPER_SPAWN = "UpperSpawn" VS_ZERG_NAT_WALL = "VsZergNatWall" diff --git a/src/ares/managers/placement_manager.py b/src/ares/managers/placement_manager.py index bf87a28..6c19667 100644 --- a/src/ares/managers/placement_manager.py +++ b/src/ares/managers/placement_manager.py @@ -560,6 +560,21 @@ def normalize_map_name(_map_name: str) -> str: ): for building_type in placements: if building_type == BuildingPlacementOptions.VS_ZERG_NAT_WALL: + if ( + BuildingPlacementOptions.AVAILABLE_VS_RACES + in placements[building_type] + ): + races: set[str] = { + race + for race in placements[building_type][ + BuildingPlacementOptions.AVAILABLE_VS_RACES + ] + } + + if not any( + [race in self.ai.enemy_race.name for race in races] + ): + continue upper_spawn: bool = ( self.ai.start_location.y