sc2nachos
NachOS — an event-driven StarCraft II bot API for Python.
A bot makes one Api, subscribes handlers to the events a game hands out with Api.on, and plays through a runner:
run_local against the built-in computer, or run_from_command_line for the ladder and local games alike. Each turn
it reads its units from Api.units and orders them through Api.orders.
The README says how to get started and lists the guides.
1"""NachOS — an event-driven StarCraft II bot API for Python. 2 3A bot makes one `Api`, subscribes handlers to the events a game hands out with `Api.on`, and plays through a runner: 4`run_local` against the built-in computer, or `run_from_command_line` for the ladder and local games alike. Each turn 5it reads its units from `Api.units` and orders them through `Api.orders`. 6 7The [README](https://github.com/maxnus/NachOS#readme) says how to get started and lists the guides. 8""" 9 10from sc2nachos.__about__ import __version__ 11from sc2nachos._shared.errors import NachOSError 12from sc2nachos.api import Api, FogOnError, NoEnemyError, NotPlayingError 13from sc2nachos.gamedata import Cost, Resources 14from sc2nachos.gamemap import Expansion, StartLocation 15from sc2nachos.gametime import GameTime 16from sc2nachos.geometry import Circle, Footprint, Point, Rectangle 17from sc2nachos.ids import AbilityId, BuffId, UnitTypeId, UpgradeId 18from sc2nachos.match import AIBuild, Computer, Difficulty, Race, Result 19from sc2nachos.run import ( 20 ReplayPlayback, 21 open_replay, 22 open_replay_recording, 23 run_from_command_line, 24 run_ladder, 25 run_local, 26 run_recording, 27 run_replay, 28) 29from sc2nachos.units import OwnUnit, Unit, UnitDict, Units, UnitType 30 31__all__ = [ 32 "AIBuild", 33 "AbilityId", 34 "Api", 35 "BuffId", 36 "Circle", 37 "Computer", 38 "Cost", 39 "Difficulty", 40 "Expansion", 41 "FogOnError", 42 "Footprint", 43 "GameTime", 44 "NachOSError", 45 "NoEnemyError", 46 "NotPlayingError", 47 "OwnUnit", 48 "Point", 49 "Race", 50 "Rectangle", 51 "ReplayPlayback", 52 "Resources", 53 "Result", 54 "StartLocation", 55 "Unit", 56 "UnitDict", 57 "UnitType", 58 "UnitTypeId", 59 "Units", 60 "UpgradeId", 61 "__version__", 62 "open_replay", 63 "open_replay_recording", 64 "run_from_command_line", 65 "run_ladder", 66 "run_local", 67 "run_recording", 68 "run_replay", 69]
86class AIBuild(ReadableIntEnum): 87 """Which opening the built-in computer opponent favors.""" 88 89 RANDOM = sc2api_pb2.AIBuild.RandomBuild 90 RUSH = sc2api_pb2.AIBuild.Rush 91 TIMING = sc2api_pb2.AIBuild.Timing 92 POWER = sc2api_pb2.AIBuild.Power 93 MACRO = sc2api_pb2.AIBuild.Macro 94 AIR = sc2api_pb2.AIBuild.Air
Which opening the built-in computer opponent favors.
29class AbilityId(IdEnum): 30 """Ability ids used in multiplayer games.""" 31 32 ADEPT_SHADE = RawAbilityId.AdeptPhaseShift_AdeptPhaseShift 33 ARMORY_RESEARCH_SHIP_WEAPONS_1 = RawAbilityId.ArmoryResearch_TerranShipWeaponsLevel1 34 ARMORY_RESEARCH_SHIP_WEAPONS_2 = RawAbilityId.ArmoryResearch_TerranShipWeaponsLevel2 35 ARMORY_RESEARCH_SHIP_WEAPONS_3 = RawAbilityId.ArmoryResearch_TerranShipWeaponsLevel3 36 # The upgrade table names the ArmoryResearchSwarm ids for these, which an armory is never offered and which do 37 # nothing when ordered. 38 ARMORY_RESEARCH_VEHICLE_AND_SHIP_ARMOR_1 = RawAbilityId.ArmoryResearch_TerranVehicleAndShipPlatingLevel1 39 ARMORY_RESEARCH_VEHICLE_AND_SHIP_ARMOR_2 = RawAbilityId.ArmoryResearch_TerranVehicleAndShipPlatingLevel2 40 ARMORY_RESEARCH_VEHICLE_AND_SHIP_ARMOR_3 = RawAbilityId.ArmoryResearch_TerranVehicleAndShipPlatingLevel3 41 ARMORY_RESEARCH_VEHICLE_WEAPONS_1 = RawAbilityId.ArmoryResearch_TerranVehicleWeaponsLevel1 42 ARMORY_RESEARCH_VEHICLE_WEAPONS_2 = RawAbilityId.ArmoryResearch_TerranVehicleWeaponsLevel2 43 ARMORY_RESEARCH_VEHICLE_WEAPONS_3 = RawAbilityId.ArmoryResearch_TerranVehicleWeaponsLevel3 44 # A unit that can fire runs it as an attack, one that cannot as a scan move (in game). 45 ATTACK = RawAbilityId.Attack 46 BANELING_ATTACK_STRUCTURES_OFF = RawAbilityId.Behavior_BuildingAttackOff 47 BANELING_ATTACK_STRUCTURES_ON = RawAbilityId.Behavior_BuildingAttackOn 48 BANELING_EXPLODE = RawAbilityId.Explode_Explode 49 BANELING_NEST_RESEARCH_BANELING_SPEED = RawAbilityId.Research_CentrifugalHooks 50 BARRACKS_TECH_LAB_RESEARCH_COMBAT_SHIELD = RawAbilityId.Research_CombatShield 51 BARRACKS_TECH_LAB_RESEARCH_CONCUSSIVE_SHELLS = RawAbilityId.Research_ConcussiveShells 52 BARRACKS_TECH_LAB_RESEARCH_STIMPACK = RawAbilityId.BarracksTechLabResearch_Stimpack 53 BARRACKS_TRAIN_GHOST = RawAbilityId.BarracksTrain_Ghost 54 BARRACKS_TRAIN_MARAUDER = RawAbilityId.BarracksTrain_Marauder 55 BARRACKS_TRAIN_MARINE = RawAbilityId.BarracksTrain_Marine 56 BARRACKS_TRAIN_REAPER = RawAbilityId.BarracksTrain_Reaper 57 BATTLECRUISER_TACTICAL_JUMP = RawAbilityId.Effect_TacticalJump 58 BATTLECRUISER_YAMATO = RawAbilityId.Yamato_YamatoGun 59 BLINK = RawAbilityId.Effect_Blink 60 BUILD_CREEP_TUMOR = RawAbilityId.Build_CreepTumor 61 BUILD_REACTOR = RawAbilityId.Build_Reactor 62 BUILD_TECH_LAB = RawAbilityId.Build_TechLab 63 BURROW = RawAbilityId.BurrowDown 64 # Cancels whatever a unit is offered a cancel for, beyond a queue: a morph, an add-on, a structure going up, a 65 # cocoon or egg, a channel, a shade, a nuke. A unit is offered one at a time (in game). 66 CANCEL = RawAbilityId.Cancel 67 # Takes the last item off a structure's queue, of units or of research. A structure training answers 68 # CANCEL with `Error`; a morph and an add-on answer this one so (in game). 69 CANCEL_LAST = RawAbilityId.Cancel_Last 70 CARRIER_BUILD_INTERCEPTORS = RawAbilityId.Build_Interceptors 71 CLOAK_OFF = RawAbilityId.Behavior_CloakOff 72 CLOAK_ON = RawAbilityId.Behavior_CloakOn 73 COMMAND_CENTER_MORPH_ORBITAL_COMMAND = RawAbilityId.UpgradeToOrbital_OrbitalCommand 74 COMMAND_CENTER_MORPH_PLANETARY_FORTRESS = RawAbilityId.UpgradeToPlanetaryFortress_PlanetaryFortress 75 COMMAND_CENTER_TRAIN_SCV = RawAbilityId.CommandCenterTrain_SCV 76 CORRUPTOR_CAUSTIC_SPRAY = RawAbilityId.CausticSpray_CausticSpray 77 CORRUPTOR_MORPH_BROOD_LORD = RawAbilityId.MorphToBroodLord_BroodLord 78 CYBERNETICS_CORE_RESEARCH_AIR_ARMOR_1 = RawAbilityId.CyberneticsCoreResearch_ProtossAirArmorLevel1 79 CYBERNETICS_CORE_RESEARCH_AIR_ARMOR_2 = RawAbilityId.CyberneticsCoreResearch_ProtossAirArmorLevel2 80 CYBERNETICS_CORE_RESEARCH_AIR_ARMOR_3 = RawAbilityId.CyberneticsCoreResearch_ProtossAirArmorLevel3 81 CYBERNETICS_CORE_RESEARCH_AIR_WEAPONS_1 = RawAbilityId.CyberneticsCoreResearch_ProtossAirWeaponsLevel1 82 CYBERNETICS_CORE_RESEARCH_AIR_WEAPONS_2 = RawAbilityId.CyberneticsCoreResearch_ProtossAirWeaponsLevel2 83 CYBERNETICS_CORE_RESEARCH_AIR_WEAPONS_3 = RawAbilityId.CyberneticsCoreResearch_ProtossAirWeaponsLevel3 84 CYBERNETICS_CORE_RESEARCH_WARP_GATE = RawAbilityId.Research_WarpGate 85 CYCLONE_LOCK_ON = RawAbilityId.LockOn_LockOn 86 DARK_SHRINE_RESEARCH_DARK_TEMPLAR_BLINK = RawAbilityId.Research_ShadowStrike 87 DISRUPTOR_PURIFICATION_NOVA = RawAbilityId.Effect_PurificationNova 88 DRONE_MORPH_BANELING_NEST = RawAbilityId.ZergBuild_BanelingNest 89 DRONE_MORPH_EVOLUTION_CHAMBER = RawAbilityId.ZergBuild_EvolutionChamber 90 DRONE_MORPH_EXTRACTOR = RawAbilityId.ZergBuild_Extractor 91 DRONE_MORPH_HATCHERY = RawAbilityId.ZergBuild_Hatchery 92 DRONE_MORPH_HYDRALISK_DEN = RawAbilityId.ZergBuild_HydraliskDen 93 DRONE_MORPH_INFESTATION_PIT = RawAbilityId.ZergBuild_InfestationPit 94 DRONE_MORPH_LURKER_DEN = RawAbilityId.Build_LurkerDen 95 DRONE_MORPH_NYDUS_NETWORK = RawAbilityId.ZergBuild_NydusNetwork 96 DRONE_MORPH_ROACH_WARREN = RawAbilityId.ZergBuild_RoachWarren 97 DRONE_MORPH_SPAWNING_POOL = RawAbilityId.ZergBuild_SpawningPool 98 DRONE_MORPH_SPINE_CRAWLER = RawAbilityId.ZergBuild_SpineCrawler 99 DRONE_MORPH_SPIRE = RawAbilityId.ZergBuild_Spire 100 DRONE_MORPH_SPORE_CRAWLER = RawAbilityId.ZergBuild_SporeCrawler 101 DRONE_MORPH_ULTRALISK_CAVERN = RawAbilityId.ZergBuild_UltraliskCavern 102 ENGINEERING_BAY_RESEARCH_BUILDING_ARMOR = RawAbilityId.Research_TerranStructureArmorUpgrade 103 ENGINEERING_BAY_RESEARCH_HISEC_AUTO_TRACKING = RawAbilityId.Research_HiSecAutoTracking 104 ENGINEERING_BAY_RESEARCH_INFANTRY_ARMOR_1 = RawAbilityId.EngineeringBayResearch_TerranInfantryArmorLevel1 105 ENGINEERING_BAY_RESEARCH_INFANTRY_ARMOR_2 = RawAbilityId.EngineeringBayResearch_TerranInfantryArmorLevel2 106 ENGINEERING_BAY_RESEARCH_INFANTRY_ARMOR_3 = RawAbilityId.EngineeringBayResearch_TerranInfantryArmorLevel3 107 ENGINEERING_BAY_RESEARCH_INFANTRY_WEAPONS_1 = RawAbilityId.EngineeringBayResearch_TerranInfantryWeaponsLevel1 108 ENGINEERING_BAY_RESEARCH_INFANTRY_WEAPONS_2 = RawAbilityId.EngineeringBayResearch_TerranInfantryWeaponsLevel2 109 ENGINEERING_BAY_RESEARCH_INFANTRY_WEAPONS_3 = RawAbilityId.EngineeringBayResearch_TerranInfantryWeaponsLevel3 110 EVOLUTION_CHAMBER_RESEARCH_GROUND_ARMOR_1 = RawAbilityId.Research_ZergGroundArmorLevel1 111 EVOLUTION_CHAMBER_RESEARCH_GROUND_ARMOR_2 = RawAbilityId.Research_ZergGroundArmorLevel2 112 EVOLUTION_CHAMBER_RESEARCH_GROUND_ARMOR_3 = RawAbilityId.Research_ZergGroundArmorLevel3 113 EVOLUTION_CHAMBER_RESEARCH_MELEE_WEAPONS_1 = RawAbilityId.Research_ZergMeleeWeaponsLevel1 114 EVOLUTION_CHAMBER_RESEARCH_MELEE_WEAPONS_2 = RawAbilityId.Research_ZergMeleeWeaponsLevel2 115 EVOLUTION_CHAMBER_RESEARCH_MELEE_WEAPONS_3 = RawAbilityId.Research_ZergMeleeWeaponsLevel3 116 EVOLUTION_CHAMBER_RESEARCH_RANGE_WEAPONS_1 = RawAbilityId.Research_ZergMissileWeaponsLevel1 117 EVOLUTION_CHAMBER_RESEARCH_RANGE_WEAPONS_2 = RawAbilityId.Research_ZergMissileWeaponsLevel2 118 EVOLUTION_CHAMBER_RESEARCH_RANGE_WEAPONS_3 = RawAbilityId.Research_ZergMissileWeaponsLevel3 119 FACTORY_TECH_LAB_RESEARCH_BLUE_FLAME = RawAbilityId.Research_InfernalPreigniter 120 FACTORY_TECH_LAB_RESEARCH_CYCLONE_LOCK_ON_DAMAGE = RawAbilityId.Research_CycloneLockOnDamage 121 FACTORY_TECH_LAB_RESEARCH_DRILLING_CLAWS = RawAbilityId.Research_DrillingClaws 122 FACTORY_TECH_LAB_RESEARCH_SMART_SERVOS = RawAbilityId.Research_SmartServos 123 FACTORY_TRAIN_CYCLONE = RawAbilityId.Train_Cyclone 124 FACTORY_TRAIN_HELLBAT = RawAbilityId.Train_Hellbat 125 FACTORY_TRAIN_HELLION = RawAbilityId.FactoryTrain_Hellion 126 FACTORY_TRAIN_SIEGE_TANK = RawAbilityId.FactoryTrain_SiegeTank 127 FACTORY_TRAIN_THOR = RawAbilityId.FactoryTrain_Thor 128 FACTORY_TRAIN_WIDOW_MINE = RawAbilityId.FactoryTrain_WidowMine 129 FLEET_BEACON_RESEARCH_PHOENIX_RANGE = RawAbilityId.Research_PhoenixAnionPulseCrystals 130 FLEET_BEACON_RESEARCH_TEMPEST_BUILDING_DAMAGE = RawAbilityId.FleetBeaconResearch_TempestResearchGroundAttackUpgrade 131 FLEET_BEACON_RESEARCH_VOID_RAY_SPEED = RawAbilityId.FleetBeaconResearch_ResearchVoidRaySpeedUpgrade 132 FORGE_RESEARCH_GROUND_ARMOR_1 = RawAbilityId.ForgeResearch_ProtossGroundArmorLevel1 133 FORGE_RESEARCH_GROUND_ARMOR_2 = RawAbilityId.ForgeResearch_ProtossGroundArmorLevel2 134 FORGE_RESEARCH_GROUND_ARMOR_3 = RawAbilityId.ForgeResearch_ProtossGroundArmorLevel3 135 FORGE_RESEARCH_GROUND_WEAPONS_1 = RawAbilityId.ForgeResearch_ProtossGroundWeaponsLevel1 136 FORGE_RESEARCH_GROUND_WEAPONS_2 = RawAbilityId.ForgeResearch_ProtossGroundWeaponsLevel2 137 FORGE_RESEARCH_GROUND_WEAPONS_3 = RawAbilityId.ForgeResearch_ProtossGroundWeaponsLevel3 138 FORGE_RESEARCH_SHIELDS_1 = RawAbilityId.ForgeResearch_ProtossShieldsLevel1 139 FORGE_RESEARCH_SHIELDS_2 = RawAbilityId.ForgeResearch_ProtossShieldsLevel2 140 FORGE_RESEARCH_SHIELDS_3 = RawAbilityId.ForgeResearch_ProtossShieldsLevel3 141 FUSION_CORE_RESEARCH_LIBERATOR_RANGE = RawAbilityId.FusionCoreResearch_ResearchBallisticRange 142 FUSION_CORE_RESEARCH_MEDIVAC_ENERGY_REGENERATION = RawAbilityId.FusionCoreResearch_ResearchMedivacEnergyUpgrade 143 FUSION_CORE_RESEARCH_YAMATO_CANNON = RawAbilityId.Research_BattlecruiserWeaponRefit 144 GATEWAY_MORPH_WARP_GATE = RawAbilityId.Morph_WarpGate 145 GATEWAY_TRAIN_ADEPT = RawAbilityId.Train_Adept 146 GATEWAY_TRAIN_DARK_TEMPLAR = RawAbilityId.GatewayTrain_DarkTemplar 147 GATEWAY_TRAIN_HIGH_TEMPLAR = RawAbilityId.GatewayTrain_HighTemplar 148 GATEWAY_TRAIN_SENTRY = RawAbilityId.GatewayTrain_Sentry 149 GATEWAY_TRAIN_STALKER = RawAbilityId.GatewayTrain_Stalker 150 GATEWAY_TRAIN_ZEALOT = RawAbilityId.GatewayTrain_Zealot 151 GATHER = RawAbilityId.Harvest_Gather 152 GHOST_ACADEMY_BUILD_NUKE = RawAbilityId.Build_Nuke 153 GHOST_ACADEMY_RESEARCH_GHOST_CLOAK = RawAbilityId.Research_PersonalCloaking 154 GHOST_EMP = RawAbilityId.EMP_EMP 155 GHOST_SNIPE = RawAbilityId.Effect_GhostSnipe 156 GHOST_TACTICAL_NUKE = RawAbilityId.TacNukeStrike_NukeCalldown 157 HALT = RawAbilityId.Halt 158 HATCHERY_MORPH_LAIR = RawAbilityId.UpgradeToLair_Lair 159 HATCHERY_TRAIN_QUEEN = RawAbilityId.TrainQueen_Queen 160 HELLBAT_MORPH_HELLION = RawAbilityId.Morph_Hellion 161 HELLION_MORPH_HELLBAT = RawAbilityId.Morph_Hellbat 162 HIGH_TEMPLAR_FEEDBACK = RawAbilityId.Feedback_Feedback 163 HIGH_TEMPLAR_STORM = RawAbilityId.PsiStorm_PsiStorm 164 HOLD_FIRE_OFF = RawAbilityId.Behavior_HoldFireOff 165 HOLD_FIRE_ON = RawAbilityId.Behavior_HoldFireOn 166 HOLD_POSITION = RawAbilityId.HoldPosition 167 HYDRALISK_DEN_RESEARCH_HYDRALISK_LUNGE = RawAbilityId.HydraliskDenResearch_ResearchFrenzy 168 HYDRALISK_DEN_RESEARCH_HYDRALISK_RANGE = RawAbilityId.Research_GroovedSpines 169 HYDRALISK_DEN_RESEARCH_HYDRALISK_SPEED = RawAbilityId.Research_MuscularAugments 170 HYDRALISK_LUNGE = RawAbilityId.HydraliskFrenzy 171 # The catalog also holds LurkerAspectMPFromHydraliskBurrowed, which no lurker den offers and which does 172 # nothing when ordered, burrowed or not. 173 HYDRALISK_MORPH_LURKER = RawAbilityId.Morph_Lurker 174 INFESTATION_PIT_RESEARCH_NEURAL_PARASITE = RawAbilityId.Research_NeuralParasite 175 INFESTOR_FUNGAL_GROWTH = RawAbilityId.FungalGrowth_FungalGrowth 176 INFESTOR_MICROBIAL_SHROUD = RawAbilityId.AmorphousArmorcloud_AmorphousArmorcloud 177 INFESTOR_NEURAL_PARASITE = RawAbilityId.NeuralParasite_NeuralParasite 178 LAIR_MORPH_HIVE = RawAbilityId.UpgradeToHive_Hive 179 LAIR_RESEARCH_BURROW = RawAbilityId.Research_Burrow 180 LAIR_RESEARCH_OVERLORD_SPEED = RawAbilityId.Research_PneumatizedCarapace 181 LAND = RawAbilityId.Land 182 LARVA_MORPH_CORRUPTOR = RawAbilityId.LarvaTrain_Corruptor 183 LARVA_MORPH_DRONE = RawAbilityId.LarvaTrain_Drone 184 LARVA_MORPH_HYDRALISK = RawAbilityId.LarvaTrain_Hydralisk 185 LARVA_MORPH_INFESTOR = RawAbilityId.LarvaTrain_Infestor 186 LARVA_MORPH_MUTALISK = RawAbilityId.LarvaTrain_Mutalisk 187 LARVA_MORPH_OVERLORD = RawAbilityId.LarvaTrain_Overlord 188 LARVA_MORPH_ROACH = RawAbilityId.LarvaTrain_Roach 189 LARVA_MORPH_SWARM_HOST = RawAbilityId.Train_SwarmHost 190 LARVA_MORPH_ULTRALISK = RawAbilityId.LarvaTrain_Ultralisk 191 LARVA_MORPH_VIPER = RawAbilityId.LarvaTrain_Viper 192 LARVA_MORPH_ZERGLING = RawAbilityId.LarvaTrain_Zergling 193 # A liberator's defender mode, aimed at the zone it guards. 194 LIBERATOR_SIEGE_AT = RawAbilityId.Morph_LiberatorAGMode 195 LIFT = RawAbilityId.Lift 196 LOAD = RawAbilityId.Load 197 LOAD_ALL = RawAbilityId.LoadAll 198 LOCUST_SWOOP = RawAbilityId.Effect_LocustSwoop 199 LURKER_DEN_RESEARCH_LURKER_BURROW_SPEED = RawAbilityId.Research_AdaptiveTalons 200 LURKER_DEN_RESEARCH_LURKER_RANGE = RawAbilityId.LurkerDenResearch_ResearchLurkerRange 201 MEDIVAC_BOOST = RawAbilityId.Effect_MedivacIgniteAfterburners 202 MEDIVAC_HEAL = RawAbilityId.MedivacHeal_Heal 203 # The order to give two templar, high or dark, selected together: they walk to each other and merge into an 204 # archon. Given to one alone it is refused. Each reports MORPH_ARCHON running, aimed at the other (in game). 205 MORPH_ARCHON = RawAbilityId.Morph_Archon 206 MOTHERSHIP_CLOAK_FIELD = RawAbilityId.MothershipCloak_OracleCloakField 207 MOTHERSHIP_TIME_WARP = RawAbilityId.Effect_TimeWarp 208 MOVE = RawAbilityId.Move 209 NEXUS_CHRONO_BOOST = RawAbilityId.Effect_ChronoBoostEnergyCost 210 NEXUS_ENERGY_RECHARGE = RawAbilityId.EnergyRecharge_EnergyRecharge 211 NEXUS_TRAIN_MOTHERSHIP = RawAbilityId.NexusTrainMothership_Mothership 212 NEXUS_TRAIN_PROBE = RawAbilityId.NexusTrain_Probe 213 # Id zero, no ability at all, so unlike the rest it names no performer. 214 NULL = RawAbilityId.Null_Null 215 NYDUS_NETWORK_BUILD_NYDUS_WORM = RawAbilityId.Build_NydusWorm 216 ORACLE_BUILD_STASIS_WARD = RawAbilityId.Build_StasisTrap 217 ORACLE_PULSAR_BEAM_OFF = RawAbilityId.Behavior_PulsarBeamOff 218 ORACLE_PULSAR_BEAM_ON = RawAbilityId.Behavior_PulsarBeamOn 219 ORACLE_REVELATION = RawAbilityId.OracleRevelation_OracleRevelation 220 ORBITAL_COMMAND_CALLDOWN_MULE = RawAbilityId.CalldownMULE_CalldownMULE 221 ORBITAL_COMMAND_SCAN = RawAbilityId.ScannerSweep_Scan 222 ORBITAL_COMMAND_SUPPLY_DROP = RawAbilityId.SupplyDrop_SupplyDrop 223 OVERLORD_CREEP_OFF = RawAbilityId.Behavior_GenerateCreepOff 224 OVERLORD_CREEP_ON = RawAbilityId.Behavior_GenerateCreepOn 225 OVERLORD_MORPH_OVERLORD_TRANSPORT = RawAbilityId.Morph_OverlordTransport 226 OVERLORD_MORPH_OVERSEER = RawAbilityId.Morph_Overseer 227 OVERSEER_CONTAMINATE = RawAbilityId.Contaminate_Contaminate 228 OVERSEER_SPAWN_CHANGELING = RawAbilityId.SpawnChangeling_SpawnChangeling 229 PATROL = RawAbilityId.Patrol 230 PHOENIX_GRAVITON_BEAM = RawAbilityId.GravitonBeam_GravitonBeam 231 PROBE_BUILD_ASSIMILATOR = RawAbilityId.ProtossBuild_Assimilator 232 PROBE_BUILD_CYBERNETICS_CORE = RawAbilityId.ProtossBuild_CyberneticsCore 233 PROBE_BUILD_DARK_SHRINE = RawAbilityId.ProtossBuild_DarkShrine 234 PROBE_BUILD_FLEET_BEACON = RawAbilityId.ProtossBuild_FleetBeacon 235 PROBE_BUILD_FORGE = RawAbilityId.ProtossBuild_Forge 236 PROBE_BUILD_GATEWAY = RawAbilityId.ProtossBuild_Gateway 237 PROBE_BUILD_NEXUS = RawAbilityId.ProtossBuild_Nexus 238 PROBE_BUILD_PHOTON_CANNON = RawAbilityId.ProtossBuild_PhotonCannon 239 PROBE_BUILD_PYLON = RawAbilityId.ProtossBuild_Pylon 240 PROBE_BUILD_ROBOTICS_BAY = RawAbilityId.ProtossBuild_RoboticsBay 241 PROBE_BUILD_ROBOTICS_FACILITY = RawAbilityId.ProtossBuild_RoboticsFacility 242 PROBE_BUILD_SHIELD_BATTERY = RawAbilityId.Build_ShieldBattery 243 PROBE_BUILD_STARGATE = RawAbilityId.ProtossBuild_Stargate 244 PROBE_BUILD_TEMPLAR_ARCHIVE = RawAbilityId.ProtossBuild_TemplarArchive 245 PROBE_BUILD_TWILIGHT_COUNCIL = RawAbilityId.ProtossBuild_TwilightCouncil 246 QUEEN_INJECT = RawAbilityId.Effect_InjectLarva 247 QUEEN_TRANSFUSE = RawAbilityId.Transfusion_Transfusion 248 RALLY_UNITS = RawAbilityId.Rally_Units 249 RALLY_WORKERS = RawAbilityId.Rally_Workers 250 RAVAGER_CORROSIVE_BILE = RawAbilityId.Effect_CorrosiveBile 251 RAVEN_ANTI_ARMOR_MISSILE = RawAbilityId.Effect_AntiArmorMissile 252 RAVEN_INTERFERENCE_MATRIX = RawAbilityId.Effect_InterferenceMatrix 253 RAVEN_SPAWN_AUTO_TURRET = RawAbilityId.BuildAutoTurret_AutoTurret 254 REAPER_GRENADE = RawAbilityId.KD8Charge_KD8Charge 255 RECALL = RawAbilityId.Effect_MassRecall 256 REPAIR = RawAbilityId.Effect_Repair 257 RETURN = RawAbilityId.Harvest_Return 258 ROACH_MORPH_RAVAGER = RawAbilityId.MorphToRavager_Ravager 259 ROACH_WARREN_RESEARCH_ROACH_SPEED = RawAbilityId.Research_GlialRegeneration 260 ROACH_WARREN_RESEARCH_TUNNELING_CLAWS = RawAbilityId.Research_TunnelingClaws 261 ROBOTICS_BAY_RESEARCH_COLOSSUS_RANGE = RawAbilityId.Research_ExtendedThermalLance 262 ROBOTICS_BAY_RESEARCH_OBSERVER_SPEED = RawAbilityId.Research_GraviticBooster 263 ROBOTICS_BAY_RESEARCH_WARP_PRISM_SPEED = RawAbilityId.Research_GraviticDrive 264 ROBOTICS_FACILITY_TRAIN_COLOSSUS = RawAbilityId.RoboticsFacilityTrain_Colossus 265 ROBOTICS_FACILITY_TRAIN_DISRUPTOR = RawAbilityId.Train_Disruptor 266 ROBOTICS_FACILITY_TRAIN_IMMORTAL = RawAbilityId.RoboticsFacilityTrain_Immortal 267 ROBOTICS_FACILITY_TRAIN_OBSERVER = RawAbilityId.RoboticsFacilityTrain_Observer 268 ROBOTICS_FACILITY_TRAIN_WARP_PRISM = RawAbilityId.RoboticsFacilityTrain_WarpPrism 269 ROOT = RawAbilityId.Morph_Root 270 SALVAGE = RawAbilityId.SalvageEffect_Salvage 271 SCV_BUILD_ARMORY = RawAbilityId.TerranBuild_Armory 272 SCV_BUILD_BARRACKS = RawAbilityId.TerranBuild_Barracks 273 SCV_BUILD_BUNKER = RawAbilityId.TerranBuild_Bunker 274 SCV_BUILD_COMMAND_CENTER = RawAbilityId.TerranBuild_CommandCenter 275 SCV_BUILD_ENGINEERING_BAY = RawAbilityId.TerranBuild_EngineeringBay 276 SCV_BUILD_FACTORY = RawAbilityId.TerranBuild_Factory 277 SCV_BUILD_FUSION_CORE = RawAbilityId.TerranBuild_FusionCore 278 SCV_BUILD_GHOST_ACADEMY = RawAbilityId.TerranBuild_GhostAcademy 279 SCV_BUILD_MISSILE_TURRET = RawAbilityId.TerranBuild_MissileTurret 280 SCV_BUILD_REFINERY = RawAbilityId.TerranBuild_Refinery 281 SCV_BUILD_SENSOR_TOWER = RawAbilityId.TerranBuild_SensorTower 282 SCV_BUILD_STARPORT = RawAbilityId.TerranBuild_Starport 283 SCV_BUILD_SUPPLY_DEPOT = RawAbilityId.TerranBuild_SupplyDepot 284 SENTRY_FORCE_FIELD = RawAbilityId.ForceField_ForceField 285 SENTRY_GUARDIAN_SHIELD = RawAbilityId.GuardianShield_GuardianShield 286 SENTRY_HALLUCINATE_ADEPT = RawAbilityId.Hallucination_Adept 287 SENTRY_HALLUCINATE_ARCHON = RawAbilityId.Hallucination_Archon 288 SENTRY_HALLUCINATE_COLOSSUS = RawAbilityId.Hallucination_Colossus 289 SENTRY_HALLUCINATE_DISRUPTOR = RawAbilityId.Hallucination_Disruptor 290 SENTRY_HALLUCINATE_HIGH_TEMPLAR = RawAbilityId.Hallucination_HighTemplar 291 SENTRY_HALLUCINATE_IMMORTAL = RawAbilityId.Hallucination_Immortal 292 SENTRY_HALLUCINATE_ORACLE = RawAbilityId.Hallucination_Oracle 293 SENTRY_HALLUCINATE_PHOENIX = RawAbilityId.Hallucination_Phoenix 294 SENTRY_HALLUCINATE_PROBE = RawAbilityId.Hallucination_Probe 295 SENTRY_HALLUCINATE_STALKER = RawAbilityId.Hallucination_Stalker 296 SENTRY_HALLUCINATE_VOID_RAY = RawAbilityId.Hallucination_VoidRay 297 SENTRY_HALLUCINATE_WARP_PRISM = RawAbilityId.Hallucination_WarpPrism 298 SENTRY_HALLUCINATE_ZEALOT = RawAbilityId.Hallucination_Zealot 299 SHIELD_BATTERY_RECHARGE = RawAbilityId.ShieldBatteryRechargeEx5_ShieldBatteryRecharge 300 # A tank's siege mode, an observer's surveillance mode and an overseer's oversight mode, which the game has no id 301 # for across them. 302 SIEGE = auto() 303 SMART = RawAbilityId.Smart # the right-click order 304 SPAWNING_POOL_RESEARCH_ADRENAL_GLANDS = RawAbilityId.Research_ZerglingAdrenalGlands 305 SPAWNING_POOL_RESEARCH_ZERGLING_SPEED = RawAbilityId.Research_ZerglingMetabolicBoost 306 SPIRE_MORPH_GREATER_SPIRE = RawAbilityId.UpgradeToGreaterSpire_GreaterSpire 307 SPIRE_RESEARCH_AIR_ARMOR_1 = RawAbilityId.Research_ZergFlyerArmorLevel1 308 SPIRE_RESEARCH_AIR_ARMOR_2 = RawAbilityId.Research_ZergFlyerArmorLevel2 309 SPIRE_RESEARCH_AIR_ARMOR_3 = RawAbilityId.Research_ZergFlyerArmorLevel3 310 SPIRE_RESEARCH_AIR_WEAPONS_1 = RawAbilityId.Research_ZergFlyerAttackLevel1 311 SPIRE_RESEARCH_AIR_WEAPONS_2 = RawAbilityId.Research_ZergFlyerAttackLevel2 312 SPIRE_RESEARCH_AIR_WEAPONS_3 = RawAbilityId.Research_ZergFlyerAttackLevel3 313 SPRAY = RawAbilityId.Effect_Spray 314 STARGATE_TRAIN_CARRIER = RawAbilityId.StargateTrain_Carrier 315 STARGATE_TRAIN_ORACLE = RawAbilityId.StargateTrain_Oracle 316 STARGATE_TRAIN_PHOENIX = RawAbilityId.StargateTrain_Phoenix 317 STARGATE_TRAIN_TEMPEST = RawAbilityId.StargateTrain_Tempest 318 STARGATE_TRAIN_VOID_RAY = RawAbilityId.StargateTrain_VoidRay 319 STARPORT_TECH_LAB_RESEARCH_BANSHEE_CLOAK = RawAbilityId.Research_BansheeCloakingField 320 STARPORT_TECH_LAB_RESEARCH_BANSHEE_SPEED = RawAbilityId.Research_BansheeHyperflightRotors 321 STARPORT_TECH_LAB_RESEARCH_INTERFERENCE_MATRIX = RawAbilityId.StarportTechLabResearch_ResearchRavenInterferenceMatrix # noqa: E501 # fmt: skip 322 STARPORT_TRAIN_BANSHEE = RawAbilityId.StarportTrain_Banshee 323 STARPORT_TRAIN_BATTLECRUISER = RawAbilityId.StarportTrain_Battlecruiser 324 STARPORT_TRAIN_LIBERATOR = RawAbilityId.StarportTrain_Liberator 325 STARPORT_TRAIN_MEDIVAC = RawAbilityId.StarportTrain_Medivac 326 STARPORT_TRAIN_RAVEN = RawAbilityId.StarportTrain_Raven 327 STARPORT_TRAIN_VIKING = RawAbilityId.StarportTrain_VikingFighter 328 STIM = RawAbilityId.Effect_Stim 329 STOP = RawAbilityId.Stop 330 SUPPLY_DEPOT_LOWER = RawAbilityId.Morph_SupplyDepot_Lower 331 SUPPLY_DEPOT_RAISE = RawAbilityId.Morph_SupplyDepot_Raise 332 SWARM_HOST_SPAWN_LOCUST = RawAbilityId.Effect_SpawnLocusts 333 TEMPLAR_ARCHIVE_RESEARCH_STORM = RawAbilityId.Research_PsiStorm 334 THOR_EXPLOSIVE_MODE = RawAbilityId.Morph_ThorExplosiveMode 335 THOR_HIGH_IMPACT_MODE = RawAbilityId.Morph_ThorHighImpactMode 336 TWILIGHT_COUNCIL_RESEARCH_BLINK = RawAbilityId.Research_Blink 337 TWILIGHT_COUNCIL_RESEARCH_CHARGE = RawAbilityId.Research_Charge 338 TWILIGHT_COUNCIL_RESEARCH_GLAIVES = RawAbilityId.Research_AdeptResonatingGlaives 339 ULTRALISK_CAVERN_RESEARCH_ULTRALISK_ARMOR = RawAbilityId.Research_ChitinousPlating 340 ULTRALISK_CAVERN_RESEARCH_ULTRALISK_SPEED = RawAbilityId.Research_AnabolicSynthesis 341 UNBURROW = RawAbilityId.BurrowUp 342 # Puts every passenger down where the transport is: UnloadAll for a bunker, command center, planetary fortress or 343 # nydus, and the unload at a point aimed at the transport itself for a medivac, warp prism or transport overlord, 344 # which answer UnloadAll `Error` (in game). 345 UNLOAD = RawAbilityId.UnloadAll 346 UNLOAD_AT = RawAbilityId.UnloadAllAt 347 # Leaving a tank's siege mode, a liberator's defender mode, an observer's surveillance mode or an overseer's 348 # oversight mode, which the game has no id for across them. 349 UNSIEGE = auto() 350 UPROOT = RawAbilityId.Morph_Uproot 351 VIKING_LAND = RawAbilityId.Morph_VikingAssaultMode # "Assault Mode" in game 352 VIKING_LIFT = RawAbilityId.Morph_VikingFighterMode 353 VIPER_ABDUCT = RawAbilityId.Effect_Abduct 354 VIPER_BLINDING_CLOUD = RawAbilityId.BlindingCloud_BlindingCloud 355 VIPER_CONSUME = RawAbilityId.ViperConsumeStructure_ViperConsume 356 VIPER_PARASITIC_BOMB = RawAbilityId.ParasiticBomb_ParasiticBomb 357 VOID_RAY_PRISMATIC_ALIGNMENT = RawAbilityId.Effect_VoidRayPrismaticAlignment 358 WARP_GATE_MORPH_GATEWAY = RawAbilityId.Morph_Gateway 359 WARP_GATE_WARP_IN_ADEPT = RawAbilityId.TrainWarp_Adept 360 WARP_GATE_WARP_IN_DARK_TEMPLAR = RawAbilityId.WarpGateTrain_DarkTemplar 361 WARP_GATE_WARP_IN_HIGH_TEMPLAR = RawAbilityId.WarpGateTrain_HighTemplar 362 WARP_GATE_WARP_IN_SENTRY = RawAbilityId.WarpGateTrain_Sentry 363 WARP_GATE_WARP_IN_STALKER = RawAbilityId.WarpGateTrain_Stalker 364 WARP_GATE_WARP_IN_ZEALOT = RawAbilityId.WarpGateTrain_Zealot 365 WARP_PRISM_PHASING_MODE = RawAbilityId.Morph_WarpPrismPhasingMode 366 WARP_PRISM_TRANSPORT_MODE = RawAbilityId.Morph_WarpPrismTransportMode 367 WIDOW_MINE_ATTACK = RawAbilityId.WidowMineAttack_WidowMineAttack 368 ZEALOT_CHARGE = RawAbilityId.Effect_Charge 369 # The catalog also holds MorphZerglingToBaneling, which a zergling is never offered and which does nothing. 370 ZERGLING_MORPH_BANELING = RawAbilityId.MorphToBaneling_Baneling 371 372 # The game's own id for each unit of an action several units perform, with the action's: the id a unit is offered 373 # and reports. The game takes the action's id as an order and runs each unit's own (in game). Then each type's own 374 # id of an action the game has no id for across types, with the custom id that goes out as it. Then the id a unit 375 # reports running for an order given by another, where the game links neither to the other, with the id ordered. 376 # Ordering such a reported id does nothing, except that the archon's, given to both templar and aimed at one of 377 # them, merges them too (in game). 378 _REMAPPED_IDS = nonmember( 379 MappingProxyType( 380 { 381 RawAbilityId.Attack_Battlecruiser: ATTACK, 382 RawAbilityId.Attack_Redirect: ATTACK, 383 RawAbilityId.Scan_Move: ATTACK, 384 RawAbilityId.attack_Attack: ATTACK, 385 RawAbilityId.Effect_Blink_Stalker: BLINK, 386 RawAbilityId.Effect_ShadowStride: BLINK, 387 RawAbilityId.Build_CreepTumor_Queen: BUILD_CREEP_TUMOR, 388 RawAbilityId.Build_CreepTumor_Tumor: BUILD_CREEP_TUMOR, 389 RawAbilityId.Build_Reactor_Barracks: BUILD_REACTOR, 390 RawAbilityId.Build_Reactor_Factory: BUILD_REACTOR, 391 RawAbilityId.Build_Reactor_Starport: BUILD_REACTOR, 392 RawAbilityId.Build_TechLab_Barracks: BUILD_TECH_LAB, 393 RawAbilityId.Build_TechLab_Factory: BUILD_TECH_LAB, 394 RawAbilityId.Build_TechLab_Starport: BUILD_TECH_LAB, 395 RawAbilityId.BurrowDown_Baneling: BURROW, 396 RawAbilityId.BurrowDown_Drone: BURROW, 397 RawAbilityId.BurrowDown_Hydralisk: BURROW, 398 RawAbilityId.BurrowDown_Infestor: BURROW, 399 RawAbilityId.BurrowDown_Lurker: BURROW, 400 RawAbilityId.BurrowDown_Queen: BURROW, 401 RawAbilityId.BurrowDown_Ravager: BURROW, 402 RawAbilityId.BurrowDown_Roach: BURROW, 403 RawAbilityId.BurrowDown_SwarmHost: BURROW, 404 RawAbilityId.BurrowDown_Ultralisk: BURROW, 405 RawAbilityId.BurrowDown_WidowMine: BURROW, 406 RawAbilityId.BurrowDown_Zergling: BURROW, 407 RawAbilityId.Cancel_AdeptPhaseShift: CANCEL, 408 RawAbilityId.Cancel_AdeptShadePhaseShift: CANCEL, 409 RawAbilityId.Cancel_BarracksAddOn: CANCEL, 410 RawAbilityId.Cancel_BuildInProgress: CANCEL, 411 RawAbilityId.Cancel_FactoryAddOn: CANCEL, 412 RawAbilityId.Cancel_GravitonBeam: CANCEL, 413 RawAbilityId.Cancel_MorphBroodlord: CANCEL, 414 RawAbilityId.Cancel_MorphGreaterSpire: CANCEL, 415 RawAbilityId.Cancel_MorphHive: CANCEL, 416 RawAbilityId.Cancel_MorphLair: CANCEL, 417 RawAbilityId.Cancel_MorphLurker: CANCEL, 418 RawAbilityId.Cancel_MorphOrbital: CANCEL, 419 RawAbilityId.Cancel_MorphOverlordTransport: CANCEL, 420 RawAbilityId.Cancel_MorphOverseer: CANCEL, 421 RawAbilityId.Cancel_MorphPlanetaryFortress: CANCEL, 422 RawAbilityId.Cancel_MorphRavager: CANCEL, 423 RawAbilityId.Cancel_NeuralParasite: CANCEL, 424 RawAbilityId.Cancel_Nuke: CANCEL, 425 RawAbilityId.Cancel_StarportAddOn: CANCEL, 426 RawAbilityId.Cancel_VoidRayPrismaticAlignment: CANCEL, 427 RawAbilityId.ChannelSnipe_Cancel: CANCEL, 428 RawAbilityId.MorphToBaneling_Cancel: CANCEL, 429 RawAbilityId.Cancel_HangarQueue5: CANCEL_LAST, 430 RawAbilityId.Cancel_Queue1: CANCEL_LAST, 431 RawAbilityId.Cancel_Queue5: CANCEL_LAST, 432 RawAbilityId.Cancel_QueueAddOn: CANCEL_LAST, 433 RawAbilityId.Cancel_QueueCancelToSelection: CANCEL_LAST, 434 RawAbilityId.Cancel_QueuePasive: CANCEL_LAST, 435 RawAbilityId.Cancel_QueuePassiveCancelToSelection: CANCEL_LAST, 436 RawAbilityId.Behavior_CloakOff_Banshee: CLOAK_OFF, 437 RawAbilityId.Behavior_CloakOff_Ghost: CLOAK_OFF, 438 RawAbilityId.Behavior_CloakOn_Banshee: CLOAK_ON, 439 RawAbilityId.Behavior_CloakOn_Ghost: CLOAK_ON, 440 RawAbilityId.Harvest_Gather_Drone: GATHER, 441 RawAbilityId.Harvest_Gather_Mule: GATHER, 442 RawAbilityId.Harvest_Gather_Probe: GATHER, 443 RawAbilityId.Harvest_Gather_SCV: GATHER, 444 RawAbilityId.Halt_Building: HALT, 445 RawAbilityId.Halt_TerranBuild: HALT, 446 RawAbilityId.Behavior_HoldFireOff_Ghost: HOLD_FIRE_OFF, 447 RawAbilityId.Behavior_HoldFireOff_Lurker: HOLD_FIRE_OFF, 448 RawAbilityId.Behavior_HoldFireOn_Ghost: HOLD_FIRE_ON, 449 RawAbilityId.Behavior_HoldFireOn_Lurker: HOLD_FIRE_ON, 450 RawAbilityId.HoldPosition_Battlecruiser: HOLD_POSITION, 451 RawAbilityId.HoldPosition_Hold: HOLD_POSITION, 452 RawAbilityId.Land_Barracks: LAND, 453 RawAbilityId.Land_CommandCenter: LAND, 454 RawAbilityId.Land_Factory: LAND, 455 RawAbilityId.Land_OrbitalCommand: LAND, 456 RawAbilityId.Land_Starport: LAND, 457 RawAbilityId.Lift_Barracks: LIFT, 458 RawAbilityId.Lift_CommandCenter: LIFT, 459 RawAbilityId.Lift_Factory: LIFT, 460 RawAbilityId.Lift_OrbitalCommand: LIFT, 461 RawAbilityId.Lift_Starport: LIFT, 462 RawAbilityId.Load_Bunker: LOAD, 463 RawAbilityId.Load_Medivac: LOAD, 464 RawAbilityId.Load_NydusNetwork: LOAD, 465 RawAbilityId.Load_NydusWorm: LOAD, 466 RawAbilityId.Load_Overlord: LOAD, 467 RawAbilityId.Load_WarpPrism: LOAD, 468 RawAbilityId.LoadAll_CommandCenter: LOAD_ALL, 469 RawAbilityId.Move_Battlecruiser: MOVE, 470 RawAbilityId.Move_Move: MOVE, 471 RawAbilityId.Patrol_Battlecruiser: PATROL, 472 RawAbilityId.Patrol_Patrol: PATROL, 473 RawAbilityId.Rally_Building: RALLY_UNITS, 474 RawAbilityId.Rally_Hatchery_Units: RALLY_UNITS, 475 RawAbilityId.Rally_CommandCenter: RALLY_WORKERS, 476 RawAbilityId.Rally_Hatchery_Workers: RALLY_WORKERS, 477 RawAbilityId.Rally_Nexus: RALLY_WORKERS, 478 RawAbilityId.Effect_MassRecall_Nexus: RECALL, 479 RawAbilityId.Effect_MassRecall_StrategicRecall: RECALL, 480 RawAbilityId.Effect_Repair_Mule: REPAIR, 481 RawAbilityId.Effect_Repair_SCV: REPAIR, 482 RawAbilityId.Harvest_Return_Drone: RETURN, 483 RawAbilityId.Harvest_Return_Mule: RETURN, 484 RawAbilityId.Harvest_Return_Probe: RETURN, 485 RawAbilityId.Harvest_Return_SCV: RETURN, 486 RawAbilityId.SpineCrawlerRoot_SpineCrawlerRoot: ROOT, 487 RawAbilityId.SporeCrawlerRoot_SporeCrawlerRoot: ROOT, 488 RawAbilityId.Effect_Spray_Protoss: SPRAY, 489 RawAbilityId.Effect_Spray_Terran: SPRAY, 490 RawAbilityId.Effect_Spray_Zerg: SPRAY, 491 RawAbilityId.Effect_Stim_Marauder: STIM, 492 RawAbilityId.Effect_Stim_Marine: STIM, 493 RawAbilityId.Stop_Battlecruiser: STOP, 494 RawAbilityId.Stop_Redirect: STOP, 495 RawAbilityId.stop_Stop: STOP, 496 RawAbilityId.BurrowUp_Baneling: UNBURROW, 497 RawAbilityId.BurrowUp_Drone: UNBURROW, 498 RawAbilityId.BurrowUp_Hydralisk: UNBURROW, 499 RawAbilityId.BurrowUp_Infestor: UNBURROW, 500 RawAbilityId.BurrowUp_Lurker: UNBURROW, 501 RawAbilityId.BurrowUp_Queen: UNBURROW, 502 RawAbilityId.BurrowUp_Ravager: UNBURROW, 503 RawAbilityId.BurrowUp_Roach: UNBURROW, 504 RawAbilityId.BurrowUp_SwarmHost: UNBURROW, 505 RawAbilityId.BurrowUp_Ultralisk: UNBURROW, 506 RawAbilityId.BurrowUp_WidowMine: UNBURROW, 507 RawAbilityId.BurrowUp_Zergling: UNBURROW, 508 RawAbilityId.OverlordTransport: UNLOAD, 509 RawAbilityId.UnloadAll_Bunker: UNLOAD, 510 RawAbilityId.UnloadAll_CommandCenter: UNLOAD, 511 RawAbilityId.UnloadAll_NydasNetwork: UNLOAD, 512 RawAbilityId.UnloadAll_NydusWorm: UNLOAD, 513 RawAbilityId.UnloadAll_WarpPrism: UNLOAD, 514 RawAbilityId.Unload_Medivac: UNLOAD, 515 RawAbilityId.BunkerTransport: UNLOAD_AT, 516 RawAbilityId.CommandCenterTransport_414: UNLOAD_AT, 517 RawAbilityId.NydusCanalTransport: UNLOAD_AT, 518 RawAbilityId.NydusWormTransport: UNLOAD_AT, 519 RawAbilityId.UnloadAllAt_Medivac: UNLOAD_AT, 520 RawAbilityId.UnloadAllAt_Overlord: UNLOAD_AT, 521 RawAbilityId.UnloadAllAt_WarpPrism: UNLOAD_AT, 522 RawAbilityId.SpineCrawlerUproot_SpineCrawlerUproot: UPROOT, 523 RawAbilityId.SporeCrawlerUproot_SporeCrawlerUproot: UPROOT, 524 RawAbilityId.Morph_OversightMode: SIEGE, 525 RawAbilityId.Morph_SurveillanceMode: SIEGE, 526 RawAbilityId.SiegeMode_SiegeMode: SIEGE, 527 RawAbilityId.Morph_LiberatorAAMode: UNSIEGE, 528 RawAbilityId.Morph_ObserverMode: UNSIEGE, 529 RawAbilityId.Morph_OverseerMode: UNSIEGE, 530 RawAbilityId.Unsiege_Unsiege: UNSIEGE, 531 RawAbilityId.LiberatorMorphtoAG_LiberatorAGMode: LIBERATOR_SIEGE_AT, 532 RawAbilityId.LiberatorMorphtoAA_LiberatorAAMode: UNSIEGE, 533 RawAbilityId.Archon_Warp_Target: MORPH_ARCHON, 534 } 535 ) 536 )
Ability ids used in multiplayer games.
62class Api[E]: 63 """Everything a bot talks to. It is built before there is a game. 64 65 Construct one where the rest of your bot can reach it, module scope included, and pass it to `run_local` or 66 `run_ladder` for its game. An api plays one game: a program that plays several makes an api for each. Never 67 subclass it: your own helpers belong in your own modules, as ordinary functions. 68 69 Time is counted in steps: one step is one game loop, and 22.4 make a second. A moment or a length of game time is a 70 `GameTime`, but for the two counts of steps, `step` and `steps_per_turn`. The bot takes a turn every 71 `steps_per_turn` steps, which the game is played with. Each turn hands its handlers a `TurnStartEvent`, then 72 the events its observation reports, in the order `docs/events.md` gives, then a `TurnEvent`. 73 74 Anything of the game raises `NotPlayingError` until the game starts. After it ends, the api keeps answering from 75 it. 76 77 `E` is the type of `extensions`: an `Api()` is an `Api[None]`, and one made with `extensions=Extensions` an 78 `Api[Extensions]`. A function that takes any api takes an `Api[object]`. 79 """ 80 81 @overload 82 def __init__( 83 self: "Api[None]", 84 *, 85 extensions: None = None, 86 time_handlers: bool = ..., 87 ) -> None: ... 88 89 @overload 90 def __init__( 91 self, 92 *, 93 extensions: Callable[["Api[E]"], E], 94 time_handlers: bool = ..., 95 ) -> None: ... 96 97 def __init__( 98 self, 99 *, 100 extensions: Callable[[Any], object] | None = None, 101 time_handlers: bool = False, 102 ) -> None: 103 """Build the bot's extensions with `extensions` once the game starts, as `Api.extensions` says, and time every 104 handler call, read as `handler_timings`, if `time_handlers`. This connects to nothing. 105 106 `extensions` builds what `Api.extensions` reads, the bot's own object holding its extensions, from this api: 107 its class, whose constructor takes the api and builds each extension. 108 """ 109 self._extensions_builder = extensions 110 self._extensions: object = _NOT_BUILT 111 self._events = _EventBus(time_handlers=time_handlers) 112 # Everything that comes with the game, from the moment it starts. 113 self._game: _Game | None = None 114 115 # A type checker refuses a parameterized event subscribed to bare: `None` is not callable. 116 @overload 117 def on[T: ParameterizedEvent]( # pyright: ignore[reportOverlappingOverload] 118 self, 119 event_type: type[T], 120 /, 121 *, 122 priority: EventPriority = ..., 123 min_interval: GameTime | None = ..., 124 at_time: GameTime | None = ..., 125 once: bool = ..., 126 catch_exceptions: bool = ..., 127 ) -> None: ... 128 129 @overload 130 def on[T: Event]( 131 self, 132 event_type: type[T] | EventFilter[T], 133 /, 134 *, 135 priority: EventPriority = ..., 136 min_interval: GameTime | None = ..., 137 at_time: GameTime | None = ..., 138 once: bool = ..., 139 catch_exceptions: bool = ..., 140 ) -> EventSubscriber[T]: ... 141 142 def on(self, event_type: type[Event] | EventFilter[Any], /, **options: Any) -> Any: 143 """Subscribe the decorated function to `event_type`, or mark the decorated method for `subscribe`. This works 144 before any game, so handlers can subscribe as their modules are imported. 145 146 `event_type` is an event type, whose events and its subclasses' the handler is handed, or a filter from `only` 147 or `of`. `where` on the `EventSubscriber` it returns narrows further. A type that has `of` is subscribed to only 148 through it, and a type checker refuses it bare. A handler of `Event` is handed every event, which makes NachOS 149 produce every type of event it otherwise would not, including comparing every unit with the observation 150 before; a parameterized event comes only with the parameters other handlers asked for. 151 152 A method is marked, and subscribed for each instance passed to `subscribe`: a function defined in a class body 153 that takes at least two positional arguments without defaults, the instance and the event, or wraps one through 154 `functools.wraps`. Any other function is subscribed at once, wherever it is defined, a static method taking the 155 event alone included, and so is a method already bound to its instance. Either stays subscribed until it is 156 passed to `unsubscribe`, held strongly, so it runs whether or not anything else keeps it alive. 157 158 `priority` orders the handler among the event's handlers, highest first and then in subscription order; and 159 among a turn's: every handler of one priority is handed each event of the turn it selects, in the turn's order, 160 before any handler of the next. `EventPriority.BEFORE` and `EventPriority.AFTER` are for the handlers 161 subscribed while NachOS builds the extensions, and those take no other, as `Api.extensions` says: either misuse 162 raises `ValueError`. The handler runs on every event unless held back: `min_interval` waits until that long has 163 passed since it last ran, `at_time` runs it once, on the first event at or after that time, and `once` on the 164 first event. `min_interval` with either of the others, or not above zero, raises `ValueError`, and either of the 165 two not a `GameTime`, `TypeError`. These count only the events selected, those emitted before the game included. 166 An exception it raises ends the game, unless `catch_exceptions`, which logs it and goes on. 167 168 The handler must take an event of `event_type`, which a type checker checks. One decorated for several event 169 types takes an `Event`. 170 """ 171 return self._events.on(event_type, **options) 172 173 def subscribe(self, instance: object) -> None: 174 """Subscribe every method of `instance` marked with `on`, until `instance` is passed to `unsubscribe`. 175 176 An unmarked override leaves the method it overrides unsubscribed. Raises `ValueError` if `instance` has no 177 marked method, or one of them is subscribed for it already, a method subscribed bound through `on` aside; and 178 `TypeError` if a marked function is under a `classmethod` or a `staticmethod`. 179 """ 180 self._events.subscribe(instance) 181 182 def unsubscribe(self, target: object) -> None: 183 """Unsubscribe `target`: a function, a bound method, or every method of an instance. 184 185 Raises `ValueError` if nothing of it is subscribed. 186 """ 187 self._events.unsubscribe(target) 188 189 def emit(self, event: Event) -> None: 190 """Hand `event` to every handler of its type or a base type that selects it and is due to run. All have returned 191 when this returns. A handler may itself emit an event. 192 193 An event made without a time is handed out as a copy with the current time, and the one passed in keeps none, 194 so it can be emitted again. Raises `ValueError` for one when no game is being played. 195 """ 196 self._events.emit(event) 197 198 @property 199 def handler_timings(self) -> Mapping[type[Event], Mapping[str, HandlerTiming]]: 200 """How long each handler has taken, by event type and handler name, on events emitted before the game too. 201 202 A handler is named by its module and qualified name, so every instance of a class counts under one name. Raises 203 `RuntimeError` unless the api was made with `time_handlers=True`. 204 """ 205 return self._events.timings 206 207 @property 208 def extensions(self) -> E: 209 """The bot's own object holding its extensions, built by what the api was given as `extensions`, or `None` for 210 an api made without. 211 212 NachOS builds it once, with this api, after reading the game's map, tables and first observation and before 213 `GameStartEvent`, so `api.map`, `api.units` and the rest answer while it is built. Every handler subscribed 214 meanwhile runs at `EventPriority.BEFORE`, before every handler of the bot's of its event and of the turn's 215 events handed out with it, or at `EventPriority.AFTER`, after every one, in the order they subscribed; one 216 subscribed at another priority raises `ValueError`. So what an extension works out before the bot is up to date 217 when the bot's handlers read it, an order a bot's handler gives a unit an extension ordered before it goes out 218 last and stands, and an extension working after the bot sees every order the bot gave in the turn. A handler an 219 extension subscribes later is subscribed as the bot's are. 220 221 Raises `NotPlayingError` before the game starts, and `RuntimeError` while the extensions are being built, or 222 once building them raised. 223 """ 224 extensions = self._extensions 225 if extensions is _NOT_BUILT: 226 self._current_game() 227 raise RuntimeError( 228 "the extensions are not built: an extension is handed the others it needs in its constructor" 229 ) 230 # Built by what `extensions` was, typed as building an `E`; `cast` would cost a call on every read. 231 built: E = extensions # pyright: ignore[reportAssignmentType] 232 return built 233 234 def _current_game(self) -> _Game: 235 """The game being played, or the one that was.""" 236 if self._game is None: 237 raise NotPlayingError("no game has been joined") 238 return self._game 239 240 def _check_has_not_played(self) -> None: 241 """Raise `RuntimeError` if this api has started its game.""" 242 if self._game is not None: 243 raise RuntimeError("this api has played its game; make a new Api to play another") 244 245 @property 246 def client(self) -> Client: 247 """The client the game is played on.""" 248 return self._current_game().client 249 250 @property 251 def map(self) -> GameMap: 252 """The map the game is played on.""" 253 return self._current_game().game_map 254 255 @property 256 def expansions(self) -> tuple[Expansion, ...]: 257 """Every place on the map to build a townhall, as the game began, by pathing distance from this player's start, 258 nearest first: its own start, then its natural. Those no path reaches come last, sorted by increasing 259 straight-line distance from this player's start. Each start location is a `StartLocation`, this player's 260 `player.start_location` and the enemy's `enemy.start_location`.""" 261 return self._current_game().expansions 262 263 @property 264 def data(self) -> GameData: 265 """The game's data tables, as they were before any upgrade.""" 266 return self._current_game().game_data 267 268 @property 269 def step(self) -> int: 270 """The step of the last observation.""" 271 return self._current_game().step 272 273 @property 274 def time(self) -> GameTime: 275 """The time of the last observation: `step` as a `GameTime`.""" 276 return self._current_game().time 277 278 @property 279 def result(self) -> Result | None: 280 """How the game ended for this player, or `None` while it is being played.""" 281 return self._current_game().result 282 283 @property 284 def orders(self) -> OrderBook: 285 """This player's orders for the turn. 286 287 Orders are sent in one request after the turn's last handler returns. A turn that orders nothing sends nothing. 288 """ 289 return self._current_game().orders 290 291 @property 292 def units(self) -> Units[Unit[Any]]: 293 """Every unit in the last observation, including remembered structures out of sight and hidden units. In a 294 replay played back with the fog off, those the observation would have listed with the fog on.""" 295 return self._current_game().tracker.unit_tracker.present 296 297 @property 298 def all_units(self) -> Units[Unit[Any]]: 299 """Every unit of a replay played back with the fog off, as the game lists it then: those of `units`, under the 300 same ids, and those this player did not see. Each reads as visible, in full, but one undetected in this 301 player's sight, whose health and the like the game reports as 0 (in game): it reads as last reported in full. 302 303 Raises `FogOnError` in a game, and in a replay played back with the fog on. 304 """ 305 if (whole_game_tracker := self._current_game().whole_game_tracker) is None: 306 raise FogOnError("the fog is on, so the game reports only what this player sees") 307 return whole_game_tracker.unit_tracker.present 308 309 @property 310 def known_units(self) -> Units[Unit[Any]]: 311 """Every unit not known to be dead: those in the last observation first, then those it left out.""" 312 return self._current_game().tracker.unit_tracker.known 313 314 @property 315 def score(self) -> Score: 316 """The score the game keeps for this player.""" 317 return self._current_game().state.score 318 319 @property 320 def resources(self) -> Resources: 321 """The minerals and vespene this player has to spend.""" 322 return self._current_game().state.resources 323 324 @property 325 def supply(self) -> Supply: 326 """The supply this player's units take and its structures and units provide.""" 327 return self._current_game().state.supply 328 329 @property 330 def ui_unit_counts(self) -> UiUnitCounts: 331 """The game interface's counts of this player's idle workers, army units and warp gates.""" 332 return self._current_game().state.ui_unit_counts 333 334 @property 335 def upgrades(self) -> frozenset[UpgradeId]: 336 """Every upgrade this player has finished. Raises `UncuratedIdError` if one is one the curated ids leave out.""" 337 return self._current_game().state.upgrades 338 339 @overload 340 def in_production( 341 self, unit_type: type[UnitType.AnyType], /, *unit_types: type[UnitType.AnyType] 342 ) -> tuple[InProduction, ...]: ... 343 344 @overload 345 def in_production(self, type_ids: UnitTypeId | Iterable[UnitTypeId], /) -> tuple[InProduction, ...]: ... 346 347 def in_production( 348 self, types: type[UnitType.AnyType] | UnitTypeId | Iterable[UnitTypeId], /, *unit_types: type[UnitType.AnyType] 349 ) -> tuple[InProduction, ...]: 350 """The units of the given types this player has started making or paid for, in the last observation. 351 352 There is one for each unit: a train a structure shows, queued ones included; an egg or a cocoon becoming one; a 353 structure going up, a structure morphing into one, a unit warping in; and a build a worker has been sent to 354 make, or an add-on its host has been ordered to build, until the structure stands. A reactor's two marines are 355 two. The turn's orders are not among them; they are in `api.orders.issued_to`. Takes the types as 356 `Units.of_type` does. 357 """ 358 wanted = frozenset((types,)) if isinstance(types, UnitTypeId) else _type_ids_of(types, unit_types) 359 return self._current_game().state.production.of_types(wanted) 360 361 @property 362 def researches(self) -> Mapping[UpgradeId, Research]: 363 """Each research this player has running or queued in the last observation, by upgrade, in the order the 364 observation lists the structures and each its orders. A finished one is in `upgrades`.""" 365 return self._current_game().state.production.researches 366 367 @property 368 def action_failures(self) -> tuple[ActionFailure, ...]: 369 """The orders the game refused when the last turn's were sent, one for each unit a refused command named, then 370 those it accepted earlier and gave up on since the observation before. 371 372 Raises `UncuratedIdError` if one the game gave up on names an ability the curated ids leave out. 373 """ 374 game = self._current_game() 375 return game.orders._refusals + game.state.action_failures 376 377 @property 378 def player(self) -> Player: 379 """This player: its id, its race and the one it asked for, its name, and its `start_location`.""" 380 return self._current_game().player 381 382 @property 383 def enemy(self) -> Enemy: 384 """The other player, and what is known of it. Raises `NoEnemyError` in a game with no other player, such as a 385 mini-game. 386 387 `api.enemy.upgrades` holds the upgrade levels enemy units have shown and those the bot or an extension added 388 with `assume_upgrades`, as `Enemy.upgrades` says. Everything an upgrade changes on an enemy unit, 389 `Unit.weapons` and `Unit.speed` among them, counts them. `api.enemy.start_location` is where it started, as 390 `Enemy.start_location` says. 391 """ 392 if (enemy := self._current_game().enemy) is None: 393 raise NoEnemyError("this game has no other player") 394 return enemy 395 396 @property 397 def vision(self) -> Vision: 398 """What this player sees: where it can see now, where it has seen at any point in the game, and when it last 399 saw each tile, as `Vision` says.""" 400 return self._current_game().vision 401 402 @property 403 def placement(self) -> PlacementGrids: 404 """Where a structure may stand: on the map whatever happens in the game, and now as far as this player knows; 405 and the ground this player's ordered builds are to stand on, and what it has reserved.""" 406 return self._current_game().placement 407 408 @property 409 def debug(self) -> DebugCommands: 410 """Drawing on the game's screen, cheats and debug commands, sent after each turn's orders.""" 411 return self._current_game().debug 412 413 @property 414 def camera(self) -> Camera: 415 """This player's camera: where it is centered, and moving it.""" 416 return self._current_game().camera 417 418 @property 419 def pathing(self) -> Pathing: 420 """How units get around the map as it stands now: the turn's grid of where ground units walk, paths over it, and 421 distances the game answers.""" 422 return self._current_game().pathing 423 424 @property 425 def creep(self) -> Grid[bool]: 426 """Where creep covers the ground, over the playable area.""" 427 return self._current_game().state.creep 428 429 @property 430 def effects(self) -> tuple[Effect, ...]: 431 """Every effect this player can see. Raises `UncuratedIdError` if one is an effect the curated ids leave out.""" 432 return self._current_game().state.effects 433 434 def chat(self, text: str, *, team_only: bool = False) -> None: 435 """Send `text` to every player, or to this player's team only if `team_only`, with the turn's orders: after 436 them and the camera's move, each message of the turn in the order given. The game drops chat that comes too 437 fast without a word, once some 500 bytes have gone out in a row, counting by the clock rather than in steps 438 (in game). 439 440 Raises `ValueError` for an empty text, and for one of 1040 bytes or more in UTF-8, which would kill the game 441 client (in game). 442 """ 443 game = self._current_game() 444 if not text: 445 raise ValueError("a chat message cannot be empty") 446 if (size := len(text.encode())) > _MOST_CHAT_BYTES: 447 raise ValueError( 448 f"a chat message of {_MOST_CHAT_BYTES + 1} bytes or more kills the game client, and this one is {size}" 449 ) 450 game.queue_chat(text, team_only=team_only) 451 452 def leave_game(self) -> None: 453 """Leave the game, conceding it, once the turn's handlers have run and its orders, chat and debug commands have 454 gone out. `play` then returns `Result.DEFEAT`, as the protocol counts leaving a surrender: the game reports 455 nothing to a client that has left, even when both players leave in the same step (in game). Leaving a replay 456 stops its playback, and `play` returns `Result.UNDECIDED`. Asking again in the turn changes nothing. 457 """ 458 self._current_game().leaving = True 459 460 def play( 461 self, 462 client: Client, 463 *, 464 steps_per_turn: int = 1, 465 realtime: bool = False, 466 time_limit: GameTime | None = None, 467 enemy_ladder_id: str | None = None, 468 save_replay_to: Path | str | None = None, 469 ) -> Result: 470 """Play the game `client` has joined to its end, a turn every `steps_per_turn` steps, and return how it ended 471 for this player. 472 473 `run_local`, `run_ladder`, `run_replay` and `run_recording` call this. Call it directly to play a game connected 474 some other way. `time_limit` calls a game that reaches it a tie, and stops a replay at it `Result.UNDECIDED`; 475 one that is not a `GameTime` raises `TypeError` before the game starts. `realtime` must say how the game was 476 created: a stepped game played in real time never moves, which raises `ValueError` on the first turn. 477 `enemy_ladder_id` is the ladder's id for the opponent, which `enemy.ladder_id` reads. 478 479 `save_replay_to` is a file to save the game's replay to, however the game ends: at its end, at the time 480 limit, before leaving it for `leave_game`, and after a handler raises. A save that fails is logged, never 481 raised. Before the game starts, a `save_replay_to` in no folder that exists raises `FileNotFoundError`, and one 482 that names a folder `IsADirectoryError`. 483 484 An api plays one game. Once it has started one, this and every runner raise `RuntimeError` before anything 485 else. A call that raised before the game started, on its arguments or while reading the game's map, tables and 486 first observation, leaves the api to play. 487 """ 488 self._check_has_not_played() 489 if time_limit is not None: 490 check_game_time(time_limit, "time_limit") 491 replay_path = None if save_replay_to is None else Path(save_replay_to) 492 if replay_path is not None: 493 check_file_to_write(replay_path, "save the replay into") 494 game = _Game.start(client, enemy_ladder_id=enemy_ladder_id) 495 self._game = game 496 if self._extensions_builder is None: 497 self._extensions = None 498 logger.info("Playing {} at {} steps a turn", game.game_map.name, steps_per_turn) 499 events = self._events 500 events._set_time(game.time) 501 try: 502 result = self._play_saving_the_replay( 503 game, 504 steps_per_turn=steps_per_turn, 505 realtime=realtime, 506 time_limit=time_limit, 507 save_replay_to=replay_path, 508 ) 509 if game.leaving and client.in_game: 510 logger.info("Leaving the game") 511 client.leave_game() 512 events.emit(GameEndEvent(result, time=game.time)) 513 finally: 514 # Ended, or ended by a handler that raised: no game is being played to give an event its time. 515 events._set_time(None) 516 return result 517 518 def _play_saving_the_replay( 519 self, 520 game: _Game, 521 *, 522 steps_per_turn: int, 523 realtime: bool, 524 time_limit: GameTime | None, 525 save_replay_to: Path | None, 526 ) -> Result: 527 """Build the extensions, start `game` and take its turns until it ends, or the bot asks to leave it, and return 528 how it ended. Then, however the turns ended, save its replay to `save_replay_to` if given, while the client is 529 still in the game.""" 530 try: 531 if (build_extensions := self._extensions_builder) is not None: 532 with self._events._subscribing_extensions(): 533 self._extensions = build_extensions(self) 534 self._events.emit(GameStartEvent(time=game.time)) 535 return self._play_turns(game, steps_per_turn=steps_per_turn, realtime=realtime, time_limit=time_limit) 536 finally: 537 if save_replay_to is not None: 538 _save_replay(game.client, save_replay_to) 539 540 def _play_turns(self, game: _Game, *, steps_per_turn: int, realtime: bool, time_limit: GameTime | None) -> Result: 541 """Take the turns of `game` until it ends or the bot asks to leave it, and return how it ended.""" 542 events, client = self._events, game.client 543 while (result := game.outcome()) is None: 544 if time_limit is not None and game.time >= time_limit: 545 if client.in_replay: 546 logger.info("Stopping the replay at its {:.0f} second limit", time_limit.seconds) 547 return game.finish(Result.UNDECIDED) 548 logger.info("Calling the game a tie at its {:.0f} second limit", time_limit.seconds) 549 return game.finish(Result.TIE) 550 551 events.emit(TurnStartEvent(time=game.time)) 552 events._hand_out([*game.report(events), TurnEvent(time=game.time)]) 553 try: 554 # The turn's handlers have all returned, so what they asked for goes out now. 555 game.send_turn() 556 if game.leaving: 557 # Left once the replay is saved, which the game gives no client that has left (in game). 558 return game.finish(Result.UNDECIDED if client.in_replay else Result.DEFEAT) 559 if not realtime: 560 client.step(steps_per_turn) 561 except GameEndedError: 562 # The game ended while the handlers ran, as a realtime game can. Its last observation says how. 563 game.observe() 564 else: 565 if realtime: 566 # A realtime game runs on its own, so each turn asks for the step it wants. 567 _observe_realtime(game, game.step + steps_per_turn) 568 else: 569 game.observe() 570 events._set_time(game.time) 571 return result
Everything a bot talks to. It is built before there is a game.
Construct one where the rest of your bot can reach it, module scope included, and pass it to run_local or
run_ladder for its game. An api plays one game: a program that plays several makes an api for each. Never
subclass it: your own helpers belong in your own modules, as ordinary functions.
Time is counted in steps: one step is one game loop, and 22.4 make a second. A moment or a length of game time is a
GameTime, but for the two counts of steps, step and steps_per_turn. The bot takes a turn every
steps_per_turn steps, which the game is played with. Each turn hands its handlers a TurnStartEvent, then
the events its observation reports, in the order docs/events.md gives, then a TurnEvent.
Anything of the game raises NotPlayingError until the game starts. After it ends, the api keeps answering from
it.
E is the type of extensions: an Api() is an Api[None], and one made with extensions=Extensions an
Api[Extensions]. A function that takes any api takes an Api[object].
97 def __init__( 98 self, 99 *, 100 extensions: Callable[[Any], object] | None = None, 101 time_handlers: bool = False, 102 ) -> None: 103 """Build the bot's extensions with `extensions` once the game starts, as `Api.extensions` says, and time every 104 handler call, read as `handler_timings`, if `time_handlers`. This connects to nothing. 105 106 `extensions` builds what `Api.extensions` reads, the bot's own object holding its extensions, from this api: 107 its class, whose constructor takes the api and builds each extension. 108 """ 109 self._extensions_builder = extensions 110 self._extensions: object = _NOT_BUILT 111 self._events = _EventBus(time_handlers=time_handlers) 112 # Everything that comes with the game, from the moment it starts. 113 self._game: _Game | None = None
Build the bot's extensions with extensions once the game starts, as Api.extensions says, and time every
handler call, read as handler_timings, if time_handlers. This connects to nothing.
extensions builds what Api.extensions reads, the bot's own object holding its extensions, from this api:
its class, whose constructor takes the api and builds each extension.
142 def on(self, event_type: type[Event] | EventFilter[Any], /, **options: Any) -> Any: 143 """Subscribe the decorated function to `event_type`, or mark the decorated method for `subscribe`. This works 144 before any game, so handlers can subscribe as their modules are imported. 145 146 `event_type` is an event type, whose events and its subclasses' the handler is handed, or a filter from `only` 147 or `of`. `where` on the `EventSubscriber` it returns narrows further. A type that has `of` is subscribed to only 148 through it, and a type checker refuses it bare. A handler of `Event` is handed every event, which makes NachOS 149 produce every type of event it otherwise would not, including comparing every unit with the observation 150 before; a parameterized event comes only with the parameters other handlers asked for. 151 152 A method is marked, and subscribed for each instance passed to `subscribe`: a function defined in a class body 153 that takes at least two positional arguments without defaults, the instance and the event, or wraps one through 154 `functools.wraps`. Any other function is subscribed at once, wherever it is defined, a static method taking the 155 event alone included, and so is a method already bound to its instance. Either stays subscribed until it is 156 passed to `unsubscribe`, held strongly, so it runs whether or not anything else keeps it alive. 157 158 `priority` orders the handler among the event's handlers, highest first and then in subscription order; and 159 among a turn's: every handler of one priority is handed each event of the turn it selects, in the turn's order, 160 before any handler of the next. `EventPriority.BEFORE` and `EventPriority.AFTER` are for the handlers 161 subscribed while NachOS builds the extensions, and those take no other, as `Api.extensions` says: either misuse 162 raises `ValueError`. The handler runs on every event unless held back: `min_interval` waits until that long has 163 passed since it last ran, `at_time` runs it once, on the first event at or after that time, and `once` on the 164 first event. `min_interval` with either of the others, or not above zero, raises `ValueError`, and either of the 165 two not a `GameTime`, `TypeError`. These count only the events selected, those emitted before the game included. 166 An exception it raises ends the game, unless `catch_exceptions`, which logs it and goes on. 167 168 The handler must take an event of `event_type`, which a type checker checks. One decorated for several event 169 types takes an `Event`. 170 """ 171 return self._events.on(event_type, **options)
Subscribe the decorated function to event_type, or mark the decorated method for subscribe. This works
before any game, so handlers can subscribe as their modules are imported.
event_type is an event type, whose events and its subclasses' the handler is handed, or a filter from only
or of. where on the EventSubscriber it returns narrows further. A type that has of is subscribed to only
through it, and a type checker refuses it bare. A handler of Event is handed every event, which makes NachOS
produce every type of event it otherwise would not, including comparing every unit with the observation
before; a parameterized event comes only with the parameters other handlers asked for.
A method is marked, and subscribed for each instance passed to subscribe: a function defined in a class body
that takes at least two positional arguments without defaults, the instance and the event, or wraps one through
functools.wraps. Any other function is subscribed at once, wherever it is defined, a static method taking the
event alone included, and so is a method already bound to its instance. Either stays subscribed until it is
passed to unsubscribe, held strongly, so it runs whether or not anything else keeps it alive.
priority orders the handler among the event's handlers, highest first and then in subscription order; and
among a turn's: every handler of one priority is handed each event of the turn it selects, in the turn's order,
before any handler of the next. EventPriority.BEFORE and EventPriority.AFTER are for the handlers
subscribed while NachOS builds the extensions, and those take no other, as Api.extensions says: either misuse
raises ValueError. The handler runs on every event unless held back: min_interval waits until that long has
passed since it last ran, at_time runs it once, on the first event at or after that time, and once on the
first event. min_interval with either of the others, or not above zero, raises ValueError, and either of the
two not a GameTime, TypeError. These count only the events selected, those emitted before the game included.
An exception it raises ends the game, unless catch_exceptions, which logs it and goes on.
The handler must take an event of event_type, which a type checker checks. One decorated for several event
types takes an Event.
173 def subscribe(self, instance: object) -> None: 174 """Subscribe every method of `instance` marked with `on`, until `instance` is passed to `unsubscribe`. 175 176 An unmarked override leaves the method it overrides unsubscribed. Raises `ValueError` if `instance` has no 177 marked method, or one of them is subscribed for it already, a method subscribed bound through `on` aside; and 178 `TypeError` if a marked function is under a `classmethod` or a `staticmethod`. 179 """ 180 self._events.subscribe(instance)
Subscribe every method of instance marked with on, until instance is passed to unsubscribe.
An unmarked override leaves the method it overrides unsubscribed. Raises ValueError if instance has no
marked method, or one of them is subscribed for it already, a method subscribed bound through on aside; and
TypeError if a marked function is under a classmethod or a staticmethod.
182 def unsubscribe(self, target: object) -> None: 183 """Unsubscribe `target`: a function, a bound method, or every method of an instance. 184 185 Raises `ValueError` if nothing of it is subscribed. 186 """ 187 self._events.unsubscribe(target)
Unsubscribe target: a function, a bound method, or every method of an instance.
Raises ValueError if nothing of it is subscribed.
189 def emit(self, event: Event) -> None: 190 """Hand `event` to every handler of its type or a base type that selects it and is due to run. All have returned 191 when this returns. A handler may itself emit an event. 192 193 An event made without a time is handed out as a copy with the current time, and the one passed in keeps none, 194 so it can be emitted again. Raises `ValueError` for one when no game is being played. 195 """ 196 self._events.emit(event)
Hand event to every handler of its type or a base type that selects it and is due to run. All have returned
when this returns. A handler may itself emit an event.
An event made without a time is handed out as a copy with the current time, and the one passed in keeps none,
so it can be emitted again. Raises ValueError for one when no game is being played.
198 @property 199 def handler_timings(self) -> Mapping[type[Event], Mapping[str, HandlerTiming]]: 200 """How long each handler has taken, by event type and handler name, on events emitted before the game too. 201 202 A handler is named by its module and qualified name, so every instance of a class counts under one name. Raises 203 `RuntimeError` unless the api was made with `time_handlers=True`. 204 """ 205 return self._events.timings
How long each handler has taken, by event type and handler name, on events emitted before the game too.
A handler is named by its module and qualified name, so every instance of a class counts under one name. Raises
RuntimeError unless the api was made with time_handlers=True.
207 @property 208 def extensions(self) -> E: 209 """The bot's own object holding its extensions, built by what the api was given as `extensions`, or `None` for 210 an api made without. 211 212 NachOS builds it once, with this api, after reading the game's map, tables and first observation and before 213 `GameStartEvent`, so `api.map`, `api.units` and the rest answer while it is built. Every handler subscribed 214 meanwhile runs at `EventPriority.BEFORE`, before every handler of the bot's of its event and of the turn's 215 events handed out with it, or at `EventPriority.AFTER`, after every one, in the order they subscribed; one 216 subscribed at another priority raises `ValueError`. So what an extension works out before the bot is up to date 217 when the bot's handlers read it, an order a bot's handler gives a unit an extension ordered before it goes out 218 last and stands, and an extension working after the bot sees every order the bot gave in the turn. A handler an 219 extension subscribes later is subscribed as the bot's are. 220 221 Raises `NotPlayingError` before the game starts, and `RuntimeError` while the extensions are being built, or 222 once building them raised. 223 """ 224 extensions = self._extensions 225 if extensions is _NOT_BUILT: 226 self._current_game() 227 raise RuntimeError( 228 "the extensions are not built: an extension is handed the others it needs in its constructor" 229 ) 230 # Built by what `extensions` was, typed as building an `E`; `cast` would cost a call on every read. 231 built: E = extensions # pyright: ignore[reportAssignmentType] 232 return built
The bot's own object holding its extensions, built by what the api was given as extensions, or None for
an api made without.
NachOS builds it once, with this api, after reading the game's map, tables and first observation and before
GameStartEvent, so api.map, api.units and the rest answer while it is built. Every handler subscribed
meanwhile runs at EventPriority.BEFORE, before every handler of the bot's of its event and of the turn's
events handed out with it, or at EventPriority.AFTER, after every one, in the order they subscribed; one
subscribed at another priority raises ValueError. So what an extension works out before the bot is up to date
when the bot's handlers read it, an order a bot's handler gives a unit an extension ordered before it goes out
last and stands, and an extension working after the bot sees every order the bot gave in the turn. A handler an
extension subscribes later is subscribed as the bot's are.
Raises NotPlayingError before the game starts, and RuntimeError while the extensions are being built, or
once building them raised.
245 @property 246 def client(self) -> Client: 247 """The client the game is played on.""" 248 return self._current_game().client
The client the game is played on.
250 @property 251 def map(self) -> GameMap: 252 """The map the game is played on.""" 253 return self._current_game().game_map
The map the game is played on.
255 @property 256 def expansions(self) -> tuple[Expansion, ...]: 257 """Every place on the map to build a townhall, as the game began, by pathing distance from this player's start, 258 nearest first: its own start, then its natural. Those no path reaches come last, sorted by increasing 259 straight-line distance from this player's start. Each start location is a `StartLocation`, this player's 260 `player.start_location` and the enemy's `enemy.start_location`.""" 261 return self._current_game().expansions
Every place on the map to build a townhall, as the game began, by pathing distance from this player's start,
nearest first: its own start, then its natural. Those no path reaches come last, sorted by increasing
straight-line distance from this player's start. Each start location is a StartLocation, this player's
player.start_location and the enemy's enemy.start_location.
263 @property 264 def data(self) -> GameData: 265 """The game's data tables, as they were before any upgrade.""" 266 return self._current_game().game_data
The game's data tables, as they were before any upgrade.
268 @property 269 def step(self) -> int: 270 """The step of the last observation.""" 271 return self._current_game().step
The step of the last observation.
278 @property 279 def result(self) -> Result | None: 280 """How the game ended for this player, or `None` while it is being played.""" 281 return self._current_game().result
How the game ended for this player, or None while it is being played.
283 @property 284 def orders(self) -> OrderBook: 285 """This player's orders for the turn. 286 287 Orders are sent in one request after the turn's last handler returns. A turn that orders nothing sends nothing. 288 """ 289 return self._current_game().orders
This player's orders for the turn.
Orders are sent in one request after the turn's last handler returns. A turn that orders nothing sends nothing.
291 @property 292 def units(self) -> Units[Unit[Any]]: 293 """Every unit in the last observation, including remembered structures out of sight and hidden units. In a 294 replay played back with the fog off, those the observation would have listed with the fog on.""" 295 return self._current_game().tracker.unit_tracker.present
Every unit in the last observation, including remembered structures out of sight and hidden units. In a replay played back with the fog off, those the observation would have listed with the fog on.
297 @property 298 def all_units(self) -> Units[Unit[Any]]: 299 """Every unit of a replay played back with the fog off, as the game lists it then: those of `units`, under the 300 same ids, and those this player did not see. Each reads as visible, in full, but one undetected in this 301 player's sight, whose health and the like the game reports as 0 (in game): it reads as last reported in full. 302 303 Raises `FogOnError` in a game, and in a replay played back with the fog on. 304 """ 305 if (whole_game_tracker := self._current_game().whole_game_tracker) is None: 306 raise FogOnError("the fog is on, so the game reports only what this player sees") 307 return whole_game_tracker.unit_tracker.present
Every unit of a replay played back with the fog off, as the game lists it then: those of units, under the
same ids, and those this player did not see. Each reads as visible, in full, but one undetected in this
player's sight, whose health and the like the game reports as 0 (in game): it reads as last reported in full.
Raises FogOnError in a game, and in a replay played back with the fog on.
309 @property 310 def known_units(self) -> Units[Unit[Any]]: 311 """Every unit not known to be dead: those in the last observation first, then those it left out.""" 312 return self._current_game().tracker.unit_tracker.known
Every unit not known to be dead: those in the last observation first, then those it left out.
314 @property 315 def score(self) -> Score: 316 """The score the game keeps for this player.""" 317 return self._current_game().state.score
The score the game keeps for this player.
319 @property 320 def resources(self) -> Resources: 321 """The minerals and vespene this player has to spend.""" 322 return self._current_game().state.resources
The minerals and vespene this player has to spend.
324 @property 325 def supply(self) -> Supply: 326 """The supply this player's units take and its structures and units provide.""" 327 return self._current_game().state.supply
The supply this player's units take and its structures and units provide.
329 @property 330 def ui_unit_counts(self) -> UiUnitCounts: 331 """The game interface's counts of this player's idle workers, army units and warp gates.""" 332 return self._current_game().state.ui_unit_counts
The game interface's counts of this player's idle workers, army units and warp gates.
334 @property 335 def upgrades(self) -> frozenset[UpgradeId]: 336 """Every upgrade this player has finished. Raises `UncuratedIdError` if one is one the curated ids leave out.""" 337 return self._current_game().state.upgrades
Every upgrade this player has finished. Raises UncuratedIdError if one is one the curated ids leave out.
347 def in_production( 348 self, types: type[UnitType.AnyType] | UnitTypeId | Iterable[UnitTypeId], /, *unit_types: type[UnitType.AnyType] 349 ) -> tuple[InProduction, ...]: 350 """The units of the given types this player has started making or paid for, in the last observation. 351 352 There is one for each unit: a train a structure shows, queued ones included; an egg or a cocoon becoming one; a 353 structure going up, a structure morphing into one, a unit warping in; and a build a worker has been sent to 354 make, or an add-on its host has been ordered to build, until the structure stands. A reactor's two marines are 355 two. The turn's orders are not among them; they are in `api.orders.issued_to`. Takes the types as 356 `Units.of_type` does. 357 """ 358 wanted = frozenset((types,)) if isinstance(types, UnitTypeId) else _type_ids_of(types, unit_types) 359 return self._current_game().state.production.of_types(wanted)
The units of the given types this player has started making or paid for, in the last observation.
There is one for each unit: a train a structure shows, queued ones included; an egg or a cocoon becoming one; a
structure going up, a structure morphing into one, a unit warping in; and a build a worker has been sent to
make, or an add-on its host has been ordered to build, until the structure stands. A reactor's two marines are
two. The turn's orders are not among them; they are in api.orders.issued_to. Takes the types as
Units.of_type does.
361 @property 362 def researches(self) -> Mapping[UpgradeId, Research]: 363 """Each research this player has running or queued in the last observation, by upgrade, in the order the 364 observation lists the structures and each its orders. A finished one is in `upgrades`.""" 365 return self._current_game().state.production.researches
Each research this player has running or queued in the last observation, by upgrade, in the order the
observation lists the structures and each its orders. A finished one is in upgrades.
367 @property 368 def action_failures(self) -> tuple[ActionFailure, ...]: 369 """The orders the game refused when the last turn's were sent, one for each unit a refused command named, then 370 those it accepted earlier and gave up on since the observation before. 371 372 Raises `UncuratedIdError` if one the game gave up on names an ability the curated ids leave out. 373 """ 374 game = self._current_game() 375 return game.orders._refusals + game.state.action_failures
The orders the game refused when the last turn's were sent, one for each unit a refused command named, then those it accepted earlier and gave up on since the observation before.
Raises UncuratedIdError if one the game gave up on names an ability the curated ids leave out.
377 @property 378 def player(self) -> Player: 379 """This player: its id, its race and the one it asked for, its name, and its `start_location`.""" 380 return self._current_game().player
This player: its id, its race and the one it asked for, its name, and its start_location.
382 @property 383 def enemy(self) -> Enemy: 384 """The other player, and what is known of it. Raises `NoEnemyError` in a game with no other player, such as a 385 mini-game. 386 387 `api.enemy.upgrades` holds the upgrade levels enemy units have shown and those the bot or an extension added 388 with `assume_upgrades`, as `Enemy.upgrades` says. Everything an upgrade changes on an enemy unit, 389 `Unit.weapons` and `Unit.speed` among them, counts them. `api.enemy.start_location` is where it started, as 390 `Enemy.start_location` says. 391 """ 392 if (enemy := self._current_game().enemy) is None: 393 raise NoEnemyError("this game has no other player") 394 return enemy
The other player, and what is known of it. Raises NoEnemyError in a game with no other player, such as a
mini-game.
api.enemy.upgrades holds the upgrade levels enemy units have shown and those the bot or an extension added
with assume_upgrades, as Enemy.upgrades says. Everything an upgrade changes on an enemy unit,
Unit.weapons and Unit.speed among them, counts them. api.enemy.start_location is where it started, as
Enemy.start_location says.
396 @property 397 def vision(self) -> Vision: 398 """What this player sees: where it can see now, where it has seen at any point in the game, and when it last 399 saw each tile, as `Vision` says.""" 400 return self._current_game().vision
What this player sees: where it can see now, where it has seen at any point in the game, and when it last
saw each tile, as Vision says.
402 @property 403 def placement(self) -> PlacementGrids: 404 """Where a structure may stand: on the map whatever happens in the game, and now as far as this player knows; 405 and the ground this player's ordered builds are to stand on, and what it has reserved.""" 406 return self._current_game().placement
Where a structure may stand: on the map whatever happens in the game, and now as far as this player knows; and the ground this player's ordered builds are to stand on, and what it has reserved.
408 @property 409 def debug(self) -> DebugCommands: 410 """Drawing on the game's screen, cheats and debug commands, sent after each turn's orders.""" 411 return self._current_game().debug
Drawing on the game's screen, cheats and debug commands, sent after each turn's orders.
413 @property 414 def camera(self) -> Camera: 415 """This player's camera: where it is centered, and moving it.""" 416 return self._current_game().camera
This player's camera: where it is centered, and moving it.
418 @property 419 def pathing(self) -> Pathing: 420 """How units get around the map as it stands now: the turn's grid of where ground units walk, paths over it, and 421 distances the game answers.""" 422 return self._current_game().pathing
How units get around the map as it stands now: the turn's grid of where ground units walk, paths over it, and distances the game answers.
424 @property 425 def creep(self) -> Grid[bool]: 426 """Where creep covers the ground, over the playable area.""" 427 return self._current_game().state.creep
Where creep covers the ground, over the playable area.
429 @property 430 def effects(self) -> tuple[Effect, ...]: 431 """Every effect this player can see. Raises `UncuratedIdError` if one is an effect the curated ids leave out.""" 432 return self._current_game().state.effects
Every effect this player can see. Raises UncuratedIdError if one is an effect the curated ids leave out.
434 def chat(self, text: str, *, team_only: bool = False) -> None: 435 """Send `text` to every player, or to this player's team only if `team_only`, with the turn's orders: after 436 them and the camera's move, each message of the turn in the order given. The game drops chat that comes too 437 fast without a word, once some 500 bytes have gone out in a row, counting by the clock rather than in steps 438 (in game). 439 440 Raises `ValueError` for an empty text, and for one of 1040 bytes or more in UTF-8, which would kill the game 441 client (in game). 442 """ 443 game = self._current_game() 444 if not text: 445 raise ValueError("a chat message cannot be empty") 446 if (size := len(text.encode())) > _MOST_CHAT_BYTES: 447 raise ValueError( 448 f"a chat message of {_MOST_CHAT_BYTES + 1} bytes or more kills the game client, and this one is {size}" 449 ) 450 game.queue_chat(text, team_only=team_only)
Send text to every player, or to this player's team only if team_only, with the turn's orders: after
them and the camera's move, each message of the turn in the order given. The game drops chat that comes too
fast without a word, once some 500 bytes have gone out in a row, counting by the clock rather than in steps
(in game).
Raises ValueError for an empty text, and for one of 1040 bytes or more in UTF-8, which would kill the game
client (in game).
452 def leave_game(self) -> None: 453 """Leave the game, conceding it, once the turn's handlers have run and its orders, chat and debug commands have 454 gone out. `play` then returns `Result.DEFEAT`, as the protocol counts leaving a surrender: the game reports 455 nothing to a client that has left, even when both players leave in the same step (in game). Leaving a replay 456 stops its playback, and `play` returns `Result.UNDECIDED`. Asking again in the turn changes nothing. 457 """ 458 self._current_game().leaving = True
Leave the game, conceding it, once the turn's handlers have run and its orders, chat and debug commands have
gone out. play then returns Result.DEFEAT, as the protocol counts leaving a surrender: the game reports
nothing to a client that has left, even when both players leave in the same step (in game). Leaving a replay
stops its playback, and play returns Result.UNDECIDED. Asking again in the turn changes nothing.
460 def play( 461 self, 462 client: Client, 463 *, 464 steps_per_turn: int = 1, 465 realtime: bool = False, 466 time_limit: GameTime | None = None, 467 enemy_ladder_id: str | None = None, 468 save_replay_to: Path | str | None = None, 469 ) -> Result: 470 """Play the game `client` has joined to its end, a turn every `steps_per_turn` steps, and return how it ended 471 for this player. 472 473 `run_local`, `run_ladder`, `run_replay` and `run_recording` call this. Call it directly to play a game connected 474 some other way. `time_limit` calls a game that reaches it a tie, and stops a replay at it `Result.UNDECIDED`; 475 one that is not a `GameTime` raises `TypeError` before the game starts. `realtime` must say how the game was 476 created: a stepped game played in real time never moves, which raises `ValueError` on the first turn. 477 `enemy_ladder_id` is the ladder's id for the opponent, which `enemy.ladder_id` reads. 478 479 `save_replay_to` is a file to save the game's replay to, however the game ends: at its end, at the time 480 limit, before leaving it for `leave_game`, and after a handler raises. A save that fails is logged, never 481 raised. Before the game starts, a `save_replay_to` in no folder that exists raises `FileNotFoundError`, and one 482 that names a folder `IsADirectoryError`. 483 484 An api plays one game. Once it has started one, this and every runner raise `RuntimeError` before anything 485 else. A call that raised before the game started, on its arguments or while reading the game's map, tables and 486 first observation, leaves the api to play. 487 """ 488 self._check_has_not_played() 489 if time_limit is not None: 490 check_game_time(time_limit, "time_limit") 491 replay_path = None if save_replay_to is None else Path(save_replay_to) 492 if replay_path is not None: 493 check_file_to_write(replay_path, "save the replay into") 494 game = _Game.start(client, enemy_ladder_id=enemy_ladder_id) 495 self._game = game 496 if self._extensions_builder is None: 497 self._extensions = None 498 logger.info("Playing {} at {} steps a turn", game.game_map.name, steps_per_turn) 499 events = self._events 500 events._set_time(game.time) 501 try: 502 result = self._play_saving_the_replay( 503 game, 504 steps_per_turn=steps_per_turn, 505 realtime=realtime, 506 time_limit=time_limit, 507 save_replay_to=replay_path, 508 ) 509 if game.leaving and client.in_game: 510 logger.info("Leaving the game") 511 client.leave_game() 512 events.emit(GameEndEvent(result, time=game.time)) 513 finally: 514 # Ended, or ended by a handler that raised: no game is being played to give an event its time. 515 events._set_time(None) 516 return result
Play the game client has joined to its end, a turn every steps_per_turn steps, and return how it ended
for this player.
run_local, run_ladder, run_replay and run_recording call this. Call it directly to play a game connected
some other way. time_limit calls a game that reaches it a tie, and stops a replay at it Result.UNDECIDED;
one that is not a GameTime raises TypeError before the game starts. realtime must say how the game was
created: a stepped game played in real time never moves, which raises ValueError on the first turn.
enemy_ladder_id is the ladder's id for the opponent, which enemy.ladder_id reads.
save_replay_to is a file to save the game's replay to, however the game ends: at its end, at the time
limit, before leaving it for leave_game, and after a handler raises. A save that fails is logged, never
raised. Before the game starts, a save_replay_to in no folder that exists raises FileNotFoundError, and one
that names a folder IsADirectoryError.
An api plays one game. Once it has started one, this and every runner raise RuntimeError before anything
else. A call that raised before the game started, on its arguments or while reading the game's map, tables and
first observation, leaves the api to play.
16class BuffId(IdEnum): 17 """Buff ids used in multiplayer games.""" 18 19 ACCELERATION_ZONE = RawBuffId.AccelerationZoneTemporalField 20 ACCELERATION_ZONE_FLYING = RawBuffId.AccelerationZoneFlyingTemporalField 21 BANSHEE_CLOAK = RawBuffId.BansheeCloak 22 # From a plain geyser, under a game id for each race's worker; none comes from a rich one. 23 CARRYING_GAS = auto() 24 CARRYING_MINERALS = RawBuffId.CarryMineralFieldMinerals 25 CARRYING_MINERALS_RICH = RawBuffId.CarryHighYieldMineralFieldMinerals 26 CYCLONE_LOCKED_ON = RawBuffId.LockOn 27 GHOST_CLOAK = RawBuffId.GhostCloak 28 GHOST_EMP_DECLOAK = RawBuffId.EMPDecloak 29 GHOST_HOLD_FIRE = RawBuffId.GhostHoldFireB 30 GHOST_SNIPE = RawBuffId.ChannelSnipeCombat # on the ghost, while it channels 31 HIGH_TEMPLAR_STORM = RawBuffId.PsiStorm 32 HYDRALISK_LUNGE = RawBuffId.HydraliskFrenzy 33 IMMORTAL_BARRIER = RawBuffId.TakenDamage 34 INFESTOR_FUNGAL_GROWTH = RawBuffId.FungalGrowth 35 INFESTOR_MICROBIAL_SHROUD = RawBuffId.AmorphousArmorcloud 36 INFESTOR_NEURAL_PARASITE = RawBuffId.NeuralParasite 37 INHIBITOR_ZONE = RawBuffId.InhibitorZoneTemporalField 38 INHIBITOR_ZONE_FLYING = RawBuffId.InhibitorZoneFlyingTemporalField 39 LURKER_HOLD_FIRE = RawBuffId.LurkerHoldFireB 40 MARAUDER_CONCUSSIVE_SHELLS_SLOW = RawBuffId.Slow 41 MARAUDER_STIMMED = RawBuffId.StimpackMarauder 42 MARINE_STIMMED = RawBuffId.Stimpack 43 MEDIVAC_BOOST = RawBuffId.MedivacSpeedBoost 44 MOTHERSHIP_CLOAK_FIELD = RawBuffId.CloakField # on the mothership 45 MOTHERSHIP_CLOAK_FIELD_CLOAKED = RawBuffId.CloakFieldEffect # on each unit the field cloaks 46 MOTHERSHIP_TIME_WARP = RawBuffId.TemporalField 47 NEXUS_CHRONO_BOOST = RawBuffId.ChronoBoostEnergyCost 48 ORACLE_PULSAR_BEAM = RawBuffId.OracleWeapon 49 ORACLE_REVELATION = RawBuffId.OracleRevelation 50 ORBITAL_COMMAND_SUPPLY_DROP = RawBuffId.SupplyDrop 51 OVERSEER_CONTAMINATED = RawBuffId.Contaminated 52 PHOENIX_GRAVITON_BEAM = RawBuffId.GravitonBeam 53 QUEEN_INJECTED = RawBuffId.QueenSpawnLarvaTimer # counts down to the larvae, then again for a queued inject 54 QUEEN_TRANSFUSED = RawBuffId.Transfusion 55 RAVEN_ANTI_ARMOR_MISSILE = RawBuffId.RavenShredderMissileArmorReductionUISubtruct 56 RAVEN_ANTI_ARMOR_MISSILE_INCOMING = RawBuffId.RavenShredderMissileTint # on its target, until the missile lands 57 RAVEN_INTERFERENCE_MATRIX = RawBuffId.RavenScramblerMissile 58 SENTRY_GUARDIAN_SHIELD = RawBuffId.GuardianShield 59 STASIS_WARD_TRAPPED = RawBuffId.OracleStasisTrapTarget # on each unit the ward traps, never on the ward (in game) 60 VIPER_BLINDING_CLOUD = RawBuffId.BlindingCloud 61 VIPER_PARASITIC_BOMB = RawBuffId.ParasiticBomb # on its target 62 VOID_RAY_PRISMATIC_ALIGNMENT = RawBuffId.VoidRaySwarmDamageBoost 63 WARP_GATE_WARPING_IN = RawBuffId.PowerUserWarpable # on a unit warping in, until the step after it finishes 64 ZEALOT_CHARGING = RawBuffId.Charging # on the zealot 65 66 # Each race's worker carries gas under a game id of its own (in game). 67 _REMAPPED_IDS = nonmember( 68 MappingProxyType( 69 { 70 RawBuffId.CarryHarvestableVespeneGeyserGas: CARRYING_GAS, 71 RawBuffId.CarryHarvestableVespeneGeyserGasProtoss: CARRYING_GAS, 72 RawBuffId.CarryHarvestableVespeneGeyserGasZerg: CARRYING_GAS, 73 } 74 ) 75 ) 76 # Every unit of one type wears each of these for as long as it is listed, so it says nothing the type does not 77 # (in game). 78 _SKIPPED_IDS = nonmember( 79 frozenset( 80 { 81 RawBuffId.ParasiticBombUnitKU, # by `UnitTypeId.PARASITIC_BOMB_LEFT_BEHIND` 82 RawBuffId.ParasiticBombSecondaryUnitSearch, # by `UnitTypeId.PARASITIC_BOMB_LEFT_BEHIND` 83 } 84 ) 85 ) 86 """Game ids that are no member's own and that a unit's buffs and the buff events pass over."""
Buff ids used in multiplayer games.
23@final 24class Circle(Area): 25 """Every point within `radius` of a center, boundary included.""" 26 27 # Not a dataclass: `Area.center` is a property, and a field cannot override one. 28 __slots__ = ("_center", "_radius") 29 30 _center: Point 31 _radius: float 32 33 def __init__(self, center: PointLike, radius: float) -> None: 34 """A circle of `radius` around `center`.""" 35 if radius <= 0: 36 raise ValueError("a circle must have a positive radius") 37 self._center = Point(center[:2]) 38 self._radius = radius 39 40 @property 41 def center(self) -> Point: 42 """The point the circle is drawn around.""" 43 return self._center 44 45 @property 46 def radius(self) -> float: 47 """The distance from the center to the boundary.""" 48 return self._radius 49 50 @property 51 def area(self) -> float: 52 """The ground covered, in square game units.""" 53 return math.pi * self._radius**2 54 55 @property 56 def perimeter(self) -> float: 57 """The length of the boundary.""" 58 return 2 * math.pi * self._radius 59 60 def __contains__(self, point: PointLike | Tile) -> bool: 61 """Whether `point` lies in the circle, boundary included.""" 62 position = coordinates_or_tile_center(point) 63 dx = position[0] - self._center[0] 64 dy = position[1] - self._center[1] 65 return dx * dx + dy * dy <= self._radius**2 66 67 def _contains_each(self, xs: ndarray, ys: ndarray) -> ndarray: 68 """Whether each point lies in the circle, boundary included.""" 69 dx = xs - self._center[0] 70 dy = ys - self._center[1] 71 return dx * dx + dy * dy <= self._radius**2 72 73 def translated(self, offset: PointLike) -> Circle: 74 """The circle shifted by `offset`, keeping its radius. Raises `ValueError` for an offset with a height.""" 75 return Circle(self._center + checked_ground_offset(offset), self._radius) 76 77 def random_point(self, *, rng: random.Random | None = None) -> Point: 78 """A point drawn uniformly from the circle, by `rng` or the `random` module's own generator.""" 79 random_fraction = random.random if rng is None else rng.random 80 # sqrt, because a uniform radius would crowd the points toward the center. 81 distance = self._radius * math.sqrt(random_fraction()) 82 angle = 2 * math.pi * random_fraction() 83 drawn = Point((self._center[0] + distance * math.cos(angle), self._center[1] + distance * math.sin(angle))) 84 return self._stepped_inside(drawn) 85 86 def closest_point_to(self, point: PointLike) -> tuple[Point, float]: 87 """The point of the circle nearest to `point`, and the distance to it. 88 89 A point inside the circle is its own nearest point, at distance zero. For one outside, the point on the edge 90 is moved toward the center by as little as rounding needs for the circle to hold it. 91 """ 92 position = Point(point[:2]) 93 offset = position - self._center 94 distance = offset.length 95 if distance <= self._radius: 96 return position, 0.0 97 return self._stepped_inside(self._center + offset * (self._radius / distance)), distance - self._radius 98 99 def _stepped_inside(self, point: Point) -> Point: 100 """`point`, on or near the edge, moved toward the center by as little as rounding needs for the circle to hold 101 it.""" 102 # Rounding leaves about half the points worked out on the edge just outside, almost always by a step of each 103 # coordinate. 104 center_x, center_y = self._center 105 while point not in self: 106 point = Point((math.nextafter(point[0], center_x), math.nextafter(point[1], center_y))) 107 return point 108 109 def bounding_rectangle(self) -> Rectangle: 110 """The smallest rectangle containing the circle.""" 111 diameter = 2 * self._radius 112 return Rectangle(self._center[0] - self._radius, self._center[1] - self._radius, diameter, diameter) 113 114 def tiles(self) -> TileSet: 115 """Every tile whose center lies in the circle.""" 116 tiles_in_circle = self._tile_mask() 117 return TileSet._from_mask(tiles_in_circle.origin, tiles_in_circle.mask) 118 119 def _tile_mask(self, within: Rectangle | None = None) -> TileMask: 120 """The tiles whose center lies in the circle and that lie `within` a rectangle on whole tiles, if one is 121 given.""" 122 # Derived from the circle, not from its bounding rectangle: that rectangle is half-open, so it would 123 # drop a tile center sitting exactly on the circle's rightmost or topmost point. 124 center_x, center_y = self._center[0], self._center[1] 125 first_x = math.ceil(center_x - self._radius - 0.5) 126 first_y = math.ceil(center_y - self._radius - 0.5) 127 last_x = math.floor(center_x + self._radius - 0.5) 128 last_y = math.floor(center_y + self._radius - 0.5) 129 if within is not None: 130 first_x, first_y = max(first_x, int(within.x)), max(first_y, int(within.y)) 131 last_x = min(last_x, int(within.x + within.width) - 1) 132 last_y = min(last_y, int(within.y + within.height) - 1) 133 offsets_x = numpy.arange(first_x, last_x + 1) + 0.5 - center_x 134 offsets_y = numpy.arange(first_y, last_y + 1) + 0.5 - center_y 135 tiles_in_circle = offsets_x[:, None] ** 2 + offsets_y[None, :] ** 2 <= self._radius**2 136 return TileMask(Tile(first_x, first_y), tiles_in_circle) 137 138 def _overlapped_tile_mask(self) -> TileMask: 139 """Every tile whose inside the circle overlaps: those whose nearest point lies nearer the center than the 140 radius.""" 141 center_x, center_y = self._center[0], self._center[1] 142 radius = self._radius 143 first_x = math.floor(center_x - radius) 144 first_y = math.floor(center_y - radius) 145 columns = math.ceil(center_x + radius) - first_x 146 overlapped = numpy.zeros((columns, math.ceil(center_y + radius) - first_y), dtype=bool) 147 # Column by column, a run of rows: up to a radius of about 10, faster than numpy over the whole box. 148 for column in range(columns): 149 left = first_x + column 150 gap_x = max(left - center_x, center_x - left - 1, 0.0) 151 reach_squared = radius * radius - gap_x * gap_x 152 if reach_squared > 0: 153 reach = math.sqrt(reach_squared) 154 lowest_row = math.floor(center_y - reach) - first_y 155 overlapped[column, lowest_row : math.ceil(center_y + reach) - first_y] = True 156 return TileMask(Tile(first_x, first_y), overlapped) 157 158 def intersections_with(self, other: Circle) -> tuple[Point, ...]: 159 """The points where the two boundaries cross: two, one where the circles touch, none otherwise. 160 161 Concentric circles, the same circle included, report none. 162 """ 163 offset = other.center - self._center 164 distance_squared = offset[0] ** 2 + offset[1] ** 2 165 if distance_squared > (self._radius + other.radius) ** 2: 166 return () 167 if distance_squared < (self._radius - other.radius) ** 2 or distance_squared == 0: 168 return () 169 distance = math.sqrt(distance_squared) 170 along = (self._radius**2 - other.radius**2 + distance_squared) / (2 * distance) 171 midpoint = self._center + offset * (along / distance) 172 across_squared = self._radius**2 - along**2 173 if across_squared <= 0: 174 return (midpoint,) 175 across = math.sqrt(across_squared) / distance 176 perpendicular = Point((offset[1] * across, -offset[0] * across)) 177 return midpoint + perpendicular, midpoint - perpendicular 178 179 def __eq__(self, other: object) -> bool: 180 if not isinstance(other, Circle): 181 return NotImplemented 182 return self._center == other.center and self._radius == other.radius 183 184 def __hash__(self) -> int: 185 return hash((self._center, self._radius)) 186 187 def __repr__(self) -> str: 188 return f"Circle({self._center!r}, {self._radius})"
Every point within radius of a center, boundary included.
40 @property 41 def center(self) -> Point: 42 """The point the circle is drawn around.""" 43 return self._center
The point the circle is drawn around.
45 @property 46 def radius(self) -> float: 47 """The distance from the center to the boundary.""" 48 return self._radius
The distance from the center to the boundary.
50 @property 51 def area(self) -> float: 52 """The ground covered, in square game units.""" 53 return math.pi * self._radius**2
The ground covered, in square game units.
55 @property 56 def perimeter(self) -> float: 57 """The length of the boundary.""" 58 return 2 * math.pi * self._radius
The length of the boundary.
73 def translated(self, offset: PointLike) -> Circle: 74 """The circle shifted by `offset`, keeping its radius. Raises `ValueError` for an offset with a height.""" 75 return Circle(self._center + checked_ground_offset(offset), self._radius)
The circle shifted by offset, keeping its radius. Raises ValueError for an offset with a height.
77 def random_point(self, *, rng: random.Random | None = None) -> Point: 78 """A point drawn uniformly from the circle, by `rng` or the `random` module's own generator.""" 79 random_fraction = random.random if rng is None else rng.random 80 # sqrt, because a uniform radius would crowd the points toward the center. 81 distance = self._radius * math.sqrt(random_fraction()) 82 angle = 2 * math.pi * random_fraction() 83 drawn = Point((self._center[0] + distance * math.cos(angle), self._center[1] + distance * math.sin(angle))) 84 return self._stepped_inside(drawn)
A point drawn uniformly from the circle, by rng or the random module's own generator.
86 def closest_point_to(self, point: PointLike) -> tuple[Point, float]: 87 """The point of the circle nearest to `point`, and the distance to it. 88 89 A point inside the circle is its own nearest point, at distance zero. For one outside, the point on the edge 90 is moved toward the center by as little as rounding needs for the circle to hold it. 91 """ 92 position = Point(point[:2]) 93 offset = position - self._center 94 distance = offset.length 95 if distance <= self._radius: 96 return position, 0.0 97 return self._stepped_inside(self._center + offset * (self._radius / distance)), distance - self._radius
The point of the circle nearest to point, and the distance to it.
A point inside the circle is its own nearest point, at distance zero. For one outside, the point on the edge is moved toward the center by as little as rounding needs for the circle to hold it.
109 def bounding_rectangle(self) -> Rectangle: 110 """The smallest rectangle containing the circle.""" 111 diameter = 2 * self._radius 112 return Rectangle(self._center[0] - self._radius, self._center[1] - self._radius, diameter, diameter)
The smallest rectangle containing the circle.
114 def tiles(self) -> TileSet: 115 """Every tile whose center lies in the circle.""" 116 tiles_in_circle = self._tile_mask() 117 return TileSet._from_mask(tiles_in_circle.origin, tiles_in_circle.mask)
Every tile whose center lies in the circle.
158 def intersections_with(self, other: Circle) -> tuple[Point, ...]: 159 """The points where the two boundaries cross: two, one where the circles touch, none otherwise. 160 161 Concentric circles, the same circle included, report none. 162 """ 163 offset = other.center - self._center 164 distance_squared = offset[0] ** 2 + offset[1] ** 2 165 if distance_squared > (self._radius + other.radius) ** 2: 166 return () 167 if distance_squared < (self._radius - other.radius) ** 2 or distance_squared == 0: 168 return () 169 distance = math.sqrt(distance_squared) 170 along = (self._radius**2 - other.radius**2 + distance_squared) / (2 * distance) 171 midpoint = self._center + offset * (along / distance) 172 across_squared = self._radius**2 - along**2 173 if across_squared <= 0: 174 return (midpoint,) 175 across = math.sqrt(across_squared) / distance 176 perpendicular = Point((offset[1] * across, -offset[0] * across)) 177 return midpoint + perpendicular, midpoint - perpendicular
The points where the two boundaries cross: two, one where the circles touch, none otherwise.
Concentric circles, the same circle included, report none.
102@dataclass(frozen=True, slots=True) 103class Computer: 104 """The built-in computer opponent. It needs no client.""" 105 106 race: Race = Race.RANDOM 107 difficulty: Difficulty = Difficulty.VERY_HARD 108 build: AIBuild = AIBuild.RANDOM 109 name: str | None = None
The built-in computer opponent. It needs no client.
13@final 14@dataclass(frozen=True, slots=True) 15class Cost: 16 """The cost of making something: minerals, vespene, supply and the time it takes. 17 18 Not a `Resources`, which is an amount a player holds, earns or spends. Supply is room under the cap, so compare 19 `cost.resources` against `api.resources` and `cost.supply` against `api.supply.left`. Costs added up add their 20 times too, which makes the production time they take one after another, not how long they take side by side. 21 """ 22 23 minerals: float 24 """Minerals.""" 25 vespene: float 26 """Vespene.""" 27 supply: float = 0.0 28 """Supply taken, or given back when negative: -1 for a spawning pool, which uses up a drone.""" 29 time: GameTime = GameTime.ZERO 30 """The time production takes, at the normal rate: a whole number of steps from the tables, fractional once scaled 31 or divided; zero for an order that makes nothing, for a switch that costs nothing, such as a siege, and where the 32 tables give none, as for an interceptor.""" 33 34 @property 35 def resources(self) -> Resources: 36 """The minerals and vespene, to compare against what the player has.""" 37 return Resources(self.minerals, self.vespene) 38 39 @property 40 def is_free(self) -> bool: 41 """Whether it takes no minerals, vespene or supply, whatever its time: a siege, a MULE's calldown.""" 42 return not (self.minerals or self.vespene or self.supply) 43 44 def __add__(self, other: Cost) -> Cost: 45 """The sum of the two costs.""" 46 return Cost( 47 self.minerals + other.minerals, 48 self.vespene + other.vespene, 49 self.supply + other.supply, 50 self.time + other.time, 51 ) 52 53 def __sub__(self, other: Cost) -> Cost: 54 """This cost less `other`.""" 55 return Cost( 56 self.minerals - other.minerals, 57 self.vespene - other.vespene, 58 self.supply - other.supply, 59 self.time - other.time, 60 ) 61 62 def __mul__(self, count: float) -> Cost: 63 """This cost `count` times over.""" 64 return Cost(self.minerals * count, self.vespene * count, self.supply * count, self.time * count) 65 66 def __rmul__(self, count: float) -> Cost: 67 """This cost `count` times over.""" 68 return self * count 69 70 def __truediv__(self, divisor: float) -> Cost: 71 """This cost divided by `divisor`.""" 72 return Cost(self.minerals / divisor, self.vespene / divisor, self.supply / divisor, self.time / divisor) 73 74 def __neg__(self) -> Cost: 75 """This cost negated: given back rather than paid.""" 76 return Cost(-self.minerals, -self.vespene, -self.supply, -self.time)
The cost of making something: minerals, vespene, supply and the time it takes.
Not a Resources, which is an amount a player holds, earns or spends. Supply is room under the cap, so compare
cost.resources against api.resources and cost.supply against api.supply.left. Costs added up add their
times too, which makes the production time they take one after another, not how long they take side by side.
Supply taken, or given back when negative: -1 for a spawning pool, which uses up a drone.
The time production takes, at the normal rate: a whole number of steps from the tables, fractional once scaled or divided; zero for an order that makes nothing, for a switch that costs nothing, such as a siege, and where the tables give none, as for an interceptor.
34 @property 35 def resources(self) -> Resources: 36 """The minerals and vespene, to compare against what the player has.""" 37 return Resources(self.minerals, self.vespene)
The minerals and vespene, to compare against what the player has.
39 @property 40 def is_free(self) -> bool: 41 """Whether it takes no minerals, vespene or supply, whatever its time: a siege, a MULE's calldown.""" 42 return not (self.minerals or self.vespene or self.supply)
Whether it takes no minerals, vespene or supply, whatever its time: a siege, a MULE's calldown.
71class Difficulty(ReadableIntEnum): 72 """How strongly the built-in computer opponent plays. The `CHEAT_` levels break the game's own rules.""" 73 74 VERY_EASY = sc2api_pb2.Difficulty.VeryEasy 75 EASY = sc2api_pb2.Difficulty.Easy 76 MEDIUM = sc2api_pb2.Difficulty.Medium 77 MEDIUM_HARD = sc2api_pb2.Difficulty.MediumHard 78 HARD = sc2api_pb2.Difficulty.Hard 79 HARDER = sc2api_pb2.Difficulty.Harder 80 VERY_HARD = sc2api_pb2.Difficulty.VeryHard 81 CHEAT_VISION = sc2api_pb2.Difficulty.CheatVision 82 CHEAT_MONEY = sc2api_pb2.Difficulty.CheatMoney 83 CHEAT_INSANE = sc2api_pb2.Difficulty.CheatInsane
How strongly the built-in computer opponent plays. The CHEAT_ levels break the game's own rules.
49@dataclass(frozen=True, slots=True, kw_only=True) 50class Expansion: 51 """A place to build a townhall, with the mineral fields and geysers it mines. 52 53 Each group of resources lying within 6 of one another, through any chain of them, is an expansion if it has 6 to 54 10 mineral fields; fewer fields are a blocker to mine out, more a wall. Where a group's fields can be mined from 55 either side, with a geyser on each, each side is an expansion of its own, and the two share the fields. Where a 56 player starts the game, it is a `StartLocation`. 57 """ 58 59 center: Point 60 """Where the townhall's center goes: of the tile centers the game takes a townhall on, the one with the least summed 61 distance to the resources.""" 62 mineral_fields: Units[Unit[UnitType.AnyMineralField]] 63 """Its mineral fields, nearest `center` first. The same units all game, though the game changes their tags as 64 they pass in and out of sight.""" 65 geysers: Units[Unit[UnitType.AnyVespeneGeyser]] 66 """Its geysers, nearest `center` first, the same units all game.""" 67 pathing_distance_from_start: float 68 """The pathing distance from this player's start to `center`, over the ground as the game began with every mineral 69 field and geyser on it: `inf` where no path reaches.""" 70 _game_map: GameMap = field(repr=False, compare=False) 71 _unit_tracker: _UnitTracker = field(repr=False, compare=False) 72 73 @property 74 def townhall(self) -> Unit[UnitType.Townhall] | None: 75 """The townhall standing on it now, this player's or another's, in sight or remembered in the fog: the one whose 76 footprint's bounding box holds `center`. `None` if there is none; a townhall in the air stands nowhere.""" 77 for townhall in self._unit_tracker.present_townhalls: 78 footprint = townhall.footprint 79 if footprint is not None and self.center in footprint.bounding_box(at=townhall.position): 80 return townhall 81 return None 82 83 def plateau(self, *, max_distance: float = math.inf, height_tolerance: float = _HALF_A_LEVEL) -> TileSet: 84 """The ground at the expansion's level: every tile less than `height_tolerance` from the height at `center`, 85 half a level by default, walkable as the game began, and joined side by side to `center` within `max_distance` 86 of it in a straight line, without crossing a ramp. The ground under its townhall, mineral fields and geysers 87 counts, though the game's pathing grid blocks this player's own at its start (in game). Empty where `center` 88 stands on no such ground. Worked out at each call.""" 89 game_map = self._game_map 90 walkable = game_map.pathing.copy() 91 # Every townhall's footprint is the command center's. 92 walkable.fill_footprint(FOOTPRINTS[UnitTypeId.COMMAND_CENTER], at=self.center, value=True) 93 for resource in (*self.mineral_fields, *self.geysers): 94 if (footprint := resource.footprint) is not None: 95 walkable.fill_footprint(footprint, at=resource.position, value=True) 96 for ramp in game_map.ramps: 97 walkable[ramp.tiles] = False 98 ground = walkable.values & (numpy.abs(game_map.height.values - game_map.height[self.center]) < height_tolerance) 99 if max_distance < math.inf: 100 ground &= walkable.distance_from(self.center).values <= max_distance 101 # `label` is unannotated, and pyright reads the return type off an early-return branch of its body. 102 patches, _ = cast("tuple[ndarray, int]", scipy.ndimage.label(ground)) 103 patch_at_center = patches[walkable.index_of(self.center)] 104 if not patch_at_center: 105 return TileSet(()) 106 return TileSet._from_mask(walkable.origin, patches == patch_at_center) 107 108 @property 109 def _is_full_base(self) -> bool: 110 """Whether it has the fields and geysers of a full base.""" 111 return ( 112 len(self.mineral_fields) >= _MIN_MINERAL_FIELDS_OF_A_FULL_BASE 113 and len(self.geysers) == _GEYSERS_OF_A_FULL_BASE 114 ) 115 116 @staticmethod 117 def _find_all(game_map: GameMap, unit_tracker: _UnitTracker) -> tuple[Expansion, ...]: 118 """The expansions of `game_map` with the neutral units `unit_tracker` holds on it at the start, by pathing 119 distance from this player's start, nearest first, each start location a `StartLocation`. Those no path reaches 120 come last, sorted by increasing straight-line distance from this player's start. Each finds its townhall among 121 the units `unit_tracker` holds then. 122 123 The mineral fields and geysers make the expansions; every other neutral unit blocks the ground under it. Every 124 walk is over the ground as the game began with every mineral field and geyser on it. 125 """ 126 neutral_units = unit_tracker.present.neutral 127 mineral_fields = neutral_units.of_type(UnitType.AnyMineralField) 128 geysers = neutral_units.of_type(UnitType.AnyVespeneGeyser) 129 blockers = neutral_units.excluding_type(UnitType.AnyMineralField, UnitType.AnyVespeneGeyser) 130 expansion_locations = _ExpansionLocations( 131 game_map.placement, mineral_fields=mineral_fields, geysers=geysers, blockers=blockers 132 ) 133 ground = _ground_as_the_game_began(game_map, (*mineral_fields, *geysers)) 134 start = game_map.start_location 135 from_start = _walking_distances(ground, start) 136 start_locations = set(game_map.all_start_locations) 137 expansions = [ 138 Expansion( 139 center=center, 140 mineral_fields=base_fields.sorted_by_distance_to(center), 141 geysers=center_geysers.sorted_by_distance_to(center), 142 pathing_distance_from_start=from_start[center], 143 _game_map=game_map, 144 _unit_tracker=unit_tracker, 145 ) 146 for base_fields, base_geysers in _resources_of_each_base(mineral_fields, geysers) 147 for center, center_geysers in _townhall_centers_of_base(expansion_locations, base_fields, base_geysers) 148 ] 149 candidates = [expansion for expansion in expansions if expansion.center not in start_locations] 150 found = [ 151 expansion 152 if expansion.center not in start_locations 153 else StartLocation._from_expansion( 154 expansion, 155 ground=ground, 156 candidates=candidates, 157 from_center=from_start if expansion.center == start else _walking_distances(ground, expansion.center), 158 ) 159 for expansion in expansions 160 ] 161 return tuple(sorted(found, key=lambda exp: (exp.pathing_distance_from_start, start.distance_to(exp.center))))
A place to build a townhall, with the mineral fields and geysers it mines.
Each group of resources lying within 6 of one another, through any chain of them, is an expansion if it has 6 to
10 mineral fields; fewer fields are a blocker to mine out, more a wall. Where a group's fields can be mined from
either side, with a geyser on each, each side is an expansion of its own, and the two share the fields. Where a
player starts the game, it is a StartLocation.
Where the townhall's center goes: of the tile centers the game takes a townhall on, the one with the least summed distance to the resources.
Its mineral fields, nearest center first. The same units all game, though the game changes their tags as
they pass in and out of sight.
Its geysers, nearest center first, the same units all game.
The pathing distance from this player's start to center, over the ground as the game began with every mineral
field and geyser on it: inf where no path reaches.
73 @property 74 def townhall(self) -> Unit[UnitType.Townhall] | None: 75 """The townhall standing on it now, this player's or another's, in sight or remembered in the fog: the one whose 76 footprint's bounding box holds `center`. `None` if there is none; a townhall in the air stands nowhere.""" 77 for townhall in self._unit_tracker.present_townhalls: 78 footprint = townhall.footprint 79 if footprint is not None and self.center in footprint.bounding_box(at=townhall.position): 80 return townhall 81 return None
The townhall standing on it now, this player's or another's, in sight or remembered in the fog: the one whose
footprint's bounding box holds center. None if there is none; a townhall in the air stands nowhere.
83 def plateau(self, *, max_distance: float = math.inf, height_tolerance: float = _HALF_A_LEVEL) -> TileSet: 84 """The ground at the expansion's level: every tile less than `height_tolerance` from the height at `center`, 85 half a level by default, walkable as the game began, and joined side by side to `center` within `max_distance` 86 of it in a straight line, without crossing a ramp. The ground under its townhall, mineral fields and geysers 87 counts, though the game's pathing grid blocks this player's own at its start (in game). Empty where `center` 88 stands on no such ground. Worked out at each call.""" 89 game_map = self._game_map 90 walkable = game_map.pathing.copy() 91 # Every townhall's footprint is the command center's. 92 walkable.fill_footprint(FOOTPRINTS[UnitTypeId.COMMAND_CENTER], at=self.center, value=True) 93 for resource in (*self.mineral_fields, *self.geysers): 94 if (footprint := resource.footprint) is not None: 95 walkable.fill_footprint(footprint, at=resource.position, value=True) 96 for ramp in game_map.ramps: 97 walkable[ramp.tiles] = False 98 ground = walkable.values & (numpy.abs(game_map.height.values - game_map.height[self.center]) < height_tolerance) 99 if max_distance < math.inf: 100 ground &= walkable.distance_from(self.center).values <= max_distance 101 # `label` is unannotated, and pyright reads the return type off an early-return branch of its body. 102 patches, _ = cast("tuple[ndarray, int]", scipy.ndimage.label(ground)) 103 patch_at_center = patches[walkable.index_of(self.center)] 104 if not patch_at_center: 105 return TileSet(()) 106 return TileSet._from_mask(walkable.origin, patches == patch_at_center)
The ground at the expansion's level: every tile less than height_tolerance from the height at center,
half a level by default, walkable as the game began, and joined side by side to center within max_distance
of it in a straight line, without crossing a ramp. The ground under its townhall, mineral fields and geysers
counts, though the game's pathing grid blocks this player's own at its start (in game). Empty where center
stands on no such ground. Worked out at each call.
58class FogOnError(NachOSError, RuntimeError): 59 """The fog is on, as in every game, so the game reports only what this player sees."""
The fog is on, as in every game, so the game reports only what this player sees.
21@final 22class Footprint: 23 """The tiles a structure covers, as a mask laid around its center. 24 25 Along a side of odd length the mask centers on the tile holding the center, and along a side of even length on the 26 tile corner nearest it, as the game snaps a structure: a 3x3 barracks stands on a tile center, a 2x2 depot on a 27 tile corner, and a 2x1 mineral field on the edge between two tiles. A grid says where a footprint fits on it. 28 """ 29 30 __slots__ = ("_mask",) 31 32 _mask: ndarray 33 34 def __init__(self, mask: ndarray) -> None: 35 """A footprint covering the true entries of `mask`, indexed `[x, y]` from its lower left tile. A mask with no 36 entries is the empty footprint, whatever its shape.""" 37 if mask.ndim != 2: 38 raise ValueError(f"a footprint is two-dimensional, got {mask.ndim} dimensions") 39 self._mask = numpy.array(mask, dtype=bool) if mask.size else numpy.zeros((0, 0), dtype=bool) 40 self._mask.flags.writeable = False 41 42 @classmethod 43 def from_rows(cls, *rows: str) -> Footprint: 44 """The footprint `rows` draw, the top row first: `#` covered, `.` not. No rows cover nothing. Raises 45 `ValueError` for rows of different lengths, or with any other character.""" 46 if len({len(row) for row in rows}) > 1: 47 raise ValueError(f"the rows of a footprint are all as long, got {rows}") 48 if set("".join(rows)) - {"#", "."}: 49 raise ValueError(f"a footprint's rows hold only '#' and '.', got {rows}") 50 width = len(rows[0]) if rows else 0 51 mask = numpy.array([[row[x] == "#" for row in reversed(rows)] for x in range(width)], dtype=bool) 52 return cls(mask.reshape(width, len(rows))) 53 54 @classmethod 55 def empty(cls) -> Footprint: 56 """A footprint covering no tile, as a Xel'Naga healing shrine's does.""" 57 return cls(numpy.zeros((0, 0), dtype=bool)) 58 59 @classmethod 60 def rectangle(cls, width: int, height: int, *, cut_corners: int = 0) -> Footprint: 61 """A footprint covering a rectangle `width` tiles across and `height` up, less, at each corner, the tiles 62 fewer than `cut_corners` steps from it, counting each step across or up: the corner tile for 1, and the two 63 beside it too for 2. Raises `ValueError` for a side shorter than 1 or a negative `cut_corners`.""" 64 if width < 1 or height < 1 or cut_corners < 0: 65 raise ValueError( 66 f"a rectangle is at least 1x1 with no negative corner cut, got {width}x{height}, {cut_corners}" 67 ) 68 steps_from_side_x = numpy.minimum(numpy.arange(width), numpy.arange(width)[::-1])[:, numpy.newaxis] 69 steps_from_side_y = numpy.minimum(numpy.arange(height), numpy.arange(height)[::-1])[numpy.newaxis, :] 70 return cls(steps_from_side_x + steps_from_side_y >= cut_corners) 71 72 @classmethod 73 def square(cls, side: int, *, cut_corners: int = 0) -> Footprint: 74 """A footprint covering a square `side` tiles across, less its corners as `rectangle` cuts them.""" 75 return cls.rectangle(side, side, cut_corners=cut_corners) 76 77 @property 78 def mask(self) -> ndarray: 79 """Whether the footprint covers each tile of its bounding box, indexed `[x, y]` from its lower left tile.""" 80 return self._mask 81 82 @property 83 def width(self) -> int: 84 """The number of tiles across its bounding box.""" 85 return self._mask.shape[0] 86 87 @property 88 def height(self) -> int: 89 """The number of tiles up its bounding box.""" 90 return self._mask.shape[1] 91 92 def bounding_box(self, *, at: PointLike) -> Rectangle: 93 """The tiles `mask` spans, with the footprint placed at `at` and centered as the game snaps it. The footprint 94 covers some of them, or all.""" 95 left, bottom = self._lower_left_tile(at=at) 96 return Rectangle(left, bottom, self.width, self.height) 97 98 def snapped_center(self, *, at: PointLike) -> Point: 99 """Where the footprint centers when placed at `at`, as the game snaps a structure: for the empty footprint, 100 the tile corner nearest `at`.""" 101 left, bottom = self._lower_left_tile(at=at) 102 return Point((left + self.width / 2, bottom + self.height / 2)) 103 104 def _lower_left_tile(self, *, at: PointLike) -> tuple[int, int]: 105 """The lower left tile of `mask`, with the footprint placed at `at` and centered as the game snaps it.""" 106 x, y = at[0], at[1] 107 return rounded_half_up(x - self.width / 2), rounded_half_up(y - self.height / 2) 108 109 def tiles(self, *, at: PointLike) -> TileSet: 110 """The tiles the footprint covers, placed at `at` and centered as the game snaps it.""" 111 left, bottom = self._lower_left_tile(at=at) 112 return TileSet._from_mask(Tile(left, bottom), self._mask) 113 114 def center_in_tile(self, tile: Tile) -> Point: 115 """Where the footprint is centered when its center lies in `tile`: the tile's center along a side of odd 116 length, and its lower left corner along a side of even length.""" 117 return Point((tile.x + 0.5 * (self.width % 2), tile.y + 0.5 * (self.height % 2))) 118 119 def _grown(self, sides: tuple[int, int, int, int]) -> Footprint: 120 """This footprint and every tile within `sides` of a tile it covers: so many to the left and right of one, and 121 so many below and above it. Its own mask lies at `[left:, bottom:]` of the grown one.""" 122 left, right, bottom, top = sides 123 width, height = self.width, self.height 124 grown = numpy.zeros((width + left + right, height + bottom + top), dtype=bool) 125 for dx in range(left + right + 1): 126 for dy in range(bottom + top + 1): 127 grown[dx : dx + width, dy : dy + height] |= self._mask 128 return Footprint(grown) 129 130 def _grown_by(self, margin: Margin, *, at: PointLike) -> tuple[Footprint, PointLike]: 131 """This footprint with every tile within `margin` of one it covers, and where that centers so that this 132 footprint stays centered at `at`. Raises as `_margin_sides` does.""" 133 if not any(sides := _margin_sides(margin)): 134 return self, at 135 left, _, bottom, _ = sides 136 lower_left_x, lower_left_y = self._lower_left_tile(at=at) 137 grown = self._grown(sides) 138 # Centered so that its lower left tile lies `left` and `bottom` beyond this footprint's. 139 return grown, (lower_left_x - left + grown.width / 2, lower_left_y - bottom + grown.height / 2) 140 141 def __eq__(self, other: object) -> bool: 142 return isinstance(other, Footprint) and numpy.array_equal(self._mask, other._mask) 143 144 def __hash__(self) -> int: 145 return hash((self._mask.shape, self._mask.tobytes())) 146 147 def __repr__(self) -> str: 148 return f"Footprint({self.width}x{self.height}, {numpy.count_nonzero(self._mask)} tiles)"
The tiles a structure covers, as a mask laid around its center.
Along a side of odd length the mask centers on the tile holding the center, and along a side of even length on the tile corner nearest it, as the game snaps a structure: a 3x3 barracks stands on a tile center, a 2x2 depot on a tile corner, and a 2x1 mineral field on the edge between two tiles. A grid says where a footprint fits on it.
34 def __init__(self, mask: ndarray) -> None: 35 """A footprint covering the true entries of `mask`, indexed `[x, y]` from its lower left tile. A mask with no 36 entries is the empty footprint, whatever its shape.""" 37 if mask.ndim != 2: 38 raise ValueError(f"a footprint is two-dimensional, got {mask.ndim} dimensions") 39 self._mask = numpy.array(mask, dtype=bool) if mask.size else numpy.zeros((0, 0), dtype=bool) 40 self._mask.flags.writeable = False
A footprint covering the true entries of mask, indexed [x, y] from its lower left tile. A mask with no
entries is the empty footprint, whatever its shape.
42 @classmethod 43 def from_rows(cls, *rows: str) -> Footprint: 44 """The footprint `rows` draw, the top row first: `#` covered, `.` not. No rows cover nothing. Raises 45 `ValueError` for rows of different lengths, or with any other character.""" 46 if len({len(row) for row in rows}) > 1: 47 raise ValueError(f"the rows of a footprint are all as long, got {rows}") 48 if set("".join(rows)) - {"#", "."}: 49 raise ValueError(f"a footprint's rows hold only '#' and '.', got {rows}") 50 width = len(rows[0]) if rows else 0 51 mask = numpy.array([[row[x] == "#" for row in reversed(rows)] for x in range(width)], dtype=bool) 52 return cls(mask.reshape(width, len(rows)))
The footprint rows draw, the top row first: # covered, . not. No rows cover nothing. Raises
ValueError for rows of different lengths, or with any other character.
54 @classmethod 55 def empty(cls) -> Footprint: 56 """A footprint covering no tile, as a Xel'Naga healing shrine's does.""" 57 return cls(numpy.zeros((0, 0), dtype=bool))
A footprint covering no tile, as a Xel'Naga healing shrine's does.
59 @classmethod 60 def rectangle(cls, width: int, height: int, *, cut_corners: int = 0) -> Footprint: 61 """A footprint covering a rectangle `width` tiles across and `height` up, less, at each corner, the tiles 62 fewer than `cut_corners` steps from it, counting each step across or up: the corner tile for 1, and the two 63 beside it too for 2. Raises `ValueError` for a side shorter than 1 or a negative `cut_corners`.""" 64 if width < 1 or height < 1 or cut_corners < 0: 65 raise ValueError( 66 f"a rectangle is at least 1x1 with no negative corner cut, got {width}x{height}, {cut_corners}" 67 ) 68 steps_from_side_x = numpy.minimum(numpy.arange(width), numpy.arange(width)[::-1])[:, numpy.newaxis] 69 steps_from_side_y = numpy.minimum(numpy.arange(height), numpy.arange(height)[::-1])[numpy.newaxis, :] 70 return cls(steps_from_side_x + steps_from_side_y >= cut_corners)
72 @classmethod 73 def square(cls, side: int, *, cut_corners: int = 0) -> Footprint: 74 """A footprint covering a square `side` tiles across, less its corners as `rectangle` cuts them.""" 75 return cls.rectangle(side, side, cut_corners=cut_corners)
A footprint covering a square side tiles across, less its corners as rectangle cuts them.
77 @property 78 def mask(self) -> ndarray: 79 """Whether the footprint covers each tile of its bounding box, indexed `[x, y]` from its lower left tile.""" 80 return self._mask
Whether the footprint covers each tile of its bounding box, indexed [x, y] from its lower left tile.
82 @property 83 def width(self) -> int: 84 """The number of tiles across its bounding box.""" 85 return self._mask.shape[0]
The number of tiles across its bounding box.
87 @property 88 def height(self) -> int: 89 """The number of tiles up its bounding box.""" 90 return self._mask.shape[1]
The number of tiles up its bounding box.
92 def bounding_box(self, *, at: PointLike) -> Rectangle: 93 """The tiles `mask` spans, with the footprint placed at `at` and centered as the game snaps it. The footprint 94 covers some of them, or all.""" 95 left, bottom = self._lower_left_tile(at=at) 96 return Rectangle(left, bottom, self.width, self.height)
The tiles mask spans, with the footprint placed at at and centered as the game snaps it. The footprint
covers some of them, or all.
98 def snapped_center(self, *, at: PointLike) -> Point: 99 """Where the footprint centers when placed at `at`, as the game snaps a structure: for the empty footprint, 100 the tile corner nearest `at`.""" 101 left, bottom = self._lower_left_tile(at=at) 102 return Point((left + self.width / 2, bottom + self.height / 2))
Where the footprint centers when placed at at, as the game snaps a structure: for the empty footprint,
the tile corner nearest at.
109 def tiles(self, *, at: PointLike) -> TileSet: 110 """The tiles the footprint covers, placed at `at` and centered as the game snaps it.""" 111 left, bottom = self._lower_left_tile(at=at) 112 return TileSet._from_mask(Tile(left, bottom), self._mask)
The tiles the footprint covers, placed at at and centered as the game snaps it.
114 def center_in_tile(self, tile: Tile) -> Point: 115 """Where the footprint is centered when its center lies in `tile`: the tile's center along a side of odd 116 length, and its lower left corner along a side of even length.""" 117 return Point((tile.x + 0.5 * (self.width % 2), tile.y + 0.5 * (self.height % 2)))
Where the footprint is centered when its center lies in tile: the tile's center along a side of odd
length, and its lower left corner along a side of even length.
22@dataclass(frozen=True, slots=True, init=False, eq=False, match_args=False) 23class GameTime: 24 """A moment of a game, counted from its start, or a length of game time, in steps of the game: 22.4 make a 25 second at the Faster speed games are played at. 26 27 Made from one of `steps`; `seconds` at the Faster speed; or `normal_seconds` at the Normal speed, 16 steps a 28 second, in which the game gives some times, such as a weapon's cooldown. `GameTime(seconds=120)` is 2688 steps. 29 Steps are kept as given. Seconds are multiplied out unrounded, exactly where they make a whole number of steps, so 30 `GameTime(seconds=45) == GameTime(steps=1008)`; normal seconds exactly, 16 being a power of two. Any other 31 keyword, none, or more than one raises `TypeError`. 32 33 A moment is a whole number of steps; a length may be fractional, as a weapon's cooldown is. Two add, subtract and 34 take `%` to a `GameTime`, and divide, `/` or `//`, to a plain number; one multiplies by a plain number and divides 35 by one to a `GameTime`. It orders against another `GameTime` alone: compared with a plain number it raises 36 `TypeError`, and it equals none. Zero is false, and is `GameTime.ZERO`; `GameTime.INFINITE` is later and longer 37 than any other. 38 """ 39 40 # Makes a numpy scalar on the left, `numpy.float64(2) * time`, hand over to `__rmul__` instead of reading the time 41 # as an array. 42 __array_ufunc__ = None 43 44 ZERO: ClassVar[GameTime] 45 """No time: the game's start, or a length of none.""" 46 47 INFINITE: ClassVar[GameTime] 48 """The time of what never comes, later and longer than any other, as `math.inf` is a number larger than any. It 49 orders above every finite time and stays infinite when one is added or subtracted, and `seconds` reads 50 `math.inf`, and `to_string` `"inf"`; `nearest_step` and dividing it by `//` raise `ValueError`. Subtracting it 51 from itself, multiplying it by zero or taking its remainder gives a time of NaN steps, which equals none.""" 52 53 steps: float 54 """The steps of the game it counts.""" 55 56 @overload 57 def __init__(self, *, steps: float) -> None: ... 58 59 @overload 60 def __init__(self, *, seconds: float) -> None: ... 61 62 @overload 63 def __init__(self, *, normal_seconds: float) -> None: ... 64 65 def __init__( 66 self, *, steps: float | None = None, seconds: float | None = None, normal_seconds: float | None = None 67 ) -> None: 68 if steps is not None: 69 if seconds is not None or normal_seconds is not None: 70 raise _not_one_unit_error(steps=steps, seconds=seconds, normal_seconds=normal_seconds) 71 counted_steps = steps 72 elif seconds is not None: 73 if normal_seconds is not None: 74 raise _not_one_unit_error(steps=steps, seconds=seconds, normal_seconds=normal_seconds) 75 counted_steps = seconds * _STEPS_PER_FIVE_SECONDS / 5 76 elif normal_seconds is not None: 77 counted_steps = normal_seconds * STEPS_PER_NORMAL_SECOND 78 else: 79 raise _not_one_unit_error(steps=steps, seconds=seconds, normal_seconds=normal_seconds) 80 object.__setattr__(self, "steps", counted_steps) 81 82 @classmethod 83 def _from_steps(cls, steps: float) -> GameTime: 84 """A time of `steps`, made without the constructor's check of its keywords.""" 85 new_time = object.__new__(cls) 86 object.__setattr__(new_time, "steps", steps) 87 return new_time 88 89 @property 90 def seconds(self) -> float: 91 """The seconds it counts at the Faster speed, unrounded.""" 92 return self.steps * SECONDS_PER_STEP 93 94 @property 95 def normal_seconds(self) -> float: 96 """The seconds it counts at the Normal speed, 16 steps a second. Exact, 16 being a power of two.""" 97 return self.steps / STEPS_PER_NORMAL_SECOND 98 99 @property 100 def nearest_step(self) -> int: 101 """The step nearest it, a tie the later, where Python's `round` takes the even one. Raises `ValueError` for 102 `INFINITE`, or any time not finite.""" 103 try: 104 return rounded_half_up(self.steps) 105 except (OverflowError, ValueError): 106 raise ValueError(f"{self!r} is not finite, so it has no nearest step") from None 107 108 def is_integer(self) -> bool: 109 """Whether it is a whole number of steps.""" 110 return float(self.steps).is_integer() 111 112 def to_string(self, decimals: int = 3) -> str: 113 """Minutes and seconds, the seconds to `decimals` places from 0 to 3, rounded down: `"3:20.000"` at step 114 4480, and `"3:20"` to 0 places. From 2 places up every step reads apart from the next, since a step is 44.6 115 milliseconds. A negative length reads `"-0:04.285"`, and a time not finite as Python writes its steps: 116 `"inf"` for `INFINITE`, `"-inf"`, or `"nan"`. Raises `ValueError` for `decimals` outside 0 to 3.""" 117 if ( 118 not isinstance(decimals, numbers.Integral) 119 or isinstance(decimals, bool) 120 or not 0 <= decimals <= _MOST_DECIMALS 121 ): 122 raise ValueError(f"decimals is a whole number from 0 to {_MOST_DECIMALS}, not {decimals!r}") 123 if not math.isfinite(self.steps): 124 return str(float(self.steps)) 125 parts_per_second = 10**decimals 126 # One division, so a whole part of a second comes out whole and nothing is rounded up past one. From about 127 # 3.6e307 steps, a tenth as many for each decimal place, the product overflows a float, and is counted 128 # exactly in integers instead. 129 try: 130 parts = math.floor(abs(self.steps) * 5 * parts_per_second / _STEPS_PER_FIVE_SECONDS) 131 except OverflowError: 132 parts = math.floor(Fraction(float(abs(self.steps))) * 5 * parts_per_second / _STEPS_PER_FIVE_SECONDS) 133 minutes, parts_in_minute = divmod(parts, 60 * parts_per_second) 134 seconds, parts_in_second = divmod(parts_in_minute, parts_per_second) 135 sign = "-" if self.steps < 0 else "" 136 fraction = f".{parts_in_second:0{decimals}d}" if decimals else "" 137 return f"{sign}{minutes}:{seconds:02d}{fraction}" 138 139 def __eq__(self, other: object) -> bool: 140 if not isinstance(other, GameTime): 141 return NotImplemented 142 return self.steps == other.steps 143 144 def __hash__(self) -> int: 145 return hash(self.steps) 146 147 def __lt__(self, other: GameTime) -> bool: 148 if not isinstance(other, GameTime): 149 return NotImplemented 150 return self.steps < other.steps 151 152 def __le__(self, other: GameTime) -> bool: 153 if not isinstance(other, GameTime): 154 return NotImplemented 155 return self.steps <= other.steps 156 157 def __gt__(self, other: GameTime) -> bool: 158 if not isinstance(other, GameTime): 159 return NotImplemented 160 return self.steps > other.steps 161 162 def __ge__(self, other: GameTime) -> bool: 163 if not isinstance(other, GameTime): 164 return NotImplemented 165 return self.steps >= other.steps 166 167 def __bool__(self) -> bool: 168 return self.steps != 0 169 170 def __add__(self, other: GameTime) -> GameTime: 171 if not isinstance(other, GameTime): 172 return NotImplemented 173 return GameTime._from_steps(self.steps + other.steps) 174 175 def __sub__(self, other: GameTime) -> GameTime: 176 if not isinstance(other, GameTime): 177 return NotImplemented 178 return GameTime._from_steps(self.steps - other.steps) 179 180 def __mul__(self, factor: float) -> GameTime: 181 if not isinstance(factor, _SCALAR_TYPES): 182 return NotImplemented 183 return GameTime._from_steps(self.steps * factor) 184 185 __rmul__ = __mul__ 186 187 @overload 188 def __truediv__(self, divisor: GameTime) -> float: ... 189 190 @overload 191 def __truediv__(self, divisor: float) -> GameTime: ... 192 193 def __truediv__(self, divisor: GameTime | float) -> GameTime | float: 194 if isinstance(divisor, GameTime): 195 return self.steps / divisor.steps 196 if not isinstance(divisor, _SCALAR_TYPES): 197 return NotImplemented 198 return GameTime._from_steps(self.steps / divisor) 199 200 def __floordiv__(self, divisor: GameTime) -> int: 201 if not isinstance(divisor, GameTime): 202 return NotImplemented 203 try: 204 return int(self.steps // divisor.steps) 205 except (OverflowError, ValueError): 206 raise ValueError(f"{self!r} // {divisor!r} is not a finite whole number") from None 207 208 def __mod__(self, divisor: GameTime) -> GameTime: 209 if not isinstance(divisor, GameTime): 210 return NotImplemented 211 return GameTime._from_steps(self.steps % divisor.steps) 212 213 def __neg__(self) -> GameTime: 214 return GameTime._from_steps(-self.steps) 215 216 def __abs__(self) -> GameTime: 217 return GameTime._from_steps(abs(self.steps))
A moment of a game, counted from its start, or a length of game time, in steps of the game: 22.4 make a second at the Faster speed games are played at.
Made from one of steps; seconds at the Faster speed; or normal_seconds at the Normal speed, 16 steps a
second, in which the game gives some times, such as a weapon's cooldown. GameTime(seconds=120) is 2688 steps.
Steps are kept as given. Seconds are multiplied out unrounded, exactly where they make a whole number of steps, so
GameTime(seconds=45) == GameTime(steps=1008); normal seconds exactly, 16 being a power of two. Any other
keyword, none, or more than one raises TypeError.
A moment is a whole number of steps; a length may be fractional, as a weapon's cooldown is. Two add, subtract and
take % to a GameTime, and divide, / or //, to a plain number; one multiplies by a plain number and divides
by one to a GameTime. It orders against another GameTime alone: compared with a plain number it raises
TypeError, and it equals none. Zero is false, and is GameTime.ZERO; GameTime.INFINITE is later and longer
than any other.
65 def __init__( 66 self, *, steps: float | None = None, seconds: float | None = None, normal_seconds: float | None = None 67 ) -> None: 68 if steps is not None: 69 if seconds is not None or normal_seconds is not None: 70 raise _not_one_unit_error(steps=steps, seconds=seconds, normal_seconds=normal_seconds) 71 counted_steps = steps 72 elif seconds is not None: 73 if normal_seconds is not None: 74 raise _not_one_unit_error(steps=steps, seconds=seconds, normal_seconds=normal_seconds) 75 counted_steps = seconds * _STEPS_PER_FIVE_SECONDS / 5 76 elif normal_seconds is not None: 77 counted_steps = normal_seconds * STEPS_PER_NORMAL_SECOND 78 else: 79 raise _not_one_unit_error(steps=steps, seconds=seconds, normal_seconds=normal_seconds) 80 object.__setattr__(self, "steps", counted_steps)
The time of what never comes, later and longer than any other, as math.inf is a number larger than any. It
orders above every finite time and stays infinite when one is added or subtracted, and seconds reads
math.inf, and to_string "inf"; nearest_step and dividing it by // raise ValueError. Subtracting it
from itself, multiplying it by zero or taking its remainder gives a time of NaN steps, which equals none.
89 @property 90 def seconds(self) -> float: 91 """The seconds it counts at the Faster speed, unrounded.""" 92 return self.steps * SECONDS_PER_STEP
The seconds it counts at the Faster speed, unrounded.
94 @property 95 def normal_seconds(self) -> float: 96 """The seconds it counts at the Normal speed, 16 steps a second. Exact, 16 being a power of two.""" 97 return self.steps / STEPS_PER_NORMAL_SECOND
The seconds it counts at the Normal speed, 16 steps a second. Exact, 16 being a power of two.
99 @property 100 def nearest_step(self) -> int: 101 """The step nearest it, a tie the later, where Python's `round` takes the even one. Raises `ValueError` for 102 `INFINITE`, or any time not finite.""" 103 try: 104 return rounded_half_up(self.steps) 105 except (OverflowError, ValueError): 106 raise ValueError(f"{self!r} is not finite, so it has no nearest step") from None
The step nearest it, a tie the later, where Python's round takes the even one. Raises ValueError for
INFINITE, or any time not finite.
108 def is_integer(self) -> bool: 109 """Whether it is a whole number of steps.""" 110 return float(self.steps).is_integer()
Whether it is a whole number of steps.
112 def to_string(self, decimals: int = 3) -> str: 113 """Minutes and seconds, the seconds to `decimals` places from 0 to 3, rounded down: `"3:20.000"` at step 114 4480, and `"3:20"` to 0 places. From 2 places up every step reads apart from the next, since a step is 44.6 115 milliseconds. A negative length reads `"-0:04.285"`, and a time not finite as Python writes its steps: 116 `"inf"` for `INFINITE`, `"-inf"`, or `"nan"`. Raises `ValueError` for `decimals` outside 0 to 3.""" 117 if ( 118 not isinstance(decimals, numbers.Integral) 119 or isinstance(decimals, bool) 120 or not 0 <= decimals <= _MOST_DECIMALS 121 ): 122 raise ValueError(f"decimals is a whole number from 0 to {_MOST_DECIMALS}, not {decimals!r}") 123 if not math.isfinite(self.steps): 124 return str(float(self.steps)) 125 parts_per_second = 10**decimals 126 # One division, so a whole part of a second comes out whole and nothing is rounded up past one. From about 127 # 3.6e307 steps, a tenth as many for each decimal place, the product overflows a float, and is counted 128 # exactly in integers instead. 129 try: 130 parts = math.floor(abs(self.steps) * 5 * parts_per_second / _STEPS_PER_FIVE_SECONDS) 131 except OverflowError: 132 parts = math.floor(Fraction(float(abs(self.steps))) * 5 * parts_per_second / _STEPS_PER_FIVE_SECONDS) 133 minutes, parts_in_minute = divmod(parts, 60 * parts_per_second) 134 seconds, parts_in_second = divmod(parts_in_minute, parts_per_second) 135 sign = "-" if self.steps < 0 else "" 136 fraction = f".{parts_in_second:0{decimals}d}" if decimals else "" 137 return f"{sign}{minutes}:{seconds:02d}{fraction}"
Minutes and seconds, the seconds to decimals places from 0 to 3, rounded down: "3:20.000" at step
4480, and "3:20" to 0 places. From 2 places up every step reads apart from the next, since a step is 44.6
milliseconds. A negative length reads "-0:04.285", and a time not finite as Python writes its steps:
"inf" for INFINITE, "-inf", or "nan". Raises ValueError for decimals outside 0 to 3.
5class NachOSError(Exception): 6 """A failure of the library's own. Misuse, such as a bad argument, raises a built-in instead."""
A failure of the library's own. Misuse, such as a bad argument, raises a built-in instead.
54class NoEnemyError(NachOSError, RuntimeError): 55 """The game has no other player, as a mini-game has not, so there is no enemy to answer about."""
The game has no other player, as a mini-game has not, so there is no enemy to answer about.
50class NotPlayingError(NachOSError, RuntimeError): 51 """No game has been joined, so there is nothing to answer from."""
No game has been joined, so there is nothing to answer from.
25class OwnUnit[K: UnitType.AnyType](Unit[K]): 26 """One of this player's units. It also reads what the game reports only to a unit's owner. 27 28 A unit changes between `Unit` and `OwnUnit` in place when it changes sides, as under a neural parasite. 29 """ 30 31 __slots__ = () 32 33 def issue( 34 self, 35 ability: AbilityId, 36 *, 37 target: PointLike | Unit[Any] | None = None, 38 queued: bool = False, 39 force: bool = False, 40 ) -> IssuedOrder: 41 """Order the unit to use `ability`, aimed at a point, a unit or nothing, and return the `IssuedOrder`, as 42 `sc2nachos.orders.OrderBook.issue` orders it: `unit.issue(AbilityId.MOVE, target=point)` is 43 `api.orders.issue(unit, AbilityId.MOVE, target=point)`. 44 45 Raises as `OrderBook.issue` does. 46 """ 47 return self._tracker.order_book.issue(self, ability, target=target, queued=queued, force=force) 48 49 def train( 50 self: OwnUnit[UnitType.Structure | UnitType.Larva], 51 unit_type: UnitTypeId, 52 *, 53 target: PointLike | Unit[Any] | None = None, 54 queued: bool = False, 55 force: bool = False, 56 ) -> IssuedOrder: 57 """Order the structure or larva to make a unit of `unit_type` and return the `IssuedOrder`, as 58 `sc2nachos.orders.OrderBook.train` orders it: `barracks.train(UnitTypeId.MARINE)` is 59 `api.orders.train(barracks, UnitTypeId.MARINE)`. 60 61 Raises as `OrderBook.train` does. 62 """ 63 return self._tracker.order_book.train(self, unit_type, target=target, queued=queued, force=force) 64 65 def build( 66 self: OwnUnit[UnitType.Worker | UnitType.AnyBarracks | UnitType.AnyFactory | UnitType.AnyStarport], 67 unit_type: UnitTypeId, 68 *, 69 target: PointLike | Unit[Any] | None = None, 70 queued: bool = False, 71 force: bool = False, 72 ) -> IssuedOrder: 73 """Order the worker to make a structure of `unit_type`, or the barracks, factory or starport its add-on, and 74 return the `IssuedOrder`, as `sc2nachos.orders.OrderBook.build` orders it: `scv.build(UnitTypeId.BUNKER, 75 target=site)` is `api.orders.build(scv, UnitTypeId.BUNKER, target=site)`. 76 77 Raises as `OrderBook.build` does. 78 """ 79 return self._tracker.order_book.build(self, unit_type, target=target, queued=queued, force=force) 80 81 def research( 82 self: OwnUnit[UnitType.Structure], upgrade: UpgradeId, *, queued: bool = False, force: bool = False 83 ) -> IssuedOrder: 84 """Order the structure to research `upgrade` and return the `IssuedOrder`, as 85 `sc2nachos.orders.OrderBook.research` orders it: `tech_lab.research(UpgradeId.STIMPACK)` is 86 `api.orders.research(tech_lab, UpgradeId.STIMPACK)`. 87 88 Raises as `OrderBook.research` does: `ValueError` for a barracks given one of its tech lab's upgrades. 89 """ 90 return self._tracker.order_book.research(self, upgrade, queued=queued, force=force) 91 92 @property 93 def orders(self) -> tuple[Order, ...]: 94 """The unit's current order, then its queued orders.""" 95 update = self._tracker.last_changes.update 96 # Read off the snapshot's fields rather than through `at`, to spare a call on the common path. 97 if (cached := self._orders).update == update: 98 return cached.value 99 reported = self._latest_report.orders 100 orders = tuple(Order._from_proto(order, self._unit_target_of_order) for order in reported) 101 self._orders = _Snapshot(orders, update) 102 return orders 103 104 @property 105 def current_order(self) -> Order | None: 106 """The order the unit is carrying out, the first of `orders`, or `None` for an idle unit.""" 107 orders = self.orders 108 return orders[0] if orders else None 109 110 def _unit_target_of_order(self, order: raw_pb2.UnitOrder) -> Unit[Any] | None: 111 """The unit `order` names: the one the game reported under its tag, or, for a tag the game never reports, the 112 one this unit's last order of the same ability named under a tag it did; `None` if there is none.""" 113 unit = self._tracker.unit_tracker.get_by_tag(order.target_unit_tag) 114 if unit is None and self._order_targets is not None: 115 unit = self._order_targets.get(order.ability_id) 116 return unit 117 118 @property 119 def is_idle(self) -> bool: 120 """Whether the unit has no orders.""" 121 return not self._latest_report.orders 122 123 def is_doing(self, abilities: AbilityId | Collection[AbilityId]) -> bool: 124 """Whether the unit's `current_order` carries out `abilities`, one ability or any of several. False for an idle 125 unit.""" 126 # Read off the report: building `orders` to read the first would read every order and look up its target. 127 if not (reported_orders := self._latest_report.orders): 128 return False 129 ability_id = AbilityId.read(reported_orders[0].ability_id) 130 if isinstance(abilities, AbilityId): 131 return ability_id == abilities 132 return ability_id in abilities 133 134 @property 135 def is_moving(self) -> bool: 136 """Whether the unit's current order is a move.""" 137 return self.is_doing(AbilityId.MOVE) 138 139 @property 140 def is_attacking(self) -> bool: 141 """Whether the unit's current order is an attack, on a unit or a point, an attack-move reading as one.""" 142 return self.is_doing(AbilityId.ATTACK) 143 144 @property 145 def is_gathering(self) -> bool: 146 """Whether the unit's current order is a gather.""" 147 return self.is_doing(AbilityId.GATHER) 148 149 @property 150 def is_returning(self) -> bool: 151 """Whether the unit's current order is a return of what it carries.""" 152 return self.is_doing(AbilityId.RETURN) 153 154 @property 155 def is_repairing(self) -> bool: 156 """Whether the unit's current order is a repair.""" 157 return self.is_doing(AbilityId.REPAIR) 158 159 @property 160 def is_constructing(self) -> bool: 161 """Whether the unit builds a structure, or walks to the site of one it was ordered to build: it has a 162 `construction`, or its current order's ability places a structure, a barracks building its add-on and a queen 163 placing a creep tumor among them.""" 164 return self.construction is not None or self.is_doing(self._tracker.game_data._placing_abilities) 165 166 @property 167 def weapon_cooldown(self) -> GameTime: 168 """The time until the unit can attack again, as the game reports it: the cooldown of its last attack, with the 169 random delay drawn for it, counting down one step each step. Zero for a unit without a weapon; `weapons` says 170 whether it can attack at all. 171 172 It reads 0 too while an attack is under way, for 0 to 6 steps before it by type and up to 8 for an ultralisk, 173 and a move ordered 2 steps or more before the attack cancels it, 1 step before it does not (in game). So a unit 174 that moves between attacks keeps each by waiting for the cooldown to rise, in the step of the attack. 175 `docs/reference/game-behavior/damage-and-buffs.md` has the steps each type reads 0. 176 """ 177 return GameTime(steps=self._latest_report.weapon_cooldown) 178 179 @property 180 def buff_duration_max(self) -> GameTime | None: 181 """The whole length of the unit's timed life, as a MULE's or a broodling's, or of a timed buff on it, as a 182 hatchery's inject timer, as the game reports it; `None` where it reports none, as for a worker or a townhall 183 (in game; corpus).""" 184 maximum = self._latest_report.buff_duration_max 185 return GameTime(steps=maximum) if maximum else None 186 187 @property 188 def buff_duration_remaining(self) -> GameTime | None: 189 """What is left of `buff_duration_max`, counting down a step at a time; `None` where `buff_duration_max` is. 190 191 It reads zero, not `None`, once run out. It can start above the maximum: a MULE read 1441 and 1443 steps against 192 1440, and a broodling up to 132 against 128. A MULE or a broodling is listed last at zero, against its maximum, 193 and reported dead the step after (in game). 194 `docs/reference/game-behavior/units.md` has the readings. 195 """ 196 report = self._latest_report 197 return GameTime(steps=report.buff_duration_remain) if report.buff_duration_max else None 198 199 @property 200 def assigned_harvesters(self: OwnUnit[UnitType.Townhall | UnitType.GasBuilding]) -> int: 201 """The workers mining a town hall's minerals or a gas building's vespene. 0 for anything else.""" 202 return self._latest_report.assigned_harvesters 203 204 @property 205 def ideal_harvesters(self: OwnUnit[UnitType.Townhall | UnitType.GasBuilding]) -> int: 206 """The workers a town hall or gas building can use before another adds nothing: 2 per field, 3 per geyser.""" 207 return self._latest_report.ideal_harvesters 208 209 @property 210 def passengers(self) -> tuple[Passenger, ...]: 211 """The units inside the unit.""" 212 unit_by_tag = self._tracker.unit_tracker.by_tag 213 return tuple(Passenger._from_proto(passenger, unit_by_tag) for passenger in self._latest_report.passengers) 214 215 @property 216 def cargo_used(self) -> int: 217 """The cargo slots the passengers fill.""" 218 return self._latest_report.cargo_space_taken 219 220 @property 221 def cargo_max(self) -> int: 222 """The unit's cargo slots. 0 for a unit that carries nothing.""" 223 return self._latest_report.cargo_space_max 224 225 @property 226 def rally_targets(self) -> tuple[RallyTarget, ...]: 227 """Where a structure, an egg or a cocoon sends what it makes. Empty for anything else.""" 228 unit_by_tag = self._tracker.unit_tracker.by_tag 229 return tuple(RallyTarget._from_proto(rally, unit_by_tag) for rally in self._latest_report.rally_targets) 230 231 @property 232 def is_weapon_ready(self) -> bool: 233 """Whether the unit has a weapon and its `weapon_cooldown` is zero: it can attack now, or is under way with an 234 attack, whose cooldown reads zero until it fires (in game). Its weapons are its `active_weapons`, which an 235 oracle whose beam is off has none of.""" 236 return bool(self.active_weapons) and not self.weapon_cooldown 237 238 @property 239 def has_reactor(self: OwnUnit[UnitType.AnyBarracks | UnitType.AnyFactory | UnitType.AnyStarport]) -> bool: 240 """Whether a finished reactor is attached to a barracks, factory or starport.""" 241 return self._has_add_on_of(UnitType.AnyReactor) 242 243 @property 244 def has_tech_lab(self: OwnUnit[UnitType.AnyBarracks | UnitType.AnyFactory | UnitType.AnyStarport]) -> bool: 245 """Whether a finished tech lab is attached to a barracks, factory or starport.""" 246 return self._has_add_on_of(UnitType.AnyTechLab) 247 248 @property 249 def production_capacity(self) -> int: 250 """How many units the unit trains at once: 2 for a structure with a reactor, 1 for another structure the 251 game's tables give as a maker of a unit, and 0 for anything else, an SCV and a larva among them, which make no 252 unit from a queue. A warp gate reads 1, though it warps in without one. Whether the structure is finished is 253 left out. A reactor counts once finished, since the game names a structure's add-on only then (in game): a 254 barracks building its reactor reads 1.""" 255 if self.type_id not in self._tracker.game_data._unit_trainers: 256 return 0 257 return 2 if self._has_add_on_of(UnitType.AnyReactor) else 1 258 259 @property 260 def add_on(self: OwnUnit[UnitType.AnyBarracks | UnitType.AnyFactory | UnitType.AnyStarport]) -> OwnUnit[Any] | None: 261 """The finished add-on of a barracks, factory or starport, or `None`, as while the add-on is built, when it is 262 the host's `construction` (in game).""" 263 return self._attached_add_on 264 265 @property 266 def _attached_add_on(self) -> OwnUnit[Any] | None: 267 """The unit's add-on, or `None`, whatever its type.""" 268 tag = self._latest_report.add_on_tag 269 # An add-on is its structure's owner's. 270 return cast("OwnUnit[Any]", self._tracker.unit_tracker.by_tag(tag)) if tag else None 271 272 def _has_add_on_of(self, add_on_type: type[UnitType.AnyAddOn]) -> bool: 273 """Whether an add-on of `add_on_type`, a type or a group, is attached to the unit, whatever its type.""" 274 add_on = self._attached_add_on 275 return add_on is not None and add_on_type.includes(add_on) 276 277 @property 278 def engaged_target(self) -> Unit[Any] | None: 279 """The unit this unit is attacking, which may be dead or gone out of the observation, or `None`. Also `None` for 280 a target no observation listed, such as a unit created and killed within a step (in game).""" 281 tag = self._latest_report.engaged_target_tag 282 return self._tracker.unit_tracker.get_by_tag(tag) if tag else None 283 284 @property 285 def construction(self) -> OwnUnit[Any] | None: 286 """The unfinished structure the unit is building, a barracks's, factory's or starport's add-on among them, or 287 the one a drone became until it finishes, or `None`, as for a dead unit.""" 288 return self._tracker.builder_tracker.structure_built_by(self) 289 290 @property 291 def builder(self: OwnUnit[UnitType.Structure]) -> OwnUnit[Any] | None: 292 """The unit building this structure, an SCV, a queen planting a creep tumor or an add-on's host, or the drone 293 that became it; `None` for a structure nobody is building: one halted, one warped in, or one finished.""" 294 return self._tracker.builder_tracker.builder_of(self)
One of this player's units. It also reads what the game reports only to a unit's owner.
A unit changes between Unit and OwnUnit in place when it changes sides, as under a neural parasite.
33 def issue( 34 self, 35 ability: AbilityId, 36 *, 37 target: PointLike | Unit[Any] | None = None, 38 queued: bool = False, 39 force: bool = False, 40 ) -> IssuedOrder: 41 """Order the unit to use `ability`, aimed at a point, a unit or nothing, and return the `IssuedOrder`, as 42 `sc2nachos.orders.OrderBook.issue` orders it: `unit.issue(AbilityId.MOVE, target=point)` is 43 `api.orders.issue(unit, AbilityId.MOVE, target=point)`. 44 45 Raises as `OrderBook.issue` does. 46 """ 47 return self._tracker.order_book.issue(self, ability, target=target, queued=queued, force=force)
Order the unit to use ability, aimed at a point, a unit or nothing, and return the IssuedOrder, as
sc2nachos.orders.OrderBook.issue orders it: unit.issue(AbilityId.MOVE, target=point) is
api.orders.issue(unit, AbilityId.MOVE, target=point).
Raises as OrderBook.issue does.
49 def train( 50 self: OwnUnit[UnitType.Structure | UnitType.Larva], 51 unit_type: UnitTypeId, 52 *, 53 target: PointLike | Unit[Any] | None = None, 54 queued: bool = False, 55 force: bool = False, 56 ) -> IssuedOrder: 57 """Order the structure or larva to make a unit of `unit_type` and return the `IssuedOrder`, as 58 `sc2nachos.orders.OrderBook.train` orders it: `barracks.train(UnitTypeId.MARINE)` is 59 `api.orders.train(barracks, UnitTypeId.MARINE)`. 60 61 Raises as `OrderBook.train` does. 62 """ 63 return self._tracker.order_book.train(self, unit_type, target=target, queued=queued, force=force)
Order the structure or larva to make a unit of unit_type and return the IssuedOrder, as
sc2nachos.orders.OrderBook.train orders it: barracks.train(UnitTypeId.MARINE) is
api.orders.train(barracks, UnitTypeId.MARINE).
Raises as OrderBook.train does.
65 def build( 66 self: OwnUnit[UnitType.Worker | UnitType.AnyBarracks | UnitType.AnyFactory | UnitType.AnyStarport], 67 unit_type: UnitTypeId, 68 *, 69 target: PointLike | Unit[Any] | None = None, 70 queued: bool = False, 71 force: bool = False, 72 ) -> IssuedOrder: 73 """Order the worker to make a structure of `unit_type`, or the barracks, factory or starport its add-on, and 74 return the `IssuedOrder`, as `sc2nachos.orders.OrderBook.build` orders it: `scv.build(UnitTypeId.BUNKER, 75 target=site)` is `api.orders.build(scv, UnitTypeId.BUNKER, target=site)`. 76 77 Raises as `OrderBook.build` does. 78 """ 79 return self._tracker.order_book.build(self, unit_type, target=target, queued=queued, force=force)
Order the worker to make a structure of unit_type, or the barracks, factory or starport its add-on, and
return the IssuedOrder, as sc2nachos.orders.OrderBook.build orders it: scv.build(UnitTypeId.BUNKER,
target=site) is api.orders.build(scv, UnitTypeId.BUNKER, target=site).
Raises as OrderBook.build does.
81 def research( 82 self: OwnUnit[UnitType.Structure], upgrade: UpgradeId, *, queued: bool = False, force: bool = False 83 ) -> IssuedOrder: 84 """Order the structure to research `upgrade` and return the `IssuedOrder`, as 85 `sc2nachos.orders.OrderBook.research` orders it: `tech_lab.research(UpgradeId.STIMPACK)` is 86 `api.orders.research(tech_lab, UpgradeId.STIMPACK)`. 87 88 Raises as `OrderBook.research` does: `ValueError` for a barracks given one of its tech lab's upgrades. 89 """ 90 return self._tracker.order_book.research(self, upgrade, queued=queued, force=force)
Order the structure to research upgrade and return the IssuedOrder, as
sc2nachos.orders.OrderBook.research orders it: tech_lab.research(UpgradeId.STIMPACK) is
api.orders.research(tech_lab, UpgradeId.STIMPACK).
Raises as OrderBook.research does: ValueError for a barracks given one of its tech lab's upgrades.
92 @property 93 def orders(self) -> tuple[Order, ...]: 94 """The unit's current order, then its queued orders.""" 95 update = self._tracker.last_changes.update 96 # Read off the snapshot's fields rather than through `at`, to spare a call on the common path. 97 if (cached := self._orders).update == update: 98 return cached.value 99 reported = self._latest_report.orders 100 orders = tuple(Order._from_proto(order, self._unit_target_of_order) for order in reported) 101 self._orders = _Snapshot(orders, update) 102 return orders
The unit's current order, then its queued orders.
104 @property 105 def current_order(self) -> Order | None: 106 """The order the unit is carrying out, the first of `orders`, or `None` for an idle unit.""" 107 orders = self.orders 108 return orders[0] if orders else None
The order the unit is carrying out, the first of orders, or None for an idle unit.
118 @property 119 def is_idle(self) -> bool: 120 """Whether the unit has no orders.""" 121 return not self._latest_report.orders
Whether the unit has no orders.
123 def is_doing(self, abilities: AbilityId | Collection[AbilityId]) -> bool: 124 """Whether the unit's `current_order` carries out `abilities`, one ability or any of several. False for an idle 125 unit.""" 126 # Read off the report: building `orders` to read the first would read every order and look up its target. 127 if not (reported_orders := self._latest_report.orders): 128 return False 129 ability_id = AbilityId.read(reported_orders[0].ability_id) 130 if isinstance(abilities, AbilityId): 131 return ability_id == abilities 132 return ability_id in abilities
Whether the unit's current_order carries out abilities, one ability or any of several. False for an idle
unit.
134 @property 135 def is_moving(self) -> bool: 136 """Whether the unit's current order is a move.""" 137 return self.is_doing(AbilityId.MOVE)
Whether the unit's current order is a move.
139 @property 140 def is_attacking(self) -> bool: 141 """Whether the unit's current order is an attack, on a unit or a point, an attack-move reading as one.""" 142 return self.is_doing(AbilityId.ATTACK)
Whether the unit's current order is an attack, on a unit or a point, an attack-move reading as one.
144 @property 145 def is_gathering(self) -> bool: 146 """Whether the unit's current order is a gather.""" 147 return self.is_doing(AbilityId.GATHER)
Whether the unit's current order is a gather.
149 @property 150 def is_returning(self) -> bool: 151 """Whether the unit's current order is a return of what it carries.""" 152 return self.is_doing(AbilityId.RETURN)
Whether the unit's current order is a return of what it carries.
154 @property 155 def is_repairing(self) -> bool: 156 """Whether the unit's current order is a repair.""" 157 return self.is_doing(AbilityId.REPAIR)
Whether the unit's current order is a repair.
159 @property 160 def is_constructing(self) -> bool: 161 """Whether the unit builds a structure, or walks to the site of one it was ordered to build: it has a 162 `construction`, or its current order's ability places a structure, a barracks building its add-on and a queen 163 placing a creep tumor among them.""" 164 return self.construction is not None or self.is_doing(self._tracker.game_data._placing_abilities)
Whether the unit builds a structure, or walks to the site of one it was ordered to build: it has a
construction, or its current order's ability places a structure, a barracks building its add-on and a queen
placing a creep tumor among them.
166 @property 167 def weapon_cooldown(self) -> GameTime: 168 """The time until the unit can attack again, as the game reports it: the cooldown of its last attack, with the 169 random delay drawn for it, counting down one step each step. Zero for a unit without a weapon; `weapons` says 170 whether it can attack at all. 171 172 It reads 0 too while an attack is under way, for 0 to 6 steps before it by type and up to 8 for an ultralisk, 173 and a move ordered 2 steps or more before the attack cancels it, 1 step before it does not (in game). So a unit 174 that moves between attacks keeps each by waiting for the cooldown to rise, in the step of the attack. 175 `docs/reference/game-behavior/damage-and-buffs.md` has the steps each type reads 0. 176 """ 177 return GameTime(steps=self._latest_report.weapon_cooldown)
The time until the unit can attack again, as the game reports it: the cooldown of its last attack, with the
random delay drawn for it, counting down one step each step. Zero for a unit without a weapon; weapons says
whether it can attack at all.
It reads 0 too while an attack is under way, for 0 to 6 steps before it by type and up to 8 for an ultralisk,
and a move ordered 2 steps or more before the attack cancels it, 1 step before it does not (in game). So a unit
that moves between attacks keeps each by waiting for the cooldown to rise, in the step of the attack.
docs/reference/game-behavior/damage-and-buffs.md has the steps each type reads 0.
179 @property 180 def buff_duration_max(self) -> GameTime | None: 181 """The whole length of the unit's timed life, as a MULE's or a broodling's, or of a timed buff on it, as a 182 hatchery's inject timer, as the game reports it; `None` where it reports none, as for a worker or a townhall 183 (in game; corpus).""" 184 maximum = self._latest_report.buff_duration_max 185 return GameTime(steps=maximum) if maximum else None
The whole length of the unit's timed life, as a MULE's or a broodling's, or of a timed buff on it, as a
hatchery's inject timer, as the game reports it; None where it reports none, as for a worker or a townhall
(in game; corpus).
187 @property 188 def buff_duration_remaining(self) -> GameTime | None: 189 """What is left of `buff_duration_max`, counting down a step at a time; `None` where `buff_duration_max` is. 190 191 It reads zero, not `None`, once run out. It can start above the maximum: a MULE read 1441 and 1443 steps against 192 1440, and a broodling up to 132 against 128. A MULE or a broodling is listed last at zero, against its maximum, 193 and reported dead the step after (in game). 194 `docs/reference/game-behavior/units.md` has the readings. 195 """ 196 report = self._latest_report 197 return GameTime(steps=report.buff_duration_remain) if report.buff_duration_max else None
What is left of buff_duration_max, counting down a step at a time; None where buff_duration_max is.
It reads zero, not None, once run out. It can start above the maximum: a MULE read 1441 and 1443 steps against
1440, and a broodling up to 132 against 128. A MULE or a broodling is listed last at zero, against its maximum,
and reported dead the step after (in game).
docs/reference/game-behavior/units.md has the readings.
199 @property 200 def assigned_harvesters(self: OwnUnit[UnitType.Townhall | UnitType.GasBuilding]) -> int: 201 """The workers mining a town hall's minerals or a gas building's vespene. 0 for anything else.""" 202 return self._latest_report.assigned_harvesters
The workers mining a town hall's minerals or a gas building's vespene. 0 for anything else.
204 @property 205 def ideal_harvesters(self: OwnUnit[UnitType.Townhall | UnitType.GasBuilding]) -> int: 206 """The workers a town hall or gas building can use before another adds nothing: 2 per field, 3 per geyser.""" 207 return self._latest_report.ideal_harvesters
The workers a town hall or gas building can use before another adds nothing: 2 per field, 3 per geyser.
209 @property 210 def passengers(self) -> tuple[Passenger, ...]: 211 """The units inside the unit.""" 212 unit_by_tag = self._tracker.unit_tracker.by_tag 213 return tuple(Passenger._from_proto(passenger, unit_by_tag) for passenger in self._latest_report.passengers)
The units inside the unit.
215 @property 216 def cargo_used(self) -> int: 217 """The cargo slots the passengers fill.""" 218 return self._latest_report.cargo_space_taken
The cargo slots the passengers fill.
220 @property 221 def cargo_max(self) -> int: 222 """The unit's cargo slots. 0 for a unit that carries nothing.""" 223 return self._latest_report.cargo_space_max
The unit's cargo slots. 0 for a unit that carries nothing.
225 @property 226 def rally_targets(self) -> tuple[RallyTarget, ...]: 227 """Where a structure, an egg or a cocoon sends what it makes. Empty for anything else.""" 228 unit_by_tag = self._tracker.unit_tracker.by_tag 229 return tuple(RallyTarget._from_proto(rally, unit_by_tag) for rally in self._latest_report.rally_targets)
Where a structure, an egg or a cocoon sends what it makes. Empty for anything else.
231 @property 232 def is_weapon_ready(self) -> bool: 233 """Whether the unit has a weapon and its `weapon_cooldown` is zero: it can attack now, or is under way with an 234 attack, whose cooldown reads zero until it fires (in game). Its weapons are its `active_weapons`, which an 235 oracle whose beam is off has none of.""" 236 return bool(self.active_weapons) and not self.weapon_cooldown
Whether the unit has a weapon and its weapon_cooldown is zero: it can attack now, or is under way with an
attack, whose cooldown reads zero until it fires (in game). Its weapons are its active_weapons, which an
oracle whose beam is off has none of.
238 @property 239 def has_reactor(self: OwnUnit[UnitType.AnyBarracks | UnitType.AnyFactory | UnitType.AnyStarport]) -> bool: 240 """Whether a finished reactor is attached to a barracks, factory or starport.""" 241 return self._has_add_on_of(UnitType.AnyReactor)
Whether a finished reactor is attached to a barracks, factory or starport.
243 @property 244 def has_tech_lab(self: OwnUnit[UnitType.AnyBarracks | UnitType.AnyFactory | UnitType.AnyStarport]) -> bool: 245 """Whether a finished tech lab is attached to a barracks, factory or starport.""" 246 return self._has_add_on_of(UnitType.AnyTechLab)
Whether a finished tech lab is attached to a barracks, factory or starport.
248 @property 249 def production_capacity(self) -> int: 250 """How many units the unit trains at once: 2 for a structure with a reactor, 1 for another structure the 251 game's tables give as a maker of a unit, and 0 for anything else, an SCV and a larva among them, which make no 252 unit from a queue. A warp gate reads 1, though it warps in without one. Whether the structure is finished is 253 left out. A reactor counts once finished, since the game names a structure's add-on only then (in game): a 254 barracks building its reactor reads 1.""" 255 if self.type_id not in self._tracker.game_data._unit_trainers: 256 return 0 257 return 2 if self._has_add_on_of(UnitType.AnyReactor) else 1
How many units the unit trains at once: 2 for a structure with a reactor, 1 for another structure the game's tables give as a maker of a unit, and 0 for anything else, an SCV and a larva among them, which make no unit from a queue. A warp gate reads 1, though it warps in without one. Whether the structure is finished is left out. A reactor counts once finished, since the game names a structure's add-on only then (in game): a barracks building its reactor reads 1.
259 @property 260 def add_on(self: OwnUnit[UnitType.AnyBarracks | UnitType.AnyFactory | UnitType.AnyStarport]) -> OwnUnit[Any] | None: 261 """The finished add-on of a barracks, factory or starport, or `None`, as while the add-on is built, when it is 262 the host's `construction` (in game).""" 263 return self._attached_add_on
The finished add-on of a barracks, factory or starport, or None, as while the add-on is built, when it is
the host's construction (in game).
277 @property 278 def engaged_target(self) -> Unit[Any] | None: 279 """The unit this unit is attacking, which may be dead or gone out of the observation, or `None`. Also `None` for 280 a target no observation listed, such as a unit created and killed within a step (in game).""" 281 tag = self._latest_report.engaged_target_tag 282 return self._tracker.unit_tracker.get_by_tag(tag) if tag else None
The unit this unit is attacking, which may be dead or gone out of the observation, or None. Also None for
a target no observation listed, such as a unit created and killed within a step (in game).
284 @property 285 def construction(self) -> OwnUnit[Any] | None: 286 """The unfinished structure the unit is building, a barracks's, factory's or starport's add-on among them, or 287 the one a drone became until it finishes, or `None`, as for a dead unit.""" 288 return self._tracker.builder_tracker.structure_built_by(self)
The unfinished structure the unit is building, a barracks's, factory's or starport's add-on among them, or
the one a drone became until it finishes, or None, as for a dead unit.
290 @property 291 def builder(self: OwnUnit[UnitType.Structure]) -> OwnUnit[Any] | None: 292 """The unit building this structure, an SCV, a queen planting a creep tumor or an add-on's host, or the drone 293 that became it; `None` for a structure nobody is building: one halted, one warped in, or one finished.""" 294 return self._tracker.builder_tracker.builder_of(self)
The unit building this structure, an SCV, a queen planting a creep tumor or an add-on's host, or the drone
that became it; None for a structure nobody is building: one halted, one warped in, or one finished.
274@final 275class Point(_PointND, tuple[float, float]): 276 """An immutable 2D point, constructed from an iterable of exactly two coordinates: `Point((3, 4))`. The count is 277 not checked, so a `Point3D` becomes a `Point` through its `ground`, never through `Point(point3d)`. 278 279 A tuple subclass, so it unpacks, hashes and compares like `(x, y)` and works as a dict key. A numpy array combines 280 with a point only through `numpy.asarray(point)`: `positions - point` raises `TypeError`. 281 """ 282 283 __slots__ = () 284 285 @classmethod 286 def _from_proto(cls, data: common_pb2.Point2D | common_pb2.PointI) -> Self: 287 """Read a point from the game's 2D point message.""" 288 return cls((data.x, data.y)) 289 290 @classmethod 291 def _rounded_to_float32(cls, point: PointLike) -> Self: 292 """`point` on the ground as the protocol carries it: its height dropped, and each coordinate cut to a 32-bit 293 float.""" 294 return cls((float(numpy.float32(point[0])), float(numpy.float32(point[1])))) 295 296 def with_height(self, z: float = 0.0) -> Point3D: 297 """The point lifted to height `z`.""" 298 return Point3D((self[0], self[1], z)) 299 300 # Two-coordinate fast paths, quicker than the general implementation and used in per-unit loops. 301 302 def __add__(self, other: PointLike | float) -> Point: # pyright: ignore[reportIncompatibleMethodOverride] 303 if isinstance(other, tuple) and len(other) == 2: 304 return Point((self[0] + other[0], self[1] + other[1])) 305 return super().__add__(other) 306 307 def __sub__(self, other: PointLike | float) -> Point: 308 if isinstance(other, tuple) and len(other) == 2: 309 return Point((self[0] - other[0], self[1] - other[1])) 310 return super().__sub__(other)
An immutable 2D point, constructed from an iterable of exactly two coordinates: Point((3, 4)). The count is
not checked, so a Point3D becomes a Point through its ground, never through Point(point3d).
A tuple subclass, so it unpacks, hashes and compares like (x, y) and works as a dict key. A numpy array combines
with a point only through numpy.asarray(point): positions - point raises TypeError.
12class Race(ReadableIntEnum): 13 """A player's race. `RANDOM` is what a player picks, not what they are given.""" 14 15 NONE = common_pb2.Race.NoRace 16 TERRAN = common_pb2.Race.Terran 17 ZERG = common_pb2.Race.Zerg 18 PROTOSS = common_pb2.Race.Protoss 19 RANDOM = common_pb2.Race.Random 20 21 @property 22 def worker_type(self) -> UnitTypeId: 23 """The race's worker: an SCV, a drone or a probe. Raises `ValueError` for `NONE` and `RANDOM`.""" 24 return _unit_types_of(self).worker 25 26 @property 27 def starting_townhall_type(self) -> UnitTypeId: 28 """The townhall the race starts with: a command center, a hatchery or a nexus. Raises `ValueError` for `NONE` 29 and `RANDOM`.""" 30 return _unit_types_of(self).starting_townhall 31 32 @property 33 def supply_type(self) -> UnitTypeId: 34 """What the race builds or makes for supply: a supply depot, an overlord or a pylon. Raises `ValueError` for 35 `NONE` and `RANDOM`.""" 36 return _unit_types_of(self).supply
A player's race. RANDOM is what a player picks, not what they are given.
163@final 164@dataclass(frozen=True, slots=True) 165class Rectangle(Area): 166 """An axis-aligned rectangle, anchored at its lower left corner. 167 168 `y` grows upward, as in the game, so `top` is the higher edge. A rectangle with no width or no height covers 169 nothing: it is empty, as `Area` has it. 170 """ 171 172 x: float 173 y: float 174 width: float 175 height: float 176 177 def __post_init__(self) -> None: 178 """Rejects a negative extent.""" 179 # Two negatives cancel in `area`, so such a rectangle would report a plausible size while covering nothing. 180 if self.width < 0 or self.height < 0: 181 raise ValueError(f"a rectangle cannot have a negative extent, got {self.width} x {self.height}") 182 183 @classmethod 184 def from_center(cls, center: PointLike, width: float, height: float) -> Rectangle: 185 """The rectangle of the given size centered on a point.""" 186 return cls(center[0] - width / 2, center[1] - height / 2, width, height) 187 188 @classmethod 189 def _from_proto(cls, data: common_pb2.RectangleI) -> Rectangle: 190 """Read a rectangle from the game's `RectangleI`, which holds opposite corners rather than a size.""" 191 return cls(data.p0.x, data.p0.y, data.p1.x - data.p0.x, data.p1.y - data.p0.y) 192 193 @property 194 def left(self) -> float: 195 """The lower x edge.""" 196 return self.x 197 198 @property 199 def bottom(self) -> float: 200 """The lower y edge.""" 201 return self.y 202 203 @property 204 def right(self) -> float: 205 """The upper x edge.""" 206 return self.x + self.width 207 208 @property 209 def top(self) -> float: 210 """The upper y edge.""" 211 return self.y + self.height 212 213 @property 214 def center(self) -> Point: 215 """The midpoint.""" 216 self._raise_if_empty("center") 217 return Point((self.x + self.width / 2, self.y + self.height / 2)) 218 219 @property 220 def _is_empty(self) -> bool: 221 """Whether the rectangle has no width or no height, and so covers nothing.""" 222 return not self.width or not self.height 223 224 def _raise_if_empty(self, what: str) -> None: 225 """Raises `ValueError`, naming `what` it lacks, if the rectangle is empty.""" 226 if self._is_empty: 227 raise ValueError(f"{self!r} covers no ground, so it has no {what}") 228 229 @property 230 def size(self) -> tuple[float, float]: 231 """The extent along each axis.""" 232 return self.width, self.height 233 234 @property 235 def area(self) -> float: 236 """The ground covered, in square game units.""" 237 return self.width * self.height 238 239 @property 240 def perimeter(self) -> float: 241 """The distance around the edge.""" 242 return 2 * (self.width + self.height) 243 244 @property 245 def corners(self) -> tuple[Point, Point, Point, Point]: 246 """The four corners, counter-clockwise from the bottom left.""" 247 return ( 248 Point((self.left, self.bottom)), 249 Point((self.right, self.bottom)), 250 Point((self.right, self.top)), 251 Point((self.left, self.top)), 252 ) 253 254 def __contains__(self, point: PointLike | Tile) -> bool: 255 """Whether a point lies inside, on the lower edges but not the upper ones.""" 256 position = coordinates_or_tile_center(point) 257 # The fields rather than the edge properties, a call each; the arithmetic is the same as `right` and `top`. 258 x, y = self.x, self.y 259 return x <= position[0] < x + self.width and y <= position[1] < y + self.height 260 261 def _contains_each(self, xs: ndarray, ys: ndarray) -> ndarray: 262 """Whether each point lies inside, on the lower edges but not the upper ones.""" 263 x, y = self.x, self.y 264 return (x <= xs) & (xs < x + self.width) & (y <= ys) & (ys < y + self.height) 265 266 def encloses(self, other: Rectangle) -> bool: 267 """Whether the whole of `other` lies inside.""" 268 return ( 269 self.left <= other.left 270 and self.bottom <= other.bottom 271 and self.right >= other.right 272 and self.top >= other.top 273 ) 274 275 def translated(self, offset: PointLike) -> Rectangle: 276 """The rectangle shifted by `offset`, keeping its size. Raises `ValueError` for an offset with a height.""" 277 ground_offset = checked_ground_offset(offset) 278 return Rectangle(self.x + ground_offset[0], self.y + ground_offset[1], self.width, self.height) 279 280 def intersects(self, other: Rectangle) -> bool: 281 """Whether the two rectangles share any ground: never when either is empty.""" 282 if self._is_empty or other._is_empty: 283 return False 284 return not ( 285 self.right <= other.left or self.left >= other.right or self.top <= other.bottom or self.bottom >= other.top 286 ) 287 288 def intersection(self, other: Rectangle) -> Rectangle | None: 289 """The ground both rectangles cover; `None` if they do not overlap.""" 290 left = max(self.left, other.left) 291 bottom = max(self.bottom, other.bottom) 292 right = min(self.right, other.right) 293 top = min(self.top, other.top) 294 if right <= left or top <= bottom: 295 return None 296 return Rectangle(left, bottom, right - left, top - bottom) 297 298 def rounded_out(self) -> Rectangle: 299 """The smallest rectangle on integer coordinates that contains this one.""" 300 left = math.floor(self.left) 301 bottom = math.floor(self.bottom) 302 return Rectangle(left, bottom, math.ceil(self.right) - left, math.ceil(self.top) - bottom) 303 304 def rounded_in(self) -> Rectangle | None: 305 """The largest rectangle on integer coordinates that fits inside this one, `None` if none fits.""" 306 left = math.ceil(self.left) 307 bottom = math.ceil(self.bottom) 308 right = math.floor(self.right) 309 top = math.floor(self.top) 310 if right <= left or top <= bottom: 311 return None 312 return Rectangle(left, bottom, right - left, top - bottom) 313 314 def random_point(self, *, rng: random.Random | None = None) -> Point: 315 """A point drawn uniformly from the rectangle, by `rng` or the `random` module's own generator.""" 316 self._raise_if_empty("points to draw from") 317 uniform = random.uniform if rng is None else rng.uniform 318 x, y = self.x, self.y 319 drawn_x = x + uniform(0, self.width) 320 drawn_y = y + uniform(0, self.height) 321 return _nearest_point_held_within(drawn_x, drawn_y, x, y, x + self.width, y + self.height) 322 323 def closest_point_to(self, point: PointLike) -> tuple[Point, float]: 324 """The point of the rectangle nearest to `point`, and the distance to it, kept off the upper edges as `Area` 325 has it.""" 326 self._raise_if_empty("closest point") 327 x, y = self.x, self.y 328 closest = _nearest_point_held_within(point[0], point[1], x, y, x + self.width, y + self.height) 329 return closest, closest.distance_to(point) 330 331 def bounding_rectangle(self) -> Rectangle: 332 """The rectangle itself.""" 333 self._raise_if_empty("bounding rectangle") 334 return self 335 336 def tile_range(self) -> tuple[range, range]: 337 """The x and y addresses of the tiles the rectangle covers.""" 338 return ( 339 range(math.ceil(self.left - 0.5), math.ceil(self.right - 0.5)), 340 range(math.ceil(self.bottom - 0.5), math.ceil(self.top - 0.5)), 341 ) 342 343 def tile_centers(self, *, offset: PointLike = (0.0, 0.0)) -> ndarray: 344 """The center of every tile the rectangle covers, as an array of shape `(x, y, 2)`. 345 346 Laid out like the tiles themselves, so a mask over the same region indexes it directly. `offset` 347 shifts every point without changing which tiles are covered. 348 """ 349 x_range, y_range = self.tile_range() 350 xs = numpy.arange(x_range.start, x_range.stop) + 0.5 + offset[0] 351 ys = numpy.arange(y_range.start, y_range.stop) + 0.5 + offset[1] 352 return numpy.stack(numpy.meshgrid(xs, ys, indexing="ij"), axis=-1) 353 354 def tiles(self) -> TileSet: 355 """Every tile whose center the rectangle contains.""" 356 x_range, y_range = self.tile_range() 357 return TileSet._from_addresses((x, y) for x in x_range for y in y_range) 358 359 def _overlapped_tile_mask(self) -> TileMask: 360 """Every tile whose inside the rectangle overlaps.""" 361 first_x = math.floor(self.x) 362 first_y = math.floor(self.y) 363 if self._is_empty: 364 return TileMask(Tile(first_x, first_y), numpy.zeros((0, 0), dtype=bool)) 365 columns = math.ceil(self.right) - first_x 366 rows = math.ceil(self.top) - first_y 367 return TileMask(Tile(first_x, first_y), numpy.ones((columns, rows), dtype=bool))
An axis-aligned rectangle, anchored at its lower left corner.
y grows upward, as in the game, so top is the higher edge. A rectangle with no width or no height covers
nothing: it is empty, as Area has it.
183 @classmethod 184 def from_center(cls, center: PointLike, width: float, height: float) -> Rectangle: 185 """The rectangle of the given size centered on a point.""" 186 return cls(center[0] - width / 2, center[1] - height / 2, width, height)
The rectangle of the given size centered on a point.
203 @property 204 def right(self) -> float: 205 """The upper x edge.""" 206 return self.x + self.width
The upper x edge.
208 @property 209 def top(self) -> float: 210 """The upper y edge.""" 211 return self.y + self.height
The upper y edge.
213 @property 214 def center(self) -> Point: 215 """The midpoint.""" 216 self._raise_if_empty("center") 217 return Point((self.x + self.width / 2, self.y + self.height / 2))
The midpoint.
229 @property 230 def size(self) -> tuple[float, float]: 231 """The extent along each axis.""" 232 return self.width, self.height
The extent along each axis.
234 @property 235 def area(self) -> float: 236 """The ground covered, in square game units.""" 237 return self.width * self.height
The ground covered, in square game units.
239 @property 240 def perimeter(self) -> float: 241 """The distance around the edge.""" 242 return 2 * (self.width + self.height)
The distance around the edge.
244 @property 245 def corners(self) -> tuple[Point, Point, Point, Point]: 246 """The four corners, counter-clockwise from the bottom left.""" 247 return ( 248 Point((self.left, self.bottom)), 249 Point((self.right, self.bottom)), 250 Point((self.right, self.top)), 251 Point((self.left, self.top)), 252 )
The four corners, counter-clockwise from the bottom left.
266 def encloses(self, other: Rectangle) -> bool: 267 """Whether the whole of `other` lies inside.""" 268 return ( 269 self.left <= other.left 270 and self.bottom <= other.bottom 271 and self.right >= other.right 272 and self.top >= other.top 273 )
Whether the whole of other lies inside.
275 def translated(self, offset: PointLike) -> Rectangle: 276 """The rectangle shifted by `offset`, keeping its size. Raises `ValueError` for an offset with a height.""" 277 ground_offset = checked_ground_offset(offset) 278 return Rectangle(self.x + ground_offset[0], self.y + ground_offset[1], self.width, self.height)
The rectangle shifted by offset, keeping its size. Raises ValueError for an offset with a height.
280 def intersects(self, other: Rectangle) -> bool: 281 """Whether the two rectangles share any ground: never when either is empty.""" 282 if self._is_empty or other._is_empty: 283 return False 284 return not ( 285 self.right <= other.left or self.left >= other.right or self.top <= other.bottom or self.bottom >= other.top 286 )
Whether the two rectangles share any ground: never when either is empty.
288 def intersection(self, other: Rectangle) -> Rectangle | None: 289 """The ground both rectangles cover; `None` if they do not overlap.""" 290 left = max(self.left, other.left) 291 bottom = max(self.bottom, other.bottom) 292 right = min(self.right, other.right) 293 top = min(self.top, other.top) 294 if right <= left or top <= bottom: 295 return None 296 return Rectangle(left, bottom, right - left, top - bottom)
The ground both rectangles cover; None if they do not overlap.
298 def rounded_out(self) -> Rectangle: 299 """The smallest rectangle on integer coordinates that contains this one.""" 300 left = math.floor(self.left) 301 bottom = math.floor(self.bottom) 302 return Rectangle(left, bottom, math.ceil(self.right) - left, math.ceil(self.top) - bottom)
The smallest rectangle on integer coordinates that contains this one.
304 def rounded_in(self) -> Rectangle | None: 305 """The largest rectangle on integer coordinates that fits inside this one, `None` if none fits.""" 306 left = math.ceil(self.left) 307 bottom = math.ceil(self.bottom) 308 right = math.floor(self.right) 309 top = math.floor(self.top) 310 if right <= left or top <= bottom: 311 return None 312 return Rectangle(left, bottom, right - left, top - bottom)
The largest rectangle on integer coordinates that fits inside this one, None if none fits.
314 def random_point(self, *, rng: random.Random | None = None) -> Point: 315 """A point drawn uniformly from the rectangle, by `rng` or the `random` module's own generator.""" 316 self._raise_if_empty("points to draw from") 317 uniform = random.uniform if rng is None else rng.uniform 318 x, y = self.x, self.y 319 drawn_x = x + uniform(0, self.width) 320 drawn_y = y + uniform(0, self.height) 321 return _nearest_point_held_within(drawn_x, drawn_y, x, y, x + self.width, y + self.height)
A point drawn uniformly from the rectangle, by rng or the random module's own generator.
323 def closest_point_to(self, point: PointLike) -> tuple[Point, float]: 324 """The point of the rectangle nearest to `point`, and the distance to it, kept off the upper edges as `Area` 325 has it.""" 326 self._raise_if_empty("closest point") 327 x, y = self.x, self.y 328 closest = _nearest_point_held_within(point[0], point[1], x, y, x + self.width, y + self.height) 329 return closest, closest.distance_to(point)
The point of the rectangle nearest to point, and the distance to it, kept off the upper edges as Area
has it.
331 def bounding_rectangle(self) -> Rectangle: 332 """The rectangle itself.""" 333 self._raise_if_empty("bounding rectangle") 334 return self
The rectangle itself.
336 def tile_range(self) -> tuple[range, range]: 337 """The x and y addresses of the tiles the rectangle covers.""" 338 return ( 339 range(math.ceil(self.left - 0.5), math.ceil(self.right - 0.5)), 340 range(math.ceil(self.bottom - 0.5), math.ceil(self.top - 0.5)), 341 )
The x and y addresses of the tiles the rectangle covers.
343 def tile_centers(self, *, offset: PointLike = (0.0, 0.0)) -> ndarray: 344 """The center of every tile the rectangle covers, as an array of shape `(x, y, 2)`. 345 346 Laid out like the tiles themselves, so a mask over the same region indexes it directly. `offset` 347 shifts every point without changing which tiles are covered. 348 """ 349 x_range, y_range = self.tile_range() 350 xs = numpy.arange(x_range.start, x_range.stop) + 0.5 + offset[0] 351 ys = numpy.arange(y_range.start, y_range.stop) + 0.5 + offset[1] 352 return numpy.stack(numpy.meshgrid(xs, ys, indexing="ij"), axis=-1)
The center of every tile the rectangle covers, as an array of shape (x, y, 2).
Laid out like the tiles themselves, so a mask over the same region indexes it directly. offset
shifts every point without changing which tiles are covered.
65@final 66@dataclass(frozen=True, slots=True) 67class ReplayPlayback: 68 """A replay being played back, on a game client or from a recording, for its observations to be read straight from 69 the protocol.""" 70 71 client: Client 72 """The connection, in the replay at its start, before its first observation. It answers what the game answers in a 73 game, observations, steps, the game's info and data among them, as the player played for saw the game, and refuses 74 every action and debug command (in game).""" 75 info: sc2api_pb2.ResponseReplayInfo 76 """What the game read from the replay: its map, its length, the build it was played on and its players."""
A replay being played back, on a game client or from a recording, for its observations to be read straight from the protocol.
The connection, in the replay at its start, before its first observation. It answers what the game answers in a game, observations, steps, the game's info and data among them, as the player played for saw the game, and refuses every action and debug command (in game).
10@final 11@dataclass(frozen=True, slots=True) 12class Resources: 13 """An amount of minerals and vespene: spent, held, earned or averaged. 14 15 Whole when it comes from the game or from adding such amounts up; fractional once scaled or divided. 16 """ 17 18 minerals: float 19 """Minerals.""" 20 vespene: float 21 """Vespene.""" 22 23 @property 24 def total(self) -> float: 25 """Minerals plus vespene, counted alike.""" 26 return self.minerals + self.vespene 27 28 def __add__(self, other: Resources) -> Resources: 29 """The sum of the two amounts.""" 30 return Resources(self.minerals + other.minerals, self.vespene + other.vespene) 31 32 def __sub__(self, other: Resources) -> Resources: 33 """This amount less `other`; negative where `other` is more.""" 34 return Resources(self.minerals - other.minerals, self.vespene - other.vespene) 35 36 def __neg__(self) -> Resources: 37 """This amount negated: owed rather than held.""" 38 return Resources(-self.minerals, -self.vespene) 39 40 def __mul__(self, factor: float) -> Resources: 41 """This amount `factor` times over.""" 42 return Resources(self.minerals * factor, self.vespene * factor) 43 44 def __rmul__(self, factor: float) -> Resources: 45 """This amount `factor` times over.""" 46 return self * factor 47 48 def __truediv__(self, divisor: float) -> Resources: 49 """This amount divided by `divisor`.""" 50 return Resources(self.minerals / divisor, self.vespene / divisor) 51 52 def covers(self, other: Resources) -> bool: 53 """Whether this amount is at least `other` in both minerals and vespene.""" 54 return self.minerals >= other.minerals and self.vespene >= other.vespene 55 56 def minimum(self, other: Resources) -> Resources: 57 """The smaller of the two amounts of each resource, each on its own: 75/50 of 100/50 and 75/80.""" 58 return Resources(min(self.minerals, other.minerals), min(self.vespene, other.vespene)) 59 60 def maximum(self, other: Resources) -> Resources: 61 """The larger of the two amounts of each resource; `maximum(Resources(0, 0))` drops what is owed.""" 62 return Resources(max(self.minerals, other.minerals), max(self.vespene, other.vespene))
An amount of minerals and vespene: spent, held, earned or averaged.
Whole when it comes from the game or from adding such amounts up; fractional once scaled or divided.
23 @property 24 def total(self) -> float: 25 """Minerals plus vespene, counted alike.""" 26 return self.minerals + self.vespene
Minerals plus vespene, counted alike.
52 def covers(self, other: Resources) -> bool: 53 """Whether this amount is at least `other` in both minerals and vespene.""" 54 return self.minerals >= other.minerals and self.vespene >= other.vespene
Whether this amount is at least other in both minerals and vespene.
56 def minimum(self, other: Resources) -> Resources: 57 """The smaller of the two amounts of each resource, each on its own: 75/50 of 100/50 and 75/80.""" 58 return Resources(min(self.minerals, other.minerals), min(self.vespene, other.vespene))
The smaller of the two amounts of each resource, each on its own: 75/50 of 100/50 and 75/80.
60 def maximum(self, other: Resources) -> Resources: 61 """The larger of the two amounts of each resource; `maximum(Resources(0, 0))` drops what is owed.""" 62 return Resources(max(self.minerals, other.minerals), max(self.vespene, other.vespene))
The larger of the two amounts of each resource; maximum(Resources(0, 0)) drops what is owed.
62class Result(ReadableIntEnum): 63 """How a match ended, from one player's point of view.""" 64 65 VICTORY = sc2api_pb2.Result.Victory 66 DEFEAT = sc2api_pb2.Result.Defeat 67 TIE = sc2api_pb2.Result.Tie 68 UNDECIDED = sc2api_pb2.Result.Undecided
How a match ended, from one player's point of view.
164@final 165@dataclass(frozen=True, slots=True, kw_only=True) 166class StartLocation(Expansion): 167 """An expansion a player starts the game at, with the ground of its main, the ramp out of it, its natural and its 168 two thirds. 169 170 It is found once, as the game begins, and none of it changes. Its natural and thirds are walked to over the ground 171 as the game began with every mineral field and geyser on it, which the game's pathing grid leaves out but for this 172 player's own (in game), and never where a player starts. 173 """ 174 175 main_area: TileSet 176 """The ground of the main, its `plateau()`: every tile within half a level of the height at `center`, walkable as 177 the game began, joined side by side to `center` without crossing a ramp.""" 178 _main_ramp: Ramp | None = field(repr=False, compare=False) 179 _natural: Expansion | None = field(repr=False, compare=False) 180 _line_third: Expansion | None = field(repr=False, compare=False) 181 _triangle_third: Expansion | None = field(repr=False, compare=False) 182 183 @property 184 def main_ramp(self) -> Ramp: 185 """The ramp out of the main: of the ramps whose top is at the main's level, within half a level of the height 186 at `center`'s tile, the one whose center is the shortest walk from `center`, and of two as short, the first in 187 tile order. The walk is over the game's pathing grid as the game began, with the ground the start's townhall 188 covers opened. Raises `NoMainRampError` where no such ramp can be walked to.""" 189 if self._main_ramp is None: 190 raise NoMainRampError(f"no ramp out of the main at {self.center} can be walked to") 191 return self._main_ramp 192 193 @property 194 def natural(self) -> Expansion: 195 """The expansion nearest `center` by pathing distance where no player starts, and of two as near, the nearer in 196 a straight line. Raises `NoExpansionError` where no such expansion can be walked to, as on a map drawn for a 197 test.""" 198 if self._natural is None: 199 raise NoExpansionError(f"no expansion where no player starts can be walked to from {self.center}") 200 return self._natural 201 202 @property 203 def line_third(self) -> Expansion: 204 """The third along the way from the main through the natural: of the two full bases nearest the natural by 205 pathing distance where no player starts, the one whose straight-line distance to `center` is the larger against 206 its straight-line distance to the playable area's nearest edge. A full base has 8 mineral fields or more and 2 207 geysers. Raises `NoExpansionError` where fewer than two such bases can be walked to from the natural.""" 208 if self._line_third is None: 209 raise NoExpansionError(f"fewer than two full bases can be walked to from the natural of {self.center}") 210 return self._line_third 211 212 @property 213 def triangle_third(self) -> Expansion: 214 """The third beside the main and the natural: of the two `line_third` is chosen from, the other. Raises 215 `NoExpansionError` as `line_third` does.""" 216 if self._triangle_third is None: 217 raise NoExpansionError(f"fewer than two full bases can be walked to from the natural of {self.center}") 218 return self._triangle_third 219 220 @classmethod 221 def _from_expansion( 222 cls, expansion: Expansion, *, ground: Grid[bool], candidates: Sequence[Expansion], from_center: Grid[float] 223 ) -> Self: 224 """The start location `expansion` is, walked from over `ground`: its natural and thirds the nearest of 225 `candidates`, the expansions where no player starts, by the pathing distances `from_center` holds.""" 226 center = expansion.center 227 line_third = triangle_third = None 228 natural = next(iter(_nearest_by_walking(candidates, center, from_center)), None) 229 if natural is not None: 230 from_natural = _walking_distances(ground, natural.center) 231 full_bases = [candidate for candidate in candidates if candidate is not natural and candidate._is_full_base] 232 thirds = _nearest_by_walking(full_bases, natural.center, from_natural)[:2] 233 if len(thirds) == 2: 234 playable_area = expansion._game_map.playable_area 235 line_third, triangle_third = sorted( 236 thirds, key=lambda third: -_how_far_out_along_the_edge(third.center, center, playable_area) 237 ) 238 return cls( 239 center=center, 240 mineral_fields=expansion.mineral_fields, 241 geysers=expansion.geysers, 242 pathing_distance_from_start=expansion.pathing_distance_from_start, 243 main_area=expansion.plateau(), 244 _main_ramp=expansion._game_map._main_ramp_of(center), 245 _natural=natural, 246 _line_third=line_third, 247 _triangle_third=triangle_third, 248 _game_map=expansion._game_map, 249 _unit_tracker=expansion._unit_tracker, 250 ) 251 252 @classmethod 253 def _find_at(cls, expansions: Iterable[Expansion], point: Point) -> Self | None: 254 """The start location of `expansions` whose townhall goes at `point`, or `None` if there is none.""" 255 return next( 256 (expansion for expansion in expansions if isinstance(expansion, cls) and expansion.center == point), None 257 ) 258 259 @classmethod 260 def _find_at_opponent_starts(cls, expansions: Iterable[Expansion], game_map: GameMap) -> tuple[Self | None, ...]: 261 """The start location of `expansions` at each of `game_map`'s start locations but this player's, in the map's 262 order: `None` for one no expansion's townhall goes at.""" 263 return tuple(cls._find_at(expansions, start) for start in game_map.opponent_start_locations)
An expansion a player starts the game at, with the ground of its main, the ramp out of it, its natural and its two thirds.
It is found once, as the game begins, and none of it changes. Its natural and thirds are walked to over the ground as the game began with every mineral field and geyser on it, which the game's pathing grid leaves out but for this player's own (in game), and never where a player starts.
183 @property 184 def main_ramp(self) -> Ramp: 185 """The ramp out of the main: of the ramps whose top is at the main's level, within half a level of the height 186 at `center`'s tile, the one whose center is the shortest walk from `center`, and of two as short, the first in 187 tile order. The walk is over the game's pathing grid as the game began, with the ground the start's townhall 188 covers opened. Raises `NoMainRampError` where no such ramp can be walked to.""" 189 if self._main_ramp is None: 190 raise NoMainRampError(f"no ramp out of the main at {self.center} can be walked to") 191 return self._main_ramp
The ramp out of the main: of the ramps whose top is at the main's level, within half a level of the height
at center's tile, the one whose center is the shortest walk from center, and of two as short, the first in
tile order. The walk is over the game's pathing grid as the game began, with the ground the start's townhall
covers opened. Raises NoMainRampError where no such ramp can be walked to.
193 @property 194 def natural(self) -> Expansion: 195 """The expansion nearest `center` by pathing distance where no player starts, and of two as near, the nearer in 196 a straight line. Raises `NoExpansionError` where no such expansion can be walked to, as on a map drawn for a 197 test.""" 198 if self._natural is None: 199 raise NoExpansionError(f"no expansion where no player starts can be walked to from {self.center}") 200 return self._natural
The expansion nearest center by pathing distance where no player starts, and of two as near, the nearer in
a straight line. Raises NoExpansionError where no such expansion can be walked to, as on a map drawn for a
test.
202 @property 203 def line_third(self) -> Expansion: 204 """The third along the way from the main through the natural: of the two full bases nearest the natural by 205 pathing distance where no player starts, the one whose straight-line distance to `center` is the larger against 206 its straight-line distance to the playable area's nearest edge. A full base has 8 mineral fields or more and 2 207 geysers. Raises `NoExpansionError` where fewer than two such bases can be walked to from the natural.""" 208 if self._line_third is None: 209 raise NoExpansionError(f"fewer than two full bases can be walked to from the natural of {self.center}") 210 return self._line_third
The third along the way from the main through the natural: of the two full bases nearest the natural by
pathing distance where no player starts, the one whose straight-line distance to center is the larger against
its straight-line distance to the playable area's nearest edge. A full base has 8 mineral fields or more and 2
geysers. Raises NoExpansionError where fewer than two such bases can be walked to from the natural.
212 @property 213 def triangle_third(self) -> Expansion: 214 """The third beside the main and the natural: of the two `line_third` is chosen from, the other. Raises 215 `NoExpansionError` as `line_third` does.""" 216 if self._triangle_third is None: 217 raise NoExpansionError(f"fewer than two full bases can be walked to from the natural of {self.center}") 218 return self._triangle_third
The third beside the main and the natural: of the two line_third is chosen from, the other. Raises
NoExpansionError as line_third does.
75class Unit[K: UnitType.AnyType]: 76 """A unit of the game: one object under one id for the whole game, reading as the game last reported it. 77 78 Position, type and visibility read as of the last observation that listed the unit. Everything else reads as 79 of the last observation that showed it visible, `last_seen`, and raises `NotReportedError` for a unit never 80 shown visible. A structure out of sight stays in the observation as `IN_FOG`. A unit the observation 81 leaves out is unlisted, `is_listed` false: it keeps its last values, and is observed under the same id again if it 82 comes back. 83 84 `K` is the unit's `UnitType` for the type checker. A read only some types have is typed for them alone, as 85 `mineral_contents` is for a mineral field, and is an error on a unit typed as another type or as a group wider than 86 them. A unit typed `Unit[Any]` reads as any type. 87 """ 88 89 # `OwnUnit` declares no slots, so a unit can change between the two classes in place. `__weakref__` lets a bot 90 # refer to a unit weakly, which slots would otherwise rule out. A `WeakKeyDictionary` keyed by unit still keeps a 91 # dead unit's entry all game, as the tracker keeps every unit it has seen; a `UnitDict` forgets it. 92 __slots__ = ( 93 "__weakref__", 94 "_damage_taken", 95 "_dead", 96 "_first_seen", 97 "_hallucination_confirmed", 98 "_id", 99 "_latest_report", 100 "_last_seen", 101 "_latest_visible_report", 102 "_listed", 103 "_order_targets", 104 "_orders", 105 "_own", 106 "_position", 107 "_previous_position", 108 "_previous_report", 109 "_previous_step", 110 "_raw_alliance", 111 "_raw_type", 112 "_radius_footprint", 113 "_step", 114 "_tag", 115 "_tracker", 116 "_type_id", 117 ) 118 119 _tracker: _Tracker 120 _id: int 121 _tag: int 122 _latest_report: raw_pb2.Unit 123 _latest_visible_report: raw_pb2.Unit | None 124 _last_seen: int | None 125 # The step of the first observation that showed the unit visible, or `None` before one has. 126 _first_seen: int | None 127 # The alliance of the latest report, as the protocol numbers it, read once per report. 128 _raw_alliance: int 129 _raw_type: int 130 _type_id: UnitTypeId 131 _position: Point 132 _own: bool 133 _step: int 134 # Where the unit was at the last step before its latest, and that step, for `velocity`. Kept while the unit is out 135 # of the observation, and across a second observation at one step; let go as it comes back. 136 _previous_position: Point | None 137 _previous_step: int 138 # The report of the observation just before, for `damage_taken`, at every update. Let go as the unit leaves the 139 # observation, so it keeps that one observation alive and no other. 140 _previous_report: raw_pb2.Unit | None 141 # `damage_taken` as last worked out, with the tracker update it was worked out at. 142 _damage_taken: _Snapshot[float | None] 143 _listed: bool 144 _dead: bool 145 # Whether the enemy's unit was once reported a hallucination, which the game flags only while a detector is near 146 # (in game). 147 _hallucination_confirmed: bool 148 # The square its radius spans, kept once made, for a type of the map's own with no footprint measured. 149 _radius_footprint: Footprint | None 150 # For each ability, the unit this unit's latest order of that ability was aimed at, kept while the game names 151 # that unit by a tag it reports. Read when an order names a tag the game never reports. Keyed by the ability's raw 152 # id; `None` until an order is aimed at a unit. 153 _order_targets: dict[int, Unit[Any]] | None 154 # `OwnUnit.orders` as last read, with the tracker update it was read at, kept here since `OwnUnit` declares no 155 # slots of its own. It holds no report, so it keeps no observation alive. 156 _orders: _Snapshot[tuple[Order, ...]] 157 158 def __init__(self, report: raw_pb2.Unit, tracker: _Tracker, unit_id: int, step: int) -> None: 159 self._tracker = tracker 160 self._id = unit_id 161 self._tag = report.tag 162 self._latest_report = report 163 self._latest_visible_report = report if report.display_type == _VISIBLE else None 164 # Set only for a unit not visible; a visible unit was last seen at its last observation. 165 self._last_seen = None 166 self._first_seen = step if report.display_type == _VISIBLE else None 167 self._position = Point((report.pos.x, report.pos.y)) 168 self._raw_alliance = report.alliance 169 self._own = self._raw_alliance == _OWN_ALLIANCE 170 self._step = step 171 self._previous_position = None 172 self._previous_report = None 173 self._previous_step = step 174 self._damage_taken = _Snapshot(None) 175 self._listed = True 176 self._dead = False 177 self._hallucination_confirmed = not self._own and report.display_type == _VISIBLE and report.is_hallucination 178 self._radius_footprint = None 179 self._order_targets = None 180 self._orders = _Snapshot(()) 181 self._update_unit_type(report.unit_type) 182 183 def _update(self, report: raw_pb2.Unit, step: int) -> _SideOrTypeChange | None: 184 """Read this unit's report from the observation at `step`, under the tag it had before. Returns what the report 185 changed of its side and type, or `None` if it changed neither. 186 187 The tracker sets `_tag` itself when the unit is observed under a new one. 188 """ 189 position = self._position 190 last_step = self._step 191 if not self._listed: 192 # Back in the observation. How it moved while away is not known. 193 self._listed = True 194 self._previous_position = None 195 else: 196 # A unit is updated once an observation, so this is the report of the observation before. 197 self._previous_report = self._latest_report 198 if step != last_step: 199 self._previous_position = position 200 self._previous_step = last_step 201 self._step = step 202 reported = report.pos 203 x, y = reported.x, reported.y 204 # Most units stand still, and comparing is faster than building a new point. 205 if x != position[0] or y != position[1]: 206 self._position = Point((x, y)) 207 if report.display_type == _VISIBLE: 208 if self._first_seen is None: 209 self._first_seen = step 210 self._latest_visible_report = report 211 if not self._own and not self._hallucination_confirmed: 212 self._hallucination_confirmed = report.is_hallucination 213 elif self._latest_visible_report is self._latest_report: 214 # Just stopped being visible: the last sighting must outlive the observation it came in. 215 self._latest_visible_report = _copy(self._latest_report) 216 self._last_seen = last_step 217 previous_alliance = None if report.alliance == self._raw_alliance else self._update_alliance(report.alliance) 218 # The game reports orders for this player's units alone. 219 if self._own and (orders := self._latest_report.orders): 220 self._remember_order_targets(orders) 221 self._latest_report = report 222 if report.unit_type == self._raw_type: 223 return None if previous_alliance is None else _SideOrTypeChange(previous_alliance, None) 224 return _SideOrTypeChange(previous_alliance, self._morph_into(report.unit_type)) 225 226 def _remember_order_targets(self, orders: Iterable[raw_pb2.UnitOrder]) -> None: 227 """Keep, by ability, the unit each of `orders`, the latest report's, names under a tag the game has reported.""" 228 targets = self._order_targets 229 for order in orders: 230 tag = order.target_unit_tag 231 if not tag: 232 continue 233 # Most orders name the unit the last one did, under the tag it still has. 234 if targets is not None and (known := targets.get(order.ability_id)) is not None and known._tag == tag: 235 continue 236 if (unit := self._tracker.unit_tracker.get_by_tag(tag)) is not None: 237 if targets is None: 238 targets = self._order_targets = {} 239 targets[order.ability_id] = unit 240 241 def _mark_unlisted(self) -> None: 242 """Mark the unit unlisted: out of the observation, keeping its last values without keeping that observation 243 alive.""" 244 self._listed = False 245 self._previous_report = None 246 report = self._latest_report 247 copy = _copy(report) 248 if self._latest_visible_report is report: 249 self._latest_visible_report = copy 250 self._latest_report = copy 251 252 def _mark_dead(self) -> None: 253 """Mark the unit dead: out of the observation for good.""" 254 if self._listed: 255 self._mark_unlisted() 256 self._dead = True 257 258 def _update_unit_type(self, raw_type: int) -> None: 259 """Set the unit's type to `raw_type`. This is the one place a type is set, on creation and at every morph. 260 261 Raises `UncuratedIdError`, as the observation is taken in, for a type the curated ids leave out: a type the 262 game reports belongs among them. 263 """ 264 self._raw_type = raw_type 265 self._type_id = UnitTypeId.read(raw_type) 266 267 def _morph_into(self, raw_type: int) -> UnitTypeId: 268 """Set the unit's type to `raw_type`, a report's other than the last. Returns the type before.""" 269 previous_type = self._type_id 270 self._update_unit_type(raw_type) 271 return previous_type 272 273 def _update_alliance(self, raw_alliance: int) -> Alliance | None: 274 """Set the unit's alliance to `raw_alliance`, a report's other than the last, as the protocol numbers it. 275 Returns the alliance before if the unit changed sides, to or from this player's, or `None` if it did not. 276 277 A unit that changes sides changes class with them, to `OwnUnit` or back, as when a neural parasite takes it 278 over or lets it go. 279 """ 280 previous_alliance = None 281 if (raw_alliance == _OWN_ALLIANCE) is not self._own: 282 from sc2nachos.units._own_unit import OwnUnit 283 284 previous_alliance = _ALLIANCES[self._raw_alliance] 285 self._own = not self._own 286 # Assigning `self.__class__` directly type-checks only for a class of `Self`. 287 object.__setattr__(self, "__class__", OwnUnit if self._own else Unit) 288 self._raw_alliance = raw_alliance 289 return previous_alliance 290 291 def _never_seen_error(self, what: str) -> NotReportedError: 292 """The error for reading `what` from a unit the game has never shown visible.""" 293 return NotReportedError(f"the game never showed {self!r} visible, so it never reported its {what}") 294 295 def __repr__(self) -> str: 296 state = ", dead" if self._dead else "" if self._listed else ", unlisted" 297 return f"{type(self).__name__}({self._type_id.name}, id={self._id}, at {self._position}{state})" 298 299 # Identity. 300 301 @property 302 def id(self) -> int: 303 """NachOS's id for this unit, the same for the whole game. 304 305 The first digit is the unit's alliance when first seen, `Alliance.OWN` being 1 and `Alliance.ENEMY` 4. The 306 rest counts that alliance's units in the order they were first seen; in a replay played back with the fog off, 307 in the order the game first listed them, so that the unit is under the same id in `Api.all_units`. 308 """ 309 return self._id 310 311 @property 312 def first_alliance(self) -> Alliance: 313 """Whose side the unit was on when first seen, as its `id` records. A unit of this player's under a neural 314 parasite reads `Alliance.ENEMY` for `alliance` and `Alliance.OWN` here, and still takes this player's 315 supply.""" 316 return _ALLIANCES[self._id // _IDS_PER_ALLIANCE] 317 318 @property 319 def tag(self) -> int: 320 """The game's current tag for this unit. A structure's tag changes each time it goes out of sight.""" 321 return self._tag 322 323 @property 324 def type_id(self) -> UnitTypeId: 325 """The unit's type.""" 326 return self._type_id 327 328 @property 329 def alliance(self) -> Alliance: 330 """Whose side the unit is on.""" 331 return _ALLIANCES[self._raw_alliance] 332 333 @property 334 def is_own(self) -> bool: 335 """Whether the unit is this player's.""" 336 return self._raw_alliance == _OWN_ALLIANCE 337 338 @property 339 def is_enemy(self) -> bool: 340 """Whether the unit is the enemy's.""" 341 return self._raw_alliance == _ENEMY_ALLIANCE 342 343 @property 344 def owner_id(self) -> int: 345 """The id of the player the unit belongs to. 16 for the map's own units.""" 346 if (report := self._latest_visible_report) is None: 347 raise self._never_seen_error("owner") 348 return report.owner 349 350 # Whether the game still reports it. 351 352 @property 353 def is_listed(self) -> bool: 354 """Whether the last observation listed the unit: in sight and seen, in sight but cloaked and undetected, or a 355 structure remembered in the fog. Not once it went out of sight, or burrowed undetected, as a zergling does, or 356 went into a transport, a gas building or a structure it is becoming, as a drone does, nor once it died. 357 `is_visible` is the first of these alone.""" 358 return self._listed 359 360 @property 361 def is_dead(self) -> bool: 362 """Whether the unit is dead: reported dead, or a structure that cannot lift off or uproot gone from its spot. 363 364 The game reports only the deaths a player can see. A structure that dies out of sight is found dead when its 365 spot comes back into sight without it. A unit of this player's that became a structure, as a drone does, is 366 dead once that structure finishes, or once it dies without the unit coming back from a cancel. A dead unit is 367 never listed again. 368 """ 369 return self._dead 370 371 @property 372 def is_alive(self) -> bool: 373 """Whether the unit is not known to be dead: the opposite of `is_dead`. True for an enemy's unit that died out 374 of sight, whose death the game never reports, until NachOS finds it dead, as `is_dead` says for a structure.""" 375 return not self._dead 376 377 @property 378 def is_orderable(self) -> bool: 379 """Whether this player can order the unit now: the last observation listed it as this player's. Not while it 380 is inside a gas building or a transport, nor under a neural parasite, which makes it an enemy `Unit`, nor once 381 it is dead. Read it before ordering a unit kept from an earlier observation, or reading what only `OwnUnit` 382 has. It goes by the listing alone, so a reaper's grenade and a parasitic bomb left behind, each listed as its 383 caster's, read orderable.""" 384 return self._listed and self._own 385 386 @property 387 def first_seen(self) -> GameTime | None: 388 """The time of the first observation that showed the unit visible, or `None` if none has, as for `last_seen`. 389 A structure remembered under a new tag keeps it, as it keeps its `id`. Later than `EnemyUnitFirstSeenEvent` for 390 an enemy's unit first listed in the fog or undetected, which that event counts as first seen.""" 391 return None if self._first_seen is None else GameTime(steps=self._first_seen) 392 393 @property 394 def last_seen(self) -> GameTime | None: 395 """The time of the last observation that showed the unit visible, or `None` if none has.""" 396 if self._latest_report.display_type == _VISIBLE: 397 return GameTime(steps=self._step) 398 return None if self._last_seen is None else GameTime(steps=self._last_seen) 399 400 # Where it is. 401 402 @property 403 def position(self) -> Point: 404 """The unit's position on the ground plane.""" 405 return self._position 406 407 @property 408 def height(self) -> float: 409 """The unit's height, on the scale of the map's terrain heights.""" 410 return self._latest_report.pos.z 411 412 @property 413 def radius(self) -> float: 414 """The radius of the circle the unit takes up around its position.""" 415 return self._latest_report.radius 416 417 @property 418 def facing(self) -> float: 419 """The direction the unit faces, in radians from the positive x-axis.""" 420 if (report := self._latest_visible_report) is None: 421 raise self._never_seen_error("facing") 422 return report.facing 423 424 @property 425 def velocity(self) -> Point | None: 426 """The unit's velocity between its last two observations, in distance per second. 427 428 `None` for a unit observed only once since it was first seen or since it came back. 429 """ 430 previous = self._previous_position 431 if previous is None: 432 return None 433 position = self._position 434 scale = STEPS_PER_SECOND / (self._step - self._previous_step) 435 return Point(((position[0] - previous[0]) * scale, (position[1] - previous[1]) * scale)) 436 437 @property 438 def damage_taken(self) -> float | None: 439 """The health and shields the unit lost since the observation before, as `OwnUnitDamagedEvent` and 440 `EnemyUnitDamagedEvent` report it, and a neutral unit's alike, which no event reports; `None` unless it was 441 visible in both and kept its type. Health regained offsets only health lost, and shields regained only shields 442 lost. The health a stim costs is lost like any other.""" 443 update = self._tracker.last_changes.update 444 if (cached := self._damage_taken).update == update: 445 return cached.value 446 damage = self._damage_since_previous_report() 447 self._damage_taken = _Snapshot(damage, update) 448 return damage 449 450 def _damage_since_previous_report(self) -> float | None: 451 """The health and shields lost between the report of the observation before and the latest, as 452 `damage_taken` defines it.""" 453 previous = self._previous_report 454 if previous is None: 455 return None 456 report = self._latest_report 457 if ( 458 report.display_type != _VISIBLE 459 or previous.display_type != _VISIBLE 460 or report.unit_type != previous.unit_type 461 ): 462 return None 463 return max(0.0, previous.health - report.health) + max(0.0, previous.shield - report.shield) 464 465 # How it is seen. 466 467 @property 468 def visibility(self) -> Visibility: 469 """Whether the unit is visible, a structure remembered out of sight, or in sight but undetected.""" 470 return _VISIBILITIES[self._latest_report.display_type] 471 472 @property 473 def is_visible(self) -> bool: 474 """Whether the last observation showed the unit visible: in it, and seen, not cloaked or detected. False for an 475 unlisted unit, whose `visibility` reads as it was last listed.""" 476 return self._listed and self._latest_report.display_type == _VISIBLE 477 478 @property 479 def cloak_state(self) -> CloakState: 480 """Whether the unit is cloaked, and whether this player sees through it.""" 481 return _CLOAKS[self._latest_report.cloak] 482 483 @property 484 def is_selected(self) -> bool: 485 """Whether a human has the unit selected in the game window.""" 486 return self._latest_report.is_selected 487 488 @property 489 def is_flying(self) -> bool: 490 """Whether the unit is in the air, including one held up by a phoenix's graviton beam.""" 491 now = self._latest_report 492 if now.display_type != _IN_FOG: 493 return now.is_flying or _LIFTED in now.buff_ids 494 if (report := self._latest_visible_report) is None: 495 raise self._never_seen_error("flying") 496 return report.is_flying 497 498 @property 499 def is_burrowed(self) -> bool: 500 """Whether the unit is burrowed.""" 501 now = self._latest_report 502 if now.display_type != _IN_FOG: 503 return now.is_burrowed 504 if (report := self._latest_visible_report) is None: 505 raise self._never_seen_error("burrowing") 506 return report.is_burrowed 507 508 @property 509 def is_hallucination(self) -> bool: 510 """Whether the unit is a hallucination. Always known for this player's own units; an enemy's reads true once a 511 detector has shown it to be one, and stays true.""" 512 if self._hallucination_confirmed: 513 return True 514 if (report := self._latest_visible_report) is None: 515 raise self._never_seen_error("hallucination") 516 return report.is_hallucination 517 518 @property 519 def detect_range(self) -> float: 520 """How far the unit detects cloaked and burrowed units. 0 for a unit that does not detect.""" 521 if (report := self._latest_visible_report) is None: 522 raise self._never_seen_error("detection range") 523 return report.detect_range 524 525 @property 526 def radar_range(self) -> float: 527 """How far the unit's radar shows units. 0 for a unit without one.""" 528 if (report := self._latest_visible_report) is None: 529 raise self._never_seen_error("radar range") 530 return report.radar_range 531 532 # Vitals. 533 534 @property 535 def health(self) -> float: 536 """The unit's current health.""" 537 if (report := self._latest_visible_report) is None: 538 raise self._never_seen_error("health") 539 return report.health 540 541 @property 542 def health_max(self) -> float: 543 """The unit's maximum health.""" 544 if (report := self._latest_visible_report) is None: 545 raise self._never_seen_error("health") 546 return report.health_max 547 548 @property 549 def health_fraction(self) -> float: 550 """The unit's health as a fraction of its maximum.""" 551 if (report := self._latest_visible_report) is None: 552 raise self._never_seen_error("health") 553 return report.health / report.health_max if report.health_max else 0.0 554 555 @property 556 def shield(self) -> float: 557 """The unit's current shield.""" 558 if (report := self._latest_visible_report) is None: 559 raise self._never_seen_error("shield") 560 return report.shield 561 562 @property 563 def shield_max(self) -> float: 564 """The unit's maximum shield. 0 for a unit without one.""" 565 if (report := self._latest_visible_report) is None: 566 raise self._never_seen_error("shield") 567 return report.shield_max 568 569 @property 570 def shield_fraction(self) -> float: 571 """The unit's shield as a fraction of its maximum. 0 for a unit without one.""" 572 if (report := self._latest_visible_report) is None: 573 raise self._never_seen_error("shield") 574 return report.shield / report.shield_max if report.shield_max else 0.0 575 576 @property 577 def life(self) -> float: 578 """The unit's health and shield together.""" 579 if (report := self._latest_visible_report) is None: 580 raise self._never_seen_error("health") 581 return report.health + report.shield 582 583 @property 584 def life_max(self) -> float: 585 """The unit's maximum health and shield together.""" 586 if (report := self._latest_visible_report) is None: 587 raise self._never_seen_error("health") 588 return report.health_max + report.shield_max 589 590 @property 591 def life_fraction(self) -> float: 592 """The unit's health and shield together, as a fraction of their combined maximum.""" 593 if (report := self._latest_visible_report) is None: 594 raise self._never_seen_error("health") 595 most = report.health_max + report.shield_max 596 return (report.health + report.shield) / most if most else 0.0 597 598 @property 599 def energy(self) -> float: 600 """The unit's current energy.""" 601 if (report := self._latest_visible_report) is None: 602 raise self._never_seen_error("energy") 603 return report.energy 604 605 @property 606 def energy_max(self) -> float: 607 """The unit's maximum energy. 0 for a unit without energy.""" 608 if (report := self._latest_visible_report) is None: 609 raise self._never_seen_error("energy") 610 return report.energy_max 611 612 @property 613 def energy_fraction(self) -> float: 614 """The unit's energy as a fraction of its maximum. 0 for a unit without energy.""" 615 if (report := self._latest_visible_report) is None: 616 raise self._never_seen_error("energy") 617 return report.energy / report.energy_max if report.energy_max else 0.0 618 619 # State. 620 621 @property 622 def build_progress(self) -> float: 623 """A structure's progress through construction, or a unit's through warping in, from 0 to 1. 624 625 Anything else reads 1, anything morphing included. A larva's egg has its progress in its order; a cocoon and a 626 structure morphing report none (in game), and `morph_progress` works theirs out. 627 """ 628 if (report := self._latest_visible_report) is None: 629 raise self._never_seen_error("build progress") 630 return report.build_progress 631 632 @property 633 def is_complete(self) -> bool: 634 """Whether a structure has finished construction, or a unit has finished warping in. Anything else is 635 complete.""" 636 if (report := self._latest_visible_report) is None: 637 raise self._never_seen_error("build progress") 638 return report.build_progress == 1.0 639 640 @property 641 def morph_progress( 642 self: Unit[UnitType.CommandCenter | UnitType.Hatchery | UnitType.Lair | UnitType.Spire | UnitType.Cocoon], 643 ) -> Progress[UnitTypeId] | None: 644 """How far the unit's morph has got, of those the game reports no progress for: a command center becoming an 645 orbital command or a planetary fortress, a hatchery a lair, a lair a hive, a spire a greater spire, and a cocoon 646 or a lurker egg hatching. `None` for a unit not morphing, a dead one among them. 647 648 A morph is taken to begin at the step of the observation before the first that shows it, the step its order was 649 sent after (in game). `fraction` is the steps since then over the product's unrounded build time, and 650 `time_left` its `UnitTypeData.build_time` less those steps: exact for a structure of this player's, and to 651 within a step for a cocoon (in game), in a game the bot steps itself. In a realtime game, or on the ladder, a 652 morph can show an observation late, and an enemy's cocoon, or one of this player's queued behind another order, 653 may have begun at any step since the observation before. A structure takes its last step as the type it 654 becomes, unfinished (in game), and a morph past its time, such as an enemy's cocoon that hatched out of sight, 655 reads done. 656 657 Raises `NotReportedError` for an enemy's structure, whose morph the game does not show, and for a morph not seen 658 to begin: a cocoon first seen as one, back in sight or turned in the fog. 659 """ 660 return self._tracker.morph_tracker.progress_of(self) 661 662 @property 663 def is_powered(self: Unit[UnitType.ProtossStructure]) -> bool: 664 """Whether a Protoss structure stands in a pylon's power field. False for one that needs no power, such as a 665 nexus, a pylon or an assimilator.""" 666 if (report := self._latest_visible_report) is None: 667 raise self._never_seen_error("power") 668 return report.is_powered 669 670 @property 671 def is_active(self) -> bool: 672 """Whether the unit is busy: moving, attacking, gathering, training or researching. Reported for enemy units 673 too.""" 674 if (report := self._latest_visible_report) is None: 675 raise self._never_seen_error("activity") 676 return report.is_active 677 678 @property 679 def attack_upgrade_level(self) -> int: 680 """The unit's attack upgrade level.""" 681 if (report := self._latest_visible_report) is None: 682 raise self._never_seen_error("attack upgrades") 683 return report.attack_upgrade_level 684 685 @property 686 def armor_upgrade_level(self) -> int: 687 """The armor the unit's upgrades add. Not a count of levels: Chitinous Plating adds 2 to an ultralisk's.""" 688 if (report := self._latest_visible_report) is None: 689 raise self._never_seen_error("armor upgrades") 690 return report.armor_upgrade_level 691 692 @property 693 def shield_upgrade_level(self) -> int: 694 """The unit's shield upgrade level.""" 695 if (report := self._latest_visible_report) is None: 696 raise self._never_seen_error("shield upgrades") 697 return report.shield_upgrade_level 698 699 @property 700 def mineral_contents(self: Unit[UnitType.AnyMineralField]) -> int: 701 """The minerals left in a mineral field. 0 for anything else.""" 702 if (report := self._latest_visible_report) is None: 703 raise self._never_seen_error("minerals") 704 return report.mineral_contents 705 706 @property 707 def vespene_contents(self: Unit[UnitType.AnyVespeneGeyser | UnitType.GasBuilding]) -> int: 708 """The vespene left in a geyser, or in the gas building on it. 0 for anything else.""" 709 if (report := self._latest_visible_report) is None: 710 raise self._never_seen_error("vespene") 711 return report.vespene_contents 712 713 @property 714 def buffs(self) -> frozenset[BuffId]: 715 """The buffs on the unit, but those every unit of its type wears for as long as it is listed, which say nothing 716 its type does not: a parasitic bomb left behind reads none.""" 717 if (report := self._latest_visible_report) is None: 718 raise self._never_seen_error("buffs") 719 return frozenset(BuffId._read_each(report.buff_ids)) 720 721 def has_buff(self, buff_ids: BuffId | Collection[BuffId]) -> bool: 722 """Whether `buff_ids`, one buff or any of several, is among the unit's `buffs`. Raises `NotReportedError` for a 723 unit never shown visible, as `buffs` does.""" 724 unit_buffs = self.buffs 725 if isinstance(buff_ids, BuffId): 726 return buff_ids in unit_buffs 727 return not unit_buffs.isdisjoint(buff_ids) 728 729 @property 730 def is_carrying_resource(self) -> bool: 731 """Whether the unit carries minerals or gas, as its buffs show: false for a worker carrying gas from a rich 732 geyser, which the game gives no buff (in game). Raises `NotReportedError` for a unit never shown visible, as 733 `buffs` does.""" 734 return self.has_buff(_CARRYING_RESOURCE_BUFFS) 735 736 @property 737 def is_carrying_minerals(self) -> bool: 738 """Whether the unit carries minerals, from a plain field or a rich one, as its buffs show. Raises 739 `NotReportedError` for a unit never shown visible, as `buffs` does.""" 740 return self.has_buff(_CARRYING_MINERALS_BUFFS) 741 742 @property 743 def is_carrying_gas(self) -> bool: 744 """Whether the unit carries gas, as its buffs show: false for a worker carrying gas from a rich geyser, which 745 the game gives no buff (in game). Raises `NotReportedError` for a unit never shown visible, as `buffs` does.""" 746 return self.has_buff(BuffId.CARRYING_GAS) 747 748 # From the game's tables. 749 750 @property 751 def type_data(self) -> UnitTypeData: 752 """The game's table entry for the unit's type, before any upgrade.""" 753 return self._tracker.game_data.units[self.type_id] 754 755 @property 756 def weapons(self) -> tuple[Weapon, ...]: 757 """The unit type's weapons with its owner's upgrades applied: this player's upgrades for its own units, 758 `Api.enemy.upgrades` for the enemy's, and none for anyone else's. `active_weapons` are those it can fire now.""" 759 return self._tracker.upgrade_tracker.upgraded_type(self).weapons 760 761 @property 762 def speed(self) -> float: 763 """The unit type's speed with its owner's upgrades applied, as for `weapons`, before creep or any buff. In 764 distance per second, like `velocity`.""" 765 return self._tracker.upgrade_tracker.upgraded_type(self).speed 766 767 @property 768 def armor(self) -> float: 769 """The unit's base armor plus the armor its upgrades add: as the unit reports it when `is_visible`, and 770 otherwise the more of what it last reported visible and what its owner is known to have.""" 771 return self._tracker.upgrade_tracker.armor_of(self) 772 773 @property 774 def shield_armor(self) -> float: 775 """The armor of the unit's shields: its shield upgrade level as it reports it when `is_visible`, and otherwise 776 the more of what it last reported visible and the levels its owner is known to have; 0 for a unit without 777 shields. 778 779 The game's tables do not hold this. `docs/reference/game-behavior/damage-and-buffs.md` has what a level was 780 measured to take off a hit. 781 """ 782 return self._tracker.upgrade_tracker.shield_armor_of(self) 783 784 @property 785 def is_structure(self) -> bool: 786 """Whether the game's tables give the unit's type the structure attribute.""" 787 return Attribute.STRUCTURE in self.type_data.attributes 788 789 @property 790 def is_ground_structure(self) -> bool: 791 """Whether the unit is a structure standing on the ground: one not lifted, and one remembered out of sight, 792 whose flying the game does not report.""" 793 return self.is_structure and (self._latest_report.display_type == _IN_FOG or not self.is_flying) 794 795 def distance_to(self, other: PointLike | Unit[Any]) -> float: 796 """The distance from this unit's position to `other`, a point or another unit's position.""" 797 return self._position.distance_to(other._position if isinstance(other, Unit) else other) 798 799 @property 800 def footprint(self) -> Footprint | None: 801 """The tiles it covers where it stands: its type's footprint, or for a type of the map's own, of no race, that 802 does not move and has none measured, the square its radius spans. `None` for a unit that covers none, a force 803 field and a critter among them.""" 804 row = self._tracker.game_data.units.get(self.type_id) 805 if row is None: 806 return None 807 if row.footprint is None and row.race is Race.NONE and not row.speed: 808 side = round(2 * self.radius) 809 if not side: 810 return None 811 if self._radius_footprint is None or self._radius_footprint.width != side: 812 self._radius_footprint = Footprint.square(side) 813 return self._radius_footprint 814 return row.footprint 815 816 @property 817 def required_repair_cost(self) -> Cost | None: 818 """What one SCV's repair of the unit from its health now to whole takes: the time and resources of 819 `total_repair_cost` for the share of its health missing, each rounded up to a whole one, steps for the time (in 820 game), and nothing for a unit whole. `None` wherever `total_repair_cost` is.""" 821 return self._repair_cost_of(self.health_max - self.health) 822 823 @property 824 def total_repair_cost(self) -> Cost | None: 825 """What one SCV's repair of a unit of this type from no health to whole takes: the time its type costs, but 826 for a MULE, an auto-turret, a widow mine and an add-on standing on its own, and a quarter of the resources its 827 type costs, each rounded up, with no supply (in game). `None` for a structure under construction, which an SCV 828 is refused, and for any type but a Terran mechanical one. `docs/reference/game-behavior/damage-and-buffs.md` 829 has what was measured.""" 830 return self._repair_cost_of(self.health_max) 831 832 @property 833 def is_repairable(self) -> bool: 834 """Whether `total_repair_cost` gives a cost: whether the unit is a complete Terran mechanical one, whoever's it 835 is, an enemy's included. Raises `NotReportedError` for a Terran mechanical unit never 836 shown visible, whose build progress the game never reported.""" 837 return self.total_repair_cost is not None 838 839 def time_to_face( 840 self, target: PointLike | Unit[Any], *, facing_tolerance: float = _DEFAULT_FACING_TOLERANCE 841 ) -> GameTime | None: 842 """The time the unit takes to turn to face `target`, a point or another unit: the angle to turn over its type's 843 `turn_rate`, rounded up to a whole step (in game); zero if it faces it already, to within `facing_tolerance` 844 radians, a degree unless given. Counted from the step its turn begins, which an order sets off a step after it 845 in a game stepped by the bot, and may set off later in a realtime one, as on the ladder. `None` wherever 846 `turn_rate` is: for a type whose facing the game never changes and for one that does not move. 847 `docs/reference/game-behavior/units.md` has what was measured.""" 848 if (turn_rate := self.type_data.turn_rate) is None: 849 return None 850 target_position = target._position if isinstance(target, Unit) else target 851 if self._position.distance_to(target_position) == 0: 852 return GameTime.ZERO 853 bearing = self._position.angle_to(target_position) 854 angle_to_turn = abs((bearing - self.facing + math.pi) % math.tau - math.pi) 855 if angle_to_turn <= facing_tolerance: 856 return GameTime.ZERO 857 return GameTime(steps=math.ceil(angle_to_turn / turn_rate)) 858 859 def _repair_cost_of(self, missing_health: float) -> Cost | None: 860 """What one SCV's repair of `missing_health` of the unit takes; `None` wherever `total_repair_cost` is.""" 861 type_data = self.type_data 862 is_terran_and_mechanical = type_data.race is Race.TERRAN and Attribute.MECHANICAL in type_data.attributes 863 if not is_terran_and_mechanical or not self.is_complete: 864 return None 865 # Priced from everything spent to reach the type, an orbital command's 550 (tool `sweep_repair`). 866 type_cost, health_max = type_data._whole_cost, self.health_max 867 whole_repair_steps = REPAIR_STEPS_EXCEPTIONS.get(self.type_id, type_cost.time.steps) 868 # Multiplied out before the one division, so that a whole number of resources comes out whole. 869 return Cost( 870 math.ceil(missing_health * type_cost.minerals * REPAIR_COST_FRACTION / health_max), 871 math.ceil(missing_health * type_cost.vespene * REPAIR_COST_FRACTION / health_max), 872 time=GameTime(steps=math.ceil(whole_repair_steps * missing_health / health_max)), 873 ) 874 875 # Combat. 876 877 @property 878 def active_weapons(self) -> tuple[Weapon, ...]: 879 """The weapons of `weapons` the unit can fire now: all of them, but none for an oracle whose beam is off, which 880 wears `BuffId.ORACLE_PULSAR_BEAM` exactly while it is on (in game). Raises `NotReportedError` for an oracle 881 never shown visible.""" 882 if self.type_id is UnitTypeId.ORACLE and BuffId.ORACLE_PULSAR_BEAM not in self.buffs: 883 return () 884 return self.weapons 885 886 @property 887 def ground_weapon(self) -> Weapon | None: 888 """The weapon of `active_weapons` that fires at the ground, alone or with the air, or `None`. No type has two 889 that do (corpus). Raises as `active_weapons` does.""" 890 return self._weapon_firing_at(TargetDomain.GROUND) 891 892 @property 893 def air_weapon(self) -> Weapon | None: 894 """The weapon of `active_weapons` that fires at the air, alone or with the ground, or `None`, as 895 `ground_weapon` is for the ground.""" 896 return self._weapon_firing_at(TargetDomain.AIR) 897 898 @property 899 def ground_range(self) -> float: 900 """The range of `ground_weapon`, with its owner's upgrades, or 0 without one.""" 901 weapon = self.ground_weapon 902 return 0.0 if weapon is None else weapon.range 903 904 @property 905 def air_range(self) -> float: 906 """The range of `air_weapon`, with its owner's upgrades, or 0 without one.""" 907 weapon = self.air_weapon 908 return 0.0 if weapon is None else weapon.range 909 910 @property 911 def ground_damage(self) -> float: 912 """What one attack of `ground_weapon` does before bonuses and armor, its `total_damage`, or 0 without 913 one. A hallucination's counts; `damage_against` is what an attack takes off a target.""" 914 weapon = self.ground_weapon 915 return 0.0 if weapon is None else weapon.total_damage 916 917 @property 918 def air_damage(self) -> float: 919 """What one attack of `air_weapon` does before bonuses and armor, as `ground_damage` is for the ground.""" 920 weapon = self.air_weapon 921 return 0.0 if weapon is None else weapon.total_damage 922 923 @property 924 def ground_dps(self) -> float: 925 """The `dps` of `ground_weapon`, per second of the game's Faster speed with the mean attack delay, before 926 bonuses, armor and buffs, or 0 without one. A hallucination's counts; `dps_against` is what a target takes.""" 927 weapon = self.ground_weapon 928 return 0.0 if weapon is None else weapon.dps 929 930 @property 931 def air_dps(self) -> float: 932 """The `dps` of `air_weapon`, as `ground_dps` is for the ground.""" 933 weapon = self.air_weapon 934 return 0.0 if weapon is None else weapon.dps 935 936 @property 937 def is_melee(self) -> bool: 938 """Whether the unit fires at the ground from no farther than 1: its `ground_range` above 0 and at most 1, as a 939 zealot's and a zergling's are.""" 940 return 0.0 < self.ground_range <= 1.0 941 942 def _weapon_firing_at(self, domain: TargetDomain) -> Weapon | None: 943 """The weapon of `active_weapons` that fires at `domain`, the ground or the air, alone or with the other.""" 944 return next( 945 (weapon for weapon in self.active_weapons if weapon.target_domain in (domain, TargetDomain.ANY)), None 946 ) 947 948 def weapon_against(self, target: Unit[Any]) -> Weapon | None: 949 """The weapon of `active_weapons` this unit fires at `target`: one that hits the air for a target that flies, 950 and one that hits the ground for a target on it, or failing that, for a colossus, one that hits the air, as a 951 viking's did (in game). `None` if it has none that hits `target`, an oracle whose beam is off among them. 952 953 Raises `NotReportedError` for a target remembered in the fog and never seen visible, as `is_flying` does, and 954 for an oracle never shown visible. 955 """ 956 weapons = self.active_weapons 957 if target.is_flying: 958 return next((weapon for weapon in weapons if weapon.target_domain is not TargetDomain.GROUND), None) 959 on_the_ground = next((weapon for weapon in weapons if weapon.target_domain is not TargetDomain.AIR), None) 960 if on_the_ground is None and target.type_id in _GROUND_TYPES_HIT_FROM_THE_AIR: 961 return next((weapon for weapon in weapons if weapon.target_domain is TargetDomain.AIR), None) 962 return on_the_ground 963 964 def has_in_range(self, target: Unit[Any], *, margin: float = 0.0) -> bool: 965 """Whether `target` is within the reach of `weapon_against(target)`: their centers no farther apart than its 966 range, both radii and `margin`. False if this unit has no weapon against `target`. 967 968 That is where a unit that can move fires at another unit (in game). An attacker that cannot move, such as a 969 sieged tank or a spine crawler, fires from up to some 0.1 nearer, and any attacker fires at a structure from up 970 to some 0.26 nearer, so pass a negative `margin` to be sure the shot can land. Raises as `weapon_against` does. 971 """ 972 weapon = self.weapon_against(target) 973 return weapon is not None and self.distance_to(target) <= weapon.range + self.radius + target.radius + margin 974 975 def damage_against(self, target: Unit[Any]) -> float: 976 """What one attack of `weapon_against(target)` takes off `target`'s shields and health as they stand, every hit 977 of it counted, as `Weapon.damage_against` works it out from the target's attributes, `armor`, `shield_armor` 978 and `shield`. 0 if 979 this unit has no weapon against it or is a hallucination, which does no damage (stated). An enemy's reads as 980 one only once revealed, as `is_hallucination` has it. No buff on either unit counts. 981 982 Raises `NotReportedError` as `weapon_against` does, and for a unit of the two never shown visible, whose 983 shields or hallucination the game never reported. 984 """ 985 weapon = self.weapon_against(target) 986 return 0.0 if weapon is None or self.is_hallucination else _damage_of_one_attack(weapon, target) 987 988 def bonus_damage_against(self, target: Unit[Any]) -> float: 989 """The bonus damage one attack of `weapon_against(target)` does for `target`'s attributes, before armor: its 990 `Weapon.bonus_per_hit_against` them, times its attacks. 0 if this unit has no weapon against it. A 991 hallucination's counts, as for `ground_damage`. Raises `NotReportedError` as `weapon_against` does.""" 992 weapon = self.weapon_against(target) 993 if weapon is None: 994 return 0.0 995 return weapon.bonus_per_hit_against(target.type_data.attributes) * weapon.attacks 996 997 def dps_against(self, target: Unit[Any]) -> float: 998 """`damage_against(target)` per second of real time at the game's Faster speed, with `weapon_against(target)` 999 attacking as often as the buffs on this unit have it: stim makes a marine's and a marauder's 1.5 times as often 1000 (in game). 0 where `damage_against` is. 1001 1002 Raises `NotReportedError` as `damage_against` does. 1003 """ 1004 weapon = self.weapon_against(target) 1005 if weapon is None or self.is_hallucination: 1006 return 0.0 1007 damage = _damage_of_one_attack(weapon, target) 1008 if (report := self._latest_visible_report) is None: 1009 raise self._never_seen_error("buffs") 1010 # What speeds an attack divides the base cooldown, and leaves the random delay as it is (in game). 1011 attack_speed_multiplier = math.prod(_ATTACK_SPEED_BY_RAW_BUFF.get(buff, 1.0) for buff in report.buff_ids) 1012 # In plain steps, which spares two `GameTime`s a call in a targeting loop. 1013 cooldown_steps = weapon.base_cooldown.steps / attack_speed_multiplier + weapon.mean_delay.steps 1014 return damage * STEPS_PER_SECOND / cooldown_steps
A unit of the game: one object under one id for the whole game, reading as the game last reported it.
Position, type and visibility read as of the last observation that listed the unit. Everything else reads as
of the last observation that showed it visible, last_seen, and raises NotReportedError for a unit never
shown visible. A structure out of sight stays in the observation as IN_FOG. A unit the observation
leaves out is unlisted, is_listed false: it keeps its last values, and is observed under the same id again if it
comes back.
K is the unit's UnitType for the type checker. A read only some types have is typed for them alone, as
mineral_contents is for a mineral field, and is an error on a unit typed as another type or as a group wider than
them. A unit typed Unit[Any] reads as any type.
158 def __init__(self, report: raw_pb2.Unit, tracker: _Tracker, unit_id: int, step: int) -> None: 159 self._tracker = tracker 160 self._id = unit_id 161 self._tag = report.tag 162 self._latest_report = report 163 self._latest_visible_report = report if report.display_type == _VISIBLE else None 164 # Set only for a unit not visible; a visible unit was last seen at its last observation. 165 self._last_seen = None 166 self._first_seen = step if report.display_type == _VISIBLE else None 167 self._position = Point((report.pos.x, report.pos.y)) 168 self._raw_alliance = report.alliance 169 self._own = self._raw_alliance == _OWN_ALLIANCE 170 self._step = step 171 self._previous_position = None 172 self._previous_report = None 173 self._previous_step = step 174 self._damage_taken = _Snapshot(None) 175 self._listed = True 176 self._dead = False 177 self._hallucination_confirmed = not self._own and report.display_type == _VISIBLE and report.is_hallucination 178 self._radius_footprint = None 179 self._order_targets = None 180 self._orders = _Snapshot(()) 181 self._update_unit_type(report.unit_type)
301 @property 302 def id(self) -> int: 303 """NachOS's id for this unit, the same for the whole game. 304 305 The first digit is the unit's alliance when first seen, `Alliance.OWN` being 1 and `Alliance.ENEMY` 4. The 306 rest counts that alliance's units in the order they were first seen; in a replay played back with the fog off, 307 in the order the game first listed them, so that the unit is under the same id in `Api.all_units`. 308 """ 309 return self._id
NachOS's id for this unit, the same for the whole game.
The first digit is the unit's alliance when first seen, Alliance.OWN being 1 and Alliance.ENEMY 4. The
rest counts that alliance's units in the order they were first seen; in a replay played back with the fog off,
in the order the game first listed them, so that the unit is under the same id in Api.all_units.
311 @property 312 def first_alliance(self) -> Alliance: 313 """Whose side the unit was on when first seen, as its `id` records. A unit of this player's under a neural 314 parasite reads `Alliance.ENEMY` for `alliance` and `Alliance.OWN` here, and still takes this player's 315 supply.""" 316 return _ALLIANCES[self._id // _IDS_PER_ALLIANCE]
318 @property 319 def tag(self) -> int: 320 """The game's current tag for this unit. A structure's tag changes each time it goes out of sight.""" 321 return self._tag
The game's current tag for this unit. A structure's tag changes each time it goes out of sight.
323 @property 324 def type_id(self) -> UnitTypeId: 325 """The unit's type.""" 326 return self._type_id
The unit's type.
328 @property 329 def alliance(self) -> Alliance: 330 """Whose side the unit is on.""" 331 return _ALLIANCES[self._raw_alliance]
Whose side the unit is on.
333 @property 334 def is_own(self) -> bool: 335 """Whether the unit is this player's.""" 336 return self._raw_alliance == _OWN_ALLIANCE
Whether the unit is this player's.
338 @property 339 def is_enemy(self) -> bool: 340 """Whether the unit is the enemy's.""" 341 return self._raw_alliance == _ENEMY_ALLIANCE
Whether the unit is the enemy's.
343 @property 344 def owner_id(self) -> int: 345 """The id of the player the unit belongs to. 16 for the map's own units.""" 346 if (report := self._latest_visible_report) is None: 347 raise self._never_seen_error("owner") 348 return report.owner
The id of the player the unit belongs to. 16 for the map's own units.
352 @property 353 def is_listed(self) -> bool: 354 """Whether the last observation listed the unit: in sight and seen, in sight but cloaked and undetected, or a 355 structure remembered in the fog. Not once it went out of sight, or burrowed undetected, as a zergling does, or 356 went into a transport, a gas building or a structure it is becoming, as a drone does, nor once it died. 357 `is_visible` is the first of these alone.""" 358 return self._listed
Whether the last observation listed the unit: in sight and seen, in sight but cloaked and undetected, or a
structure remembered in the fog. Not once it went out of sight, or burrowed undetected, as a zergling does, or
went into a transport, a gas building or a structure it is becoming, as a drone does, nor once it died.
is_visible is the first of these alone.
360 @property 361 def is_dead(self) -> bool: 362 """Whether the unit is dead: reported dead, or a structure that cannot lift off or uproot gone from its spot. 363 364 The game reports only the deaths a player can see. A structure that dies out of sight is found dead when its 365 spot comes back into sight without it. A unit of this player's that became a structure, as a drone does, is 366 dead once that structure finishes, or once it dies without the unit coming back from a cancel. A dead unit is 367 never listed again. 368 """ 369 return self._dead
Whether the unit is dead: reported dead, or a structure that cannot lift off or uproot gone from its spot.
The game reports only the deaths a player can see. A structure that dies out of sight is found dead when its spot comes back into sight without it. A unit of this player's that became a structure, as a drone does, is dead once that structure finishes, or once it dies without the unit coming back from a cancel. A dead unit is never listed again.
371 @property 372 def is_alive(self) -> bool: 373 """Whether the unit is not known to be dead: the opposite of `is_dead`. True for an enemy's unit that died out 374 of sight, whose death the game never reports, until NachOS finds it dead, as `is_dead` says for a structure.""" 375 return not self._dead
377 @property 378 def is_orderable(self) -> bool: 379 """Whether this player can order the unit now: the last observation listed it as this player's. Not while it 380 is inside a gas building or a transport, nor under a neural parasite, which makes it an enemy `Unit`, nor once 381 it is dead. Read it before ordering a unit kept from an earlier observation, or reading what only `OwnUnit` 382 has. It goes by the listing alone, so a reaper's grenade and a parasitic bomb left behind, each listed as its 383 caster's, read orderable.""" 384 return self._listed and self._own
Whether this player can order the unit now: the last observation listed it as this player's. Not while it
is inside a gas building or a transport, nor under a neural parasite, which makes it an enemy Unit, nor once
it is dead. Read it before ordering a unit kept from an earlier observation, or reading what only OwnUnit
has. It goes by the listing alone, so a reaper's grenade and a parasitic bomb left behind, each listed as its
caster's, read orderable.
386 @property 387 def first_seen(self) -> GameTime | None: 388 """The time of the first observation that showed the unit visible, or `None` if none has, as for `last_seen`. 389 A structure remembered under a new tag keeps it, as it keeps its `id`. Later than `EnemyUnitFirstSeenEvent` for 390 an enemy's unit first listed in the fog or undetected, which that event counts as first seen.""" 391 return None if self._first_seen is None else GameTime(steps=self._first_seen)
The time of the first observation that showed the unit visible, or None if none has, as for last_seen.
A structure remembered under a new tag keeps it, as it keeps its id. Later than EnemyUnitFirstSeenEvent for
an enemy's unit first listed in the fog or undetected, which that event counts as first seen.
393 @property 394 def last_seen(self) -> GameTime | None: 395 """The time of the last observation that showed the unit visible, or `None` if none has.""" 396 if self._latest_report.display_type == _VISIBLE: 397 return GameTime(steps=self._step) 398 return None if self._last_seen is None else GameTime(steps=self._last_seen)
The time of the last observation that showed the unit visible, or None if none has.
402 @property 403 def position(self) -> Point: 404 """The unit's position on the ground plane.""" 405 return self._position
The unit's position on the ground plane.
407 @property 408 def height(self) -> float: 409 """The unit's height, on the scale of the map's terrain heights.""" 410 return self._latest_report.pos.z
The unit's height, on the scale of the map's terrain heights.
412 @property 413 def radius(self) -> float: 414 """The radius of the circle the unit takes up around its position.""" 415 return self._latest_report.radius
The radius of the circle the unit takes up around its position.
417 @property 418 def facing(self) -> float: 419 """The direction the unit faces, in radians from the positive x-axis.""" 420 if (report := self._latest_visible_report) is None: 421 raise self._never_seen_error("facing") 422 return report.facing
The direction the unit faces, in radians from the positive x-axis.
424 @property 425 def velocity(self) -> Point | None: 426 """The unit's velocity between its last two observations, in distance per second. 427 428 `None` for a unit observed only once since it was first seen or since it came back. 429 """ 430 previous = self._previous_position 431 if previous is None: 432 return None 433 position = self._position 434 scale = STEPS_PER_SECOND / (self._step - self._previous_step) 435 return Point(((position[0] - previous[0]) * scale, (position[1] - previous[1]) * scale))
The unit's velocity between its last two observations, in distance per second.
None for a unit observed only once since it was first seen or since it came back.
437 @property 438 def damage_taken(self) -> float | None: 439 """The health and shields the unit lost since the observation before, as `OwnUnitDamagedEvent` and 440 `EnemyUnitDamagedEvent` report it, and a neutral unit's alike, which no event reports; `None` unless it was 441 visible in both and kept its type. Health regained offsets only health lost, and shields regained only shields 442 lost. The health a stim costs is lost like any other.""" 443 update = self._tracker.last_changes.update 444 if (cached := self._damage_taken).update == update: 445 return cached.value 446 damage = self._damage_since_previous_report() 447 self._damage_taken = _Snapshot(damage, update) 448 return damage
The health and shields the unit lost since the observation before, as OwnUnitDamagedEvent and
EnemyUnitDamagedEvent report it, and a neutral unit's alike, which no event reports; None unless it was
visible in both and kept its type. Health regained offsets only health lost, and shields regained only shields
lost. The health a stim costs is lost like any other.
467 @property 468 def visibility(self) -> Visibility: 469 """Whether the unit is visible, a structure remembered out of sight, or in sight but undetected.""" 470 return _VISIBILITIES[self._latest_report.display_type]
Whether the unit is visible, a structure remembered out of sight, or in sight but undetected.
472 @property 473 def is_visible(self) -> bool: 474 """Whether the last observation showed the unit visible: in it, and seen, not cloaked or detected. False for an 475 unlisted unit, whose `visibility` reads as it was last listed.""" 476 return self._listed and self._latest_report.display_type == _VISIBLE
Whether the last observation showed the unit visible: in it, and seen, not cloaked or detected. False for an
unlisted unit, whose visibility reads as it was last listed.
478 @property 479 def cloak_state(self) -> CloakState: 480 """Whether the unit is cloaked, and whether this player sees through it.""" 481 return _CLOAKS[self._latest_report.cloak]
Whether the unit is cloaked, and whether this player sees through it.
483 @property 484 def is_selected(self) -> bool: 485 """Whether a human has the unit selected in the game window.""" 486 return self._latest_report.is_selected
Whether a human has the unit selected in the game window.
488 @property 489 def is_flying(self) -> bool: 490 """Whether the unit is in the air, including one held up by a phoenix's graviton beam.""" 491 now = self._latest_report 492 if now.display_type != _IN_FOG: 493 return now.is_flying or _LIFTED in now.buff_ids 494 if (report := self._latest_visible_report) is None: 495 raise self._never_seen_error("flying") 496 return report.is_flying
Whether the unit is in the air, including one held up by a phoenix's graviton beam.
498 @property 499 def is_burrowed(self) -> bool: 500 """Whether the unit is burrowed.""" 501 now = self._latest_report 502 if now.display_type != _IN_FOG: 503 return now.is_burrowed 504 if (report := self._latest_visible_report) is None: 505 raise self._never_seen_error("burrowing") 506 return report.is_burrowed
Whether the unit is burrowed.
508 @property 509 def is_hallucination(self) -> bool: 510 """Whether the unit is a hallucination. Always known for this player's own units; an enemy's reads true once a 511 detector has shown it to be one, and stays true.""" 512 if self._hallucination_confirmed: 513 return True 514 if (report := self._latest_visible_report) is None: 515 raise self._never_seen_error("hallucination") 516 return report.is_hallucination
Whether the unit is a hallucination. Always known for this player's own units; an enemy's reads true once a detector has shown it to be one, and stays true.
518 @property 519 def detect_range(self) -> float: 520 """How far the unit detects cloaked and burrowed units. 0 for a unit that does not detect.""" 521 if (report := self._latest_visible_report) is None: 522 raise self._never_seen_error("detection range") 523 return report.detect_range
How far the unit detects cloaked and burrowed units. 0 for a unit that does not detect.
525 @property 526 def radar_range(self) -> float: 527 """How far the unit's radar shows units. 0 for a unit without one.""" 528 if (report := self._latest_visible_report) is None: 529 raise self._never_seen_error("radar range") 530 return report.radar_range
How far the unit's radar shows units. 0 for a unit without one.
534 @property 535 def health(self) -> float: 536 """The unit's current health.""" 537 if (report := self._latest_visible_report) is None: 538 raise self._never_seen_error("health") 539 return report.health
The unit's current health.
541 @property 542 def health_max(self) -> float: 543 """The unit's maximum health.""" 544 if (report := self._latest_visible_report) is None: 545 raise self._never_seen_error("health") 546 return report.health_max
The unit's maximum health.
548 @property 549 def health_fraction(self) -> float: 550 """The unit's health as a fraction of its maximum.""" 551 if (report := self._latest_visible_report) is None: 552 raise self._never_seen_error("health") 553 return report.health / report.health_max if report.health_max else 0.0
The unit's health as a fraction of its maximum.
555 @property 556 def shield(self) -> float: 557 """The unit's current shield.""" 558 if (report := self._latest_visible_report) is None: 559 raise self._never_seen_error("shield") 560 return report.shield
The unit's current shield.
562 @property 563 def shield_max(self) -> float: 564 """The unit's maximum shield. 0 for a unit without one.""" 565 if (report := self._latest_visible_report) is None: 566 raise self._never_seen_error("shield") 567 return report.shield_max
The unit's maximum shield. 0 for a unit without one.
569 @property 570 def shield_fraction(self) -> float: 571 """The unit's shield as a fraction of its maximum. 0 for a unit without one.""" 572 if (report := self._latest_visible_report) is None: 573 raise self._never_seen_error("shield") 574 return report.shield / report.shield_max if report.shield_max else 0.0
The unit's shield as a fraction of its maximum. 0 for a unit without one.
576 @property 577 def life(self) -> float: 578 """The unit's health and shield together.""" 579 if (report := self._latest_visible_report) is None: 580 raise self._never_seen_error("health") 581 return report.health + report.shield
The unit's health and shield together.
583 @property 584 def life_max(self) -> float: 585 """The unit's maximum health and shield together.""" 586 if (report := self._latest_visible_report) is None: 587 raise self._never_seen_error("health") 588 return report.health_max + report.shield_max
The unit's maximum health and shield together.
590 @property 591 def life_fraction(self) -> float: 592 """The unit's health and shield together, as a fraction of their combined maximum.""" 593 if (report := self._latest_visible_report) is None: 594 raise self._never_seen_error("health") 595 most = report.health_max + report.shield_max 596 return (report.health + report.shield) / most if most else 0.0
The unit's health and shield together, as a fraction of their combined maximum.
598 @property 599 def energy(self) -> float: 600 """The unit's current energy.""" 601 if (report := self._latest_visible_report) is None: 602 raise self._never_seen_error("energy") 603 return report.energy
The unit's current energy.
605 @property 606 def energy_max(self) -> float: 607 """The unit's maximum energy. 0 for a unit without energy.""" 608 if (report := self._latest_visible_report) is None: 609 raise self._never_seen_error("energy") 610 return report.energy_max
The unit's maximum energy. 0 for a unit without energy.
612 @property 613 def energy_fraction(self) -> float: 614 """The unit's energy as a fraction of its maximum. 0 for a unit without energy.""" 615 if (report := self._latest_visible_report) is None: 616 raise self._never_seen_error("energy") 617 return report.energy / report.energy_max if report.energy_max else 0.0
The unit's energy as a fraction of its maximum. 0 for a unit without energy.
621 @property 622 def build_progress(self) -> float: 623 """A structure's progress through construction, or a unit's through warping in, from 0 to 1. 624 625 Anything else reads 1, anything morphing included. A larva's egg has its progress in its order; a cocoon and a 626 structure morphing report none (in game), and `morph_progress` works theirs out. 627 """ 628 if (report := self._latest_visible_report) is None: 629 raise self._never_seen_error("build progress") 630 return report.build_progress
A structure's progress through construction, or a unit's through warping in, from 0 to 1.
Anything else reads 1, anything morphing included. A larva's egg has its progress in its order; a cocoon and a
structure morphing report none (in game), and morph_progress works theirs out.
632 @property 633 def is_complete(self) -> bool: 634 """Whether a structure has finished construction, or a unit has finished warping in. Anything else is 635 complete.""" 636 if (report := self._latest_visible_report) is None: 637 raise self._never_seen_error("build progress") 638 return report.build_progress == 1.0
Whether a structure has finished construction, or a unit has finished warping in. Anything else is complete.
640 @property 641 def morph_progress( 642 self: Unit[UnitType.CommandCenter | UnitType.Hatchery | UnitType.Lair | UnitType.Spire | UnitType.Cocoon], 643 ) -> Progress[UnitTypeId] | None: 644 """How far the unit's morph has got, of those the game reports no progress for: a command center becoming an 645 orbital command or a planetary fortress, a hatchery a lair, a lair a hive, a spire a greater spire, and a cocoon 646 or a lurker egg hatching. `None` for a unit not morphing, a dead one among them. 647 648 A morph is taken to begin at the step of the observation before the first that shows it, the step its order was 649 sent after (in game). `fraction` is the steps since then over the product's unrounded build time, and 650 `time_left` its `UnitTypeData.build_time` less those steps: exact for a structure of this player's, and to 651 within a step for a cocoon (in game), in a game the bot steps itself. In a realtime game, or on the ladder, a 652 morph can show an observation late, and an enemy's cocoon, or one of this player's queued behind another order, 653 may have begun at any step since the observation before. A structure takes its last step as the type it 654 becomes, unfinished (in game), and a morph past its time, such as an enemy's cocoon that hatched out of sight, 655 reads done. 656 657 Raises `NotReportedError` for an enemy's structure, whose morph the game does not show, and for a morph not seen 658 to begin: a cocoon first seen as one, back in sight or turned in the fog. 659 """ 660 return self._tracker.morph_tracker.progress_of(self)
How far the unit's morph has got, of those the game reports no progress for: a command center becoming an
orbital command or a planetary fortress, a hatchery a lair, a lair a hive, a spire a greater spire, and a cocoon
or a lurker egg hatching. None for a unit not morphing, a dead one among them.
A morph is taken to begin at the step of the observation before the first that shows it, the step its order was
sent after (in game). fraction is the steps since then over the product's unrounded build time, and
time_left its UnitTypeData.build_time less those steps: exact for a structure of this player's, and to
within a step for a cocoon (in game), in a game the bot steps itself. In a realtime game, or on the ladder, a
morph can show an observation late, and an enemy's cocoon, or one of this player's queued behind another order,
may have begun at any step since the observation before. A structure takes its last step as the type it
becomes, unfinished (in game), and a morph past its time, such as an enemy's cocoon that hatched out of sight,
reads done.
Raises NotReportedError for an enemy's structure, whose morph the game does not show, and for a morph not seen
to begin: a cocoon first seen as one, back in sight or turned in the fog.
662 @property 663 def is_powered(self: Unit[UnitType.ProtossStructure]) -> bool: 664 """Whether a Protoss structure stands in a pylon's power field. False for one that needs no power, such as a 665 nexus, a pylon or an assimilator.""" 666 if (report := self._latest_visible_report) is None: 667 raise self._never_seen_error("power") 668 return report.is_powered
Whether a Protoss structure stands in a pylon's power field. False for one that needs no power, such as a nexus, a pylon or an assimilator.
670 @property 671 def is_active(self) -> bool: 672 """Whether the unit is busy: moving, attacking, gathering, training or researching. Reported for enemy units 673 too.""" 674 if (report := self._latest_visible_report) is None: 675 raise self._never_seen_error("activity") 676 return report.is_active
Whether the unit is busy: moving, attacking, gathering, training or researching. Reported for enemy units too.
678 @property 679 def attack_upgrade_level(self) -> int: 680 """The unit's attack upgrade level.""" 681 if (report := self._latest_visible_report) is None: 682 raise self._never_seen_error("attack upgrades") 683 return report.attack_upgrade_level
The unit's attack upgrade level.
685 @property 686 def armor_upgrade_level(self) -> int: 687 """The armor the unit's upgrades add. Not a count of levels: Chitinous Plating adds 2 to an ultralisk's.""" 688 if (report := self._latest_visible_report) is None: 689 raise self._never_seen_error("armor upgrades") 690 return report.armor_upgrade_level
The armor the unit's upgrades add. Not a count of levels: Chitinous Plating adds 2 to an ultralisk's.
692 @property 693 def shield_upgrade_level(self) -> int: 694 """The unit's shield upgrade level.""" 695 if (report := self._latest_visible_report) is None: 696 raise self._never_seen_error("shield upgrades") 697 return report.shield_upgrade_level
The unit's shield upgrade level.
699 @property 700 def mineral_contents(self: Unit[UnitType.AnyMineralField]) -> int: 701 """The minerals left in a mineral field. 0 for anything else.""" 702 if (report := self._latest_visible_report) is None: 703 raise self._never_seen_error("minerals") 704 return report.mineral_contents
The minerals left in a mineral field. 0 for anything else.
706 @property 707 def vespene_contents(self: Unit[UnitType.AnyVespeneGeyser | UnitType.GasBuilding]) -> int: 708 """The vespene left in a geyser, or in the gas building on it. 0 for anything else.""" 709 if (report := self._latest_visible_report) is None: 710 raise self._never_seen_error("vespene") 711 return report.vespene_contents
The vespene left in a geyser, or in the gas building on it. 0 for anything else.
713 @property 714 def buffs(self) -> frozenset[BuffId]: 715 """The buffs on the unit, but those every unit of its type wears for as long as it is listed, which say nothing 716 its type does not: a parasitic bomb left behind reads none.""" 717 if (report := self._latest_visible_report) is None: 718 raise self._never_seen_error("buffs") 719 return frozenset(BuffId._read_each(report.buff_ids))
The buffs on the unit, but those every unit of its type wears for as long as it is listed, which say nothing its type does not: a parasitic bomb left behind reads none.
721 def has_buff(self, buff_ids: BuffId | Collection[BuffId]) -> bool: 722 """Whether `buff_ids`, one buff or any of several, is among the unit's `buffs`. Raises `NotReportedError` for a 723 unit never shown visible, as `buffs` does.""" 724 unit_buffs = self.buffs 725 if isinstance(buff_ids, BuffId): 726 return buff_ids in unit_buffs 727 return not unit_buffs.isdisjoint(buff_ids)
729 @property 730 def is_carrying_resource(self) -> bool: 731 """Whether the unit carries minerals or gas, as its buffs show: false for a worker carrying gas from a rich 732 geyser, which the game gives no buff (in game). Raises `NotReportedError` for a unit never shown visible, as 733 `buffs` does.""" 734 return self.has_buff(_CARRYING_RESOURCE_BUFFS)
Whether the unit carries minerals or gas, as its buffs show: false for a worker carrying gas from a rich
geyser, which the game gives no buff (in game). Raises NotReportedError for a unit never shown visible, as
buffs does.
736 @property 737 def is_carrying_minerals(self) -> bool: 738 """Whether the unit carries minerals, from a plain field or a rich one, as its buffs show. Raises 739 `NotReportedError` for a unit never shown visible, as `buffs` does.""" 740 return self.has_buff(_CARRYING_MINERALS_BUFFS)
Whether the unit carries minerals, from a plain field or a rich one, as its buffs show. Raises
NotReportedError for a unit never shown visible, as buffs does.
742 @property 743 def is_carrying_gas(self) -> bool: 744 """Whether the unit carries gas, as its buffs show: false for a worker carrying gas from a rich geyser, which 745 the game gives no buff (in game). Raises `NotReportedError` for a unit never shown visible, as `buffs` does.""" 746 return self.has_buff(BuffId.CARRYING_GAS)
Whether the unit carries gas, as its buffs show: false for a worker carrying gas from a rich geyser, which
the game gives no buff (in game). Raises NotReportedError for a unit never shown visible, as buffs does.
750 @property 751 def type_data(self) -> UnitTypeData: 752 """The game's table entry for the unit's type, before any upgrade.""" 753 return self._tracker.game_data.units[self.type_id]
The game's table entry for the unit's type, before any upgrade.
755 @property 756 def weapons(self) -> tuple[Weapon, ...]: 757 """The unit type's weapons with its owner's upgrades applied: this player's upgrades for its own units, 758 `Api.enemy.upgrades` for the enemy's, and none for anyone else's. `active_weapons` are those it can fire now.""" 759 return self._tracker.upgrade_tracker.upgraded_type(self).weapons
The unit type's weapons with its owner's upgrades applied: this player's upgrades for its own units,
Api.enemy.upgrades for the enemy's, and none for anyone else's. active_weapons are those it can fire now.
767 @property 768 def armor(self) -> float: 769 """The unit's base armor plus the armor its upgrades add: as the unit reports it when `is_visible`, and 770 otherwise the more of what it last reported visible and what its owner is known to have.""" 771 return self._tracker.upgrade_tracker.armor_of(self)
The unit's base armor plus the armor its upgrades add: as the unit reports it when is_visible, and
otherwise the more of what it last reported visible and what its owner is known to have.
773 @property 774 def shield_armor(self) -> float: 775 """The armor of the unit's shields: its shield upgrade level as it reports it when `is_visible`, and otherwise 776 the more of what it last reported visible and the levels its owner is known to have; 0 for a unit without 777 shields. 778 779 The game's tables do not hold this. `docs/reference/game-behavior/damage-and-buffs.md` has what a level was 780 measured to take off a hit. 781 """ 782 return self._tracker.upgrade_tracker.shield_armor_of(self)
The armor of the unit's shields: its shield upgrade level as it reports it when is_visible, and otherwise
the more of what it last reported visible and the levels its owner is known to have; 0 for a unit without
shields.
The game's tables do not hold this. docs/reference/game-behavior/damage-and-buffs.md has what a level was
measured to take off a hit.
784 @property 785 def is_structure(self) -> bool: 786 """Whether the game's tables give the unit's type the structure attribute.""" 787 return Attribute.STRUCTURE in self.type_data.attributes
Whether the game's tables give the unit's type the structure attribute.
789 @property 790 def is_ground_structure(self) -> bool: 791 """Whether the unit is a structure standing on the ground: one not lifted, and one remembered out of sight, 792 whose flying the game does not report.""" 793 return self.is_structure and (self._latest_report.display_type == _IN_FOG or not self.is_flying)
Whether the unit is a structure standing on the ground: one not lifted, and one remembered out of sight, whose flying the game does not report.
795 def distance_to(self, other: PointLike | Unit[Any]) -> float: 796 """The distance from this unit's position to `other`, a point or another unit's position.""" 797 return self._position.distance_to(other._position if isinstance(other, Unit) else other)
The distance from this unit's position to other, a point or another unit's position.
799 @property 800 def footprint(self) -> Footprint | None: 801 """The tiles it covers where it stands: its type's footprint, or for a type of the map's own, of no race, that 802 does not move and has none measured, the square its radius spans. `None` for a unit that covers none, a force 803 field and a critter among them.""" 804 row = self._tracker.game_data.units.get(self.type_id) 805 if row is None: 806 return None 807 if row.footprint is None and row.race is Race.NONE and not row.speed: 808 side = round(2 * self.radius) 809 if not side: 810 return None 811 if self._radius_footprint is None or self._radius_footprint.width != side: 812 self._radius_footprint = Footprint.square(side) 813 return self._radius_footprint 814 return row.footprint
The tiles it covers where it stands: its type's footprint, or for a type of the map's own, of no race, that
does not move and has none measured, the square its radius spans. None for a unit that covers none, a force
field and a critter among them.
816 @property 817 def required_repair_cost(self) -> Cost | None: 818 """What one SCV's repair of the unit from its health now to whole takes: the time and resources of 819 `total_repair_cost` for the share of its health missing, each rounded up to a whole one, steps for the time (in 820 game), and nothing for a unit whole. `None` wherever `total_repair_cost` is.""" 821 return self._repair_cost_of(self.health_max - self.health)
What one SCV's repair of the unit from its health now to whole takes: the time and resources of
total_repair_cost for the share of its health missing, each rounded up to a whole one, steps for the time (in
game), and nothing for a unit whole. None wherever total_repair_cost is.
823 @property 824 def total_repair_cost(self) -> Cost | None: 825 """What one SCV's repair of a unit of this type from no health to whole takes: the time its type costs, but 826 for a MULE, an auto-turret, a widow mine and an add-on standing on its own, and a quarter of the resources its 827 type costs, each rounded up, with no supply (in game). `None` for a structure under construction, which an SCV 828 is refused, and for any type but a Terran mechanical one. `docs/reference/game-behavior/damage-and-buffs.md` 829 has what was measured.""" 830 return self._repair_cost_of(self.health_max)
What one SCV's repair of a unit of this type from no health to whole takes: the time its type costs, but
for a MULE, an auto-turret, a widow mine and an add-on standing on its own, and a quarter of the resources its
type costs, each rounded up, with no supply (in game). None for a structure under construction, which an SCV
is refused, and for any type but a Terran mechanical one. docs/reference/game-behavior/damage-and-buffs.md
has what was measured.
832 @property 833 def is_repairable(self) -> bool: 834 """Whether `total_repair_cost` gives a cost: whether the unit is a complete Terran mechanical one, whoever's it 835 is, an enemy's included. Raises `NotReportedError` for a Terran mechanical unit never 836 shown visible, whose build progress the game never reported.""" 837 return self.total_repair_cost is not None
Whether total_repair_cost gives a cost: whether the unit is a complete Terran mechanical one, whoever's it
is, an enemy's included. Raises NotReportedError for a Terran mechanical unit never
shown visible, whose build progress the game never reported.
839 def time_to_face( 840 self, target: PointLike | Unit[Any], *, facing_tolerance: float = _DEFAULT_FACING_TOLERANCE 841 ) -> GameTime | None: 842 """The time the unit takes to turn to face `target`, a point or another unit: the angle to turn over its type's 843 `turn_rate`, rounded up to a whole step (in game); zero if it faces it already, to within `facing_tolerance` 844 radians, a degree unless given. Counted from the step its turn begins, which an order sets off a step after it 845 in a game stepped by the bot, and may set off later in a realtime one, as on the ladder. `None` wherever 846 `turn_rate` is: for a type whose facing the game never changes and for one that does not move. 847 `docs/reference/game-behavior/units.md` has what was measured.""" 848 if (turn_rate := self.type_data.turn_rate) is None: 849 return None 850 target_position = target._position if isinstance(target, Unit) else target 851 if self._position.distance_to(target_position) == 0: 852 return GameTime.ZERO 853 bearing = self._position.angle_to(target_position) 854 angle_to_turn = abs((bearing - self.facing + math.pi) % math.tau - math.pi) 855 if angle_to_turn <= facing_tolerance: 856 return GameTime.ZERO 857 return GameTime(steps=math.ceil(angle_to_turn / turn_rate))
The time the unit takes to turn to face target, a point or another unit: the angle to turn over its type's
turn_rate, rounded up to a whole step (in game); zero if it faces it already, to within facing_tolerance
radians, a degree unless given. Counted from the step its turn begins, which an order sets off a step after it
in a game stepped by the bot, and may set off later in a realtime one, as on the ladder. None wherever
turn_rate is: for a type whose facing the game never changes and for one that does not move.
docs/reference/game-behavior/units.md has what was measured.
877 @property 878 def active_weapons(self) -> tuple[Weapon, ...]: 879 """The weapons of `weapons` the unit can fire now: all of them, but none for an oracle whose beam is off, which 880 wears `BuffId.ORACLE_PULSAR_BEAM` exactly while it is on (in game). Raises `NotReportedError` for an oracle 881 never shown visible.""" 882 if self.type_id is UnitTypeId.ORACLE and BuffId.ORACLE_PULSAR_BEAM not in self.buffs: 883 return () 884 return self.weapons
The weapons of weapons the unit can fire now: all of them, but none for an oracle whose beam is off, which
wears BuffId.ORACLE_PULSAR_BEAM exactly while it is on (in game). Raises NotReportedError for an oracle
never shown visible.
886 @property 887 def ground_weapon(self) -> Weapon | None: 888 """The weapon of `active_weapons` that fires at the ground, alone or with the air, or `None`. No type has two 889 that do (corpus). Raises as `active_weapons` does.""" 890 return self._weapon_firing_at(TargetDomain.GROUND)
The weapon of active_weapons that fires at the ground, alone or with the air, or None. No type has two
that do (corpus). Raises as active_weapons does.
892 @property 893 def air_weapon(self) -> Weapon | None: 894 """The weapon of `active_weapons` that fires at the air, alone or with the ground, or `None`, as 895 `ground_weapon` is for the ground.""" 896 return self._weapon_firing_at(TargetDomain.AIR)
The weapon of active_weapons that fires at the air, alone or with the ground, or None, as
ground_weapon is for the ground.
898 @property 899 def ground_range(self) -> float: 900 """The range of `ground_weapon`, with its owner's upgrades, or 0 without one.""" 901 weapon = self.ground_weapon 902 return 0.0 if weapon is None else weapon.range
The range of ground_weapon, with its owner's upgrades, or 0 without one.
904 @property 905 def air_range(self) -> float: 906 """The range of `air_weapon`, with its owner's upgrades, or 0 without one.""" 907 weapon = self.air_weapon 908 return 0.0 if weapon is None else weapon.range
The range of air_weapon, with its owner's upgrades, or 0 without one.
910 @property 911 def ground_damage(self) -> float: 912 """What one attack of `ground_weapon` does before bonuses and armor, its `total_damage`, or 0 without 913 one. A hallucination's counts; `damage_against` is what an attack takes off a target.""" 914 weapon = self.ground_weapon 915 return 0.0 if weapon is None else weapon.total_damage
What one attack of ground_weapon does before bonuses and armor, its total_damage, or 0 without
one. A hallucination's counts; damage_against is what an attack takes off a target.
917 @property 918 def air_damage(self) -> float: 919 """What one attack of `air_weapon` does before bonuses and armor, as `ground_damage` is for the ground.""" 920 weapon = self.air_weapon 921 return 0.0 if weapon is None else weapon.total_damage
What one attack of air_weapon does before bonuses and armor, as ground_damage is for the ground.
923 @property 924 def ground_dps(self) -> float: 925 """The `dps` of `ground_weapon`, per second of the game's Faster speed with the mean attack delay, before 926 bonuses, armor and buffs, or 0 without one. A hallucination's counts; `dps_against` is what a target takes.""" 927 weapon = self.ground_weapon 928 return 0.0 if weapon is None else weapon.dps
The dps of ground_weapon, per second of the game's Faster speed with the mean attack delay, before
bonuses, armor and buffs, or 0 without one. A hallucination's counts; dps_against is what a target takes.
930 @property 931 def air_dps(self) -> float: 932 """The `dps` of `air_weapon`, as `ground_dps` is for the ground.""" 933 weapon = self.air_weapon 934 return 0.0 if weapon is None else weapon.dps
The dps of air_weapon, as ground_dps is for the ground.
936 @property 937 def is_melee(self) -> bool: 938 """Whether the unit fires at the ground from no farther than 1: its `ground_range` above 0 and at most 1, as a 939 zealot's and a zergling's are.""" 940 return 0.0 < self.ground_range <= 1.0
Whether the unit fires at the ground from no farther than 1: its ground_range above 0 and at most 1, as a
zealot's and a zergling's are.
948 def weapon_against(self, target: Unit[Any]) -> Weapon | None: 949 """The weapon of `active_weapons` this unit fires at `target`: one that hits the air for a target that flies, 950 and one that hits the ground for a target on it, or failing that, for a colossus, one that hits the air, as a 951 viking's did (in game). `None` if it has none that hits `target`, an oracle whose beam is off among them. 952 953 Raises `NotReportedError` for a target remembered in the fog and never seen visible, as `is_flying` does, and 954 for an oracle never shown visible. 955 """ 956 weapons = self.active_weapons 957 if target.is_flying: 958 return next((weapon for weapon in weapons if weapon.target_domain is not TargetDomain.GROUND), None) 959 on_the_ground = next((weapon for weapon in weapons if weapon.target_domain is not TargetDomain.AIR), None) 960 if on_the_ground is None and target.type_id in _GROUND_TYPES_HIT_FROM_THE_AIR: 961 return next((weapon for weapon in weapons if weapon.target_domain is TargetDomain.AIR), None) 962 return on_the_ground
The weapon of active_weapons this unit fires at target: one that hits the air for a target that flies,
and one that hits the ground for a target on it, or failing that, for a colossus, one that hits the air, as a
viking's did (in game). None if it has none that hits target, an oracle whose beam is off among them.
Raises NotReportedError for a target remembered in the fog and never seen visible, as is_flying does, and
for an oracle never shown visible.
964 def has_in_range(self, target: Unit[Any], *, margin: float = 0.0) -> bool: 965 """Whether `target` is within the reach of `weapon_against(target)`: their centers no farther apart than its 966 range, both radii and `margin`. False if this unit has no weapon against `target`. 967 968 That is where a unit that can move fires at another unit (in game). An attacker that cannot move, such as a 969 sieged tank or a spine crawler, fires from up to some 0.1 nearer, and any attacker fires at a structure from up 970 to some 0.26 nearer, so pass a negative `margin` to be sure the shot can land. Raises as `weapon_against` does. 971 """ 972 weapon = self.weapon_against(target) 973 return weapon is not None and self.distance_to(target) <= weapon.range + self.radius + target.radius + margin
Whether target is within the reach of weapon_against(target): their centers no farther apart than its
range, both radii and margin. False if this unit has no weapon against target.
That is where a unit that can move fires at another unit (in game). An attacker that cannot move, such as a
sieged tank or a spine crawler, fires from up to some 0.1 nearer, and any attacker fires at a structure from up
to some 0.26 nearer, so pass a negative margin to be sure the shot can land. Raises as weapon_against does.
975 def damage_against(self, target: Unit[Any]) -> float: 976 """What one attack of `weapon_against(target)` takes off `target`'s shields and health as they stand, every hit 977 of it counted, as `Weapon.damage_against` works it out from the target's attributes, `armor`, `shield_armor` 978 and `shield`. 0 if 979 this unit has no weapon against it or is a hallucination, which does no damage (stated). An enemy's reads as 980 one only once revealed, as `is_hallucination` has it. No buff on either unit counts. 981 982 Raises `NotReportedError` as `weapon_against` does, and for a unit of the two never shown visible, whose 983 shields or hallucination the game never reported. 984 """ 985 weapon = self.weapon_against(target) 986 return 0.0 if weapon is None or self.is_hallucination else _damage_of_one_attack(weapon, target)
What one attack of weapon_against(target) takes off target's shields and health as they stand, every hit
of it counted, as Weapon.damage_against works it out from the target's attributes, armor, shield_armor
and shield. 0 if
this unit has no weapon against it or is a hallucination, which does no damage (stated). An enemy's reads as
one only once revealed, as is_hallucination has it. No buff on either unit counts.
Raises NotReportedError as weapon_against does, and for a unit of the two never shown visible, whose
shields or hallucination the game never reported.
988 def bonus_damage_against(self, target: Unit[Any]) -> float: 989 """The bonus damage one attack of `weapon_against(target)` does for `target`'s attributes, before armor: its 990 `Weapon.bonus_per_hit_against` them, times its attacks. 0 if this unit has no weapon against it. A 991 hallucination's counts, as for `ground_damage`. Raises `NotReportedError` as `weapon_against` does.""" 992 weapon = self.weapon_against(target) 993 if weapon is None: 994 return 0.0 995 return weapon.bonus_per_hit_against(target.type_data.attributes) * weapon.attacks
The bonus damage one attack of weapon_against(target) does for target's attributes, before armor: its
Weapon.bonus_per_hit_against them, times its attacks. 0 if this unit has no weapon against it. A
hallucination's counts, as for ground_damage. Raises NotReportedError as weapon_against does.
997 def dps_against(self, target: Unit[Any]) -> float: 998 """`damage_against(target)` per second of real time at the game's Faster speed, with `weapon_against(target)` 999 attacking as often as the buffs on this unit have it: stim makes a marine's and a marauder's 1.5 times as often 1000 (in game). 0 where `damage_against` is. 1001 1002 Raises `NotReportedError` as `damage_against` does. 1003 """ 1004 weapon = self.weapon_against(target) 1005 if weapon is None or self.is_hallucination: 1006 return 0.0 1007 damage = _damage_of_one_attack(weapon, target) 1008 if (report := self._latest_visible_report) is None: 1009 raise self._never_seen_error("buffs") 1010 # What speeds an attack divides the base cooldown, and leaves the random delay as it is (in game). 1011 attack_speed_multiplier = math.prod(_ATTACK_SPEED_BY_RAW_BUFF.get(buff, 1.0) for buff in report.buff_ids) 1012 # In plain steps, which spares two `GameTime`s a call in a targeting loop. 1013 cooldown_steps = weapon.base_cooldown.steps / attack_speed_multiplier + weapon.mean_delay.steps 1014 return damage * STEPS_PER_SECOND / cooldown_steps
damage_against(target) per second of real time at the game's Faster speed, with weapon_against(target)
attacking as often as the buffs on this unit have it: stim makes a marine's and a marauder's 1.5 times as often
(in game). 0 where damage_against is.
Raises NotReportedError as damage_against does.
15@final 16class UnitDict[K: Unit[Any], V](MutableMapping[K, V]): 17 """A value for each unit, as a dict keyed by unit holds one, that forgets a unit once it is dead: a bot's own data 18 for its units, such as a role or the mineral field a worker mines. 19 20 A unit is the same key for the whole game, however often the game changes its tag. A dead key reads as absent 21 wherever it is read: a lookup drops its entry, and iterating, `len` and the views skip it, so a unit's value cannot 22 be read in the turn it dies. A unit is dead once `is_dead` says so: an enemy's unit that dies out of sight stays a 23 key until NachOS finds it dead, and a dead unit held as a value stays. Storing a dead unit is not refused, and no 24 read sees it. A unit a neural parasite takes over changes class in place, so an `OwnUnit` key can be the enemy's 25 while it lasts. In a replay played back with the fog off, `api.units` and `api.all_units` hold different objects 26 for one unit, each a key of its own. 27 """ 28 29 __slots__ = ("_values",) 30 31 def __init__(self, values: Mapping[K, V] | Iterable[tuple[K, V]] = (), /) -> None: 32 """Hold `values`: a mapping, or pairs of a unit and its value.""" 33 self._values: dict[K, V] = {} 34 self.update(values) 35 36 def __repr__(self) -> str: 37 return f"UnitDict({dict(self.items())!r})" 38 39 def __getitem__(self, unit: K, /) -> V: 40 value = self._values[unit] 41 if unit._dead: 42 del self._values[unit] 43 raise KeyError(unit) 44 return value 45 46 def __setitem__(self, unit: K, value: V, /) -> None: 47 self._values[unit] = value 48 49 def __delitem__(self, unit: K, /) -> None: 50 del self._values[unit] 51 if unit._dead: 52 raise KeyError(unit) 53 54 def __contains__(self, unit: object, /) -> bool: 55 values = self._values 56 if unit not in values: 57 return False 58 # A key, so a unit; `cast` would cost a call on every lookup. 59 key: K = unit # pyright: ignore[reportAssignmentType] 60 if key._dead: 61 del values[key] 62 return False 63 return True 64 65 def __iter__(self) -> Iterator[K]: 66 self._forget_dead_units() 67 return iter(self._values) 68 69 def __len__(self) -> int: 70 self._forget_dead_units() 71 return len(self._values) 72 73 def __bool__(self) -> bool: 74 return any(not unit._dead for unit in self._values) 75 76 def clear(self) -> None: 77 """Forget every unit.""" 78 self._values.clear() 79 80 def copy(self) -> UnitDict[K, V]: 81 """A new `UnitDict` of the living units with their values.""" 82 self._forget_dead_units() 83 copied: UnitDict[K, V] = UnitDict() 84 copied._values = dict(self._values) 85 return copied 86 87 __copy__ = copy 88 89 @overload 90 def get(self, unit: K, /) -> V | None: ... 91 92 @overload 93 def get(self, unit: K, default: V, /) -> V: ... 94 95 @overload 96 def get[T](self, unit: K, default: T, /) -> V | T: ... 97 98 def get(self, unit: K, default: Any = None, /) -> Any: 99 """The value of `unit`, or `default` if it has none or is dead.""" 100 value = self._values.get(unit, _NO_ENTRY) 101 if value is _NO_ENTRY: 102 return default 103 if unit._dead: 104 del self._values[unit] 105 return default 106 return value 107 108 def items(self) -> ItemsView[K, V]: 109 """Each living unit with its value.""" 110 return _LivingUnitItems(self) 111 112 def values(self) -> ValuesView[V]: 113 """The value of each living unit.""" 114 return _LivingUnitValues(self) 115 116 def _forget_dead_units(self) -> None: 117 """Drop the entries of the units now dead.""" 118 values = self._values 119 for unit in [unit for unit in values if unit._dead]: 120 del values[unit]
A value for each unit, as a dict keyed by unit holds one, that forgets a unit once it is dead: a bot's own data for its units, such as a role or the mineral field a worker mines.
A unit is the same key for the whole game, however often the game changes its tag. A dead key reads as absent
wherever it is read: a lookup drops its entry, and iterating, len and the views skip it, so a unit's value cannot
be read in the turn it dies. A unit is dead once is_dead says so: an enemy's unit that dies out of sight stays a
key until NachOS finds it dead, and a dead unit held as a value stays. Storing a dead unit is not refused, and no
read sees it. A unit a neural parasite takes over changes class in place, so an OwnUnit key can be the enemy's
while it lasts. In a replay played back with the fog off, api.units and api.all_units hold different objects
for one unit, each a key of its own.
31 def __init__(self, values: Mapping[K, V] | Iterable[tuple[K, V]] = (), /) -> None: 32 """Hold `values`: a mapping, or pairs of a unit and its value.""" 33 self._values: dict[K, V] = {} 34 self.update(values)
Hold values: a mapping, or pairs of a unit and its value.
80 def copy(self) -> UnitDict[K, V]: 81 """A new `UnitDict` of the living units with their values.""" 82 self._forget_dead_units() 83 copied: UnitDict[K, V] = UnitDict() 84 copied._values = dict(self._values) 85 return copied
A new UnitDict of the living units with their values.
98 def get(self, unit: K, default: Any = None, /) -> Any: 99 """The value of `unit`, or `default` if it has none or is dead.""" 100 value = self._values.get(unit, _NO_ENTRY) 101 if value is _NO_ENTRY: 102 return default 103 if unit._dead: 104 del self._values[unit] 105 return default 106 return value
The value of unit, or default if it has none or is dead.
20class UnitType: 21 """Every type of unit, and every group of types, for the type checker. None is ever instantiated. 22 23 `Unit[UnitType.Marine]` is a marine, and `Unit[UnitType.ProtossStructure]` a Protoss structure. A type's `id` is its 24 `UnitTypeId`. A group is a race, the structures, the types that are not, or the structures of a race, as the game's 25 tables give them; or the workers, the townhalls, the Terran and the Zerg townhalls, what workers gather at, the 26 mineral fields, the vespene geysers, the gas buildings, each race's on a plain or a rich geyser, the collapsible 27 towers and their debris, the destructible rocks, the inhibitor and acceleration zones, the critters, the 28 changelings, the creep tumors, the locusts, the cocoons, the add-ons, tech labs and reactors, the spires, the 29 overlords, the units each Terran and Protoss production structure makes, or the two forms of a structure or a unit 30 that changes and changes back, such as a supply depot raised or lowered, a siege tank sieged or not, or a roach 31 burrowed or not. Each group is in every group that holds all its types: `AnySupplyDepot` is a `TerranStructure`, 32 `AnyDrone` a `Worker`, `AnySiegeTank` a `FactoryUnit`, `Townhall` a `Structure`, and `Worker` a `NonStructure`. A 33 type's `UnitTypeData.equivalent_types` is the group of two forms it is in, or else its own class. 34 35 `includes(unit)` tells whether a unit is of a type or group, narrowing it, `type_ids` holds its ids, and 36 `types_are_equivalent` whether a unit converts between its types and back at will. 37 """ 38 39 class AnyType: 40 """Any type of unit, and what every type and group is. 41 42 `type[UnitType.AnyType]` takes any of them. `Unit[Any]` is a unit that reads as any type, where 43 `Unit[UnitType.AnyType]` is one whose type the type checker does not know, so a read only some types have is an 44 error on it until `includes` narrows it. 45 """ 46 47 type_ids: ClassVar[frozenset[UnitTypeId]] = frozenset() 48 """The ids this class stands for: a type's own `id`, or those of every type in a group. A type id with no unit 49 is tested against them, as for a structure about to be built: `type_id in UnitType.GasBuilding.type_ids`. A 50 unit is tested by `includes`, which narrows it.""" 51 52 types_are_equivalent: ClassVar[bool] = False 53 """Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and 54 unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as 55 `UnitType.AnySiegeTank`, the `UnitTypeData.equivalent_types` of its types. No class reads False in a group that 56 reads True. Any other group reads False, and a class in it may still read True, as `UnitType.Marine` does in 57 `UnitType.BarracksUnit`.""" 58 59 def __init_subclass__(cls) -> None: 60 """Add the type a class names by its `id` to every group it is in. A class with an `id` is a single type, 61 whose types are equivalent, and one without is a group.""" 62 super().__init_subclass__() 63 type_id: UnitTypeId | None = cls.__dict__.get("id") 64 cls.type_ids = frozenset() if type_id is None else frozenset((type_id,)) 65 if type_id is not None: 66 cls.types_are_equivalent = True 67 # Everything between the class and `object` is a group it is in, `AnyType` included. 68 for group in cast("tuple[type[UnitType.AnyType], ...]", cls.__mro__[1:-1]): 69 group.type_ids |= cls.type_ids 70 71 @overload 72 @classmethod 73 def includes(cls, unit: OwnUnit[Any], /) -> TypeGuard[OwnUnit[Self]]: ... 74 75 @overload 76 @classmethod 77 def includes(cls, unit: Unit[Any], /) -> TypeGuard[Unit[Self]]: ... 78 79 @classmethod 80 def includes(cls, unit: Unit[Any], /) -> bool: 81 """Whether `unit` is of this type, or of a type in this group, narrowing it for the type checker. 82 83 Raises `UncuratedIdError` for a unit of a type the curated ids leave out. 84 """ 85 return unit.type_id in cls.type_ids 86 87 class Structure(AnyType): 88 """A type the game's tables give the structure attribute.""" 89 90 class NonStructure(AnyType): 91 """A type the game's tables do not give the structure attribute.""" 92 93 class Terran(AnyType): 94 """A Terran type.""" 95 96 class Zerg(AnyType): 97 """A Zerg type.""" 98 99 class Protoss(AnyType): 100 """A Protoss type.""" 101 102 class TerranStructure(Terran, Structure): 103 """A Terran structure.""" 104 105 class ZergStructure(Zerg, Structure): 106 """A Zerg structure.""" 107 108 class ProtossStructure(Protoss, Structure): 109 """A Protoss structure.""" 110 111 class Worker(NonStructure): 112 """A worker: an SCV, a probe or a drone, burrowed or not. A MULE is none.""" 113 114 class Townhall(Structure): 115 """A townhall: a command center or what it becomes, lifted or not, a nexus, a hatchery, lair or hive.""" 116 117 class AnyTerranTownhall(Townhall, TerranStructure): 118 """A command center or an orbital command, lifted or not, or a planetary fortress.""" 119 120 class AnyZergTownhall(Townhall, ZergStructure): 121 """A Zerg townhall: a hatchery, a lair or a hive.""" 122 123 class AnyResource(Structure): 124 """What a worker gathers at: a mineral field or a gas building, never the geyser under it.""" 125 126 class AnyMineralField(AnyResource): 127 """A mineral field of any kind: one the game's tables say holds minerals.""" 128 129 class AnyVespeneGeyser(Structure): 130 """A vespene geyser of any kind: one the game's tables say holds vespene, of no race.""" 131 132 class GasBuilding(AnyResource): 133 """A refinery, an assimilator or an extractor: one the game's tables say holds vespene, of a race.""" 134 135 class AnyRefinery(GasBuilding, TerranStructure): 136 """A refinery, on a plain or a rich geyser.""" 137 138 class AnyExtractor(GasBuilding, ZergStructure): 139 """An extractor, on a plain or a rich geyser.""" 140 141 class AnyAssimilator(GasBuilding, ProtossStructure): 142 """An assimilator, on a plain or a rich geyser.""" 143 144 class Destructible(Structure): 145 """A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.""" 146 147 class CollapsibleTower(Destructible): 148 """A collapsible tower, which falls across a path once destroyed and stays there.""" 149 150 class CollapsibleTowerDebris(Destructible): 151 """The debris a collapsible tower leaves where it lands once felled.""" 152 153 class InhibitorZone(AnyType): 154 """An inhibitor zone generator, of any size, plain or flying.""" 155 156 class AccelerationZone(NonStructure): 157 """An acceleration zone generator, of any size, plain or flying.""" 158 159 class Critter(NonStructure): 160 """One of a map's critters: an animal or a robot that wanders and covers no ground.""" 161 162 class AnyChangeling(NonStructure, Zerg): 163 """A changeling, plain or in the shape of a marine, a zealot or a zergling.""" 164 165 class AnyCreepTumor(ZergStructure): 166 """A creep tumor, a queen's or another tumor's, growing or burrowed.""" 167 168 class AnyLocust(NonStructure, Zerg): 169 """A locust, on the ground or flying.""" 170 171 class Cocoon(NonStructure, Zerg): 172 """A cocoon or a lurker egg: a unit on its way to becoming another, as a zergling becomes a baneling.""" 173 174 class AnyAddOn(TerranStructure): 175 """An add-on of any kind: a tech lab or a reactor, attached to its host or plain.""" 176 177 class AnyTechLab(AnyAddOn): 178 """A tech lab of any kind: a barracks', a factory's or a starport's, or a plain one.""" 179 180 class AnyReactor(AnyAddOn): 181 """A reactor of any kind: a barracks', a factory's or a starport's, or a plain one.""" 182 183 class AnySpire(ZergStructure): 184 """A spire or a greater spire.""" 185 186 class AnyOverlord(NonStructure, Zerg): 187 """An overlord, a transport overlord, or an overseer in either mode, which the tables count as one.""" 188 189 class BarracksUnit(NonStructure, Terran): 190 """A unit a barracks trains: a marine, a marauder, a reaper or a ghost.""" 191 192 class FactoryUnit(NonStructure, Terran): 193 """A unit a factory makes, in any form: a hellion or hellbat, a widow mine, siege tank, cyclone or thor.""" 194 195 class StarportUnit(NonStructure, Terran): 196 """A unit a starport makes, in any form: a viking, medivac, liberator, raven, banshee or battlecruiser.""" 197 198 class GatewayUnit(NonStructure, Protoss): 199 """A unit a gateway trains or a warp gate warps in: a zealot, stalker, sentry, adept or either templar.""" 200 201 class RoboticsFacilityUnit(NonStructure, Protoss): 202 """A unit a robotics facility makes, in any form: an observer, warp prism, immortal, colossus or disruptor.""" 203 204 class StargateUnit(NonStructure, Protoss): 205 """A unit a stargate makes: a phoenix, an oracle, a void ray, a tempest or a carrier.""" 206 207 class AnySupplyDepot(TerranStructure): 208 """A supply depot, raised or lowered.""" 209 210 types_are_equivalent = True 211 212 class AnyBarracks(TerranStructure): 213 """A barracks, landed or flying.""" 214 215 types_are_equivalent = True 216 217 class AnyFactory(TerranStructure): 218 """A factory, landed or flying.""" 219 220 types_are_equivalent = True 221 222 class AnyStarport(TerranStructure): 223 """A starport, landed or flying.""" 224 225 types_are_equivalent = True 226 227 class AnyCommandCenter(AnyTerranTownhall): 228 """A command center, landed or flying. An orbital command and a planetary fortress are none.""" 229 230 types_are_equivalent = True 231 232 class AnyOrbitalCommand(AnyTerranTownhall): 233 """An orbital command, landed or flying.""" 234 235 types_are_equivalent = True 236 237 class AnyGateway(ProtossStructure): 238 """A gateway or a warp gate.""" 239 240 types_are_equivalent = True 241 242 class AnySpineCrawler(ZergStructure): 243 """A spine crawler, rooted or uprooted.""" 244 245 types_are_equivalent = True 246 247 class AnySporeCrawler(ZergStructure): 248 """A spore crawler, rooted or uprooted.""" 249 250 types_are_equivalent = True 251 252 class AnyViking(StarportUnit): 253 """A viking, flying or landed.""" 254 255 types_are_equivalent = True 256 257 class AnySiegeTank(FactoryUnit): 258 """A siege tank, sieged or not.""" 259 260 types_are_equivalent = True 261 262 class AnyWidowMine(FactoryUnit): 263 """A widow mine, burrowed or not.""" 264 265 types_are_equivalent = True 266 267 class AnyLiberator(StarportUnit): 268 """A liberator, sieged or not.""" 269 270 types_are_equivalent = True 271 272 class AnyThor(FactoryUnit): 273 """A thor, in either mode.""" 274 275 types_are_equivalent = True 276 277 class AnyHellion(FactoryUnit): 278 """A hellion or a hellbat.""" 279 280 types_are_equivalent = True 281 282 class AnyObserver(RoboticsFacilityUnit): 283 """An observer, in surveillance mode or not.""" 284 285 types_are_equivalent = True 286 287 class AnyOverseer(AnyOverlord): 288 """An overseer, in oversight mode or not.""" 289 290 types_are_equivalent = True 291 292 class AnyWarpPrism(RoboticsFacilityUnit): 293 """A warp prism, phasing or not.""" 294 295 types_are_equivalent = True 296 297 class AnyDrone(Worker, Zerg): 298 """A drone, burrowed or not.""" 299 300 types_are_equivalent = True 301 302 class AnyZergling(NonStructure, Zerg): 303 """A zergling, burrowed or not.""" 304 305 types_are_equivalent = True 306 307 class AnyBaneling(NonStructure, Zerg): 308 """A baneling, burrowed or not.""" 309 310 types_are_equivalent = True 311 312 class AnyRoach(NonStructure, Zerg): 313 """A roach, burrowed or not.""" 314 315 types_are_equivalent = True 316 317 class AnyRavager(NonStructure, Zerg): 318 """A ravager, burrowed or not.""" 319 320 types_are_equivalent = True 321 322 class AnyHydralisk(NonStructure, Zerg): 323 """A hydralisk, burrowed or not.""" 324 325 types_are_equivalent = True 326 327 class AnyLurker(NonStructure, Zerg): 328 """A lurker, burrowed or not.""" 329 330 types_are_equivalent = True 331 332 class AnyInfestor(NonStructure, Zerg): 333 """An infestor, burrowed or not.""" 334 335 types_are_equivalent = True 336 337 class AnySwarmHost(NonStructure, Zerg): 338 """A swarm host, burrowed or not.""" 339 340 types_are_equivalent = True 341 342 class AnyUltralisk(NonStructure, Zerg): 343 """An ultralisk, burrowed or not.""" 344 345 types_are_equivalent = True 346 347 class AnyQueen(NonStructure, Zerg): 348 """A queen, burrowed or not.""" 349 350 types_are_equivalent = True 351 352 class AccelerationZoneFlyingLarge(AccelerationZone): 353 id = UnitTypeId.ACCELERATION_ZONE_FLYING_LARGE 354 355 class AccelerationZoneFlyingMedium(AccelerationZone): 356 id = UnitTypeId.ACCELERATION_ZONE_FLYING_MEDIUM 357 358 class AccelerationZoneFlyingSmall(AccelerationZone): 359 id = UnitTypeId.ACCELERATION_ZONE_FLYING_SMALL 360 361 class AccelerationZoneLarge(AccelerationZone): 362 id = UnitTypeId.ACCELERATION_ZONE_LARGE 363 364 class AccelerationZoneMedium(AccelerationZone): 365 id = UnitTypeId.ACCELERATION_ZONE_MEDIUM 366 367 class AccelerationZoneSmall(AccelerationZone): 368 id = UnitTypeId.ACCELERATION_ZONE_SMALL 369 370 class Adept(GatewayUnit): 371 id = UnitTypeId.ADEPT 372 373 class AdeptShade(NonStructure, Protoss): 374 id = UnitTypeId.ADEPT_SHADE 375 376 class Archon(NonStructure, Protoss): 377 id = UnitTypeId.ARCHON 378 379 class Armory(TerranStructure): 380 id = UnitTypeId.ARMORY 381 382 class Assimilator(AnyAssimilator): 383 id = UnitTypeId.ASSIMILATOR 384 385 class AssimilatorRich(AnyAssimilator): 386 id = UnitTypeId.ASSIMILATOR_RICH 387 388 class AutoTurret(TerranStructure): 389 id = UnitTypeId.AUTO_TURRET 390 391 class Baneling(AnyBaneling): 392 id = UnitTypeId.BANELING 393 394 class BanelingBurrowed(AnyBaneling): 395 id = UnitTypeId.BANELING_BURROWED 396 397 class BanelingCocoon(Cocoon): 398 id = UnitTypeId.BANELING_COCOON 399 400 class BanelingNest(ZergStructure): 401 id = UnitTypeId.BANELING_NEST 402 403 class Banshee(StarportUnit): 404 id = UnitTypeId.BANSHEE 405 406 class Barracks(AnyBarracks): 407 id = UnitTypeId.BARRACKS 408 409 class BarracksFlying(AnyBarracks): 410 id = UnitTypeId.BARRACKS_FLYING 411 412 class Battlecruiser(StarportUnit): 413 id = UnitTypeId.BATTLECRUISER 414 415 class BroodLord(NonStructure, Zerg): 416 id = UnitTypeId.BROOD_LORD 417 418 class BroodLordCocoon(Cocoon): 419 id = UnitTypeId.BROOD_LORD_COCOON 420 421 class Broodling(NonStructure, Zerg): 422 id = UnitTypeId.BROODLING 423 424 class Bunker(TerranStructure): 425 id = UnitTypeId.BUNKER 426 427 class Carrier(StargateUnit): 428 id = UnitTypeId.CARRIER 429 430 class Changeling(AnyChangeling): 431 id = UnitTypeId.CHANGELING 432 433 class ChangelingMarine(AnyChangeling): 434 id = UnitTypeId.CHANGELING_MARINE 435 436 class ChangelingMarineShield(AnyChangeling): 437 id = UnitTypeId.CHANGELING_MARINE_SHIELD 438 439 class ChangelingZealot(AnyChangeling): 440 id = UnitTypeId.CHANGELING_ZEALOT 441 442 class ChangelingZergling(AnyChangeling): 443 id = UnitTypeId.CHANGELING_ZERGLING 444 445 class ChangelingZerglingWings(AnyChangeling): 446 id = UnitTypeId.CHANGELING_ZERGLING_WINGS 447 448 class CollapsibleTowerDebrisPurifier(CollapsibleTowerDebris): 449 id = UnitTypeId.COLLAPSIBLE_TOWER_DEBRIS_PURIFIER 450 451 class CollapsibleTowerDebrisRampLeftRock(CollapsibleTowerDebris): 452 id = UnitTypeId.COLLAPSIBLE_TOWER_DEBRIS_RAMP_LEFT_ROCK 453 454 class CollapsibleTowerDebrisRampLeftRockGreen(CollapsibleTowerDebris): 455 id = UnitTypeId.COLLAPSIBLE_TOWER_DEBRIS_RAMP_LEFT_ROCK_GREEN 456 457 class CollapsibleTowerDebrisRampRightRock(CollapsibleTowerDebris): 458 id = UnitTypeId.COLLAPSIBLE_TOWER_DEBRIS_RAMP_RIGHT_ROCK 459 460 class CollapsibleTowerDebrisRampRightRockGreen(CollapsibleTowerDebris): 461 id = UnitTypeId.COLLAPSIBLE_TOWER_DEBRIS_RAMP_RIGHT_ROCK_GREEN 462 463 class CollapsibleTowerDebrisRock(CollapsibleTowerDebris): 464 id = UnitTypeId.COLLAPSIBLE_TOWER_DEBRIS_ROCK 465 466 class CollapsibleTowerDebrisTerran(CollapsibleTowerDebris): 467 id = UnitTypeId.COLLAPSIBLE_TOWER_DEBRIS_TERRAN 468 469 class CollapsibleTowerDiagonalPurifier(CollapsibleTower): 470 id = UnitTypeId.COLLAPSIBLE_TOWER_DIAGONAL_PURIFIER 471 472 class CollapsibleTowerDiagonalRock(CollapsibleTower): 473 id = UnitTypeId.COLLAPSIBLE_TOWER_DIAGONAL_ROCK 474 475 class CollapsibleTowerDiagonalTerran(CollapsibleTower): 476 id = UnitTypeId.COLLAPSIBLE_TOWER_DIAGONAL_TERRAN 477 478 class CollapsibleTowerPushUnitPurifier(Structure): 479 id = UnitTypeId.COLLAPSIBLE_TOWER_PUSH_UNIT_PURIFIER 480 481 class CollapsibleTowerPushUnitRampLeftRock(Structure): 482 id = UnitTypeId.COLLAPSIBLE_TOWER_PUSH_UNIT_RAMP_LEFT_ROCK 483 484 class CollapsibleTowerPushUnitRampLeftRockGreen(Structure): 485 id = UnitTypeId.COLLAPSIBLE_TOWER_PUSH_UNIT_RAMP_LEFT_ROCK_GREEN 486 487 class CollapsibleTowerPushUnitRampLeftTerran(Structure): 488 id = UnitTypeId.COLLAPSIBLE_TOWER_PUSH_UNIT_RAMP_LEFT_TERRAN 489 490 class CollapsibleTowerPushUnitRampRightRock(Structure): 491 id = UnitTypeId.COLLAPSIBLE_TOWER_PUSH_UNIT_RAMP_RIGHT_ROCK 492 493 class CollapsibleTowerPushUnitRampRightRockGreen(Structure): 494 id = UnitTypeId.COLLAPSIBLE_TOWER_PUSH_UNIT_RAMP_RIGHT_ROCK_GREEN 495 496 class CollapsibleTowerPushUnitRampRightTerran(Structure): 497 id = UnitTypeId.COLLAPSIBLE_TOWER_PUSH_UNIT_RAMP_RIGHT_TERRAN 498 499 class CollapsibleTowerPushUnitRock(Structure): 500 id = UnitTypeId.COLLAPSIBLE_TOWER_PUSH_UNIT_ROCK 501 502 class CollapsibleTowerPushUnitTerran(Structure): 503 id = UnitTypeId.COLLAPSIBLE_TOWER_PUSH_UNIT_TERRAN 504 505 class CollapsibleTowerRampLeftRock(CollapsibleTower): 506 id = UnitTypeId.COLLAPSIBLE_TOWER_RAMP_LEFT_ROCK 507 508 class CollapsibleTowerRampLeftRockGreen(CollapsibleTower): 509 id = UnitTypeId.COLLAPSIBLE_TOWER_RAMP_LEFT_ROCK_GREEN 510 511 class CollapsibleTowerRampLeftTerran(CollapsibleTower): 512 id = UnitTypeId.COLLAPSIBLE_TOWER_RAMP_LEFT_TERRAN 513 514 class CollapsibleTowerRampRightRock(CollapsibleTower): 515 id = UnitTypeId.COLLAPSIBLE_TOWER_RAMP_RIGHT_ROCK 516 517 class CollapsibleTowerRampRightRockGreen(CollapsibleTower): 518 id = UnitTypeId.COLLAPSIBLE_TOWER_RAMP_RIGHT_ROCK_GREEN 519 520 class CollapsibleTowerRampRightTerran(CollapsibleTower): 521 id = UnitTypeId.COLLAPSIBLE_TOWER_RAMP_RIGHT_TERRAN 522 523 class CollapsibleTowerRock(CollapsibleTower): 524 id = UnitTypeId.COLLAPSIBLE_TOWER_ROCK 525 526 class CollapsibleTowerTerran(CollapsibleTower): 527 id = UnitTypeId.COLLAPSIBLE_TOWER_TERRAN 528 529 class Colossus(RoboticsFacilityUnit): 530 id = UnitTypeId.COLOSSUS 531 532 class CommandCenter(AnyCommandCenter): 533 id = UnitTypeId.COMMAND_CENTER 534 535 class CommandCenterFlying(AnyCommandCenter): 536 id = UnitTypeId.COMMAND_CENTER_FLYING 537 538 class Corruptor(NonStructure, Zerg): 539 id = UnitTypeId.CORRUPTOR 540 541 class CreepTumor(AnyCreepTumor): 542 id = UnitTypeId.CREEP_TUMOR 543 544 class CreepTumorBurrowed(AnyCreepTumor): 545 id = UnitTypeId.CREEP_TUMOR_BURROWED 546 547 class CreepTumorQueen(AnyCreepTumor): 548 id = UnitTypeId.CREEP_TUMOR_QUEEN 549 550 class CritterCleaningBot(Critter): 551 id = UnitTypeId.CRITTER_CLEANING_BOT 552 553 class CritterLabBot(Critter): 554 id = UnitTypeId.CRITTER_LAB_BOT 555 556 class CyberneticsCore(ProtossStructure): 557 id = UnitTypeId.CYBERNETICS_CORE 558 559 class Cyclone(FactoryUnit): 560 id = UnitTypeId.CYCLONE 561 562 class DarkShrine(ProtossStructure): 563 id = UnitTypeId.DARK_SHRINE 564 565 class DarkTemplar(GatewayUnit): 566 id = UnitTypeId.DARK_TEMPLAR 567 568 class Destructible1x1BraxisAlpha(Destructible): 569 id = UnitTypeId.DESTRUCTIBLE_1X1_BRAXIS_ALPHA 570 571 class Destructible2x2BraxisAlpha(Destructible): 572 id = UnitTypeId.DESTRUCTIBLE_2X2_BRAXIS_ALPHA 573 574 class Destructible2x4HorizontalCityDebris(Destructible): 575 id = UnitTypeId.DESTRUCTIBLE_2X4_HORIZONTAL_CITY_DEBRIS 576 577 class Destructible2x4HorizontalIce(Destructible): 578 id = UnitTypeId.DESTRUCTIBLE_2X4_HORIZONTAL_ICE 579 580 class Destructible2x4HorizontalRock(Destructible): 581 id = UnitTypeId.DESTRUCTIBLE_2X4_HORIZONTAL_ROCK 582 583 class Destructible2x4HorizontalRockEx1(Destructible): 584 id = UnitTypeId.DESTRUCTIBLE_2X4_HORIZONTAL_ROCK_EX1 585 586 class Destructible2x4VerticalCityDebris(Destructible): 587 id = UnitTypeId.DESTRUCTIBLE_2X4_VERTICAL_CITY_DEBRIS 588 589 class Destructible2x4VerticalIce(Destructible): 590 id = UnitTypeId.DESTRUCTIBLE_2X4_VERTICAL_ICE 591 592 class Destructible2x4VerticalRock(Destructible): 593 id = UnitTypeId.DESTRUCTIBLE_2X4_VERTICAL_ROCK 594 595 class Destructible2x4VerticalRockEx1(Destructible): 596 id = UnitTypeId.DESTRUCTIBLE_2X4_VERTICAL_ROCK_EX1 597 598 class Destructible2x6HorizontalCityDebris(Destructible): 599 id = UnitTypeId.DESTRUCTIBLE_2X6_HORIZONTAL_CITY_DEBRIS 600 601 class Destructible2x6HorizontalIce(Destructible): 602 id = UnitTypeId.DESTRUCTIBLE_2X6_HORIZONTAL_ICE 603 604 class Destructible2x6HorizontalRock(Destructible): 605 id = UnitTypeId.DESTRUCTIBLE_2X6_HORIZONTAL_ROCK 606 607 class Destructible2x6HorizontalRockEx1(Destructible): 608 id = UnitTypeId.DESTRUCTIBLE_2X6_HORIZONTAL_ROCK_EX1 609 610 class Destructible2x6VerticalCityDebris(Destructible): 611 id = UnitTypeId.DESTRUCTIBLE_2X6_VERTICAL_CITY_DEBRIS 612 613 class Destructible2x6VerticalIce(Destructible): 614 id = UnitTypeId.DESTRUCTIBLE_2X6_VERTICAL_ICE 615 616 class Destructible2x6VerticalRock(Destructible): 617 id = UnitTypeId.DESTRUCTIBLE_2X6_VERTICAL_ROCK 618 619 class Destructible2x6VerticalRockEx1(Destructible): 620 id = UnitTypeId.DESTRUCTIBLE_2X6_VERTICAL_ROCK_EX1 621 622 class Destructible3x3ZergInfestation(Destructible): 623 id = UnitTypeId.DESTRUCTIBLE_3X3_ZERG_INFESTATION 624 625 class Destructible4x4CityDebris(Destructible): 626 id = UnitTypeId.DESTRUCTIBLE_4X4_CITY_DEBRIS 627 628 class Destructible4x4Debris(Destructible): 629 id = UnitTypeId.DESTRUCTIBLE_4X4_DEBRIS 630 631 class Destructible4x4Ice(Destructible): 632 id = UnitTypeId.DESTRUCTIBLE_4X4_ICE 633 634 class Destructible4x4Rock(Destructible): 635 id = UnitTypeId.DESTRUCTIBLE_4X4_ROCK 636 637 class Destructible4x4RockEx1(Destructible): 638 id = UnitTypeId.DESTRUCTIBLE_4X4_ROCK_EX1 639 640 class Destructible6x6CityDebris(Destructible): 641 id = UnitTypeId.DESTRUCTIBLE_6X6_CITY_DEBRIS 642 643 class Destructible6x6Debris(Destructible): 644 id = UnitTypeId.DESTRUCTIBLE_6X6_DEBRIS 645 646 class Destructible6x6ExpeditionGate(Destructible): 647 id = UnitTypeId.DESTRUCTIBLE_6X6_EXPEDITION_GATE 648 649 class Destructible6x6Ice(Destructible): 650 id = UnitTypeId.DESTRUCTIBLE_6X6_ICE 651 652 class Destructible6x6Rock(Destructible): 653 id = UnitTypeId.DESTRUCTIBLE_6X6_ROCK 654 655 class Destructible6x6RockEx1(Destructible): 656 id = UnitTypeId.DESTRUCTIBLE_6X6_ROCK_EX1 657 658 class Destructible6x6WeakRock(Destructible): 659 id = UnitTypeId.DESTRUCTIBLE_6X6_WEAK_ROCK 660 661 class DestructibleHugeDiagonalBlurCityDebris(Destructible): 662 id = UnitTypeId.DESTRUCTIBLE_HUGE_DIAGONAL_BLUR_CITY_DEBRIS 663 664 class DestructibleHugeDiagonalBlurDebrisRamp(Destructible): 665 id = UnitTypeId.DESTRUCTIBLE_HUGE_DIAGONAL_BLUR_DEBRIS_RAMP 666 667 class DestructibleHugeDiagonalBlurIce(Destructible): 668 id = UnitTypeId.DESTRUCTIBLE_HUGE_DIAGONAL_BLUR_ICE 669 670 class DestructibleHugeDiagonalBlurRamp(Destructible): 671 id = UnitTypeId.DESTRUCTIBLE_HUGE_DIAGONAL_BLUR_RAMP 672 673 class DestructibleHugeDiagonalBlurRockEx1(Destructible): 674 id = UnitTypeId.DESTRUCTIBLE_HUGE_DIAGONAL_BLUR_ROCK_EX1 675 676 class DestructibleHugeDiagonalUlbrCityDebris(Destructible): 677 id = UnitTypeId.DESTRUCTIBLE_HUGE_DIAGONAL_ULBR_CITY_DEBRIS 678 679 class DestructibleHugeDiagonalUlbrDebrisRamp(Destructible): 680 id = UnitTypeId.DESTRUCTIBLE_HUGE_DIAGONAL_ULBR_DEBRIS_RAMP 681 682 class DestructibleHugeDiagonalUlbrIce(Destructible): 683 id = UnitTypeId.DESTRUCTIBLE_HUGE_DIAGONAL_ULBR_ICE 684 685 class DestructibleHugeDiagonalUlbrRamp(Destructible): 686 id = UnitTypeId.DESTRUCTIBLE_HUGE_DIAGONAL_ULBR_RAMP 687 688 class DestructibleHugeDiagonalUlbrRockEx1(Destructible): 689 id = UnitTypeId.DESTRUCTIBLE_HUGE_DIAGONAL_ULBR_ROCK_EX1 690 691 class DestructibleHugeHorizontalIce(Destructible): 692 id = UnitTypeId.DESTRUCTIBLE_HUGE_HORIZONTAL_ICE 693 694 class DestructibleHugeHorizontalRamp(Destructible): 695 id = UnitTypeId.DESTRUCTIBLE_HUGE_HORIZONTAL_RAMP 696 697 class DestructibleHugeHorizontalRockEx1(Destructible): 698 id = UnitTypeId.DESTRUCTIBLE_HUGE_HORIZONTAL_ROCK_EX1 699 700 class DestructibleHugeVerticalIce(Destructible): 701 id = UnitTypeId.DESTRUCTIBLE_HUGE_VERTICAL_ICE 702 703 class DestructibleHugeVerticalRamp(Destructible): 704 id = UnitTypeId.DESTRUCTIBLE_HUGE_VERTICAL_RAMP 705 706 class DestructibleHugeVerticalRockEx1(Destructible): 707 id = UnitTypeId.DESTRUCTIBLE_HUGE_VERTICAL_ROCK_EX1 708 709 class DestructibleUnbuildableBricks(Destructible): 710 id = UnitTypeId.DESTRUCTIBLE_UNBUILDABLE_BRICKS 711 712 class DestructibleUnbuildablePlates(Destructible): 713 id = UnitTypeId.DESTRUCTIBLE_UNBUILDABLE_PLATES 714 715 class DestructibleUnbuildableRocks(Destructible): 716 id = UnitTypeId.DESTRUCTIBLE_UNBUILDABLE_ROCKS 717 718 class Disruptor(RoboticsFacilityUnit): 719 id = UnitTypeId.DISRUPTOR 720 721 class Drone(AnyDrone): 722 id = UnitTypeId.DRONE 723 724 class DroneBurrowed(AnyDrone): 725 id = UnitTypeId.DRONE_BURROWED 726 727 class Egg(NonStructure, Zerg): 728 id = UnitTypeId.EGG 729 730 class EngineeringBay(TerranStructure): 731 id = UnitTypeId.ENGINEERING_BAY 732 733 class EvolutionChamber(ZergStructure): 734 id = UnitTypeId.EVOLUTION_CHAMBER 735 736 class Extractor(AnyExtractor): 737 id = UnitTypeId.EXTRACTOR 738 739 class ExtractorRich(AnyExtractor): 740 id = UnitTypeId.EXTRACTOR_RICH 741 742 class Factory(AnyFactory): 743 id = UnitTypeId.FACTORY 744 745 class FactoryFlying(AnyFactory): 746 id = UnitTypeId.FACTORY_FLYING 747 748 class FleetBeacon(ProtossStructure): 749 id = UnitTypeId.FLEET_BEACON 750 751 class ForceField(NonStructure, Protoss): 752 id = UnitTypeId.FORCE_FIELD 753 754 class Forge(ProtossStructure): 755 id = UnitTypeId.FORGE 756 757 class FusionCore(TerranStructure): 758 id = UnitTypeId.FUSION_CORE 759 760 class Gateway(AnyGateway): 761 id = UnitTypeId.GATEWAY 762 763 class Ghost(BarracksUnit): 764 id = UnitTypeId.GHOST 765 766 class GhostAcademy(TerranStructure): 767 id = UnitTypeId.GHOST_ACADEMY 768 769 class GreaterSpire(AnySpire): 770 id = UnitTypeId.GREATER_SPIRE 771 772 class Hatchery(AnyZergTownhall): 773 id = UnitTypeId.HATCHERY 774 775 class HealingShrineXelNaga(NonStructure): 776 id = UnitTypeId.HEALING_SHRINE_XEL_NAGA 777 778 class Hellbat(AnyHellion): 779 id = UnitTypeId.HELLBAT 780 781 class Hellion(AnyHellion): 782 id = UnitTypeId.HELLION 783 784 class HighTemplar(GatewayUnit): 785 id = UnitTypeId.HIGH_TEMPLAR 786 787 class Hive(AnyZergTownhall): 788 id = UnitTypeId.HIVE 789 790 class Hydralisk(AnyHydralisk): 791 id = UnitTypeId.HYDRALISK 792 793 class HydraliskBurrowed(AnyHydralisk): 794 id = UnitTypeId.HYDRALISK_BURROWED 795 796 class HydraliskDen(ZergStructure): 797 id = UnitTypeId.HYDRALISK_DEN 798 799 class Immortal(RoboticsFacilityUnit): 800 id = UnitTypeId.IMMORTAL 801 802 class InfestationPit(ZergStructure): 803 id = UnitTypeId.INFESTATION_PIT 804 805 class Infestor(AnyInfestor): 806 id = UnitTypeId.INFESTOR 807 808 class InfestorBurrowed(AnyInfestor): 809 id = UnitTypeId.INFESTOR_BURROWED 810 811 class InhibitorZoneFlyingLarge(NonStructure, InhibitorZone): 812 id = UnitTypeId.INHIBITOR_ZONE_FLYING_LARGE 813 814 class InhibitorZoneFlyingMedium(NonStructure, InhibitorZone): 815 id = UnitTypeId.INHIBITOR_ZONE_FLYING_MEDIUM 816 817 class InhibitorZoneFlyingSmall(NonStructure, InhibitorZone): 818 id = UnitTypeId.INHIBITOR_ZONE_FLYING_SMALL 819 820 class InhibitorZoneLarge(Structure, InhibitorZone): 821 id = UnitTypeId.INHIBITOR_ZONE_LARGE 822 823 class InhibitorZoneMedium(Structure, InhibitorZone): 824 id = UnitTypeId.INHIBITOR_ZONE_MEDIUM 825 826 class InhibitorZoneSmall(Structure, InhibitorZone): 827 id = UnitTypeId.INHIBITOR_ZONE_SMALL 828 829 class Interceptor(NonStructure, Protoss): 830 id = UnitTypeId.INTERCEPTOR 831 832 class Lair(AnyZergTownhall): 833 id = UnitTypeId.LAIR 834 835 class Larva(NonStructure, Zerg): 836 id = UnitTypeId.LARVA 837 838 class Liberator(AnyLiberator): 839 id = UnitTypeId.LIBERATOR 840 841 class LiberatorSieged(AnyLiberator): 842 id = UnitTypeId.LIBERATOR_SIEGED 843 844 class Locust(AnyLocust): 845 id = UnitTypeId.LOCUST 846 847 class LocustFlying(AnyLocust): 848 id = UnitTypeId.LOCUST_FLYING 849 850 class Lurker(AnyLurker): 851 id = UnitTypeId.LURKER 852 853 class LurkerBurrowed(AnyLurker): 854 id = UnitTypeId.LURKER_BURROWED 855 856 class LurkerDen(ZergStructure): 857 id = UnitTypeId.LURKER_DEN 858 859 class LurkerEgg(Cocoon): 860 id = UnitTypeId.LURKER_EGG 861 862 class Marauder(BarracksUnit): 863 id = UnitTypeId.MARAUDER 864 865 class Marine(BarracksUnit): 866 id = UnitTypeId.MARINE 867 868 class Medivac(StarportUnit): 869 id = UnitTypeId.MEDIVAC 870 871 class MineralField(AnyMineralField): 872 id = UnitTypeId.MINERAL_FIELD 873 874 class MineralField450(AnyMineralField): 875 id = UnitTypeId.MINERAL_FIELD_450 876 877 class MineralField750(AnyMineralField): 878 id = UnitTypeId.MINERAL_FIELD_750 879 880 class MineralField750BattleStation(AnyMineralField): 881 id = UnitTypeId.MINERAL_FIELD_750_BATTLE_STATION 882 883 class MineralField750Lab(AnyMineralField): 884 id = UnitTypeId.MINERAL_FIELD_750_LAB 885 886 class MineralField750Purifier(AnyMineralField): 887 id = UnitTypeId.MINERAL_FIELD_750_PURIFIER 888 889 class MineralField900Opaque(AnyMineralField): 890 id = UnitTypeId.MINERAL_FIELD_900_OPAQUE 891 892 class MineralFieldBattleStation(AnyMineralField): 893 id = UnitTypeId.MINERAL_FIELD_BATTLE_STATION 894 895 class MineralFieldLab(AnyMineralField): 896 id = UnitTypeId.MINERAL_FIELD_LAB 897 898 class MineralFieldOpaque(AnyMineralField): 899 id = UnitTypeId.MINERAL_FIELD_OPAQUE 900 901 class MineralFieldPurifier(AnyMineralField): 902 id = UnitTypeId.MINERAL_FIELD_PURIFIER 903 904 class MineralFieldRich(AnyMineralField): 905 id = UnitTypeId.MINERAL_FIELD_RICH 906 907 class MineralFieldRich750(AnyMineralField): 908 id = UnitTypeId.MINERAL_FIELD_RICH_750 909 910 class MineralFieldRich750Purifier(AnyMineralField): 911 id = UnitTypeId.MINERAL_FIELD_RICH_750_PURIFIER 912 913 class MineralFieldRichPurifier(AnyMineralField): 914 id = UnitTypeId.MINERAL_FIELD_RICH_PURIFIER 915 916 class MissileTurret(TerranStructure): 917 id = UnitTypeId.MISSILE_TURRET 918 919 class Mothership(NonStructure, Protoss): 920 id = UnitTypeId.MOTHERSHIP 921 922 class Mule(NonStructure, Terran): 923 id = UnitTypeId.MULE 924 925 class Mutalisk(NonStructure, Zerg): 926 id = UnitTypeId.MUTALISK 927 928 class Nexus(ProtossStructure, Townhall): 929 id = UnitTypeId.NEXUS 930 931 class NotAUnit(NonStructure): 932 id = UnitTypeId.NOT_A_UNIT 933 934 class NydusNetwork(ZergStructure): 935 id = UnitTypeId.NYDUS_NETWORK 936 937 class NydusWorm(ZergStructure): 938 id = UnitTypeId.NYDUS_WORM 939 940 class Observer(AnyObserver): 941 id = UnitTypeId.OBSERVER 942 943 class ObserverSieged(AnyObserver): 944 id = UnitTypeId.OBSERVER_SIEGED 945 946 class Oracle(StargateUnit): 947 id = UnitTypeId.ORACLE 948 949 class OrbitalCommand(AnyOrbitalCommand): 950 id = UnitTypeId.ORBITAL_COMMAND 951 952 class OrbitalCommandFlying(AnyOrbitalCommand): 953 id = UnitTypeId.ORBITAL_COMMAND_FLYING 954 955 class Overlord(AnyOverlord): 956 id = UnitTypeId.OVERLORD 957 958 class OverlordCocoon(Cocoon): 959 id = UnitTypeId.OVERLORD_COCOON 960 961 class OverlordTransport(AnyOverlord): 962 id = UnitTypeId.OVERLORD_TRANSPORT 963 964 class OverlordTransportCocoon(Cocoon): 965 id = UnitTypeId.OVERLORD_TRANSPORT_COCOON 966 967 class Overseer(AnyOverseer): 968 id = UnitTypeId.OVERSEER 969 970 class OverseerSieged(AnyOverseer): 971 id = UnitTypeId.OVERSEER_SIEGED 972 973 class ParasiticBombLeftBehind(NonStructure, Zerg): 974 id = UnitTypeId.PARASITIC_BOMB_LEFT_BEHIND 975 976 class Phoenix(StargateUnit): 977 id = UnitTypeId.PHOENIX 978 979 class PhotonCannon(ProtossStructure): 980 id = UnitTypeId.PHOTON_CANNON 981 982 class PlanetaryFortress(AnyTerranTownhall): 983 id = UnitTypeId.PLANETARY_FORTRESS 984 985 class Probe(Protoss, Worker): 986 id = UnitTypeId.PROBE 987 988 class PurificationNova(NonStructure, Protoss): 989 id = UnitTypeId.PURIFICATION_NOVA 990 991 class Pylon(ProtossStructure): 992 id = UnitTypeId.PYLON 993 994 class Queen(AnyQueen): 995 id = UnitTypeId.QUEEN 996 997 class QueenBurrowed(AnyQueen): 998 id = UnitTypeId.QUEEN_BURROWED 999 1000 class Ravager(AnyRavager): 1001 id = UnitTypeId.RAVAGER 1002 1003 class RavagerBurrowed(AnyRavager): 1004 id = UnitTypeId.RAVAGER_BURROWED 1005 1006 class RavagerCocoon(Cocoon): 1007 id = UnitTypeId.RAVAGER_COCOON 1008 1009 class Raven(StarportUnit): 1010 id = UnitTypeId.RAVEN 1011 1012 class Reactor(AnyReactor): 1013 id = UnitTypeId.REACTOR 1014 1015 class ReactorBarracks(AnyReactor): 1016 id = UnitTypeId.REACTOR_BARRACKS 1017 1018 class ReactorFactory(AnyReactor): 1019 id = UnitTypeId.REACTOR_FACTORY 1020 1021 class ReactorStarport(AnyReactor): 1022 id = UnitTypeId.REACTOR_STARPORT 1023 1024 class Reaper(BarracksUnit): 1025 id = UnitTypeId.REAPER 1026 1027 class ReaperGrenade(TerranStructure): 1028 id = UnitTypeId.REAPER_GRENADE 1029 1030 class Refinery(AnyRefinery): 1031 id = UnitTypeId.REFINERY 1032 1033 class RefineryRich(AnyRefinery): 1034 id = UnitTypeId.REFINERY_RICH 1035 1036 class Roach(AnyRoach): 1037 id = UnitTypeId.ROACH 1038 1039 class RoachBurrowed(AnyRoach): 1040 id = UnitTypeId.ROACH_BURROWED 1041 1042 class RoachWarren(ZergStructure): 1043 id = UnitTypeId.ROACH_WARREN 1044 1045 class RoboticsBay(ProtossStructure): 1046 id = UnitTypeId.ROBOTICS_BAY 1047 1048 class RoboticsFacility(ProtossStructure): 1049 id = UnitTypeId.ROBOTICS_FACILITY 1050 1051 class Rocks2x2NonConjoined(Structure): 1052 id = UnitTypeId.ROCKS_2X2_NON_CONJOINED 1053 1054 class Scv(Terran, Worker): 1055 id = UnitTypeId.SCV 1056 1057 class SensorTower(TerranStructure): 1058 id = UnitTypeId.SENSOR_TOWER 1059 1060 class Sentry(GatewayUnit): 1061 id = UnitTypeId.SENTRY 1062 1063 class ShieldBattery(ProtossStructure): 1064 id = UnitTypeId.SHIELD_BATTERY 1065 1066 class SiegeTank(AnySiegeTank): 1067 id = UnitTypeId.SIEGE_TANK 1068 1069 class SiegeTankSieged(AnySiegeTank): 1070 id = UnitTypeId.SIEGE_TANK_SIEGED 1071 1072 class SpawningPool(ZergStructure): 1073 id = UnitTypeId.SPAWNING_POOL 1074 1075 class SpineCrawler(AnySpineCrawler): 1076 id = UnitTypeId.SPINE_CRAWLER 1077 1078 class SpineCrawlerUprooted(AnySpineCrawler): 1079 id = UnitTypeId.SPINE_CRAWLER_UPROOTED 1080 1081 class Spire(AnySpire): 1082 id = UnitTypeId.SPIRE 1083 1084 class SporeCrawler(AnySporeCrawler): 1085 id = UnitTypeId.SPORE_CRAWLER 1086 1087 class SporeCrawlerUprooted(AnySporeCrawler): 1088 id = UnitTypeId.SPORE_CRAWLER_UPROOTED 1089 1090 class Stalker(GatewayUnit): 1091 id = UnitTypeId.STALKER 1092 1093 class Stargate(ProtossStructure): 1094 id = UnitTypeId.STARGATE 1095 1096 class Starport(AnyStarport): 1097 id = UnitTypeId.STARPORT 1098 1099 class StarportFlying(AnyStarport): 1100 id = UnitTypeId.STARPORT_FLYING 1101 1102 class StasisWard(ProtossStructure): 1103 id = UnitTypeId.STASIS_WARD 1104 1105 class SupplyDepot(AnySupplyDepot): 1106 id = UnitTypeId.SUPPLY_DEPOT 1107 1108 class SupplyDepotLowered(AnySupplyDepot): 1109 id = UnitTypeId.SUPPLY_DEPOT_LOWERED 1110 1111 class SwarmHost(AnySwarmHost): 1112 id = UnitTypeId.SWARM_HOST 1113 1114 class SwarmHostBurrowed(AnySwarmHost): 1115 id = UnitTypeId.SWARM_HOST_BURROWED 1116 1117 class TechLab(AnyTechLab): 1118 id = UnitTypeId.TECH_LAB 1119 1120 class TechLabBarracks(AnyTechLab): 1121 id = UnitTypeId.TECH_LAB_BARRACKS 1122 1123 class TechLabFactory(AnyTechLab): 1124 id = UnitTypeId.TECH_LAB_FACTORY 1125 1126 class TechLabStarport(AnyTechLab): 1127 id = UnitTypeId.TECH_LAB_STARPORT 1128 1129 class Tempest(StargateUnit): 1130 id = UnitTypeId.TEMPEST 1131 1132 class TemplarArchive(ProtossStructure): 1133 id = UnitTypeId.TEMPLAR_ARCHIVE 1134 1135 class Thor(AnyThor): 1136 id = UnitTypeId.THOR 1137 1138 class ThorHighImpact(AnyThor): 1139 id = UnitTypeId.THOR_HIGH_IMPACT 1140 1141 class TwilightCouncil(ProtossStructure): 1142 id = UnitTypeId.TWILIGHT_COUNCIL 1143 1144 class Ultralisk(AnyUltralisk): 1145 id = UnitTypeId.ULTRALISK 1146 1147 class UltraliskBurrowed(AnyUltralisk): 1148 id = UnitTypeId.ULTRALISK_BURROWED 1149 1150 class UltraliskCavern(ZergStructure): 1151 id = UnitTypeId.ULTRALISK_CAVERN 1152 1153 class VespeneGeyser(AnyVespeneGeyser): 1154 id = UnitTypeId.VESPENE_GEYSER 1155 1156 class VespeneGeyserProtoss(AnyVespeneGeyser): 1157 id = UnitTypeId.VESPENE_GEYSER_PROTOSS 1158 1159 class VespeneGeyserPurifier(AnyVespeneGeyser): 1160 id = UnitTypeId.VESPENE_GEYSER_PURIFIER 1161 1162 class VespeneGeyserRich(AnyVespeneGeyser): 1163 id = UnitTypeId.VESPENE_GEYSER_RICH 1164 1165 class VespeneGeyserShakuras(AnyVespeneGeyser): 1166 id = UnitTypeId.VESPENE_GEYSER_SHAKURAS 1167 1168 class VespeneGeyserSpacePlatform(AnyVespeneGeyser): 1169 id = UnitTypeId.VESPENE_GEYSER_SPACE_PLATFORM 1170 1171 class Viking(AnyViking): 1172 id = UnitTypeId.VIKING 1173 1174 class VikingLanded(AnyViking): 1175 id = UnitTypeId.VIKING_LANDED 1176 1177 class Viper(NonStructure, Zerg): 1178 id = UnitTypeId.VIPER 1179 1180 class VoidRay(StargateUnit): 1181 id = UnitTypeId.VOID_RAY 1182 1183 class WarpGate(AnyGateway): 1184 id = UnitTypeId.WARP_GATE 1185 1186 class WarpPrism(AnyWarpPrism): 1187 id = UnitTypeId.WARP_PRISM 1188 1189 class WarpPrismPhasing(AnyWarpPrism): 1190 id = UnitTypeId.WARP_PRISM_PHASING 1191 1192 class Watchtower(Structure): 1193 id = UnitTypeId.WATCHTOWER 1194 1195 class WidowMine(AnyWidowMine): 1196 id = UnitTypeId.WIDOW_MINE 1197 1198 class WidowMineBurrowed(AnyWidowMine): 1199 id = UnitTypeId.WIDOW_MINE_BURROWED 1200 1201 class Zealot(GatewayUnit): 1202 id = UnitTypeId.ZEALOT 1203 1204 class Zergling(AnyZergling): 1205 id = UnitTypeId.ZERGLING 1206 1207 class ZerglingBurrowed(AnyZergling): 1208 id = UnitTypeId.ZERGLING_BURROWED
Every type of unit, and every group of types, for the type checker. None is ever instantiated.
Unit[UnitType.Marine] is a marine, and Unit[UnitType.ProtossStructure] a Protoss structure. A type's id is its
UnitTypeId. A group is a race, the structures, the types that are not, or the structures of a race, as the game's
tables give them; or the workers, the townhalls, the Terran and the Zerg townhalls, what workers gather at, the
mineral fields, the vespene geysers, the gas buildings, each race's on a plain or a rich geyser, the collapsible
towers and their debris, the destructible rocks, the inhibitor and acceleration zones, the critters, the
changelings, the creep tumors, the locusts, the cocoons, the add-ons, tech labs and reactors, the spires, the
overlords, the units each Terran and Protoss production structure makes, or the two forms of a structure or a unit
that changes and changes back, such as a supply depot raised or lowered, a siege tank sieged or not, or a roach
burrowed or not. Each group is in every group that holds all its types: AnySupplyDepot is a TerranStructure,
AnyDrone a Worker, AnySiegeTank a FactoryUnit, Townhall a Structure, and Worker a NonStructure. A
type's UnitTypeData.equivalent_types is the group of two forms it is in, or else its own class.
includes(unit) tells whether a unit is of a type or group, narrowing it, type_ids holds its ids, and
types_are_equivalent whether a unit converts between its types and back at will.
39 class AnyType: 40 """Any type of unit, and what every type and group is. 41 42 `type[UnitType.AnyType]` takes any of them. `Unit[Any]` is a unit that reads as any type, where 43 `Unit[UnitType.AnyType]` is one whose type the type checker does not know, so a read only some types have is an 44 error on it until `includes` narrows it. 45 """ 46 47 type_ids: ClassVar[frozenset[UnitTypeId]] = frozenset() 48 """The ids this class stands for: a type's own `id`, or those of every type in a group. A type id with no unit 49 is tested against them, as for a structure about to be built: `type_id in UnitType.GasBuilding.type_ids`. A 50 unit is tested by `includes`, which narrows it.""" 51 52 types_are_equivalent: ClassVar[bool] = False 53 """Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and 54 unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as 55 `UnitType.AnySiegeTank`, the `UnitTypeData.equivalent_types` of its types. No class reads False in a group that 56 reads True. Any other group reads False, and a class in it may still read True, as `UnitType.Marine` does in 57 `UnitType.BarracksUnit`.""" 58 59 def __init_subclass__(cls) -> None: 60 """Add the type a class names by its `id` to every group it is in. A class with an `id` is a single type, 61 whose types are equivalent, and one without is a group.""" 62 super().__init_subclass__() 63 type_id: UnitTypeId | None = cls.__dict__.get("id") 64 cls.type_ids = frozenset() if type_id is None else frozenset((type_id,)) 65 if type_id is not None: 66 cls.types_are_equivalent = True 67 # Everything between the class and `object` is a group it is in, `AnyType` included. 68 for group in cast("tuple[type[UnitType.AnyType], ...]", cls.__mro__[1:-1]): 69 group.type_ids |= cls.type_ids 70 71 @overload 72 @classmethod 73 def includes(cls, unit: OwnUnit[Any], /) -> TypeGuard[OwnUnit[Self]]: ... 74 75 @overload 76 @classmethod 77 def includes(cls, unit: Unit[Any], /) -> TypeGuard[Unit[Self]]: ... 78 79 @classmethod 80 def includes(cls, unit: Unit[Any], /) -> bool: 81 """Whether `unit` is of this type, or of a type in this group, narrowing it for the type checker. 82 83 Raises `UncuratedIdError` for a unit of a type the curated ids leave out. 84 """ 85 return unit.type_id in cls.type_ids
Any type of unit, and what every type and group is.
type[UnitType.AnyType] takes any of them. Unit[Any] is a unit that reads as any type, where
Unit[UnitType.AnyType] is one whose type the type checker does not know, so a read only some types have is an
error on it until includes narrows it.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
79 @classmethod 80 def includes(cls, unit: Unit[Any], /) -> bool: 81 """Whether `unit` is of this type, or of a type in this group, narrowing it for the type checker. 82 83 Raises `UncuratedIdError` for a unit of a type the curated ids leave out. 84 """ 85 return unit.type_id in cls.type_ids
Whether unit is of this type, or of a type in this group, narrowing it for the type checker.
Raises UncuratedIdError for a unit of a type the curated ids leave out.
A type the game's tables give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
90 class NonStructure(AnyType): 91 """A type the game's tables do not give the structure attribute."""
A type the game's tables do not give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A Terran type.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A Zerg type.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A Protoss type.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A Terran structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A Zerg structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A Protoss structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
111 class Worker(NonStructure): 112 """A worker: an SCV, a probe or a drone, burrowed or not. A MULE is none."""
A worker: an SCV, a probe or a drone, burrowed or not. A MULE is none.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
114 class Townhall(Structure): 115 """A townhall: a command center or what it becomes, lifted or not, a nexus, a hatchery, lair or hive."""
A townhall: a command center or what it becomes, lifted or not, a nexus, a hatchery, lair or hive.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
117 class AnyTerranTownhall(Townhall, TerranStructure): 118 """A command center or an orbital command, lifted or not, or a planetary fortress."""
A command center or an orbital command, lifted or not, or a planetary fortress.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
120 class AnyZergTownhall(Townhall, ZergStructure): 121 """A Zerg townhall: a hatchery, a lair or a hive."""
A Zerg townhall: a hatchery, a lair or a hive.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
123 class AnyResource(Structure): 124 """What a worker gathers at: a mineral field or a gas building, never the geyser under it."""
What a worker gathers at: a mineral field or a gas building, never the geyser under it.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
126 class AnyMineralField(AnyResource): 127 """A mineral field of any kind: one the game's tables say holds minerals."""
A mineral field of any kind: one the game's tables say holds minerals.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
129 class AnyVespeneGeyser(Structure): 130 """A vespene geyser of any kind: one the game's tables say holds vespene, of no race."""
A vespene geyser of any kind: one the game's tables say holds vespene, of no race.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
132 class GasBuilding(AnyResource): 133 """A refinery, an assimilator or an extractor: one the game's tables say holds vespene, of a race."""
A refinery, an assimilator or an extractor: one the game's tables say holds vespene, of a race.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
135 class AnyRefinery(GasBuilding, TerranStructure): 136 """A refinery, on a plain or a rich geyser."""
A refinery, on a plain or a rich geyser.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
138 class AnyExtractor(GasBuilding, ZergStructure): 139 """An extractor, on a plain or a rich geyser."""
An extractor, on a plain or a rich geyser.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
141 class AnyAssimilator(GasBuilding, ProtossStructure): 142 """An assimilator, on a plain or a rich geyser."""
An assimilator, on a plain or a rich geyser.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
144 class Destructible(Structure): 145 """A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris."""
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
147 class CollapsibleTower(Destructible): 148 """A collapsible tower, which falls across a path once destroyed and stays there."""
A collapsible tower, which falls across a path once destroyed and stays there.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
150 class CollapsibleTowerDebris(Destructible): 151 """The debris a collapsible tower leaves where it lands once felled."""
The debris a collapsible tower leaves where it lands once felled.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
153 class InhibitorZone(AnyType): 154 """An inhibitor zone generator, of any size, plain or flying."""
An inhibitor zone generator, of any size, plain or flying.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
156 class AccelerationZone(NonStructure): 157 """An acceleration zone generator, of any size, plain or flying."""
An acceleration zone generator, of any size, plain or flying.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
159 class Critter(NonStructure): 160 """One of a map's critters: an animal or a robot that wanders and covers no ground."""
One of a map's critters: an animal or a robot that wanders and covers no ground.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
162 class AnyChangeling(NonStructure, Zerg): 163 """A changeling, plain or in the shape of a marine, a zealot or a zergling."""
A changeling, plain or in the shape of a marine, a zealot or a zergling.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
165 class AnyCreepTumor(ZergStructure): 166 """A creep tumor, a queen's or another tumor's, growing or burrowed."""
A creep tumor, a queen's or another tumor's, growing or burrowed.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A locust, on the ground or flying.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
171 class Cocoon(NonStructure, Zerg): 172 """A cocoon or a lurker egg: a unit on its way to becoming another, as a zergling becomes a baneling."""
A cocoon or a lurker egg: a unit on its way to becoming another, as a zergling becomes a baneling.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
174 class AnyAddOn(TerranStructure): 175 """An add-on of any kind: a tech lab or a reactor, attached to its host or plain."""
An add-on of any kind: a tech lab or a reactor, attached to its host or plain.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
177 class AnyTechLab(AnyAddOn): 178 """A tech lab of any kind: a barracks', a factory's or a starport's, or a plain one."""
A tech lab of any kind: a barracks', a factory's or a starport's, or a plain one.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
180 class AnyReactor(AnyAddOn): 181 """A reactor of any kind: a barracks', a factory's or a starport's, or a plain one."""
A reactor of any kind: a barracks', a factory's or a starport's, or a plain one.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A spire or a greater spire.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
186 class AnyOverlord(NonStructure, Zerg): 187 """An overlord, a transport overlord, or an overseer in either mode, which the tables count as one."""
An overlord, a transport overlord, or an overseer in either mode, which the tables count as one.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
189 class BarracksUnit(NonStructure, Terran): 190 """A unit a barracks trains: a marine, a marauder, a reaper or a ghost."""
A unit a barracks trains: a marine, a marauder, a reaper or a ghost.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
192 class FactoryUnit(NonStructure, Terran): 193 """A unit a factory makes, in any form: a hellion or hellbat, a widow mine, siege tank, cyclone or thor."""
A unit a factory makes, in any form: a hellion or hellbat, a widow mine, siege tank, cyclone or thor.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
195 class StarportUnit(NonStructure, Terran): 196 """A unit a starport makes, in any form: a viking, medivac, liberator, raven, banshee or battlecruiser."""
A unit a starport makes, in any form: a viking, medivac, liberator, raven, banshee or battlecruiser.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
198 class GatewayUnit(NonStructure, Protoss): 199 """A unit a gateway trains or a warp gate warps in: a zealot, stalker, sentry, adept or either templar."""
A unit a gateway trains or a warp gate warps in: a zealot, stalker, sentry, adept or either templar.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
201 class RoboticsFacilityUnit(NonStructure, Protoss): 202 """A unit a robotics facility makes, in any form: an observer, warp prism, immortal, colossus or disruptor."""
A unit a robotics facility makes, in any form: an observer, warp prism, immortal, colossus or disruptor.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
204 class StargateUnit(NonStructure, Protoss): 205 """A unit a stargate makes: a phoenix, an oracle, a void ray, a tempest or a carrier."""
A unit a stargate makes: a phoenix, an oracle, a void ray, a tempest or a carrier.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
207 class AnySupplyDepot(TerranStructure): 208 """A supply depot, raised or lowered.""" 209 210 types_are_equivalent = True
A supply depot, raised or lowered.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
212 class AnyBarracks(TerranStructure): 213 """A barracks, landed or flying.""" 214 215 types_are_equivalent = True
A barracks, landed or flying.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
217 class AnyFactory(TerranStructure): 218 """A factory, landed or flying.""" 219 220 types_are_equivalent = True
A factory, landed or flying.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
222 class AnyStarport(TerranStructure): 223 """A starport, landed or flying.""" 224 225 types_are_equivalent = True
A starport, landed or flying.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
227 class AnyCommandCenter(AnyTerranTownhall): 228 """A command center, landed or flying. An orbital command and a planetary fortress are none.""" 229 230 types_are_equivalent = True
A command center, landed or flying. An orbital command and a planetary fortress are none.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
232 class AnyOrbitalCommand(AnyTerranTownhall): 233 """An orbital command, landed or flying.""" 234 235 types_are_equivalent = True
An orbital command, landed or flying.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
237 class AnyGateway(ProtossStructure): 238 """A gateway or a warp gate.""" 239 240 types_are_equivalent = True
A gateway or a warp gate.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
242 class AnySpineCrawler(ZergStructure): 243 """A spine crawler, rooted or uprooted.""" 244 245 types_are_equivalent = True
A spine crawler, rooted or uprooted.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
247 class AnySporeCrawler(ZergStructure): 248 """A spore crawler, rooted or uprooted.""" 249 250 types_are_equivalent = True
A spore crawler, rooted or uprooted.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
252 class AnyViking(StarportUnit): 253 """A viking, flying or landed.""" 254 255 types_are_equivalent = True
A viking, flying or landed.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
257 class AnySiegeTank(FactoryUnit): 258 """A siege tank, sieged or not.""" 259 260 types_are_equivalent = True
A siege tank, sieged or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
262 class AnyWidowMine(FactoryUnit): 263 """A widow mine, burrowed or not.""" 264 265 types_are_equivalent = True
A widow mine, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
267 class AnyLiberator(StarportUnit): 268 """A liberator, sieged or not.""" 269 270 types_are_equivalent = True
A liberator, sieged or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
272 class AnyThor(FactoryUnit): 273 """A thor, in either mode.""" 274 275 types_are_equivalent = True
A thor, in either mode.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
277 class AnyHellion(FactoryUnit): 278 """A hellion or a hellbat.""" 279 280 types_are_equivalent = True
A hellion or a hellbat.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
282 class AnyObserver(RoboticsFacilityUnit): 283 """An observer, in surveillance mode or not.""" 284 285 types_are_equivalent = True
An observer, in surveillance mode or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
287 class AnyOverseer(AnyOverlord): 288 """An overseer, in oversight mode or not.""" 289 290 types_are_equivalent = True
An overseer, in oversight mode or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
292 class AnyWarpPrism(RoboticsFacilityUnit): 293 """A warp prism, phasing or not.""" 294 295 types_are_equivalent = True
A warp prism, phasing or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
297 class AnyDrone(Worker, Zerg): 298 """A drone, burrowed or not.""" 299 300 types_are_equivalent = True
A drone, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
302 class AnyZergling(NonStructure, Zerg): 303 """A zergling, burrowed or not.""" 304 305 types_are_equivalent = True
A zergling, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
307 class AnyBaneling(NonStructure, Zerg): 308 """A baneling, burrowed or not.""" 309 310 types_are_equivalent = True
A baneling, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
312 class AnyRoach(NonStructure, Zerg): 313 """A roach, burrowed or not.""" 314 315 types_are_equivalent = True
A roach, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
317 class AnyRavager(NonStructure, Zerg): 318 """A ravager, burrowed or not.""" 319 320 types_are_equivalent = True
A ravager, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
322 class AnyHydralisk(NonStructure, Zerg): 323 """A hydralisk, burrowed or not.""" 324 325 types_are_equivalent = True
A hydralisk, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
327 class AnyLurker(NonStructure, Zerg): 328 """A lurker, burrowed or not.""" 329 330 types_are_equivalent = True
A lurker, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
332 class AnyInfestor(NonStructure, Zerg): 333 """An infestor, burrowed or not.""" 334 335 types_are_equivalent = True
An infestor, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
337 class AnySwarmHost(NonStructure, Zerg): 338 """A swarm host, burrowed or not.""" 339 340 types_are_equivalent = True
A swarm host, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
342 class AnyUltralisk(NonStructure, Zerg): 343 """An ultralisk, burrowed or not.""" 344 345 types_are_equivalent = True
An ultralisk, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
347 class AnyQueen(NonStructure, Zerg): 348 """A queen, burrowed or not.""" 349 350 types_are_equivalent = True
A queen, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
352 class AccelerationZoneFlyingLarge(AccelerationZone): 353 id = UnitTypeId.ACCELERATION_ZONE_FLYING_LARGE
An acceleration zone generator, of any size, plain or flying.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
355 class AccelerationZoneFlyingMedium(AccelerationZone): 356 id = UnitTypeId.ACCELERATION_ZONE_FLYING_MEDIUM
An acceleration zone generator, of any size, plain or flying.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
358 class AccelerationZoneFlyingSmall(AccelerationZone): 359 id = UnitTypeId.ACCELERATION_ZONE_FLYING_SMALL
An acceleration zone generator, of any size, plain or flying.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
An acceleration zone generator, of any size, plain or flying.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
An acceleration zone generator, of any size, plain or flying.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
An acceleration zone generator, of any size, plain or flying.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A unit a gateway trains or a warp gate warps in: a zealot, stalker, sentry, adept or either templar.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A type the game's tables do not give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A type the game's tables do not give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A Terran structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
An assimilator, on a plain or a rich geyser.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
An assimilator, on a plain or a rich geyser.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A Terran structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A baneling, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A baneling, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A cocoon or a lurker egg: a unit on its way to becoming another, as a zergling becomes a baneling.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A Zerg structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A unit a starport makes, in any form: a viking, medivac, liberator, raven, banshee or battlecruiser.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A barracks, landed or flying.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A barracks, landed or flying.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A unit a starport makes, in any form: a viking, medivac, liberator, raven, banshee or battlecruiser.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A type the game's tables do not give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A cocoon or a lurker egg: a unit on its way to becoming another, as a zergling becomes a baneling.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A type the game's tables do not give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A Terran structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A unit a stargate makes: a phoenix, an oracle, a void ray, a tempest or a carrier.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A changeling, plain or in the shape of a marine, a zealot or a zergling.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A changeling, plain or in the shape of a marine, a zealot or a zergling.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A changeling, plain or in the shape of a marine, a zealot or a zergling.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A changeling, plain or in the shape of a marine, a zealot or a zergling.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A changeling, plain or in the shape of a marine, a zealot or a zergling.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A changeling, plain or in the shape of a marine, a zealot or a zergling.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
448 class CollapsibleTowerDebrisPurifier(CollapsibleTowerDebris): 449 id = UnitTypeId.COLLAPSIBLE_TOWER_DEBRIS_PURIFIER
The debris a collapsible tower leaves where it lands once felled.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
451 class CollapsibleTowerDebrisRampLeftRock(CollapsibleTowerDebris): 452 id = UnitTypeId.COLLAPSIBLE_TOWER_DEBRIS_RAMP_LEFT_ROCK
The debris a collapsible tower leaves where it lands once felled.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
454 class CollapsibleTowerDebrisRampLeftRockGreen(CollapsibleTowerDebris): 455 id = UnitTypeId.COLLAPSIBLE_TOWER_DEBRIS_RAMP_LEFT_ROCK_GREEN
The debris a collapsible tower leaves where it lands once felled.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
457 class CollapsibleTowerDebrisRampRightRock(CollapsibleTowerDebris): 458 id = UnitTypeId.COLLAPSIBLE_TOWER_DEBRIS_RAMP_RIGHT_ROCK
The debris a collapsible tower leaves where it lands once felled.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
460 class CollapsibleTowerDebrisRampRightRockGreen(CollapsibleTowerDebris): 461 id = UnitTypeId.COLLAPSIBLE_TOWER_DEBRIS_RAMP_RIGHT_ROCK_GREEN
The debris a collapsible tower leaves where it lands once felled.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
463 class CollapsibleTowerDebrisRock(CollapsibleTowerDebris): 464 id = UnitTypeId.COLLAPSIBLE_TOWER_DEBRIS_ROCK
The debris a collapsible tower leaves where it lands once felled.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
466 class CollapsibleTowerDebrisTerran(CollapsibleTowerDebris): 467 id = UnitTypeId.COLLAPSIBLE_TOWER_DEBRIS_TERRAN
The debris a collapsible tower leaves where it lands once felled.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
469 class CollapsibleTowerDiagonalPurifier(CollapsibleTower): 470 id = UnitTypeId.COLLAPSIBLE_TOWER_DIAGONAL_PURIFIER
A collapsible tower, which falls across a path once destroyed and stays there.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
472 class CollapsibleTowerDiagonalRock(CollapsibleTower): 473 id = UnitTypeId.COLLAPSIBLE_TOWER_DIAGONAL_ROCK
A collapsible tower, which falls across a path once destroyed and stays there.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
475 class CollapsibleTowerDiagonalTerran(CollapsibleTower): 476 id = UnitTypeId.COLLAPSIBLE_TOWER_DIAGONAL_TERRAN
A collapsible tower, which falls across a path once destroyed and stays there.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
478 class CollapsibleTowerPushUnitPurifier(Structure): 479 id = UnitTypeId.COLLAPSIBLE_TOWER_PUSH_UNIT_PURIFIER
A type the game's tables give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
481 class CollapsibleTowerPushUnitRampLeftRock(Structure): 482 id = UnitTypeId.COLLAPSIBLE_TOWER_PUSH_UNIT_RAMP_LEFT_ROCK
A type the game's tables give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
484 class CollapsibleTowerPushUnitRampLeftRockGreen(Structure): 485 id = UnitTypeId.COLLAPSIBLE_TOWER_PUSH_UNIT_RAMP_LEFT_ROCK_GREEN
A type the game's tables give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
487 class CollapsibleTowerPushUnitRampLeftTerran(Structure): 488 id = UnitTypeId.COLLAPSIBLE_TOWER_PUSH_UNIT_RAMP_LEFT_TERRAN
A type the game's tables give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
490 class CollapsibleTowerPushUnitRampRightRock(Structure): 491 id = UnitTypeId.COLLAPSIBLE_TOWER_PUSH_UNIT_RAMP_RIGHT_ROCK
A type the game's tables give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
493 class CollapsibleTowerPushUnitRampRightRockGreen(Structure): 494 id = UnitTypeId.COLLAPSIBLE_TOWER_PUSH_UNIT_RAMP_RIGHT_ROCK_GREEN
A type the game's tables give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
496 class CollapsibleTowerPushUnitRampRightTerran(Structure): 497 id = UnitTypeId.COLLAPSIBLE_TOWER_PUSH_UNIT_RAMP_RIGHT_TERRAN
A type the game's tables give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
499 class CollapsibleTowerPushUnitRock(Structure): 500 id = UnitTypeId.COLLAPSIBLE_TOWER_PUSH_UNIT_ROCK
A type the game's tables give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
502 class CollapsibleTowerPushUnitTerran(Structure): 503 id = UnitTypeId.COLLAPSIBLE_TOWER_PUSH_UNIT_TERRAN
A type the game's tables give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
505 class CollapsibleTowerRampLeftRock(CollapsibleTower): 506 id = UnitTypeId.COLLAPSIBLE_TOWER_RAMP_LEFT_ROCK
A collapsible tower, which falls across a path once destroyed and stays there.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
508 class CollapsibleTowerRampLeftRockGreen(CollapsibleTower): 509 id = UnitTypeId.COLLAPSIBLE_TOWER_RAMP_LEFT_ROCK_GREEN
A collapsible tower, which falls across a path once destroyed and stays there.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
511 class CollapsibleTowerRampLeftTerran(CollapsibleTower): 512 id = UnitTypeId.COLLAPSIBLE_TOWER_RAMP_LEFT_TERRAN
A collapsible tower, which falls across a path once destroyed and stays there.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
514 class CollapsibleTowerRampRightRock(CollapsibleTower): 515 id = UnitTypeId.COLLAPSIBLE_TOWER_RAMP_RIGHT_ROCK
A collapsible tower, which falls across a path once destroyed and stays there.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
517 class CollapsibleTowerRampRightRockGreen(CollapsibleTower): 518 id = UnitTypeId.COLLAPSIBLE_TOWER_RAMP_RIGHT_ROCK_GREEN
A collapsible tower, which falls across a path once destroyed and stays there.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
520 class CollapsibleTowerRampRightTerran(CollapsibleTower): 521 id = UnitTypeId.COLLAPSIBLE_TOWER_RAMP_RIGHT_TERRAN
A collapsible tower, which falls across a path once destroyed and stays there.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A collapsible tower, which falls across a path once destroyed and stays there.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A collapsible tower, which falls across a path once destroyed and stays there.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A unit a robotics facility makes, in any form: an observer, warp prism, immortal, colossus or disruptor.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A command center, landed or flying. An orbital command and a planetary fortress are none.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A command center, landed or flying. An orbital command and a planetary fortress are none.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A type the game's tables do not give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A creep tumor, a queen's or another tumor's, growing or burrowed.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A creep tumor, a queen's or another tumor's, growing or burrowed.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A creep tumor, a queen's or another tumor's, growing or burrowed.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
One of a map's critters: an animal or a robot that wanders and covers no ground.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
One of a map's critters: an animal or a robot that wanders and covers no ground.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A Protoss structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A unit a factory makes, in any form: a hellion or hellbat, a widow mine, siege tank, cyclone or thor.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A Protoss structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A unit a gateway trains or a warp gate warps in: a zealot, stalker, sentry, adept or either templar.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
568 class Destructible1x1BraxisAlpha(Destructible): 569 id = UnitTypeId.DESTRUCTIBLE_1X1_BRAXIS_ALPHA
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
571 class Destructible2x2BraxisAlpha(Destructible): 572 id = UnitTypeId.DESTRUCTIBLE_2X2_BRAXIS_ALPHA
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
574 class Destructible2x4HorizontalCityDebris(Destructible): 575 id = UnitTypeId.DESTRUCTIBLE_2X4_HORIZONTAL_CITY_DEBRIS
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
577 class Destructible2x4HorizontalIce(Destructible): 578 id = UnitTypeId.DESTRUCTIBLE_2X4_HORIZONTAL_ICE
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
580 class Destructible2x4HorizontalRock(Destructible): 581 id = UnitTypeId.DESTRUCTIBLE_2X4_HORIZONTAL_ROCK
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
583 class Destructible2x4HorizontalRockEx1(Destructible): 584 id = UnitTypeId.DESTRUCTIBLE_2X4_HORIZONTAL_ROCK_EX1
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
586 class Destructible2x4VerticalCityDebris(Destructible): 587 id = UnitTypeId.DESTRUCTIBLE_2X4_VERTICAL_CITY_DEBRIS
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
589 class Destructible2x4VerticalIce(Destructible): 590 id = UnitTypeId.DESTRUCTIBLE_2X4_VERTICAL_ICE
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
592 class Destructible2x4VerticalRock(Destructible): 593 id = UnitTypeId.DESTRUCTIBLE_2X4_VERTICAL_ROCK
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
595 class Destructible2x4VerticalRockEx1(Destructible): 596 id = UnitTypeId.DESTRUCTIBLE_2X4_VERTICAL_ROCK_EX1
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
598 class Destructible2x6HorizontalCityDebris(Destructible): 599 id = UnitTypeId.DESTRUCTIBLE_2X6_HORIZONTAL_CITY_DEBRIS
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
601 class Destructible2x6HorizontalIce(Destructible): 602 id = UnitTypeId.DESTRUCTIBLE_2X6_HORIZONTAL_ICE
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
604 class Destructible2x6HorizontalRock(Destructible): 605 id = UnitTypeId.DESTRUCTIBLE_2X6_HORIZONTAL_ROCK
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
607 class Destructible2x6HorizontalRockEx1(Destructible): 608 id = UnitTypeId.DESTRUCTIBLE_2X6_HORIZONTAL_ROCK_EX1
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
610 class Destructible2x6VerticalCityDebris(Destructible): 611 id = UnitTypeId.DESTRUCTIBLE_2X6_VERTICAL_CITY_DEBRIS
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
613 class Destructible2x6VerticalIce(Destructible): 614 id = UnitTypeId.DESTRUCTIBLE_2X6_VERTICAL_ICE
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
616 class Destructible2x6VerticalRock(Destructible): 617 id = UnitTypeId.DESTRUCTIBLE_2X6_VERTICAL_ROCK
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
619 class Destructible2x6VerticalRockEx1(Destructible): 620 id = UnitTypeId.DESTRUCTIBLE_2X6_VERTICAL_ROCK_EX1
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
622 class Destructible3x3ZergInfestation(Destructible): 623 id = UnitTypeId.DESTRUCTIBLE_3X3_ZERG_INFESTATION
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
646 class Destructible6x6ExpeditionGate(Destructible): 647 id = UnitTypeId.DESTRUCTIBLE_6X6_EXPEDITION_GATE
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
661 class DestructibleHugeDiagonalBlurCityDebris(Destructible): 662 id = UnitTypeId.DESTRUCTIBLE_HUGE_DIAGONAL_BLUR_CITY_DEBRIS
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
664 class DestructibleHugeDiagonalBlurDebrisRamp(Destructible): 665 id = UnitTypeId.DESTRUCTIBLE_HUGE_DIAGONAL_BLUR_DEBRIS_RAMP
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
667 class DestructibleHugeDiagonalBlurIce(Destructible): 668 id = UnitTypeId.DESTRUCTIBLE_HUGE_DIAGONAL_BLUR_ICE
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
670 class DestructibleHugeDiagonalBlurRamp(Destructible): 671 id = UnitTypeId.DESTRUCTIBLE_HUGE_DIAGONAL_BLUR_RAMP
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
673 class DestructibleHugeDiagonalBlurRockEx1(Destructible): 674 id = UnitTypeId.DESTRUCTIBLE_HUGE_DIAGONAL_BLUR_ROCK_EX1
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
676 class DestructibleHugeDiagonalUlbrCityDebris(Destructible): 677 id = UnitTypeId.DESTRUCTIBLE_HUGE_DIAGONAL_ULBR_CITY_DEBRIS
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
679 class DestructibleHugeDiagonalUlbrDebrisRamp(Destructible): 680 id = UnitTypeId.DESTRUCTIBLE_HUGE_DIAGONAL_ULBR_DEBRIS_RAMP
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
682 class DestructibleHugeDiagonalUlbrIce(Destructible): 683 id = UnitTypeId.DESTRUCTIBLE_HUGE_DIAGONAL_ULBR_ICE
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
685 class DestructibleHugeDiagonalUlbrRamp(Destructible): 686 id = UnitTypeId.DESTRUCTIBLE_HUGE_DIAGONAL_ULBR_RAMP
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
688 class DestructibleHugeDiagonalUlbrRockEx1(Destructible): 689 id = UnitTypeId.DESTRUCTIBLE_HUGE_DIAGONAL_ULBR_ROCK_EX1
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
691 class DestructibleHugeHorizontalIce(Destructible): 692 id = UnitTypeId.DESTRUCTIBLE_HUGE_HORIZONTAL_ICE
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
694 class DestructibleHugeHorizontalRamp(Destructible): 695 id = UnitTypeId.DESTRUCTIBLE_HUGE_HORIZONTAL_RAMP
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
697 class DestructibleHugeHorizontalRockEx1(Destructible): 698 id = UnitTypeId.DESTRUCTIBLE_HUGE_HORIZONTAL_ROCK_EX1
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
700 class DestructibleHugeVerticalIce(Destructible): 701 id = UnitTypeId.DESTRUCTIBLE_HUGE_VERTICAL_ICE
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
703 class DestructibleHugeVerticalRamp(Destructible): 704 id = UnitTypeId.DESTRUCTIBLE_HUGE_VERTICAL_RAMP
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
706 class DestructibleHugeVerticalRockEx1(Destructible): 707 id = UnitTypeId.DESTRUCTIBLE_HUGE_VERTICAL_ROCK_EX1
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
709 class DestructibleUnbuildableBricks(Destructible): 710 id = UnitTypeId.DESTRUCTIBLE_UNBUILDABLE_BRICKS
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
712 class DestructibleUnbuildablePlates(Destructible): 713 id = UnitTypeId.DESTRUCTIBLE_UNBUILDABLE_PLATES
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
715 class DestructibleUnbuildableRocks(Destructible): 716 id = UnitTypeId.DESTRUCTIBLE_UNBUILDABLE_ROCKS
A destructible rock, debris, ice, unbuildable brick, plate or rock, or a collapsible tower or its debris.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A unit a robotics facility makes, in any form: an observer, warp prism, immortal, colossus or disruptor.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A drone, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A drone, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A type the game's tables do not give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A Terran structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A Zerg structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
An extractor, on a plain or a rich geyser.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
An extractor, on a plain or a rich geyser.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A factory, landed or flying.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A factory, landed or flying.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A Protoss structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A type the game's tables do not give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A Protoss structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A Terran structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A gateway or a warp gate.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A unit a barracks trains: a marine, a marauder, a reaper or a ghost.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A Terran structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A spire or a greater spire.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A Zerg townhall: a hatchery, a lair or a hive.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A type the game's tables do not give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A hellion or a hellbat.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A hellion or a hellbat.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A unit a gateway trains or a warp gate warps in: a zealot, stalker, sentry, adept or either templar.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A Zerg townhall: a hatchery, a lair or a hive.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A hydralisk, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A hydralisk, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A Zerg structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A unit a robotics facility makes, in any form: an observer, warp prism, immortal, colossus or disruptor.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A Zerg structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
An infestor, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
An infestor, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
811 class InhibitorZoneFlyingLarge(NonStructure, InhibitorZone): 812 id = UnitTypeId.INHIBITOR_ZONE_FLYING_LARGE
A type the game's tables do not give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
814 class InhibitorZoneFlyingMedium(NonStructure, InhibitorZone): 815 id = UnitTypeId.INHIBITOR_ZONE_FLYING_MEDIUM
A type the game's tables do not give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
817 class InhibitorZoneFlyingSmall(NonStructure, InhibitorZone): 818 id = UnitTypeId.INHIBITOR_ZONE_FLYING_SMALL
A type the game's tables do not give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A type the game's tables give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A type the game's tables give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A type the game's tables give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A type the game's tables do not give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A Zerg townhall: a hatchery, a lair or a hive.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A type the game's tables do not give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A liberator, sieged or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A liberator, sieged or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A locust, on the ground or flying.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A locust, on the ground or flying.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A lurker, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A lurker, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A Zerg structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A cocoon or a lurker egg: a unit on its way to becoming another, as a zergling becomes a baneling.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A unit a barracks trains: a marine, a marauder, a reaper or a ghost.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A unit a barracks trains: a marine, a marauder, a reaper or a ghost.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A unit a starport makes, in any form: a viking, medivac, liberator, raven, banshee or battlecruiser.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A mineral field of any kind: one the game's tables say holds minerals.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A mineral field of any kind: one the game's tables say holds minerals.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A mineral field of any kind: one the game's tables say holds minerals.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
880 class MineralField750BattleStation(AnyMineralField): 881 id = UnitTypeId.MINERAL_FIELD_750_BATTLE_STATION
A mineral field of any kind: one the game's tables say holds minerals.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A mineral field of any kind: one the game's tables say holds minerals.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A mineral field of any kind: one the game's tables say holds minerals.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A mineral field of any kind: one the game's tables say holds minerals.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
892 class MineralFieldBattleStation(AnyMineralField): 893 id = UnitTypeId.MINERAL_FIELD_BATTLE_STATION
A mineral field of any kind: one the game's tables say holds minerals.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A mineral field of any kind: one the game's tables say holds minerals.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A mineral field of any kind: one the game's tables say holds minerals.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A mineral field of any kind: one the game's tables say holds minerals.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A mineral field of any kind: one the game's tables say holds minerals.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A mineral field of any kind: one the game's tables say holds minerals.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
910 class MineralFieldRich750Purifier(AnyMineralField): 911 id = UnitTypeId.MINERAL_FIELD_RICH_750_PURIFIER
A mineral field of any kind: one the game's tables say holds minerals.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
913 class MineralFieldRichPurifier(AnyMineralField): 914 id = UnitTypeId.MINERAL_FIELD_RICH_PURIFIER
A mineral field of any kind: one the game's tables say holds minerals.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A Terran structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A type the game's tables do not give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A type the game's tables do not give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A type the game's tables do not give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A Protoss structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A type the game's tables do not give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A Zerg structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A Zerg structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
An observer, in surveillance mode or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
An observer, in surveillance mode or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A unit a stargate makes: a phoenix, an oracle, a void ray, a tempest or a carrier.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
An orbital command, landed or flying.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
An orbital command, landed or flying.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
An overlord, a transport overlord, or an overseer in either mode, which the tables count as one.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A cocoon or a lurker egg: a unit on its way to becoming another, as a zergling becomes a baneling.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
An overlord, a transport overlord, or an overseer in either mode, which the tables count as one.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A cocoon or a lurker egg: a unit on its way to becoming another, as a zergling becomes a baneling.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
An overseer, in oversight mode or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
An overseer, in oversight mode or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
973 class ParasiticBombLeftBehind(NonStructure, Zerg): 974 id = UnitTypeId.PARASITIC_BOMB_LEFT_BEHIND
A type the game's tables do not give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A unit a stargate makes: a phoenix, an oracle, a void ray, a tempest or a carrier.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A Protoss structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A command center or an orbital command, lifted or not, or a planetary fortress.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A Protoss type.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A type the game's tables do not give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A Protoss structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A queen, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A queen, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A ravager, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A ravager, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A cocoon or a lurker egg: a unit on its way to becoming another, as a zergling becomes a baneling.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A unit a starport makes, in any form: a viking, medivac, liberator, raven, banshee or battlecruiser.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A reactor of any kind: a barracks', a factory's or a starport's, or a plain one.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A reactor of any kind: a barracks', a factory's or a starport's, or a plain one.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A reactor of any kind: a barracks', a factory's or a starport's, or a plain one.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A reactor of any kind: a barracks', a factory's or a starport's, or a plain one.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A unit a barracks trains: a marine, a marauder, a reaper or a ghost.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A Terran structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A refinery, on a plain or a rich geyser.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A refinery, on a plain or a rich geyser.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A roach, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A roach, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A Zerg structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A Protoss structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A Protoss structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A type the game's tables give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A Terran type.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A Terran structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A unit a gateway trains or a warp gate warps in: a zealot, stalker, sentry, adept or either templar.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A Protoss structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A siege tank, sieged or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A siege tank, sieged or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A Zerg structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A spine crawler, rooted or uprooted.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A spine crawler, rooted or uprooted.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A spire or a greater spire.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A spore crawler, rooted or uprooted.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A spore crawler, rooted or uprooted.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A unit a gateway trains or a warp gate warps in: a zealot, stalker, sentry, adept or either templar.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A Protoss structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A starport, landed or flying.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A starport, landed or flying.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A Protoss structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A supply depot, raised or lowered.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A supply depot, raised or lowered.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A swarm host, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A swarm host, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A tech lab of any kind: a barracks', a factory's or a starport's, or a plain one.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A tech lab of any kind: a barracks', a factory's or a starport's, or a plain one.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A tech lab of any kind: a barracks', a factory's or a starport's, or a plain one.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A tech lab of any kind: a barracks', a factory's or a starport's, or a plain one.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A unit a stargate makes: a phoenix, an oracle, a void ray, a tempest or a carrier.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A Protoss structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A thor, in either mode.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A thor, in either mode.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A Protoss structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
An ultralisk, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
An ultralisk, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A Zerg structure.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A vespene geyser of any kind: one the game's tables say holds vespene, of no race.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A vespene geyser of any kind: one the game's tables say holds vespene, of no race.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A vespene geyser of any kind: one the game's tables say holds vespene, of no race.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A vespene geyser of any kind: one the game's tables say holds vespene, of no race.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A vespene geyser of any kind: one the game's tables say holds vespene, of no race.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
1168 class VespeneGeyserSpacePlatform(AnyVespeneGeyser): 1169 id = UnitTypeId.VESPENE_GEYSER_SPACE_PLATFORM
A vespene geyser of any kind: one the game's tables say holds vespene, of no race.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A viking, flying or landed.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A viking, flying or landed.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A type the game's tables do not give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A unit a stargate makes: a phoenix, an oracle, a void ray, a tempest or a carrier.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A gateway or a warp gate.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A warp prism, phasing or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A warp prism, phasing or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A type the game's tables give the structure attribute.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A widow mine, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A widow mine, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A unit a gateway trains or a warp gate warps in: a zealot, stalker, sentry, adept or either templar.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
A zergling, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
A zergling, burrowed or not.
Whether a unit converts between any two of this class's types and back at will, as a siege tank sieges and
unsieges. True for a single type, its one type equivalent to itself, and for a group of two forms such as
UnitType.AnySiegeTank, the UnitTypeData.equivalent_types of its types. No class reads False in a group that
reads True. Any other group reads False, and a class in it may still read True, as UnitType.Marine does in
UnitType.BarracksUnit.
The ids this class stands for: a type's own id, or those of every type in a group. A type id with no unit
is tested against them, as for a structure about to be built: type_id in UnitType.GasBuilding.type_ids. A
unit is tested by includes, which narrows it.
12class UnitTypeId(IdEnum): 13 """UnitType ids used in multiplayer games.""" 14 15 ACCELERATION_ZONE_FLYING_LARGE = RawUnitTypeId.AccelerationZoneFlyingLarge 16 ACCELERATION_ZONE_FLYING_MEDIUM = RawUnitTypeId.AccelerationZoneFlyingMedium 17 ACCELERATION_ZONE_FLYING_SMALL = RawUnitTypeId.AccelerationZoneFlyingSmall 18 ACCELERATION_ZONE_LARGE = RawUnitTypeId.AccelerationZoneLarge 19 ACCELERATION_ZONE_MEDIUM = RawUnitTypeId.AccelerationZoneMedium 20 ACCELERATION_ZONE_SMALL = RawUnitTypeId.AccelerationZoneSmall 21 ADEPT = RawUnitTypeId.Adept 22 ADEPT_SHADE = RawUnitTypeId.AdeptPhaseShift 23 ARCHON = RawUnitTypeId.Archon 24 ARMORY = RawUnitTypeId.Armory 25 ASSIMILATOR = RawUnitTypeId.Assimilator 26 ASSIMILATOR_RICH = RawUnitTypeId.AssimilatorRich 27 AUTO_TURRET = RawUnitTypeId.AutoTurret 28 BANELING = RawUnitTypeId.Baneling 29 BANELING_BURROWED = RawUnitTypeId.BanelingBurrowed 30 BANELING_COCOON = RawUnitTypeId.BanelingCocoon 31 BANELING_NEST = RawUnitTypeId.BanelingNest 32 BANSHEE = RawUnitTypeId.Banshee 33 BARRACKS = RawUnitTypeId.Barracks 34 BARRACKS_FLYING = RawUnitTypeId.BarracksFlying 35 BATTLECRUISER = RawUnitTypeId.Battlecruiser 36 BROODLING = RawUnitTypeId.Broodling 37 BROOD_LORD = RawUnitTypeId.BroodLord 38 BROOD_LORD_COCOON = RawUnitTypeId.BroodLordCocoon 39 BUNKER = RawUnitTypeId.Bunker 40 CARRIER = RawUnitTypeId.Carrier 41 CHANGELING = RawUnitTypeId.Changeling 42 CHANGELING_MARINE = RawUnitTypeId.ChangelingMarine 43 CHANGELING_MARINE_SHIELD = RawUnitTypeId.ChangelingMarineShield 44 CHANGELING_ZEALOT = RawUnitTypeId.ChangelingZealot 45 CHANGELING_ZERGLING = RawUnitTypeId.ChangelingZergling 46 CHANGELING_ZERGLING_WINGS = RawUnitTypeId.ChangelingZerglingWings 47 COLLAPSIBLE_TOWER_DEBRIS_PURIFIER = RawUnitTypeId.CollapsiblePurifierTowerDebris 48 COLLAPSIBLE_TOWER_DEBRIS_RAMP_LEFT_ROCK = RawUnitTypeId.CollapsibleRockTowerDebrisRampLeft 49 COLLAPSIBLE_TOWER_DEBRIS_RAMP_LEFT_ROCK_GREEN = RawUnitTypeId.CollapsibleRockTowerDebrisRampLeftGreen 50 COLLAPSIBLE_TOWER_DEBRIS_RAMP_RIGHT_ROCK = RawUnitTypeId.CollapsibleRockTowerDebrisRampRight 51 COLLAPSIBLE_TOWER_DEBRIS_RAMP_RIGHT_ROCK_GREEN = RawUnitTypeId.CollapsibleRockTowerDebrisRampRightGreen 52 COLLAPSIBLE_TOWER_DEBRIS_ROCK = RawUnitTypeId.CollapsibleRockTowerDebris 53 COLLAPSIBLE_TOWER_DEBRIS_TERRAN = RawUnitTypeId.CollapsibleTerranTowerDebris 54 COLLAPSIBLE_TOWER_DIAGONAL_PURIFIER = RawUnitTypeId.CollapsiblePurifierTowerDiagonal 55 COLLAPSIBLE_TOWER_DIAGONAL_ROCK = RawUnitTypeId.CollapsibleRockTowerDiagonal 56 COLLAPSIBLE_TOWER_DIAGONAL_TERRAN = RawUnitTypeId.CollapsibleTerranTowerDiagonal 57 COLLAPSIBLE_TOWER_PUSH_UNIT_PURIFIER = RawUnitTypeId.CollapsiblePurifierTowerPushUnit 58 COLLAPSIBLE_TOWER_PUSH_UNIT_RAMP_LEFT_ROCK = RawUnitTypeId.CollapsibleRockTowerPushUnitRampLeft 59 COLLAPSIBLE_TOWER_PUSH_UNIT_RAMP_LEFT_ROCK_GREEN = RawUnitTypeId.CollapsibleRockTowerPushUnitRampLeftGreen 60 COLLAPSIBLE_TOWER_PUSH_UNIT_RAMP_LEFT_TERRAN = RawUnitTypeId.CollapsibleTerranTowerPushUnitRampLeft 61 COLLAPSIBLE_TOWER_PUSH_UNIT_RAMP_RIGHT_ROCK = RawUnitTypeId.CollapsibleRockTowerPushUnitRampRight 62 COLLAPSIBLE_TOWER_PUSH_UNIT_RAMP_RIGHT_ROCK_GREEN = RawUnitTypeId.CollapsibleRockTowerPushUnitRampRightGreen 63 COLLAPSIBLE_TOWER_PUSH_UNIT_RAMP_RIGHT_TERRAN = RawUnitTypeId.CollapsibleTerranTowerPushUnitRampRight 64 COLLAPSIBLE_TOWER_PUSH_UNIT_ROCK = RawUnitTypeId.CollapsibleRockTowerPushUnit 65 COLLAPSIBLE_TOWER_PUSH_UNIT_TERRAN = RawUnitTypeId.CollapsibleTerranTowerPushUnit 66 COLLAPSIBLE_TOWER_RAMP_LEFT_ROCK = RawUnitTypeId.CollapsibleRockTowerRampLeft 67 COLLAPSIBLE_TOWER_RAMP_LEFT_ROCK_GREEN = RawUnitTypeId.CollapsibleRockTowerRampLeftGreen 68 COLLAPSIBLE_TOWER_RAMP_LEFT_TERRAN = RawUnitTypeId.CollapsibleTerranTowerRampLeft 69 COLLAPSIBLE_TOWER_RAMP_RIGHT_ROCK = RawUnitTypeId.CollapsibleRockTowerRampRight 70 COLLAPSIBLE_TOWER_RAMP_RIGHT_ROCK_GREEN = RawUnitTypeId.CollapsibleRockTowerRampRightGreen 71 COLLAPSIBLE_TOWER_RAMP_RIGHT_TERRAN = RawUnitTypeId.CollapsibleTerranTowerRampRight 72 COLLAPSIBLE_TOWER_ROCK = RawUnitTypeId.CollapsibleRockTower 73 COLLAPSIBLE_TOWER_TERRAN = RawUnitTypeId.CollapsibleTerranTower 74 COLOSSUS = RawUnitTypeId.Colossus 75 COMMAND_CENTER = RawUnitTypeId.CommandCenter 76 COMMAND_CENTER_FLYING = RawUnitTypeId.CommandCenterFlying 77 CORRUPTOR = RawUnitTypeId.Corruptor 78 CREEP_TUMOR = RawUnitTypeId.CreepTumor 79 CREEP_TUMOR_BURROWED = RawUnitTypeId.CreepTumorBurrowed 80 CREEP_TUMOR_QUEEN = RawUnitTypeId.CreepTumorQueen 81 CRITTER_CLEANING_BOT = RawUnitTypeId.CleaningBot 82 CRITTER_LAB_BOT = RawUnitTypeId.LabBot 83 CYBERNETICS_CORE = RawUnitTypeId.CyberneticsCore 84 CYCLONE = RawUnitTypeId.Cyclone 85 DARK_SHRINE = RawUnitTypeId.DarkShrine 86 DARK_TEMPLAR = RawUnitTypeId.DarkTemplar 87 DESTRUCTIBLE_1X1_BRAXIS_ALPHA = RawUnitTypeId.BraxisAlphaDestructible1x1 88 DESTRUCTIBLE_2X2_BRAXIS_ALPHA = RawUnitTypeId.BraxisAlphaDestructible2x2 89 DESTRUCTIBLE_2X4_HORIZONTAL_CITY_DEBRIS = RawUnitTypeId.DestructibleCityDebris2x4Horizontal 90 DESTRUCTIBLE_2X4_HORIZONTAL_ICE = RawUnitTypeId.DestructibleIce2x4Horizontal 91 DESTRUCTIBLE_2X4_HORIZONTAL_ROCK = RawUnitTypeId.DestructibleRock2x4Horizontal 92 DESTRUCTIBLE_2X4_HORIZONTAL_ROCK_EX1 = RawUnitTypeId.DestructibleRockEx12x4Horizontal 93 DESTRUCTIBLE_2X4_VERTICAL_CITY_DEBRIS = RawUnitTypeId.DestructibleCityDebris2x4Vertical 94 DESTRUCTIBLE_2X4_VERTICAL_ICE = RawUnitTypeId.DestructibleIce2x4Vertical 95 DESTRUCTIBLE_2X4_VERTICAL_ROCK = RawUnitTypeId.DestructibleRock2x4Vertical 96 DESTRUCTIBLE_2X4_VERTICAL_ROCK_EX1 = RawUnitTypeId.DestructibleRockEx12x4Vertical 97 DESTRUCTIBLE_2X6_HORIZONTAL_CITY_DEBRIS = RawUnitTypeId.DestructibleCityDebris2x6Horizontal 98 DESTRUCTIBLE_2X6_HORIZONTAL_ICE = RawUnitTypeId.DestructibleIce2x6Horizontal 99 DESTRUCTIBLE_2X6_HORIZONTAL_ROCK = RawUnitTypeId.DestructibleRock2x6Horizontal 100 DESTRUCTIBLE_2X6_HORIZONTAL_ROCK_EX1 = RawUnitTypeId.DestructibleRockEx12x6Horizontal 101 DESTRUCTIBLE_2X6_VERTICAL_CITY_DEBRIS = RawUnitTypeId.DestructibleCityDebris2x6Vertical 102 DESTRUCTIBLE_2X6_VERTICAL_ICE = RawUnitTypeId.DestructibleIce2x6Vertical 103 DESTRUCTIBLE_2X6_VERTICAL_ROCK = RawUnitTypeId.DestructibleRock2x6Vertical 104 DESTRUCTIBLE_2X6_VERTICAL_ROCK_EX1 = RawUnitTypeId.DestructibleRockEx12x6Vertical 105 DESTRUCTIBLE_3X3_ZERG_INFESTATION = RawUnitTypeId.DestructibleZergInfestation3x3 106 DESTRUCTIBLE_4X4_CITY_DEBRIS = RawUnitTypeId.DestructibleCityDebris4x4 107 DESTRUCTIBLE_4X4_DEBRIS = RawUnitTypeId.DestructibleDebris4x4 108 DESTRUCTIBLE_4X4_ICE = RawUnitTypeId.DestructibleIce4x4 109 DESTRUCTIBLE_4X4_ROCK = RawUnitTypeId.DestructibleRock4x4 110 DESTRUCTIBLE_4X4_ROCK_EX1 = RawUnitTypeId.DestructibleRockEx14x4 111 DESTRUCTIBLE_6X6_CITY_DEBRIS = RawUnitTypeId.DestructibleCityDebris6x6 112 DESTRUCTIBLE_6X6_DEBRIS = RawUnitTypeId.DestructibleDebris6x6 113 DESTRUCTIBLE_6X6_EXPEDITION_GATE = RawUnitTypeId.DestructibleExpeditionGate6x6 114 DESTRUCTIBLE_6X6_ICE = RawUnitTypeId.DestructibleIce6x6 115 DESTRUCTIBLE_6X6_ROCK = RawUnitTypeId.DestructibleRock6x6 116 DESTRUCTIBLE_6X6_ROCK_EX1 = RawUnitTypeId.DestructibleRockEx16x6 117 DESTRUCTIBLE_6X6_WEAK_ROCK = RawUnitTypeId.DestructibleRock6x6Weak 118 # ULBR runs from the upper left to the bottom right, BLUR from the bottom left to the upper right. 119 DESTRUCTIBLE_HUGE_DIAGONAL_BLUR_CITY_DEBRIS = RawUnitTypeId.DestructibleCityDebrisHugeDiagonalBLUR 120 DESTRUCTIBLE_HUGE_DIAGONAL_BLUR_DEBRIS_RAMP = RawUnitTypeId.DestructibleDebrisRampDiagonalHugeBLUR 121 DESTRUCTIBLE_HUGE_DIAGONAL_BLUR_ICE = RawUnitTypeId.DestructibleIceDiagonalHugeBLUR 122 DESTRUCTIBLE_HUGE_DIAGONAL_BLUR_RAMP = RawUnitTypeId.DestructibleRampDiagonalHugeBLUR 123 DESTRUCTIBLE_HUGE_DIAGONAL_BLUR_ROCK_EX1 = RawUnitTypeId.DestructibleRockEx1DiagonalHugeBLUR 124 DESTRUCTIBLE_HUGE_DIAGONAL_ULBR_CITY_DEBRIS = RawUnitTypeId.DestructibleCityDebrisHugeDiagonalULBR 125 DESTRUCTIBLE_HUGE_DIAGONAL_ULBR_DEBRIS_RAMP = RawUnitTypeId.DestructibleDebrisRampDiagonalHugeULBR 126 DESTRUCTIBLE_HUGE_DIAGONAL_ULBR_ICE = RawUnitTypeId.DestructibleIceDiagonalHugeULBR 127 DESTRUCTIBLE_HUGE_DIAGONAL_ULBR_RAMP = RawUnitTypeId.DestructibleRampDiagonalHugeULBR 128 DESTRUCTIBLE_HUGE_DIAGONAL_ULBR_ROCK_EX1 = RawUnitTypeId.DestructibleRockEx1DiagonalHugeULBR 129 DESTRUCTIBLE_HUGE_HORIZONTAL_ICE = RawUnitTypeId.DestructibleIceHorizontalHuge 130 DESTRUCTIBLE_HUGE_HORIZONTAL_RAMP = RawUnitTypeId.DestructibleRampHorizontalHuge 131 DESTRUCTIBLE_HUGE_HORIZONTAL_ROCK_EX1 = RawUnitTypeId.DestructibleRockEx1HorizontalHuge 132 DESTRUCTIBLE_HUGE_VERTICAL_ICE = RawUnitTypeId.DestructibleIceVerticalHuge 133 DESTRUCTIBLE_HUGE_VERTICAL_RAMP = RawUnitTypeId.DestructibleRampVerticalHuge 134 DESTRUCTIBLE_HUGE_VERTICAL_ROCK_EX1 = RawUnitTypeId.DestructibleRockEx1VerticalHuge 135 DESTRUCTIBLE_UNBUILDABLE_BRICKS = RawUnitTypeId.UnbuildableBricksDestructible 136 DESTRUCTIBLE_UNBUILDABLE_PLATES = RawUnitTypeId.UnbuildablePlatesDestructible 137 DESTRUCTIBLE_UNBUILDABLE_ROCKS = RawUnitTypeId.UnbuildableRocksDestructible 138 DISRUPTOR = RawUnitTypeId.Disruptor 139 DRONE = RawUnitTypeId.Drone 140 DRONE_BURROWED = RawUnitTypeId.DroneBurrowed 141 EGG = RawUnitTypeId.Egg 142 ENGINEERING_BAY = RawUnitTypeId.EngineeringBay 143 EVOLUTION_CHAMBER = RawUnitTypeId.EvolutionChamber 144 EXTRACTOR = RawUnitTypeId.Extractor 145 EXTRACTOR_RICH = RawUnitTypeId.ExtractorRich 146 FACTORY = RawUnitTypeId.Factory 147 FACTORY_FLYING = RawUnitTypeId.FactoryFlying 148 FLEET_BEACON = RawUnitTypeId.FleetBeacon 149 FORCE_FIELD = RawUnitTypeId.ForceField 150 FORGE = RawUnitTypeId.Forge 151 FUSION_CORE = RawUnitTypeId.FusionCore 152 GATEWAY = RawUnitTypeId.Gateway 153 GHOST = RawUnitTypeId.Ghost 154 GHOST_ACADEMY = RawUnitTypeId.GhostAcademy 155 GREATER_SPIRE = RawUnitTypeId.GreaterSpire 156 HATCHERY = RawUnitTypeId.Hatchery 157 HEALING_SHRINE_XEL_NAGA = RawUnitTypeId.XelNagaHealingShrine 158 HELLBAT = RawUnitTypeId.HellionTank 159 HELLION = RawUnitTypeId.Hellion 160 HIGH_TEMPLAR = RawUnitTypeId.HighTemplar 161 HIVE = RawUnitTypeId.Hive 162 HYDRALISK = RawUnitTypeId.Hydralisk 163 HYDRALISK_BURROWED = RawUnitTypeId.HydraliskBurrowed 164 HYDRALISK_DEN = RawUnitTypeId.HydraliskDen 165 IMMORTAL = RawUnitTypeId.Immortal 166 INFESTATION_PIT = RawUnitTypeId.InfestationPit 167 INFESTOR = RawUnitTypeId.Infestor 168 INFESTOR_BURROWED = RawUnitTypeId.InfestorBurrowed 169 INHIBITOR_ZONE_FLYING_LARGE = RawUnitTypeId.InhibitorZoneFlyingLarge 170 INHIBITOR_ZONE_FLYING_MEDIUM = RawUnitTypeId.InhibitorZoneFlyingMedium 171 INHIBITOR_ZONE_FLYING_SMALL = RawUnitTypeId.InhibitorZoneFlyingSmall 172 INHIBITOR_ZONE_LARGE = RawUnitTypeId.InhibitorZoneLarge 173 INHIBITOR_ZONE_MEDIUM = RawUnitTypeId.InhibitorZoneMedium 174 INHIBITOR_ZONE_SMALL = RawUnitTypeId.InhibitorZoneSmall 175 INTERCEPTOR = RawUnitTypeId.Interceptor 176 LAIR = RawUnitTypeId.Lair 177 LARVA = RawUnitTypeId.Larva 178 LIBERATOR = RawUnitTypeId.Liberator 179 LIBERATOR_SIEGED = RawUnitTypeId.LiberatorAG 180 LOCUST = RawUnitTypeId.LocustMP 181 LOCUST_FLYING = RawUnitTypeId.LocustMPFlying 182 LURKER = RawUnitTypeId.LurkerMP 183 LURKER_BURROWED = RawUnitTypeId.LurkerMPBurrowed 184 LURKER_DEN = RawUnitTypeId.LurkerDenMP 185 LURKER_EGG = RawUnitTypeId.LurkerMPEgg 186 MARAUDER = RawUnitTypeId.Marauder 187 MARINE = RawUnitTypeId.Marine 188 MEDIVAC = RawUnitTypeId.Medivac 189 MINERAL_FIELD = RawUnitTypeId.MineralField 190 MINERAL_FIELD_450 = RawUnitTypeId.MineralField450 191 MINERAL_FIELD_750 = RawUnitTypeId.MineralField750 192 MINERAL_FIELD_750_BATTLE_STATION = RawUnitTypeId.BattleStationMineralField750 193 MINERAL_FIELD_750_LAB = RawUnitTypeId.LabMineralField750 194 MINERAL_FIELD_750_PURIFIER = RawUnitTypeId.PurifierMineralField750 195 MINERAL_FIELD_900_OPAQUE = RawUnitTypeId.MineralFieldOpaque900 196 MINERAL_FIELD_BATTLE_STATION = RawUnitTypeId.BattleStationMineralField 197 MINERAL_FIELD_LAB = RawUnitTypeId.LabMineralField 198 MINERAL_FIELD_OPAQUE = RawUnitTypeId.MineralFieldOpaque 199 MINERAL_FIELD_PURIFIER = RawUnitTypeId.PurifierMineralField 200 MINERAL_FIELD_RICH = RawUnitTypeId.RichMineralField 201 MINERAL_FIELD_RICH_750 = RawUnitTypeId.RichMineralField750 202 MINERAL_FIELD_RICH_750_PURIFIER = RawUnitTypeId.PurifierRichMineralField750 203 MINERAL_FIELD_RICH_PURIFIER = RawUnitTypeId.PurifierRichMineralField 204 MISSILE_TURRET = RawUnitTypeId.MissileTurret 205 MOTHERSHIP = RawUnitTypeId.Mothership 206 MULE = RawUnitTypeId.MULE 207 MUTALISK = RawUnitTypeId.Mutalisk 208 NEXUS = RawUnitTypeId.Nexus 209 NOT_A_UNIT = RawUnitTypeId.NotAUnit 210 NYDUS_NETWORK = RawUnitTypeId.NydusNetwork 211 NYDUS_WORM = RawUnitTypeId.NydusCanal 212 OBSERVER = RawUnitTypeId.Observer 213 OBSERVER_SIEGED = RawUnitTypeId.ObserverSiegeMode 214 ORACLE = RawUnitTypeId.Oracle 215 ORBITAL_COMMAND = RawUnitTypeId.OrbitalCommand 216 ORBITAL_COMMAND_FLYING = RawUnitTypeId.OrbitalCommandFlying 217 OVERLORD = RawUnitTypeId.Overlord 218 OVERLORD_COCOON = RawUnitTypeId.OverlordCocoon 219 OVERLORD_TRANSPORT = RawUnitTypeId.OverlordTransport 220 OVERLORD_TRANSPORT_COCOON = RawUnitTypeId.TransportOverlordCocoon 221 OVERSEER = RawUnitTypeId.Overseer 222 OVERSEER_SIEGED = RawUnitTypeId.OverseerSiegeMode 223 # A parasitic bomb that has left its target, where the target was, once the target died or the bomb ran out; until 224 # then the bomb is the target's buff (in game). 225 PARASITIC_BOMB_LEFT_BEHIND = RawUnitTypeId.ParasiticBombDummy 226 PHOENIX = RawUnitTypeId.Phoenix 227 PHOTON_CANNON = RawUnitTypeId.PhotonCannon 228 PLANETARY_FORTRESS = RawUnitTypeId.PlanetaryFortress 229 PROBE = RawUnitTypeId.Probe 230 PURIFICATION_NOVA = RawUnitTypeId.DisruptorPhased 231 PYLON = RawUnitTypeId.Pylon 232 QUEEN = RawUnitTypeId.Queen 233 QUEEN_BURROWED = RawUnitTypeId.QueenBurrowed 234 RAVAGER = RawUnitTypeId.Ravager 235 RAVAGER_BURROWED = RawUnitTypeId.RavagerBurrowed 236 RAVAGER_COCOON = RawUnitTypeId.RavagerCocoon 237 RAVEN = RawUnitTypeId.Raven 238 REACTOR = RawUnitTypeId.Reactor 239 REACTOR_BARRACKS = RawUnitTypeId.BarracksReactor 240 REACTOR_FACTORY = RawUnitTypeId.FactoryReactor 241 REACTOR_STARPORT = RawUnitTypeId.StarportReactor 242 REAPER = RawUnitTypeId.Reaper 243 REAPER_GRENADE = RawUnitTypeId.KD8Charge 244 REFINERY = RawUnitTypeId.Refinery 245 REFINERY_RICH = RawUnitTypeId.RefineryRich 246 ROACH = RawUnitTypeId.Roach 247 ROACH_BURROWED = RawUnitTypeId.RoachBurrowed 248 ROACH_WARREN = RawUnitTypeId.RoachWarren 249 ROBOTICS_BAY = RawUnitTypeId.RoboticsBay 250 ROBOTICS_FACILITY = RawUnitTypeId.RoboticsFacility 251 ROCKS_2X2_NON_CONJOINED = RawUnitTypeId.Rocks2x2NonConjoined 252 SCV = RawUnitTypeId.SCV 253 SENSOR_TOWER = RawUnitTypeId.SensorTower 254 SENTRY = RawUnitTypeId.Sentry 255 SHIELD_BATTERY = RawUnitTypeId.ShieldBattery 256 SIEGE_TANK = RawUnitTypeId.SiegeTank 257 SIEGE_TANK_SIEGED = RawUnitTypeId.SiegeTankSieged 258 SPAWNING_POOL = RawUnitTypeId.SpawningPool 259 SPINE_CRAWLER = RawUnitTypeId.SpineCrawler 260 SPINE_CRAWLER_UPROOTED = RawUnitTypeId.SpineCrawlerUprooted 261 SPIRE = RawUnitTypeId.Spire 262 SPORE_CRAWLER = RawUnitTypeId.SporeCrawler 263 SPORE_CRAWLER_UPROOTED = RawUnitTypeId.SporeCrawlerUprooted 264 STALKER = RawUnitTypeId.Stalker 265 STARGATE = RawUnitTypeId.Stargate 266 STARPORT = RawUnitTypeId.Starport 267 STARPORT_FLYING = RawUnitTypeId.StarportFlying 268 STASIS_WARD = RawUnitTypeId.OracleStasisTrap 269 SUPPLY_DEPOT = RawUnitTypeId.SupplyDepot 270 SUPPLY_DEPOT_LOWERED = RawUnitTypeId.SupplyDepotLowered 271 SWARM_HOST = RawUnitTypeId.SwarmHostMP 272 SWARM_HOST_BURROWED = RawUnitTypeId.SwarmHostBurrowedMP 273 TECH_LAB = RawUnitTypeId.TechLab 274 TECH_LAB_BARRACKS = RawUnitTypeId.BarracksTechLab 275 TECH_LAB_FACTORY = RawUnitTypeId.FactoryTechLab 276 TECH_LAB_STARPORT = RawUnitTypeId.StarportTechLab 277 TEMPEST = RawUnitTypeId.Tempest 278 TEMPLAR_ARCHIVE = RawUnitTypeId.TemplarArchive 279 THOR = RawUnitTypeId.Thor 280 THOR_HIGH_IMPACT = RawUnitTypeId.ThorAP 281 TWILIGHT_COUNCIL = RawUnitTypeId.TwilightCouncil 282 ULTRALISK = RawUnitTypeId.Ultralisk 283 ULTRALISK_BURROWED = RawUnitTypeId.UltraliskBurrowed 284 ULTRALISK_CAVERN = RawUnitTypeId.UltraliskCavern 285 VESPENE_GEYSER = RawUnitTypeId.VespeneGeyser 286 VESPENE_GEYSER_PROTOSS = RawUnitTypeId.ProtossVespeneGeyser 287 VESPENE_GEYSER_PURIFIER = RawUnitTypeId.PurifierVespeneGeyser 288 VESPENE_GEYSER_RICH = RawUnitTypeId.RichVespeneGeyser 289 VESPENE_GEYSER_SHAKURAS = RawUnitTypeId.ShakurasVespeneGeyser 290 VESPENE_GEYSER_SPACE_PLATFORM = RawUnitTypeId.SpacePlatformGeyser 291 VIKING = RawUnitTypeId.VikingFighter 292 VIKING_LANDED = RawUnitTypeId.VikingAssault 293 VIPER = RawUnitTypeId.Viper 294 VOID_RAY = RawUnitTypeId.VoidRay 295 WARP_GATE = RawUnitTypeId.WarpGate 296 WARP_PRISM = RawUnitTypeId.WarpPrism 297 WARP_PRISM_PHASING = RawUnitTypeId.WarpPrismPhasing 298 WATCHTOWER = RawUnitTypeId.XelNagaTower 299 WIDOW_MINE = RawUnitTypeId.WidowMine 300 WIDOW_MINE_BURROWED = RawUnitTypeId.WidowMineBurrowed 301 ZEALOT = RawUnitTypeId.Zealot 302 ZERGLING = RawUnitTypeId.Zergling 303 ZERGLING_BURROWED = RawUnitTypeId.ZerglingBurrowed
UnitType ids used in multiplayer games.
31@final 32class Units(Sequence[U]): 33 """An immutable, ordered collection of units. Filters keep the order. 34 35 Every filter returns a new collection. A query that picks the nearest unit, such as `closest_to`, raises 36 `ValueError` on an empty collection; `structure_at` answers `None` where no structure stands. Two collections are 37 equal, and hash alike, when they hold the same units in the same order; a collection never equals a tuple or a 38 list. 39 """ 40 41 __slots__ = ("_by_id", "_units") 42 43 _units: tuple[U, ...] 44 _by_id: dict[int, U] | None 45 46 def __init__(self, units: Iterable[U] = ()) -> None: 47 self._units = tuple(units) 48 self._by_id = None 49 50 @classmethod 51 def combined[V: Unit[Any]](cls, *collections: Iterable[V]) -> Units[V]: 52 """Every unit of `collections` in one collection, in order, each unit at its first appearance. 53 54 Units are matched by id, so a unit in two collections appears once, and collections that overlap combine 55 cleanly. 56 """ 57 index: dict[int, V] = {} 58 for collection in collections: 59 for unit in collection: 60 if unit.id not in index: 61 index[unit.id] = unit 62 combined = Units(index.values()) 63 combined._by_id = index 64 return combined 65 66 def combined_with[V: Unit[Any]](self, units: V | Iterable[V]) -> Units[U | V]: 67 """These units and then `units`, one unit or many, each unit at its first appearance, matched by id as 68 `combined` matches them.""" 69 return Units.combined(self._units, _unit_tuple(units)) 70 71 def __len__(self) -> int: 72 return len(self._units) 73 74 def __iter__(self) -> Iterator[U]: 75 return iter(self._units) 76 77 @overload 78 def __getitem__(self, index: int) -> U: ... 79 80 @overload 81 def __getitem__(self, index: slice) -> Units[U]: ... 82 83 def __getitem__(self, index: int | slice) -> U | Units[U]: 84 if isinstance(index, slice): 85 return Units(self._units[index]) 86 return self._units[index] 87 88 def __contains__(self, unit: object) -> bool: 89 return unit in self._units 90 91 def __eq__(self, other: object) -> bool: 92 if not isinstance(other, Units): 93 return NotImplemented 94 return self._units == other._units 95 96 def __hash__(self) -> int: 97 return hash(self._units) 98 99 def __repr__(self) -> str: 100 return f"Units({list(self._units)!r})" 101 102 # By id. 103 104 def _index(self) -> dict[int, U]: 105 """The units by id, built on first use.""" 106 if self._by_id is None: 107 self._by_id = {unit.id: unit for unit in self._units} 108 return self._by_id 109 110 @property 111 def ids(self) -> frozenset[int]: 112 """The id of every unit.""" 113 return frozenset(self._index()) 114 115 def by_id(self, unit_id: int) -> U: 116 """The unit with `unit_id`. Raises `KeyError` if there is none.""" 117 return self._index()[unit_id] 118 119 def get(self, unit_id: int) -> U | None: 120 """The unit with `unit_id`, or `None` if there is none.""" 121 return self._index().get(unit_id) 122 123 def with_ids(self, unit_ids: int | Iterable[int]) -> Units[U]: 124 """The units whose id is `unit_ids`, one id, or in it, a collection of them.""" 125 wanted = {unit_ids} if isinstance(unit_ids, int) else set(unit_ids) 126 return Units(unit for unit in self._units if unit.id in wanted) 127 128 def without_ids(self, unit_ids: int | Iterable[int]) -> Units[U]: 129 """The units whose id is not `unit_ids`, one id, or not in it, a collection of them.""" 130 unwanted = {unit_ids} if isinstance(unit_ids, int) else set(unit_ids) 131 return Units(unit for unit in self._units if unit.id not in unwanted) 132 133 def without(self, units: Unit[Any] | Iterable[Unit[Any]]) -> Units[U]: 134 """These units, leaving out `units`, one unit or many, matched by NachOS id, so a structure remembered under a 135 new tag still matches.""" 136 return self.without_ids(unit.id for unit in _unit_tuple(units)) 137 138 # By what they are. 139 140 def filter(self, predicate: Callable[[U], bool]) -> Units[U]: 141 """The units for which `predicate` is true.""" 142 return Units(unit for unit in self._units if predicate(unit)) 143 144 @overload 145 def of_type[K: UnitType.AnyType]( 146 self: Units[OwnUnit[Any]], unit_type: type[K], /, *unit_types: type[K] 147 ) -> Units[OwnUnit[K]]: ... 148 149 @overload 150 def of_type[K: UnitType.AnyType]( 151 self: Units[Unit[Any]], unit_type: type[K], /, *unit_types: type[K] 152 ) -> Units[Unit[K]]: ... 153 154 @overload 155 def of_type( 156 self, unit_type: type[UnitType.AnyType] | UnitTypeId, /, *unit_types: type[UnitType.AnyType] | UnitTypeId 157 ) -> Units[U]: ... 158 159 @overload 160 def of_type(self, type_ids: Iterable[UnitTypeId], /) -> Units[U]: ... 161 162 def of_type( 163 self, 164 types: type[UnitType.AnyType] | UnitTypeId | Iterable[UnitTypeId], 165 /, 166 *unit_types: type[UnitType.AnyType] | UnitTypeId, 167 ) -> Units[Any]: 168 """The units of the given types, each a `UnitType`, a group of them, or a `UnitTypeId`, or of the 169 `UnitTypeId`s in one collection given alone. Typed as those types when every one is a `UnitType`; the 170 collection keeps its type otherwise. Raises `TypeError` for anything else. 171 """ 172 if isinstance(types, UnitTypeId) and not unit_types: 173 return Units(unit for unit in self._units if unit.type_id is types) 174 wanted = _type_ids_of(types, unit_types) 175 return Units(unit for unit in self._units if unit.type_id in wanted) 176 177 @overload 178 def excluding_type( 179 self, unit_type: type[UnitType.AnyType] | UnitTypeId, /, *unit_types: type[UnitType.AnyType] | UnitTypeId 180 ) -> Units[U]: ... 181 182 @overload 183 def excluding_type(self, type_ids: Iterable[UnitTypeId], /) -> Units[U]: ... 184 185 def excluding_type( 186 self, 187 types: type[UnitType.AnyType] | UnitTypeId | Iterable[UnitTypeId], 188 /, 189 *unit_types: type[UnitType.AnyType] | UnitTypeId, 190 ) -> Units[U]: 191 """The units not of any of the given types, taken as `of_type` takes them.""" 192 if isinstance(types, UnitTypeId) and not unit_types: 193 return Units(unit for unit in self._units if unit.type_id is not types) 194 unwanted = _type_ids_of(types, unit_types) 195 return Units(unit for unit in self._units if unit.type_id not in unwanted) 196 197 def _of_alliance(self, alliance: Alliance) -> Units[U]: 198 return Units(unit for unit in self._units if unit._raw_alliance == alliance) 199 200 @property 201 def own[K: UnitType.AnyType](self: Units[Unit[K]]) -> Units[OwnUnit[K]]: 202 """This player's units.""" 203 return Units(unit for unit in self._units if isinstance(unit, OwnUnit)) 204 205 @property 206 def allied(self) -> Units[U]: 207 """The units of this player's allies.""" 208 return self._of_alliance(Alliance.ALLY) 209 210 @property 211 def neutral(self) -> Units[U]: 212 """The map's own units.""" 213 return self._of_alliance(Alliance.NEUTRAL) 214 215 @property 216 def enemy(self) -> Units[U]: 217 """The enemies' units.""" 218 return self._of_alliance(Alliance.ENEMY) 219 220 @property 221 def structures(self) -> Units[U]: 222 """The structures, as `UnitType.Structure` has them: the types the game's tables give the structure 223 attribute.""" 224 return self._in_group(UnitType.Structure) 225 226 @property 227 def non_structures(self) -> Units[U]: 228 """The units that are not structures, those of `UnitType.NonStructure`: larvae, eggs and a sieged tank among 229 them, and not a lifted barracks.""" 230 return self._in_group(UnitType.NonStructure) 231 232 @property 233 def workers(self) -> Units[U]: 234 """The workers: SCVs, probes and drones, burrowed or not, as `UnitType.Worker` has them. A MULE is none.""" 235 return self._in_group(UnitType.Worker) 236 237 @property 238 def townhalls(self) -> Units[U]: 239 """The townhalls, a lifted command center among them, as `UnitType.Townhall` has them.""" 240 return self._in_group(UnitType.Townhall) 241 242 @property 243 def mineral_fields(self) -> Units[U]: 244 """The mineral fields of every kind, as `UnitType.AnyMineralField` has them.""" 245 return self._in_group(UnitType.AnyMineralField) 246 247 @property 248 def geysers(self) -> Units[U]: 249 """The vespene geysers of every kind, as `UnitType.AnyVespeneGeyser` has them.""" 250 return self._in_group(UnitType.AnyVespeneGeyser) 251 252 @property 253 def gas_buildings(self) -> Units[U]: 254 """The refineries, assimilators and extractors, as `UnitType.GasBuilding` has them.""" 255 return self._in_group(UnitType.GasBuilding) 256 257 def _in_group(self, group: type[UnitType.AnyType]) -> Units[U]: 258 """The units of a type in `group`.""" 259 wanted = group.type_ids 260 return Units(unit for unit in self._units if unit.type_id in wanted) 261 262 @property 263 def complete(self) -> Units[U]: 264 """The units that have finished building or warping in. Raises `NotReportedError` for a unit never shown 265 visible.""" 266 return Units(unit for unit in self._units if unit.is_complete) 267 268 @property 269 def not_complete(self) -> Units[U]: 270 """The units still building or warping in: those `complete` leaves out. Raises `NotReportedError` as it 271 does.""" 272 return Units(unit for unit in self._units if not unit.is_complete) 273 274 @property 275 def alive(self) -> Units[U]: 276 """The units not known to be dead, as `Unit.is_alive` has it.""" 277 return Units(unit for unit in self._units if unit.is_alive) 278 279 @property 280 def dead(self) -> Units[U]: 281 """The units known to be dead: those `alive` leaves out.""" 282 return Units(unit for unit in self._units if unit.is_dead) 283 284 @property 285 def listed(self) -> Units[U]: 286 """The units the last observation listed, as `Unit.is_listed` has it.""" 287 return Units(unit for unit in self._units if unit.is_listed) 288 289 @property 290 def not_listed(self) -> Units[U]: 291 """The units the last observation did not list: those `listed` leaves out.""" 292 return Units(unit for unit in self._units if not unit.is_listed) 293 294 @property 295 def visible(self) -> Units[U]: 296 """The units the last observation showed visible, as `Unit.is_visible` has it: in it, and seen, not cloaked or 297 detected.""" 298 return Units(unit for unit in self._units if unit.is_visible) 299 300 @property 301 def orderable[K: UnitType.AnyType](self: Units[Unit[K]]) -> Units[OwnUnit[K]]: 302 """The units this player can order now, as `Unit.is_orderable` has it.""" 303 return Units(unit for unit in self._units if isinstance(unit, OwnUnit) and unit.is_listed) 304 305 @property 306 def ground(self) -> Units[U]: 307 """The units on the ground: those not flying, and the structures remembered in the fog, whose flying the game 308 does not report, as `Unit.is_ground_structure` takes them.""" 309 return Units(unit for unit in self._units if _is_on_the_ground(unit)) 310 311 @property 312 def air(self) -> Units[U]: 313 """The units in the air: those `ground` leaves out.""" 314 return Units(unit for unit in self._units if not _is_on_the_ground(unit)) 315 316 @property 317 def idle[O: OwnUnit[Any]](self: Units[O]) -> Units[O]: 318 """This player's units without orders.""" 319 return Units(unit for unit in self._units if unit.is_idle) 320 321 def doing[O: OwnUnit[Any]](self: Units[O], abilities: AbilityId | Collection[AbilityId]) -> Units[O]: 322 """This player's units whose current order carries out `abilities`, one ability or any of several.""" 323 return Units(unit for unit in self._units if unit.is_doing(abilities)) 324 325 def with_buff(self, buff_ids: BuffId | Collection[BuffId]) -> Units[U]: 326 """The units with `buff_ids`, one buff or any of several, among their buffs. Raises `NotReportedError` for a 327 unit never shown visible.""" 328 return Units(unit for unit in self._units if unit.has_buff(buff_ids)) 329 330 # By what they can hit. 331 332 def having_in_range(self, target: Unit[Any], *, margin: float = 0.0) -> Units[U]: 333 """The units that have `target` in range of a weapon, as `Unit.has_in_range` has it. Raises 334 `NotReportedError` as it does.""" 335 return Units(unit for unit in self._units if unit.has_in_range(target, margin=margin)) 336 337 def in_range_of(self, attacker: Unit[Any], *, margin: float = 0.0) -> Units[U]: 338 """The units `attacker` has in range of a weapon, as `Unit.has_in_range` has it. Raises `NotReportedError` as 339 it does.""" 340 return Units(unit for unit in self._units if attacker.has_in_range(unit, margin=margin)) 341 342 # By where they are. Written as plain loops over each unit's position: measured three times faster than `min` 343 # with a key, and faster than building an array of positions, which would have to be rebuilt on every query 344 # since the units move. 345 346 def inside(self, areas: Area | Iterable[Area]) -> Units[U]: 347 """The units standing in `areas`: in one area, or in any of several.""" 348 if isinstance(areas, Area): 349 return Units(unit for unit in self._units if unit._position in areas) 350 regions = tuple(areas) 351 return Units(unit for unit in self._units if any(unit._position in region for region in regions)) 352 353 def outside(self, areas: Area | Iterable[Area]) -> Units[U]: 354 """The units standing in none of `areas`: those `inside` leaves out.""" 355 if isinstance(areas, Area): 356 return Units(unit for unit in self._units if unit._position not in areas) 357 regions = tuple(areas) 358 return Units(unit for unit in self._units if not any(unit._position in region for region in regions)) 359 360 def within(self, distance: float, *, of: PointLike | Unit[Any] | Iterable[PointLike | Unit[Any]]) -> Units[U]: 361 """The units at most `distance` from `of`, a point or a unit, or from any of several, measured between 362 positions. Raises `ValueError` for a distance that is negative or not a number.""" 363 if not distance >= 0: 364 raise ValueError(f"a distance is at least 0, not {distance}") 365 centers = _positions(of) 366 distance_squared = distance * distance 367 kept = [] 368 for unit in self._units: 369 position = unit._position 370 x, y = position[0], position[1] 371 for cx, cy in centers: 372 dx = x - cx 373 dy = y - cy 374 if dx * dx + dy * dy <= distance_squared: 375 kept.append(unit) 376 break 377 return Units(kept) 378 379 def beyond(self, distance: float, *, of: PointLike | Unit[Any] | Iterable[PointLike | Unit[Any]]) -> Units[U]: 380 """The units farther than `distance` from `of`, a point or a unit, and from every one of several: those 381 `within` leaves out. Raises `ValueError` as `within` does.""" 382 return self.without(self.within(distance, of=of)) 383 384 def sorted(self, key: Callable[[U], Any], *, reverse: bool = False) -> Units[U]: 385 """The units in the order of `key`, ascending unless `reverse`. Units of equal key keep their order.""" 386 return Units(sorted(self._units, key=key, reverse=reverse)) 387 388 def sorted_by_distance_to(self, point_or_unit: PointLike | Unit[Any]) -> Units[U]: 389 """The units from nearest to `point_or_unit`, a point or a unit's position, to furthest. Units at equal 390 distance keep their order.""" 391 x, y = _ground_position_of(point_or_unit) 392 distances = [] 393 for unit in self._units: 394 position = unit._position 395 dx = position[0] - x 396 dy = position[1] - y 397 distances.append(dx * dx + dy * dy) 398 order = sorted(range(len(distances)), key=distances.__getitem__) 399 return Units(self._units[index] for index in order) 400 401 def closest_n_to(self, count: int, point_or_unit: PointLike | Unit[Any]) -> Units[U]: 402 """The `count` units nearest to `point_or_unit`, a point or a unit's position, nearest first, or all of them if 403 there are fewer.""" 404 if count < 0: 405 raise ValueError(f"cannot pick {count} units") 406 return self.sorted_by_distance_to(point_or_unit)[:count] 407 408 def closest_to(self, point_or_unit: PointLike | Unit[Any]) -> U: 409 """The unit nearest to `point_or_unit`, a point or a unit's position. At equal distance, the first in the 410 collection: a unit in it is at distance 0 from itself, and is picked unless another on the same spot comes 411 first.""" 412 if not self._units: 413 raise ValueError("no units to choose from") 414 x, y = _ground_position_of(point_or_unit) 415 closest = self._units[0] 416 nearest = math.inf 417 for unit in self._units: 418 position = unit._position 419 dx = position[0] - x 420 dy = position[1] - y 421 distance = dx * dx + dy * dy 422 if distance < nearest: 423 nearest = distance 424 closest = unit 425 return closest 426 427 def closest_distance_to(self, point_or_unit: PointLike | Unit[Any]) -> float: 428 """The distance from `point_or_unit`, a point or a unit's position, to the nearest unit's position.""" 429 if not self._units: 430 raise ValueError("no units to measure to") 431 x, y = _ground_position_of(point_or_unit) 432 nearest = math.inf 433 for unit in self._units: 434 position = unit._position 435 dx = position[0] - x 436 dy = position[1] - y 437 distance = dx * dx + dy * dy 438 if distance < nearest: 439 nearest = distance 440 return math.sqrt(nearest) 441 442 def structure_at(self, point: PointLike | Tile) -> U | None: 443 """The structure on the ground whose footprint holds `point`, a tile reading as its center, or `None` if none of 444 these does. Of one in sight and a snapshot over the same ground, the one in sight; a lifted structure covers no 445 ground.""" 446 tile = Tile.at(point) 447 x, y = _ground_position_of(tile.center if isinstance(point, Tile) else point) 448 remembered = None 449 for unit in self._units: 450 position = unit._position 451 if abs(position[0] - x) > _FOOTPRINT_REACH or abs(position[1] - y) > _FOOTPRINT_REACH: 452 continue 453 if not unit.is_ground_structure or (footprint := unit.footprint) is None: 454 continue 455 if tile not in footprint.tiles(at=position): 456 continue 457 if unit.is_listed and unit.visibility.in_sight: 458 return unit 459 if remembered is None: 460 remembered = unit 461 return remembered 462 463 @property 464 def center(self) -> Point: 465 """The mean of the units' positions.""" 466 if not self._units: 467 raise ValueError("no units to find the center of") 468 x = y = 0.0 469 for unit in self._units: 470 position = unit._position 471 x += position[0] 472 y += position[1] 473 count = len(self._units) 474 return Point((x / count, y / count))
An immutable, ordered collection of units. Filters keep the order.
Every filter returns a new collection. A query that picks the nearest unit, such as closest_to, raises
ValueError on an empty collection; structure_at answers None where no structure stands. Two collections are
equal, and hash alike, when they hold the same units in the same order; a collection never equals a tuple or a
list.
50 @classmethod 51 def combined[V: Unit[Any]](cls, *collections: Iterable[V]) -> Units[V]: 52 """Every unit of `collections` in one collection, in order, each unit at its first appearance. 53 54 Units are matched by id, so a unit in two collections appears once, and collections that overlap combine 55 cleanly. 56 """ 57 index: dict[int, V] = {} 58 for collection in collections: 59 for unit in collection: 60 if unit.id not in index: 61 index[unit.id] = unit 62 combined = Units(index.values()) 63 combined._by_id = index 64 return combined
Every unit of collections in one collection, in order, each unit at its first appearance.
Units are matched by id, so a unit in two collections appears once, and collections that overlap combine cleanly.
66 def combined_with[V: Unit[Any]](self, units: V | Iterable[V]) -> Units[U | V]: 67 """These units and then `units`, one unit or many, each unit at its first appearance, matched by id as 68 `combined` matches them.""" 69 return Units.combined(self._units, _unit_tuple(units))
These units and then units, one unit or many, each unit at its first appearance, matched by id as
combined matches them.
110 @property 111 def ids(self) -> frozenset[int]: 112 """The id of every unit.""" 113 return frozenset(self._index())
The id of every unit.
115 def by_id(self, unit_id: int) -> U: 116 """The unit with `unit_id`. Raises `KeyError` if there is none.""" 117 return self._index()[unit_id]
The unit with unit_id. Raises KeyError if there is none.
119 def get(self, unit_id: int) -> U | None: 120 """The unit with `unit_id`, or `None` if there is none.""" 121 return self._index().get(unit_id)
The unit with unit_id, or None if there is none.
123 def with_ids(self, unit_ids: int | Iterable[int]) -> Units[U]: 124 """The units whose id is `unit_ids`, one id, or in it, a collection of them.""" 125 wanted = {unit_ids} if isinstance(unit_ids, int) else set(unit_ids) 126 return Units(unit for unit in self._units if unit.id in wanted)
The units whose id is unit_ids, one id, or in it, a collection of them.
128 def without_ids(self, unit_ids: int | Iterable[int]) -> Units[U]: 129 """The units whose id is not `unit_ids`, one id, or not in it, a collection of them.""" 130 unwanted = {unit_ids} if isinstance(unit_ids, int) else set(unit_ids) 131 return Units(unit for unit in self._units if unit.id not in unwanted)
The units whose id is not unit_ids, one id, or not in it, a collection of them.
133 def without(self, units: Unit[Any] | Iterable[Unit[Any]]) -> Units[U]: 134 """These units, leaving out `units`, one unit or many, matched by NachOS id, so a structure remembered under a 135 new tag still matches.""" 136 return self.without_ids(unit.id for unit in _unit_tuple(units))
These units, leaving out units, one unit or many, matched by NachOS id, so a structure remembered under a
new tag still matches.
140 def filter(self, predicate: Callable[[U], bool]) -> Units[U]: 141 """The units for which `predicate` is true.""" 142 return Units(unit for unit in self._units if predicate(unit))
The units for which predicate is true.
162 def of_type( 163 self, 164 types: type[UnitType.AnyType] | UnitTypeId | Iterable[UnitTypeId], 165 /, 166 *unit_types: type[UnitType.AnyType] | UnitTypeId, 167 ) -> Units[Any]: 168 """The units of the given types, each a `UnitType`, a group of them, or a `UnitTypeId`, or of the 169 `UnitTypeId`s in one collection given alone. Typed as those types when every one is a `UnitType`; the 170 collection keeps its type otherwise. Raises `TypeError` for anything else. 171 """ 172 if isinstance(types, UnitTypeId) and not unit_types: 173 return Units(unit for unit in self._units if unit.type_id is types) 174 wanted = _type_ids_of(types, unit_types) 175 return Units(unit for unit in self._units if unit.type_id in wanted)
The units of the given types, each a UnitType, a group of them, or a UnitTypeId, or of the
UnitTypeIds in one collection given alone. Typed as those types when every one is a UnitType; the
collection keeps its type otherwise. Raises TypeError for anything else.
185 def excluding_type( 186 self, 187 types: type[UnitType.AnyType] | UnitTypeId | Iterable[UnitTypeId], 188 /, 189 *unit_types: type[UnitType.AnyType] | UnitTypeId, 190 ) -> Units[U]: 191 """The units not of any of the given types, taken as `of_type` takes them.""" 192 if isinstance(types, UnitTypeId) and not unit_types: 193 return Units(unit for unit in self._units if unit.type_id is not types) 194 unwanted = _type_ids_of(types, unit_types) 195 return Units(unit for unit in self._units if unit.type_id not in unwanted)
The units not of any of the given types, taken as of_type takes them.
200 @property 201 def own[K: UnitType.AnyType](self: Units[Unit[K]]) -> Units[OwnUnit[K]]: 202 """This player's units.""" 203 return Units(unit for unit in self._units if isinstance(unit, OwnUnit))
This player's units.
205 @property 206 def allied(self) -> Units[U]: 207 """The units of this player's allies.""" 208 return self._of_alliance(Alliance.ALLY)
The units of this player's allies.
210 @property 211 def neutral(self) -> Units[U]: 212 """The map's own units.""" 213 return self._of_alliance(Alliance.NEUTRAL)
The map's own units.
215 @property 216 def enemy(self) -> Units[U]: 217 """The enemies' units.""" 218 return self._of_alliance(Alliance.ENEMY)
The enemies' units.
220 @property 221 def structures(self) -> Units[U]: 222 """The structures, as `UnitType.Structure` has them: the types the game's tables give the structure 223 attribute.""" 224 return self._in_group(UnitType.Structure)
The structures, as UnitType.Structure has them: the types the game's tables give the structure
attribute.
226 @property 227 def non_structures(self) -> Units[U]: 228 """The units that are not structures, those of `UnitType.NonStructure`: larvae, eggs and a sieged tank among 229 them, and not a lifted barracks.""" 230 return self._in_group(UnitType.NonStructure)
The units that are not structures, those of UnitType.NonStructure: larvae, eggs and a sieged tank among
them, and not a lifted barracks.
232 @property 233 def workers(self) -> Units[U]: 234 """The workers: SCVs, probes and drones, burrowed or not, as `UnitType.Worker` has them. A MULE is none.""" 235 return self._in_group(UnitType.Worker)
The workers: SCVs, probes and drones, burrowed or not, as UnitType.Worker has them. A MULE is none.
237 @property 238 def townhalls(self) -> Units[U]: 239 """The townhalls, a lifted command center among them, as `UnitType.Townhall` has them.""" 240 return self._in_group(UnitType.Townhall)
The townhalls, a lifted command center among them, as UnitType.Townhall has them.
242 @property 243 def mineral_fields(self) -> Units[U]: 244 """The mineral fields of every kind, as `UnitType.AnyMineralField` has them.""" 245 return self._in_group(UnitType.AnyMineralField)
The mineral fields of every kind, as UnitType.AnyMineralField has them.
247 @property 248 def geysers(self) -> Units[U]: 249 """The vespene geysers of every kind, as `UnitType.AnyVespeneGeyser` has them.""" 250 return self._in_group(UnitType.AnyVespeneGeyser)
The vespene geysers of every kind, as UnitType.AnyVespeneGeyser has them.
252 @property 253 def gas_buildings(self) -> Units[U]: 254 """The refineries, assimilators and extractors, as `UnitType.GasBuilding` has them.""" 255 return self._in_group(UnitType.GasBuilding)
The refineries, assimilators and extractors, as UnitType.GasBuilding has them.
262 @property 263 def complete(self) -> Units[U]: 264 """The units that have finished building or warping in. Raises `NotReportedError` for a unit never shown 265 visible.""" 266 return Units(unit for unit in self._units if unit.is_complete)
The units that have finished building or warping in. Raises NotReportedError for a unit never shown
visible.
268 @property 269 def not_complete(self) -> Units[U]: 270 """The units still building or warping in: those `complete` leaves out. Raises `NotReportedError` as it 271 does.""" 272 return Units(unit for unit in self._units if not unit.is_complete)
The units still building or warping in: those complete leaves out. Raises NotReportedError as it
does.
274 @property 275 def alive(self) -> Units[U]: 276 """The units not known to be dead, as `Unit.is_alive` has it.""" 277 return Units(unit for unit in self._units if unit.is_alive)
The units not known to be dead, as Unit.is_alive has it.
279 @property 280 def dead(self) -> Units[U]: 281 """The units known to be dead: those `alive` leaves out.""" 282 return Units(unit for unit in self._units if unit.is_dead)
The units known to be dead: those alive leaves out.
284 @property 285 def listed(self) -> Units[U]: 286 """The units the last observation listed, as `Unit.is_listed` has it.""" 287 return Units(unit for unit in self._units if unit.is_listed)
The units the last observation listed, as Unit.is_listed has it.
289 @property 290 def not_listed(self) -> Units[U]: 291 """The units the last observation did not list: those `listed` leaves out.""" 292 return Units(unit for unit in self._units if not unit.is_listed)
The units the last observation did not list: those listed leaves out.
294 @property 295 def visible(self) -> Units[U]: 296 """The units the last observation showed visible, as `Unit.is_visible` has it: in it, and seen, not cloaked or 297 detected.""" 298 return Units(unit for unit in self._units if unit.is_visible)
The units the last observation showed visible, as Unit.is_visible has it: in it, and seen, not cloaked or
detected.
300 @property 301 def orderable[K: UnitType.AnyType](self: Units[Unit[K]]) -> Units[OwnUnit[K]]: 302 """The units this player can order now, as `Unit.is_orderable` has it.""" 303 return Units(unit for unit in self._units if isinstance(unit, OwnUnit) and unit.is_listed)
The units this player can order now, as Unit.is_orderable has it.
305 @property 306 def ground(self) -> Units[U]: 307 """The units on the ground: those not flying, and the structures remembered in the fog, whose flying the game 308 does not report, as `Unit.is_ground_structure` takes them.""" 309 return Units(unit for unit in self._units if _is_on_the_ground(unit))
The units on the ground: those not flying, and the structures remembered in the fog, whose flying the game
does not report, as Unit.is_ground_structure takes them.
311 @property 312 def air(self) -> Units[U]: 313 """The units in the air: those `ground` leaves out.""" 314 return Units(unit for unit in self._units if not _is_on_the_ground(unit))
The units in the air: those ground leaves out.
316 @property 317 def idle[O: OwnUnit[Any]](self: Units[O]) -> Units[O]: 318 """This player's units without orders.""" 319 return Units(unit for unit in self._units if unit.is_idle)
This player's units without orders.
321 def doing[O: OwnUnit[Any]](self: Units[O], abilities: AbilityId | Collection[AbilityId]) -> Units[O]: 322 """This player's units whose current order carries out `abilities`, one ability or any of several.""" 323 return Units(unit for unit in self._units if unit.is_doing(abilities))
This player's units whose current order carries out abilities, one ability or any of several.
325 def with_buff(self, buff_ids: BuffId | Collection[BuffId]) -> Units[U]: 326 """The units with `buff_ids`, one buff or any of several, among their buffs. Raises `NotReportedError` for a 327 unit never shown visible.""" 328 return Units(unit for unit in self._units if unit.has_buff(buff_ids))
The units with buff_ids, one buff or any of several, among their buffs. Raises NotReportedError for a
unit never shown visible.
332 def having_in_range(self, target: Unit[Any], *, margin: float = 0.0) -> Units[U]: 333 """The units that have `target` in range of a weapon, as `Unit.has_in_range` has it. Raises 334 `NotReportedError` as it does.""" 335 return Units(unit for unit in self._units if unit.has_in_range(target, margin=margin))
The units that have target in range of a weapon, as Unit.has_in_range has it. Raises
NotReportedError as it does.
337 def in_range_of(self, attacker: Unit[Any], *, margin: float = 0.0) -> Units[U]: 338 """The units `attacker` has in range of a weapon, as `Unit.has_in_range` has it. Raises `NotReportedError` as 339 it does.""" 340 return Units(unit for unit in self._units if attacker.has_in_range(unit, margin=margin))
The units attacker has in range of a weapon, as Unit.has_in_range has it. Raises NotReportedError as
it does.
346 def inside(self, areas: Area | Iterable[Area]) -> Units[U]: 347 """The units standing in `areas`: in one area, or in any of several.""" 348 if isinstance(areas, Area): 349 return Units(unit for unit in self._units if unit._position in areas) 350 regions = tuple(areas) 351 return Units(unit for unit in self._units if any(unit._position in region for region in regions))
The units standing in areas: in one area, or in any of several.
353 def outside(self, areas: Area | Iterable[Area]) -> Units[U]: 354 """The units standing in none of `areas`: those `inside` leaves out.""" 355 if isinstance(areas, Area): 356 return Units(unit for unit in self._units if unit._position not in areas) 357 regions = tuple(areas) 358 return Units(unit for unit in self._units if not any(unit._position in region for region in regions))
The units standing in none of areas: those inside leaves out.
360 def within(self, distance: float, *, of: PointLike | Unit[Any] | Iterable[PointLike | Unit[Any]]) -> Units[U]: 361 """The units at most `distance` from `of`, a point or a unit, or from any of several, measured between 362 positions. Raises `ValueError` for a distance that is negative or not a number.""" 363 if not distance >= 0: 364 raise ValueError(f"a distance is at least 0, not {distance}") 365 centers = _positions(of) 366 distance_squared = distance * distance 367 kept = [] 368 for unit in self._units: 369 position = unit._position 370 x, y = position[0], position[1] 371 for cx, cy in centers: 372 dx = x - cx 373 dy = y - cy 374 if dx * dx + dy * dy <= distance_squared: 375 kept.append(unit) 376 break 377 return Units(kept)
The units at most distance from of, a point or a unit, or from any of several, measured between
positions. Raises ValueError for a distance that is negative or not a number.
379 def beyond(self, distance: float, *, of: PointLike | Unit[Any] | Iterable[PointLike | Unit[Any]]) -> Units[U]: 380 """The units farther than `distance` from `of`, a point or a unit, and from every one of several: those 381 `within` leaves out. Raises `ValueError` as `within` does.""" 382 return self.without(self.within(distance, of=of))
384 def sorted(self, key: Callable[[U], Any], *, reverse: bool = False) -> Units[U]: 385 """The units in the order of `key`, ascending unless `reverse`. Units of equal key keep their order.""" 386 return Units(sorted(self._units, key=key, reverse=reverse))
The units in the order of key, ascending unless reverse. Units of equal key keep their order.
388 def sorted_by_distance_to(self, point_or_unit: PointLike | Unit[Any]) -> Units[U]: 389 """The units from nearest to `point_or_unit`, a point or a unit's position, to furthest. Units at equal 390 distance keep their order.""" 391 x, y = _ground_position_of(point_or_unit) 392 distances = [] 393 for unit in self._units: 394 position = unit._position 395 dx = position[0] - x 396 dy = position[1] - y 397 distances.append(dx * dx + dy * dy) 398 order = sorted(range(len(distances)), key=distances.__getitem__) 399 return Units(self._units[index] for index in order)
The units from nearest to point_or_unit, a point or a unit's position, to furthest. Units at equal
distance keep their order.
401 def closest_n_to(self, count: int, point_or_unit: PointLike | Unit[Any]) -> Units[U]: 402 """The `count` units nearest to `point_or_unit`, a point or a unit's position, nearest first, or all of them if 403 there are fewer.""" 404 if count < 0: 405 raise ValueError(f"cannot pick {count} units") 406 return self.sorted_by_distance_to(point_or_unit)[:count]
The count units nearest to point_or_unit, a point or a unit's position, nearest first, or all of them if
there are fewer.
408 def closest_to(self, point_or_unit: PointLike | Unit[Any]) -> U: 409 """The unit nearest to `point_or_unit`, a point or a unit's position. At equal distance, the first in the 410 collection: a unit in it is at distance 0 from itself, and is picked unless another on the same spot comes 411 first.""" 412 if not self._units: 413 raise ValueError("no units to choose from") 414 x, y = _ground_position_of(point_or_unit) 415 closest = self._units[0] 416 nearest = math.inf 417 for unit in self._units: 418 position = unit._position 419 dx = position[0] - x 420 dy = position[1] - y 421 distance = dx * dx + dy * dy 422 if distance < nearest: 423 nearest = distance 424 closest = unit 425 return closest
The unit nearest to point_or_unit, a point or a unit's position. At equal distance, the first in the
collection: a unit in it is at distance 0 from itself, and is picked unless another on the same spot comes
first.
427 def closest_distance_to(self, point_or_unit: PointLike | Unit[Any]) -> float: 428 """The distance from `point_or_unit`, a point or a unit's position, to the nearest unit's position.""" 429 if not self._units: 430 raise ValueError("no units to measure to") 431 x, y = _ground_position_of(point_or_unit) 432 nearest = math.inf 433 for unit in self._units: 434 position = unit._position 435 dx = position[0] - x 436 dy = position[1] - y 437 distance = dx * dx + dy * dy 438 if distance < nearest: 439 nearest = distance 440 return math.sqrt(nearest)
The distance from point_or_unit, a point or a unit's position, to the nearest unit's position.
442 def structure_at(self, point: PointLike | Tile) -> U | None: 443 """The structure on the ground whose footprint holds `point`, a tile reading as its center, or `None` if none of 444 these does. Of one in sight and a snapshot over the same ground, the one in sight; a lifted structure covers no 445 ground.""" 446 tile = Tile.at(point) 447 x, y = _ground_position_of(tile.center if isinstance(point, Tile) else point) 448 remembered = None 449 for unit in self._units: 450 position = unit._position 451 if abs(position[0] - x) > _FOOTPRINT_REACH or abs(position[1] - y) > _FOOTPRINT_REACH: 452 continue 453 if not unit.is_ground_structure or (footprint := unit.footprint) is None: 454 continue 455 if tile not in footprint.tiles(at=position): 456 continue 457 if unit.is_listed and unit.visibility.in_sight: 458 return unit 459 if remembered is None: 460 remembered = unit 461 return remembered
The structure on the ground whose footprint holds point, a tile reading as its center, or None if none of
these does. Of one in sight and a snapshot over the same ground, the one in sight; a lifted structure covers no
ground.
463 @property 464 def center(self) -> Point: 465 """The mean of the units' positions.""" 466 if not self._units: 467 raise ValueError("no units to find the center of") 468 x = y = 0.0 469 for unit in self._units: 470 position = unit._position 471 x += position[0] 472 y += position[1] 473 count = len(self._units) 474 return Point((x / count, y / count))
The mean of the units' positions.
12class UpgradeId(IdEnum): 13 """Upgrade ids used in multiplayer games.""" 14 15 ADRENAL_GLANDS = RawUpgradeId.zerglingattackspeed # "Adrenal Glands" in game 16 BANELING_SPEED = RawUpgradeId.CentrificalHooks # "Centrifugal Hooks" in game 17 BANSHEE_CLOAK = RawUpgradeId.BansheeCloak # "Cloaking Field" in game 18 BANSHEE_SPEED = RawUpgradeId.BansheeSpeed # "Hyperflight Rotors" in game 19 BLINK = RawUpgradeId.BlinkTech 20 BLUE_FLAME = RawUpgradeId.HighCapacityBarrels # "Infernal Pre-Igniter" in game 21 BUILDING_ARMOR = RawUpgradeId.TerranBuildingArmor 22 BURROW = RawUpgradeId.Burrow 23 CHARGE = RawUpgradeId.Charge 24 COLOSSUS_RANGE = RawUpgradeId.ExtendedThermalLance # "Extended Thermal Lance" in game 25 COMBAT_SHIELD = RawUpgradeId.ShieldWall 26 CONCUSSIVE_SHELLS = RawUpgradeId.PunisherGrenades 27 CYCLONE_LOCK_ON_DAMAGE = RawUpgradeId.CycloneLockOnDamageUpgrade # "Mag-Field Accelerator" in game 28 DARK_TEMPLAR_BLINK = RawUpgradeId.DarkTemplarBlinkUpgrade # "Shadow Stride" in game 29 DRILLING_CLAWS = RawUpgradeId.DrillClaws 30 GHOST_CLOAK = RawUpgradeId.PersonalCloaking 31 GLAIVES = RawUpgradeId.AdeptPiercingAttack # "Resonating Glaives" in game 32 HISEC_AUTO_TRACKING = RawUpgradeId.HiSecAutoTracking 33 HYDRALISK_LUNGE = RawUpgradeId.Frenzy # "Nanomuscular Swell" in game 34 HYDRALISK_RANGE = RawUpgradeId.EvolveGroovedSpines # "Grooved Spines" in game 35 HYDRALISK_SPEED = RawUpgradeId.EvolveMuscularAugments # "Muscular Augments" in game 36 INTERFERENCE_MATRIX = RawUpgradeId.InterferenceMatrix 37 LIBERATOR_RANGE = RawUpgradeId.LiberatorAGRangeUpgrade # "Advanced Ballistics" in game 38 LURKER_BURROW_SPEED = RawUpgradeId.DiggingClaws # "Adaptive Talons" in game 39 LURKER_RANGE = RawUpgradeId.LurkerRange # "Seismic Spines" in game 40 MEDIVAC_ENERGY_REGENERATION = RawUpgradeId.MedivacCaduceusReactor # "Caduceus Reactor" in game 41 NEURAL_PARASITE = RawUpgradeId.NeuralParasite 42 OBSERVER_SPEED = RawUpgradeId.ObserverGraviticBooster # "Gravitic Boosters" in game 43 OVERLORD_SPEED = RawUpgradeId.overlordspeed # "Pneumatized Carapace" in game 44 PHOENIX_RANGE = RawUpgradeId.PhoenixRangeUpgrade # "Anion Pulse-Crystals" in game 45 PROTOSS_AIR_ARMOR_1 = RawUpgradeId.ProtossAirArmorsLevel1 46 PROTOSS_AIR_ARMOR_2 = RawUpgradeId.ProtossAirArmorsLevel2 47 PROTOSS_AIR_ARMOR_3 = RawUpgradeId.ProtossAirArmorsLevel3 48 PROTOSS_AIR_WEAPONS_1 = RawUpgradeId.ProtossAirWeaponsLevel1 49 PROTOSS_AIR_WEAPONS_2 = RawUpgradeId.ProtossAirWeaponsLevel2 50 PROTOSS_AIR_WEAPONS_3 = RawUpgradeId.ProtossAirWeaponsLevel3 51 PROTOSS_GROUND_ARMOR_1 = RawUpgradeId.ProtossGroundArmorsLevel1 52 PROTOSS_GROUND_ARMOR_2 = RawUpgradeId.ProtossGroundArmorsLevel2 53 PROTOSS_GROUND_ARMOR_3 = RawUpgradeId.ProtossGroundArmorsLevel3 54 PROTOSS_GROUND_WEAPONS_1 = RawUpgradeId.ProtossGroundWeaponsLevel1 55 PROTOSS_GROUND_WEAPONS_2 = RawUpgradeId.ProtossGroundWeaponsLevel2 56 PROTOSS_GROUND_WEAPONS_3 = RawUpgradeId.ProtossGroundWeaponsLevel3 57 PROTOSS_SHIELDS_1 = RawUpgradeId.ProtossShieldsLevel1 58 PROTOSS_SHIELDS_2 = RawUpgradeId.ProtossShieldsLevel2 59 PROTOSS_SHIELDS_3 = RawUpgradeId.ProtossShieldsLevel3 60 ROACH_SPEED = RawUpgradeId.GlialReconstitution 61 SMART_SERVOS = RawUpgradeId.SmartServos 62 STIMPACK = RawUpgradeId.Stimpack 63 STORM = RawUpgradeId.PsiStormTech 64 TEMPEST_BUILDING_DAMAGE = RawUpgradeId.TempestGroundAttackUpgrade # "Tectonic Destabilizers" in game 65 TERRAN_INFANTRY_ARMOR_1 = RawUpgradeId.TerranInfantryArmorsLevel1 66 TERRAN_INFANTRY_ARMOR_2 = RawUpgradeId.TerranInfantryArmorsLevel2 67 TERRAN_INFANTRY_ARMOR_3 = RawUpgradeId.TerranInfantryArmorsLevel3 68 TERRAN_INFANTRY_WEAPONS_1 = RawUpgradeId.TerranInfantryWeaponsLevel1 69 TERRAN_INFANTRY_WEAPONS_2 = RawUpgradeId.TerranInfantryWeaponsLevel2 70 TERRAN_INFANTRY_WEAPONS_3 = RawUpgradeId.TerranInfantryWeaponsLevel3 71 TERRAN_SHIP_WEAPONS_1 = RawUpgradeId.TerranShipWeaponsLevel1 72 TERRAN_SHIP_WEAPONS_2 = RawUpgradeId.TerranShipWeaponsLevel2 73 TERRAN_SHIP_WEAPONS_3 = RawUpgradeId.TerranShipWeaponsLevel3 74 TERRAN_VEHICLE_AND_SHIP_ARMOR_1 = RawUpgradeId.TerranVehicleAndShipArmorsLevel1 # "Plating" in game 75 TERRAN_VEHICLE_AND_SHIP_ARMOR_2 = RawUpgradeId.TerranVehicleAndShipArmorsLevel2 76 TERRAN_VEHICLE_AND_SHIP_ARMOR_3 = RawUpgradeId.TerranVehicleAndShipArmorsLevel3 77 TERRAN_VEHICLE_WEAPONS_1 = RawUpgradeId.TerranVehicleWeaponsLevel1 78 TERRAN_VEHICLE_WEAPONS_2 = RawUpgradeId.TerranVehicleWeaponsLevel2 79 TERRAN_VEHICLE_WEAPONS_3 = RawUpgradeId.TerranVehicleWeaponsLevel3 80 TUNNELING_CLAWS = RawUpgradeId.TunnelingClaws 81 ULTRALISK_ARMOR = RawUpgradeId.ChitinousPlating 82 ULTRALISK_SPEED = RawUpgradeId.AnabolicSynthesis 83 VOID_RAY_SPEED = RawUpgradeId.VoidRaySpeedUpgrade # "Flux Vanes" in game 84 WARP_GATE = RawUpgradeId.WarpGateResearch 85 WARP_PRISM_SPEED = RawUpgradeId.GraviticDrive # "Gravitic Drive" in game 86 YAMATO_CANNON = RawUpgradeId.BattlecruiserEnableSpecializations # "Weapon Refit" in game 87 ZERGLING_SPEED = RawUpgradeId.zerglingmovementspeed # "Metabolic Boost" in game 88 ZERG_AIR_ARMOR_1 = RawUpgradeId.ZergFlyerArmorsLevel1 89 ZERG_AIR_ARMOR_2 = RawUpgradeId.ZergFlyerArmorsLevel2 90 ZERG_AIR_ARMOR_3 = RawUpgradeId.ZergFlyerArmorsLevel3 91 ZERG_AIR_WEAPONS_1 = RawUpgradeId.ZergFlyerWeaponsLevel1 92 ZERG_AIR_WEAPONS_2 = RawUpgradeId.ZergFlyerWeaponsLevel2 93 ZERG_AIR_WEAPONS_3 = RawUpgradeId.ZergFlyerWeaponsLevel3 94 ZERG_GROUND_ARMOR_1 = RawUpgradeId.ZergGroundArmorsLevel1 95 ZERG_GROUND_ARMOR_2 = RawUpgradeId.ZergGroundArmorsLevel2 96 ZERG_GROUND_ARMOR_3 = RawUpgradeId.ZergGroundArmorsLevel3 97 ZERG_MELEE_WEAPONS_1 = RawUpgradeId.ZergMeleeWeaponsLevel1 98 ZERG_MELEE_WEAPONS_2 = RawUpgradeId.ZergMeleeWeaponsLevel2 99 ZERG_MELEE_WEAPONS_3 = RawUpgradeId.ZergMeleeWeaponsLevel3 100 ZERG_RANGE_WEAPONS_1 = RawUpgradeId.ZergMissileWeaponsLevel1 101 ZERG_RANGE_WEAPONS_2 = RawUpgradeId.ZergMissileWeaponsLevel2 102 ZERG_RANGE_WEAPONS_3 = RawUpgradeId.ZergMissileWeaponsLevel3
Upgrade ids used in multiplayer games.
79@contextmanager 80def open_replay( 81 replay: Path | str, 82 *, 83 player_id: int, 84 disable_fog: bool = False, 85 record_to: Path | str | None = None, 86 installation: Installation | None = None, 87 window: tuple[int, int] = (1024, 768), 88) -> Iterator[ReplayPlayback]: 89 """Start a game client, play back the replay in the file `replay` on it as the player `player_id` saw it, and give 90 the playback, for its observations to be read straight from the protocol. `run_replay` plays one for an api. 91 92 Raises `ValueError` for a `player_id` that is not one of the replay's players, as 0 is not. The replay is played 93 on its own build, which must be installed, or `GameVersionError` is raised: the newest build installed reads which 94 it is, and a second client is started when that is not the one. The game opens the replay's map by the path the 95 replay names, which an AI Arena replay gives as a bare file name the game does not find (in game); so unless the 96 path is an absolute path to a file here, the map it names under the installation's maps goes with the replay, or 97 else the map of its name there. The game reports the raw interface, with cloaked units, burrowed units' shadows 98 and the placeholders of structures ordered shown, on the whole map. `disable_fog` lists every unit, as 99 `Client.start_replay` says. 100 101 `record_to` is a file to record the whole conversation into, the replay's info included, which 102 `open_replay_recording` and `run_recording` play back; it is complete once the playback ends. However the 103 playback ends, the client leaves the replay and is stopped, and its temporary directory removed. Each playback 104 starts a client of its own, so two can be open at once, one for each player. 105 """ 106 check_output_files(record_to, None) 107 replay_data = Path(replay).read_bytes() 108 installation = installation or Installation.find() 109 newest_build = installation.build_to_launch() 110 with ExitStack() as running: 111 game = running.enter_context(GameProcess.launch(installation, base_build=newest_build, window=window)) 112 with closing(Client(WebSocketTransport.connect(game.url))) as info_client: 113 info_on_the_newest_build = info_client.replay_info(replay_data) 114 _check_replay_player(info_on_the_newest_build, player_id) 115 if info_on_the_newest_build.base_build != newest_build: 116 replay_build = installation.build_to_launch(base_build=info_on_the_newest_build.base_build) 117 game.terminate() 118 game = running.enter_context(GameProcess.launch(installation, base_build=replay_build, window=window)) 119 map_data = _map_bytes_the_game_needs(info_on_the_newest_build.local_map_path, installation) 120 with closing(connect_client(game.url, record_to)) as client: 121 try: 122 # Asked again on the connection recorded, so that a recording holds it. 123 info = client.replay_info(replay_data) 124 client.start_replay(replay_data, player_id=player_id, disable_fog=disable_fog, map_data=map_data) 125 yield ReplayPlayback(client, info) 126 finally: 127 client.leave_game() 128 client.quit()
Start a game client, play back the replay in the file replay on it as the player player_id saw it, and give
the playback, for its observations to be read straight from the protocol. run_replay plays one for an api.
Raises ValueError for a player_id that is not one of the replay's players, as 0 is not. The replay is played
on its own build, which must be installed, or GameVersionError is raised: the newest build installed reads which
it is, and a second client is started when that is not the one. The game opens the replay's map by the path the
replay names, which an AI Arena replay gives as a bare file name the game does not find (in game); so unless the
path is an absolute path to a file here, the map it names under the installation's maps goes with the replay, or
else the map of its name there. The game reports the raw interface, with cloaked units, burrowed units' shadows
and the placeholders of structures ordered shown, on the whole map. disable_fog lists every unit, as
Client.start_replay says.
record_to is a file to record the whole conversation into, the replay's info included, which
open_replay_recording and run_recording play back; it is complete once the playback ends. However the
playback ends, the client leaves the replay and is stopped, and its temporary directory removed. Each playback
starts a client of its own, so two can be open at once, one for each player.
131@contextmanager 132def open_replay_recording(recording: Recording | Path | str) -> Iterator[ReplayPlayback]: 133 """Play back `recording`, a recording of a replay played back that `open_replay` or `run_replay` made, with no game 134 client, and give the playback, as `open_replay` gives it. It answers what was asked when it was recorded, in the 135 same order, and raises `ProtocolError` when asked for a request of another kind, as `PlaybackTransport` does. 136 137 Raises `ValueError` for a recording of a game played rather than a replay played back, and for one of a replay 138 made before NachOS recorded a replay's info, which plays back once recorded again. 139 """ 140 if not isinstance(recording, Recording): 141 recording = Recording(Path(recording)) 142 start_replay_request = _start_of_recorded_replay(recording) 143 with closing(Client(PlaybackTransport(recording))) as client: 144 # A recording answers each kind of request in turn without reading it, so the setup is repeated without its 145 # details. 146 info = client.replay_info(start_replay_request.replay_data) 147 client.start_replay( 148 start_replay_request.replay_data, 149 player_id=start_replay_request.observed_player_id, 150 disable_fog=start_replay_request.disable_fog, 151 map_data=start_replay_request.map_data if start_replay_request.HasField("map_data") else None, 152 ) 153 yield ReplayPlayback(client, info)
Play back recording, a recording of a replay played back that open_replay or run_replay made, with no game
client, and give the playback, as open_replay gives it. It answers what was asked when it was recorded, in the
same order, and raises ProtocolError when asked for a request of another kind, as PlaybackTransport does.
Raises ValueError for a recording of a game played rather than a replay played back, and for one of a replay
made before NachOS recorded a replay's info, which plays back once recorded again.
191def run_from_command_line( 192 api: Api[object], 193 argv: Sequence[str] | None = None, 194 *, 195 race: Race, 196 name: str | None = None, 197 steps_per_turn: int = 1, 198) -> Result: 199 """Play one game for `api` as the command line asks, a ladder's or a local one against the built-in computer, 200 playing `race` under `name`, a turn every `steps_per_turn` steps, and write how it went. 201 202 With `--GamePort` it joins the game a ladder has set up, as `run_ladder` does, with the ladder's `--LadderServer` 203 (127.0.0.1 if not given), `--StartPort` and `--OpponentId`, which `Enemy.ladder_id` reads. It takes the ladder's 204 `--ComputerOpponent`, `--ComputerRace` and `--ComputerDifficulty` and uses none of them. A connection the ladder 205 closes before the game ends is logged as a warning, and the game's result is `Result.UNDECIDED`. 206 207 Without it, it plays a local game against the built-in computer, as NachOS's match workflow, 208 `.github/workflows/match.yml`, asks: `--ComputerRace`, `--ComputerDifficulty` and `--ComputerBuild` as member names 209 of `Race`, `Difficulty` and `AIBuild` (`ZERG`, `VERY_EASY`, `RANDOM`; by default `RANDOM`, `VERY_HARD` and 210 `RANDOM`), `--Map`, by default one at random from the installation's, and `--TimeLimit` in game seconds. A value 211 that names no member stops the run, as an argument argparse refuses does. 212 213 In either, `--RealTime` plays the game in real time, `--ReplayFile` is a file to save its replay to, `--RecordFile` 214 one to record the whole conversation with the game into, as `record_to` does, for `run_recording` to play back, and 215 `--ResultFile` one to write the JSON the match workflow reads: the result, the map, as its file's name in a local 216 game and as its display name in a ladder game, and the game time, each of those two `null` if the ladder closed the 217 connection before the game began, and `opponent_actual_race`, the race the opponent played as `Enemy.race` reads at 218 the end, `null` if it was never known. An argument of the other kind of game is logged as ignored, and one NachOS 219 does not read is left for the bot, listed in the log. `argv` defaults to `sys.argv[1:]`. 220 221 Raises `RuntimeError` before anything else if `api` has played its game. 222 """ 223 api._check_has_not_played() 224 command_line_arguments = _CommandLineArguments(argv) 225 command_line_arguments.log_arguments_not_used() 226 if command_line_arguments.is_ladder_game: 227 result, map_name = _play_ladder_game( 228 api, command_line_arguments, race=race, name=name, steps_per_turn=steps_per_turn 229 ) 230 else: 231 result, map_name = _play_local_game( 232 api, command_line_arguments, race=race, name=name, steps_per_turn=steps_per_turn 233 ) 234 if command_line_arguments.result_file is not None: 235 outcome = { 236 "result": result.name, 237 "map": map_name, 238 "game_time": _game_time(api), 239 "opponent_actual_race": _enemy_race_name(api), 240 } 241 command_line_arguments.result_file.write_text(json.dumps(outcome), encoding="utf-8") 242 return result
Play one game for api as the command line asks, a ladder's or a local one against the built-in computer,
playing race under name, a turn every steps_per_turn steps, and write how it went.
With --GamePort it joins the game a ladder has set up, as run_ladder does, with the ladder's --LadderServer
(127.0.0.1 if not given), --StartPort and --OpponentId, which Enemy.ladder_id reads. It takes the ladder's
--ComputerOpponent, --ComputerRace and --ComputerDifficulty and uses none of them. A connection the ladder
closes before the game ends is logged as a warning, and the game's result is Result.UNDECIDED.
Without it, it plays a local game against the built-in computer, as NachOS's match workflow,
.github/workflows/match.yml, asks: --ComputerRace, --ComputerDifficulty and --ComputerBuild as member names
of Race, Difficulty and AIBuild (ZERG, VERY_EASY, RANDOM; by default RANDOM, VERY_HARD and
RANDOM), --Map, by default one at random from the installation's, and --TimeLimit in game seconds. A value
that names no member stops the run, as an argument argparse refuses does.
In either, --RealTime plays the game in real time, --ReplayFile is a file to save its replay to, --RecordFile
one to record the whole conversation with the game into, as record_to does, for run_recording to play back, and
--ResultFile one to write the JSON the match workflow reads: the result, the map, as its file's name in a local
game and as its display name in a ladder game, and the game time, each of those two null if the ladder closed the
connection before the game began, and opponent_actual_race, the race the opponent played as Enemy.race reads at
the end, null if it was never known. An argument of the other kind of game is logged as ignored, and one NachOS
does not read is left for the bot, listed in the log. argv defaults to sys.argv[1:].
Raises RuntimeError before anything else if api has played its game.
92def run_ladder( 93 api: Api[object], 94 *, 95 race: Race, 96 name: str | None = None, 97 host: str, 98 port: int, 99 start_port: int | None = None, 100 enemy_ladder_id: str | None = None, 101 steps_per_turn: int = 1, 102 realtime: bool = False, 103 record_to: Path | str | None = None, 104 save_replay_to: Path | str | None = None, 105) -> Result: 106 """Join the game a ladder has set up for `api`, playing `race` under `name`, and play it out. 107 108 The ladder starts the client, creates the match, and passes the bot the client's address, `start_port` and the 109 opponent's `enemy_ladder_id` on the command line. A game against the built-in computer has no `start_port`. 110 `realtime` must match the ladder's `--RealTime` flag, as `Api.play` says. There is no time limit: a bot can only 111 end a game early by leaving it, which concedes. `record_to` and `save_replay_to` are as for `run_local`. Raises 112 `RuntimeError` before anything else if `api` has played its game. 113 """ 114 api._check_has_not_played() 115 check_output_files(record_to, save_replay_to) 116 with closing(connect_client(f"ws://{host}:{port}/sc2api", record_to)) as client: 117 try: 118 ports = GamePorts.from_start_port(start_port) if start_port is not None else None 119 client.join_game(race, name=name, ports=ports) 120 return api.play( 121 client, 122 steps_per_turn=steps_per_turn, 123 realtime=realtime, 124 enemy_ladder_id=enemy_ladder_id, 125 save_replay_to=save_replay_to, 126 ) 127 finally: 128 # The client is the ladder's, so it is left running. 129 client.leave_game()
Join the game a ladder has set up for api, playing race under name, and play it out.
The ladder starts the client, creates the match, and passes the bot the client's address, start_port and the
opponent's enemy_ladder_id on the command line. A game against the built-in computer has no start_port.
realtime must match the ladder's --RealTime flag, as Api.play says. There is no time limit: a bot can only
end a game early by leaving it, which concedes. record_to and save_replay_to are as for run_local. Raises
RuntimeError before anything else if api has played its game.
34def run_local( 35 map_file: MapFile | str, 36 api: Api[object], 37 opponent: Computer | None = None, 38 *, 39 race: Race, 40 name: str | None = None, 41 steps_per_turn: int = 1, 42 realtime: bool = False, 43 time_limit: GameTime | None = None, 44 random_seed: int | None = None, 45 record_to: Path | str | None = None, 46 save_replay_to: Path | str | None = None, 47 installation: Installation | None = None, 48 window: tuple[int, int] = (1024, 768), 49) -> Result: 50 """Start a game client, create a match on `map_file` for `api` against `opponent`, and play it out. 51 52 `map_file` is a file or the name of one under the installation. The api takes the first slot, playing `race` under 53 `name`, and without an `opponent` it plays the map alone, which on a melee map, such as the ladder's, ends at once 54 in a victory (in game). `realtime` creates the game in real time and plays it so. 55 `record_to` is a file to record the whole conversation into, and `save_replay_to` one to save the game's replay to, 56 as `Api.play` says. Each must be in a folder that exists, or `FileNotFoundError` is raised before the game starts, 57 and `IsADirectoryError` if it names a folder; so is `TypeError` for a `time_limit` that is not a `GameTime`. However 58 the game ends, the client is stopped and its temporary directory removed. The newest build installed is played, with 59 a warning if it is not the one the tech tree was swept on. Raises `RuntimeError` before anything else if `api` has 60 played its game. 61 """ 62 api._check_has_not_played() 63 check_output_files(record_to, save_replay_to) 64 check_time_limit(time_limit) 65 installation = installation or Installation.find() 66 if isinstance(map_file, str): 67 map_file = MapFile.find(map_file, installation=installation) 68 # A participant tells the game a client will fill the slot; who fills it is settled at the join. 69 players: list[PlayerSetup] = [Participant()] if opponent is None else [Participant(), opponent] 70 base_build = installation.build_to_launch() 71 TECH_TREE.warn_if_not_swept_on(base_build) 72 73 with ( 74 GameProcess.launch(installation, base_build=base_build, window=window) as game, 75 closing(connect_client(game.url, record_to)) as client, 76 ): 77 try: 78 client.create_game(map_file.path, players, realtime=realtime, random_seed=random_seed) 79 client.join_game(race, name=name) 80 return api.play( 81 client, 82 steps_per_turn=steps_per_turn, 83 realtime=realtime, 84 time_limit=time_limit, 85 save_replay_to=save_replay_to, 86 ) 87 finally: 88 client.leave_game() 89 client.quit()
Start a game client, create a match on map_file for api against opponent, and play it out.
map_file is a file or the name of one under the installation. The api takes the first slot, playing race under
name, and without an opponent it plays the map alone, which on a melee map, such as the ladder's, ends at once
in a victory (in game). realtime creates the game in real time and plays it so.
record_to is a file to record the whole conversation into, and save_replay_to one to save the game's replay to,
as Api.play says. Each must be in a folder that exists, or FileNotFoundError is raised before the game starts,
and IsADirectoryError if it names a folder; so is TypeError for a time_limit that is not a GameTime. However
the game ends, the client is stopped and its temporary directory removed. The newest build installed is played, with
a warning if it is not the one the tech tree was swept on. Raises RuntimeError before anything else if api has
played its game.
132def run_recording( 133 recording: Recording | Path | str, 134 api: Api[object], 135 *, 136 permissive: bool = False, 137 time_limit: GameTime | None = None, 138 enemy_ladder_id: str | None = None, 139 save_replay_to: Path | str | None = None, 140) -> Result: 141 """Play `api` through the game recorded in `recording`, with no game client, a turn at each recorded observation, 142 and return how it ended for the player recorded, or `TIE` at `time_limit`. `enemy_ladder_id` and `save_replay_to` 143 are as for `Api.play`. 144 145 By default the bot must ask what was asked when the game was recorded, and gets the game's own answers, as a 146 `PlaybackTransport` gives them: a request of another kind raises `ProtocolError`. The game is created if the 147 recording created it, and played in real time if it was, as `Recording.created_its_game` and `played_in_real_time` 148 say. `time_limit`, `enemy_ladder_id` and `save_replay_to` must be what the game was played with: a game its time 149 limit ended raises at its end without it, and so does one the bot left after saving its replay without 150 `save_replay_to`, which then holds the replay recorded. 151 152 With `permissive`, any bot plays the recording through, though nothing it does changes what comes next: what it 153 asks of its own accord is answered as `PermissivePlaybackTransport` makes it up. It returns `UNDECIDED` if the 154 recording stops before the game's end, as one made with a time limit does, and `DEFEAT` if the bot leaves first, 155 and saves no replay, logging a save asked for as failed. A request the recording cannot answer raises 156 `ProtocolError`. 157 158 A replay played back by `run_replay` or `open_replay` is played back again as `open_replay_recording` plays it, as 159 the player it was played for and with the fog as it was, by default only: `permissive` raises `ValueError` for 160 one. 161 162 Raises `RuntimeError` before anything else if `api` has played its game. 163 """ 164 api._check_has_not_played() 165 check_time_limit(time_limit) 166 if not isinstance(recording, Recording): 167 recording = Recording(Path(recording)) 168 if recording.start_replay_request is not None: 169 if permissive: 170 raise ValueError(f"{recording.path} is a replay played back, which plays back only as it was recorded") 171 with open_replay_recording(recording) as playback: 172 return api.play( 173 playback.client, time_limit=time_limit, enemy_ladder_id=enemy_ladder_id, save_replay_to=save_replay_to 174 ) 175 transport: Transport = PermissivePlaybackTransport(recording) if permissive else PlaybackTransport(recording) 176 with closing(Client(transport)) as client: 177 # A recording answers each kind of request in turn without reading it, so the setup is repeated without its 178 # details. A permissive one makes up a create and every step. 179 if permissive or recording.created_its_game: 180 client.create_game("recorded", [Participant(), Computer()]) 181 client.join_game(Race.RANDOM) 182 return api.play( 183 client, 184 realtime=not permissive and recording.played_in_real_time, 185 time_limit=time_limit, 186 enemy_ladder_id=enemy_ladder_id, 187 save_replay_to=save_replay_to, 188 )
Play api through the game recorded in recording, with no game client, a turn at each recorded observation,
and return how it ended for the player recorded, or TIE at time_limit. enemy_ladder_id and save_replay_to
are as for Api.play.
By default the bot must ask what was asked when the game was recorded, and gets the game's own answers, as a
PlaybackTransport gives them: a request of another kind raises ProtocolError. The game is created if the
recording created it, and played in real time if it was, as Recording.created_its_game and played_in_real_time
say. time_limit, enemy_ladder_id and save_replay_to must be what the game was played with: a game its time
limit ended raises at its end without it, and so does one the bot left after saving its replay without
save_replay_to, which then holds the replay recorded.
With permissive, any bot plays the recording through, though nothing it does changes what comes next: what it
asks of its own accord is answered as PermissivePlaybackTransport makes it up. It returns UNDECIDED if the
recording stops before the game's end, as one made with a time limit does, and DEFEAT if the bot leaves first,
and saves no replay, logging a save asked for as failed. A request the recording cannot answer raises
ProtocolError.
A replay played back by run_replay or open_replay is played back again as open_replay_recording plays it, as
the player it was played for and with the fog as it was, by default only: permissive raises ValueError for
one.
Raises RuntimeError before anything else if api has played its game.
25def run_replay( 26 replay: Path | str, 27 api: Api[object], 28 *, 29 player_id: int, 30 disable_fog: bool = False, 31 steps_per_turn: int = 1, 32 time_limit: GameTime | None = None, 33 record_to: Path | str | None = None, 34 installation: Installation | None = None, 35 window: tuple[int, int] = (1024, 768), 36) -> Result: 37 """Start a game client, play back the replay in the file `replay` for `api` as the player `player_id` saw it, a 38 turn every `steps_per_turn` steps, and return how it ended for that player. 39 40 The api sees what that player saw when the game was played (in game): `api.player` is that player, `api.units.own` 41 its units, and each action it took comes as an `OwnActionEvent`. With `disable_fog`, it sees that too, and 42 `api.all_units` holds every unit besides. The game takes no actions or debug commands in a replay, so a turn that 43 orders, chats, draws or moves the camera raises `ProtocolError` once its handlers have run (in game). Leaving the 44 replay, or reaching `time_limit`, stops it `Result.UNDECIDED`. 45 46 The replay is played back as `open_replay` plays it, on its own build and with its map, and refused where that 47 says. `record_to` is a file to record the whole conversation into, as for `run_local`, which `run_recording` plays 48 back. However the replay ends, the client is stopped and its temporary directory removed. Raises `RuntimeError` 49 before anything else if `api` has played its game. 50 """ 51 api._check_has_not_played() 52 check_time_limit(time_limit) 53 with open_replay( 54 replay, 55 player_id=player_id, 56 disable_fog=disable_fog, 57 record_to=record_to, 58 installation=installation, 59 window=window, 60 ) as playback: 61 TECH_TREE.warn_if_not_swept_on(playback.info.base_build) 62 return api.play(playback.client, steps_per_turn=steps_per_turn, time_limit=time_limit)
Start a game client, play back the replay in the file replay for api as the player player_id saw it, a
turn every steps_per_turn steps, and return how it ended for that player.
The api sees what that player saw when the game was played (in game): api.player is that player, api.units.own
its units, and each action it took comes as an OwnActionEvent. With disable_fog, it sees that too, and
api.all_units holds every unit besides. The game takes no actions or debug commands in a replay, so a turn that
orders, chats, draws or moves the camera raises ProtocolError once its handlers have run (in game). Leaving the
replay, or reaching time_limit, stops it Result.UNDECIDED.
The replay is played back as open_replay plays it, on its own build and with its map, and refused where that
says. record_to is a file to record the whole conversation into, as for run_local, which run_recording plays
back. However the replay ends, the client is stopped and its temporary directory removed. Raises RuntimeError
before anything else if api has played its game.