sc2nachos.state

What an observation reports beyond its units: the score, the supply, effects and this player's actions.

 1"""What an observation reports beyond its units: the score, the supply, effects and this player's actions."""
 2
 3from sc2nachos.state._action_result import ActionResult, UnknownActionResultError
 4from sc2nachos.state._actions import Action, ActionFailure, AutocastToggle, CameraMove, UnitCommand
 5from sc2nachos.state._alert import Alert
 6from sc2nachos.state._effect import Effect
 7from sc2nachos.state._in_production import InProduction
 8from sc2nachos.state._research import Research
 9from sc2nachos.state._score import CategoryScore, Score, ValueScore, VitalScore
10from sc2nachos.state._supply import Supply
11from sc2nachos.state._ui_unit_counts import UiUnitCounts
12
13__all__ = [
14    "Action",
15    "ActionFailure",
16    "ActionResult",
17    "Alert",
18    "AutocastToggle",
19    "CameraMove",
20    "CategoryScore",
21    "Effect",
22    "InProduction",
23    "Research",
24    "Score",
25    "Supply",
26    "UiUnitCounts",
27    "UnitCommand",
28    "UnknownActionResultError",
29    "ValueScore",
30    "VitalScore",
31]
@dataclass(frozen=True, slots=True)
class Action:
25@dataclass(frozen=True, slots=True)
26class Action:
27    """An action of this player's, as the game carried it out: a `UnitCommand`, an `AutocastToggle` or a
28    `CameraMove`."""
29
30    time: GameTime
31    """When the game carried it out."""

An action of this player's, as the game carried it out: a UnitCommand, an AutocastToggle or a CameraMove.

Action(time: sc2nachos.GameTime)

When the game carried it out.

@final
@dataclass(frozen=True, slots=True)
class ActionFailure:
114@final
115@dataclass(frozen=True, slots=True)
116class ActionFailure:
117    """An order the game refused when it was sent, or accepted and then gave up on (in game).
118
119    Not an `Action`: an action is something this player did, and this is something the game refused or undid. Not an
120    exception either: the game reports it, and nothing raises it.
121    """
122
123    time: GameTime
124    """When the order was refused, which is when it was issued, or when the game gave up on it."""
125    unit: Unit[Any] | None
126    """The unit whose order was refused or given up, or `None` if the game named none. A refusal always names one."""
127    ability: AbilityId | None
128    """The ability refused, as it was ordered, or the ability given up, or `None` if the game named none."""
129    action_result: ActionResult
130    """Why: `NOT_ENOUGH_MINERALS` for a build refused as it was sent, `NOT_ENOUGH_FOOD` for a marine with no supply
131    left, `CANT_BUILD_LOCATION_INVALID` for a site taken meanwhile."""
132
133    @classmethod
134    def _from_proto(
135        cls, error: sc2api_pb2.ActionError, unit_by_tag: Callable[[int], Unit[Any]], time: GameTime
136    ) -> Self:
137        """Read an action error (the protocol's name for it) from the observation at `time`, looking up its unit
138        through `unit_by_tag`.
139
140        Raises `UncuratedIdError` if it names an ability the curated ids leave out.
141        """
142        unit = unit_by_tag(error.unit_tag) if error.HasField("unit_tag") else None
143        ability = AbilityId.read(error.ability_id) if error.HasField("ability_id") else None
144        return cls(time, unit, ability, ActionResult.read(error.result))

An order the game refused when it was sent, or accepted and then gave up on (in game).

Not an Action: an action is something this player did, and this is something the game refused or undid. Not an exception either: the game reports it, and nothing raises it.

ActionFailure( time: sc2nachos.GameTime, unit: Optional[sc2nachos.Unit[Any]], ability: sc2nachos.AbilityId | None, action_result: ActionResult)

When the order was refused, which is when it was issued, or when the game gave up on it.

unit: Optional[sc2nachos.Unit[Any]]

The unit whose order was refused or given up, or None if the game named none. A refusal always names one.

ability: sc2nachos.AbilityId | None

The ability refused, as it was ordered, or the ability given up, or None if the game named none.

action_result: ActionResult

Why: NOT_ENOUGH_MINERALS for a build refused as it was sent, NOT_ENOUGH_FOOD for a marine with no supply left, CANT_BUILD_LOCATION_INVALID for a site taken meanwhile.

class ActionResult(sc2nachos._shared.readable_int_enum.ReadableIntEnum):
 24class ActionResult(ReadableIntEnum):
 25    """The game's answer to an action, or its reason for giving one up.
 26
 27    `SUCCESS` means the game accepted the action, not that it carried it out: an order it accepts and then drops is
 28    still answered `SUCCESS` (in game).
 29    """
 30
 31    @classmethod
 32    def _unknown(cls, value: int) -> UnknownValueError:
 33        return UnknownActionResultError(cls, value)
 34
 35    SUCCESS = error_pb2.ActionResult.Success
 36    NOT_SUPPORTED = error_pb2.ActionResult.NotSupported
 37    ERROR = error_pb2.ActionResult.Error
 38    CANT_QUEUE_THAT_ORDER = error_pb2.ActionResult.CantQueueThatOrder
 39    RETRY = error_pb2.ActionResult.Retry
 40    COOLDOWN = error_pb2.ActionResult.Cooldown
 41    QUEUE_IS_FULL = error_pb2.ActionResult.QueueIsFull
 42    RALLY_QUEUE_IS_FULL = error_pb2.ActionResult.RallyQueueIsFull
 43    NOT_ENOUGH_MINERALS = error_pb2.ActionResult.NotEnoughMinerals
 44    NOT_ENOUGH_VESPENE = error_pb2.ActionResult.NotEnoughVespene
 45    NOT_ENOUGH_TERRAZINE = error_pb2.ActionResult.NotEnoughTerrazine
 46    NOT_ENOUGH_CUSTOM = error_pb2.ActionResult.NotEnoughCustom
 47    NOT_ENOUGH_FOOD = error_pb2.ActionResult.NotEnoughFood
 48    FOOD_USAGE_IMPOSSIBLE = error_pb2.ActionResult.FoodUsageImpossible
 49    NOT_ENOUGH_LIFE = error_pb2.ActionResult.NotEnoughLife
 50    NOT_ENOUGH_SHIELDS = error_pb2.ActionResult.NotEnoughShields
 51    NOT_ENOUGH_ENERGY = error_pb2.ActionResult.NotEnoughEnergy
 52    LIFE_SUPPRESSED = error_pb2.ActionResult.LifeSuppressed
 53    SHIELDS_SUPPRESSED = error_pb2.ActionResult.ShieldsSuppressed
 54    ENERGY_SUPPRESSED = error_pb2.ActionResult.EnergySuppressed
 55    NOT_ENOUGH_CHARGES = error_pb2.ActionResult.NotEnoughCharges
 56    CANT_ADD_MORE_CHARGES = error_pb2.ActionResult.CantAddMoreCharges
 57    TOO_MUCH_MINERALS = error_pb2.ActionResult.TooMuchMinerals
 58    TOO_MUCH_VESPENE = error_pb2.ActionResult.TooMuchVespene
 59    TOO_MUCH_TERRAZINE = error_pb2.ActionResult.TooMuchTerrazine
 60    TOO_MUCH_CUSTOM = error_pb2.ActionResult.TooMuchCustom
 61    TOO_MUCH_FOOD = error_pb2.ActionResult.TooMuchFood
 62    TOO_MUCH_LIFE = error_pb2.ActionResult.TooMuchLife
 63    TOO_MUCH_SHIELDS = error_pb2.ActionResult.TooMuchShields
 64    TOO_MUCH_ENERGY = error_pb2.ActionResult.TooMuchEnergy
 65    MUST_TARGET_UNIT_WITH_LIFE = error_pb2.ActionResult.MustTargetUnitWithLife
 66    MUST_TARGET_UNIT_WITH_SHIELDS = error_pb2.ActionResult.MustTargetUnitWithShields
 67    MUST_TARGET_UNIT_WITH_ENERGY = error_pb2.ActionResult.MustTargetUnitWithEnergy
 68    CANT_TRADE = error_pb2.ActionResult.CantTrade
 69    CANT_SPEND = error_pb2.ActionResult.CantSpend
 70    CANT_TARGET_THAT_UNIT = error_pb2.ActionResult.CantTargetThatUnit
 71    COULDNT_ALLOCATE_UNIT = error_pb2.ActionResult.CouldntAllocateUnit
 72    UNIT_CANT_MOVE = error_pb2.ActionResult.UnitCantMove
 73    TRANSPORT_IS_HOLDING_POSITION = error_pb2.ActionResult.TransportIsHoldingPosition
 74    BUILD_TECH_REQUIREMENTS_NOT_MET = error_pb2.ActionResult.BuildTechRequirementsNotMet
 75    CANT_FIND_PLACEMENT_LOCATION = error_pb2.ActionResult.CantFindPlacementLocation
 76    CANT_BUILD_ON_THAT = error_pb2.ActionResult.CantBuildOnThat
 77    CANT_BUILD_TOO_CLOSE_TO_DROP_OFF = error_pb2.ActionResult.CantBuildTooCloseToDropOff
 78    CANT_BUILD_LOCATION_INVALID = error_pb2.ActionResult.CantBuildLocationInvalid
 79    CANT_SEE_BUILD_LOCATION = error_pb2.ActionResult.CantSeeBuildLocation
 80    CANT_BUILD_TOO_CLOSE_TO_CREEP_SOURCE = error_pb2.ActionResult.CantBuildTooCloseToCreepSource
 81    CANT_BUILD_TOO_CLOSE_TO_RESOURCES = error_pb2.ActionResult.CantBuildTooCloseToResources
 82    CANT_BUILD_TOO_FAR_FROM_WATER = error_pb2.ActionResult.CantBuildTooFarFromWater
 83    CANT_BUILD_TOO_FAR_FROM_CREEP_SOURCE = error_pb2.ActionResult.CantBuildTooFarFromCreepSource
 84    CANT_BUILD_TOO_FAR_FROM_BUILD_POWER_SOURCE = error_pb2.ActionResult.CantBuildTooFarFromBuildPowerSource
 85    CANT_BUILD_ON_DENSE_TERRAIN = error_pb2.ActionResult.CantBuildOnDenseTerrain
 86    CANT_TRAIN_TOO_FAR_FROM_TRAIN_POWER_SOURCE = error_pb2.ActionResult.CantTrainTooFarFromTrainPowerSource
 87    CANT_LAND_LOCATION_INVALID = error_pb2.ActionResult.CantLandLocationInvalid
 88    CANT_SEE_LAND_LOCATION = error_pb2.ActionResult.CantSeeLandLocation
 89    CANT_LAND_TOO_CLOSE_TO_CREEP_SOURCE = error_pb2.ActionResult.CantLandTooCloseToCreepSource
 90    CANT_LAND_TOO_CLOSE_TO_RESOURCES = error_pb2.ActionResult.CantLandTooCloseToResources
 91    CANT_LAND_TOO_FAR_FROM_WATER = error_pb2.ActionResult.CantLandTooFarFromWater
 92    CANT_LAND_TOO_FAR_FROM_CREEP_SOURCE = error_pb2.ActionResult.CantLandTooFarFromCreepSource
 93    CANT_LAND_TOO_FAR_FROM_BUILD_POWER_SOURCE = error_pb2.ActionResult.CantLandTooFarFromBuildPowerSource
 94    CANT_LAND_TOO_FAR_FROM_TRAIN_POWER_SOURCE = error_pb2.ActionResult.CantLandTooFarFromTrainPowerSource
 95    CANT_LAND_ON_DENSE_TERRAIN = error_pb2.ActionResult.CantLandOnDenseTerrain
 96    ADD_ON_TOO_FAR_FROM_BUILDING = error_pb2.ActionResult.AddOnTooFarFromBuilding
 97    MUST_BUILD_REFINERY_FIRST = error_pb2.ActionResult.MustBuildRefineryFirst
 98    BUILDING_IS_UNDER_CONSTRUCTION = error_pb2.ActionResult.BuildingIsUnderConstruction
 99    CANT_FIND_DROP_OFF = error_pb2.ActionResult.CantFindDropOff
100    CANT_LOAD_OTHER_PLAYERS_UNITS = error_pb2.ActionResult.CantLoadOtherPlayersUnits
101    NOT_ENOUGH_ROOM_TO_LOAD_UNIT = error_pb2.ActionResult.NotEnoughRoomToLoadUnit
102    CANT_UNLOAD_UNITS_THERE = error_pb2.ActionResult.CantUnloadUnitsThere
103    CANT_WARP_IN_UNITS_THERE = error_pb2.ActionResult.CantWarpInUnitsThere
104    CANT_LOAD_IMMOBILE_UNITS = error_pb2.ActionResult.CantLoadImmobileUnits
105    CANT_RECHARGE_IMMOBILE_UNITS = error_pb2.ActionResult.CantRechargeImmobileUnits
106    CANT_RECHARGE_UNDER_CONSTRUCTION_UNITS = error_pb2.ActionResult.CantRechargeUnderConstructionUnits
107    CANT_LOAD_THAT_UNIT = error_pb2.ActionResult.CantLoadThatUnit
108    NO_CARGO_TO_UNLOAD = error_pb2.ActionResult.NoCargoToUnload
109    LOAD_ALL_NO_TARGETS_FOUND = error_pb2.ActionResult.LoadAllNoTargetsFound
110    NOT_WHILE_OCCUPIED = error_pb2.ActionResult.NotWhileOccupied
111    CANT_ATTACK_WITHOUT_AMMO = error_pb2.ActionResult.CantAttackWithoutAmmo
112    CANT_HOLD_ANY_MORE_AMMO = error_pb2.ActionResult.CantHoldAnyMoreAmmo
113    TECH_REQUIREMENTS_NOT_MET = error_pb2.ActionResult.TechRequirementsNotMet
114    MUST_LOCKDOWN_UNIT_FIRST = error_pb2.ActionResult.MustLockdownUnitFirst
115    MUST_TARGET_UNIT = error_pb2.ActionResult.MustTargetUnit
116    MUST_TARGET_INVENTORY = error_pb2.ActionResult.MustTargetInventory
117    MUST_TARGET_VISIBLE_UNIT = error_pb2.ActionResult.MustTargetVisibleUnit
118    MUST_TARGET_VISIBLE_LOCATION = error_pb2.ActionResult.MustTargetVisibleLocation
119    MUST_TARGET_WALKABLE_LOCATION = error_pb2.ActionResult.MustTargetWalkableLocation
120    MUST_TARGET_PAWNABLE_UNIT = error_pb2.ActionResult.MustTargetPawnableUnit
121    YOU_CANT_CONTROL_THAT_UNIT = error_pb2.ActionResult.YouCantControlThatUnit
122    YOU_CANT_ISSUE_COMMANDS_TO_THAT_UNIT = error_pb2.ActionResult.YouCantIssueCommandsToThatUnit
123    MUST_TARGET_RESOURCES = error_pb2.ActionResult.MustTargetResources
124    REQUIRES_HEAL_TARGET = error_pb2.ActionResult.RequiresHealTarget
125    REQUIRES_REPAIR_TARGET = error_pb2.ActionResult.RequiresRepairTarget
126    NO_ITEMS_TO_DROP = error_pb2.ActionResult.NoItemsToDrop
127    CANT_HOLD_ANY_MORE_ITEMS = error_pb2.ActionResult.CantHoldAnyMoreItems
128    CANT_HOLD_THAT = error_pb2.ActionResult.CantHoldThat
129    TARGET_HAS_NO_INVENTORY = error_pb2.ActionResult.TargetHasNoInventory
130    CANT_DROP_THIS_ITEM = error_pb2.ActionResult.CantDropThisItem
131    CANT_MOVE_THIS_ITEM = error_pb2.ActionResult.CantMoveThisItem
132    CANT_PAWN_THIS_UNIT = error_pb2.ActionResult.CantPawnThisUnit
133    MUST_TARGET_CASTER = error_pb2.ActionResult.MustTargetCaster
134    CANT_TARGET_CASTER = error_pb2.ActionResult.CantTargetCaster
135    MUST_TARGET_OUTER = error_pb2.ActionResult.MustTargetOuter
136    CANT_TARGET_OUTER = error_pb2.ActionResult.CantTargetOuter
137    MUST_TARGET_YOUR_OWN_UNITS = error_pb2.ActionResult.MustTargetYourOwnUnits
138    CANT_TARGET_YOUR_OWN_UNITS = error_pb2.ActionResult.CantTargetYourOwnUnits
139    MUST_TARGET_FRIENDLY_UNITS = error_pb2.ActionResult.MustTargetFriendlyUnits
140    CANT_TARGET_FRIENDLY_UNITS = error_pb2.ActionResult.CantTargetFriendlyUnits
141    MUST_TARGET_NEUTRAL_UNITS = error_pb2.ActionResult.MustTargetNeutralUnits
142    CANT_TARGET_NEUTRAL_UNITS = error_pb2.ActionResult.CantTargetNeutralUnits
143    MUST_TARGET_ENEMY_UNITS = error_pb2.ActionResult.MustTargetEnemyUnits
144    CANT_TARGET_ENEMY_UNITS = error_pb2.ActionResult.CantTargetEnemyUnits
145    MUST_TARGET_AIR_UNITS = error_pb2.ActionResult.MustTargetAirUnits
146    CANT_TARGET_AIR_UNITS = error_pb2.ActionResult.CantTargetAirUnits
147    MUST_TARGET_GROUND_UNITS = error_pb2.ActionResult.MustTargetGroundUnits
148    CANT_TARGET_GROUND_UNITS = error_pb2.ActionResult.CantTargetGroundUnits
149    MUST_TARGET_STRUCTURES = error_pb2.ActionResult.MustTargetStructures
150    CANT_TARGET_STRUCTURES = error_pb2.ActionResult.CantTargetStructures
151    MUST_TARGET_LIGHT_UNITS = error_pb2.ActionResult.MustTargetLightUnits
152    CANT_TARGET_LIGHT_UNITS = error_pb2.ActionResult.CantTargetLightUnits
153    MUST_TARGET_ARMORED_UNITS = error_pb2.ActionResult.MustTargetArmoredUnits
154    CANT_TARGET_ARMORED_UNITS = error_pb2.ActionResult.CantTargetArmoredUnits
155    MUST_TARGET_BIOLOGICAL_UNITS = error_pb2.ActionResult.MustTargetBiologicalUnits
156    CANT_TARGET_BIOLOGICAL_UNITS = error_pb2.ActionResult.CantTargetBiologicalUnits
157    MUST_TARGET_HEROIC_UNITS = error_pb2.ActionResult.MustTargetHeroicUnits
158    CANT_TARGET_HEROIC_UNITS = error_pb2.ActionResult.CantTargetHeroicUnits
159    MUST_TARGET_ROBOTIC_UNITS = error_pb2.ActionResult.MustTargetRoboticUnits
160    CANT_TARGET_ROBOTIC_UNITS = error_pb2.ActionResult.CantTargetRoboticUnits
161    MUST_TARGET_MECHANICAL_UNITS = error_pb2.ActionResult.MustTargetMechanicalUnits
162    CANT_TARGET_MECHANICAL_UNITS = error_pb2.ActionResult.CantTargetMechanicalUnits
163    MUST_TARGET_PSIONIC_UNITS = error_pb2.ActionResult.MustTargetPsionicUnits
164    CANT_TARGET_PSIONIC_UNITS = error_pb2.ActionResult.CantTargetPsionicUnits
165    MUST_TARGET_MASSIVE_UNITS = error_pb2.ActionResult.MustTargetMassiveUnits
166    CANT_TARGET_MASSIVE_UNITS = error_pb2.ActionResult.CantTargetMassiveUnits
167    MUST_TARGET_MISSILE = error_pb2.ActionResult.MustTargetMissile
168    CANT_TARGET_MISSILE = error_pb2.ActionResult.CantTargetMissile
169    MUST_TARGET_WORKER_UNITS = error_pb2.ActionResult.MustTargetWorkerUnits
170    CANT_TARGET_WORKER_UNITS = error_pb2.ActionResult.CantTargetWorkerUnits
171    MUST_TARGET_ENERGY_CAPABLE_UNITS = error_pb2.ActionResult.MustTargetEnergyCapableUnits
172    CANT_TARGET_ENERGY_CAPABLE_UNITS = error_pb2.ActionResult.CantTargetEnergyCapableUnits
173    MUST_TARGET_SHIELD_CAPABLE_UNITS = error_pb2.ActionResult.MustTargetShieldCapableUnits
174    CANT_TARGET_SHIELD_CAPABLE_UNITS = error_pb2.ActionResult.CantTargetShieldCapableUnits
175    MUST_TARGET_FLYERS = error_pb2.ActionResult.MustTargetFlyers
176    CANT_TARGET_FLYERS = error_pb2.ActionResult.CantTargetFlyers
177    MUST_TARGET_BURIED_UNITS = error_pb2.ActionResult.MustTargetBuriedUnits
178    CANT_TARGET_BURIED_UNITS = error_pb2.ActionResult.CantTargetBuriedUnits
179    MUST_TARGET_CLOAKED_UNITS = error_pb2.ActionResult.MustTargetCloakedUnits
180    CANT_TARGET_CLOAKED_UNITS = error_pb2.ActionResult.CantTargetCloakedUnits
181    MUST_TARGET_UNITS_IN_A_STASIS_FIELD = error_pb2.ActionResult.MustTargetUnitsInAStasisField
182    CANT_TARGET_UNITS_IN_A_STASIS_FIELD = error_pb2.ActionResult.CantTargetUnitsInAStasisField
183    MUST_TARGET_UNDER_CONSTRUCTION_UNITS = error_pb2.ActionResult.MustTargetUnderConstructionUnits
184    CANT_TARGET_UNDER_CONSTRUCTION_UNITS = error_pb2.ActionResult.CantTargetUnderConstructionUnits
185    MUST_TARGET_DEAD_UNITS = error_pb2.ActionResult.MustTargetDeadUnits
186    CANT_TARGET_DEAD_UNITS = error_pb2.ActionResult.CantTargetDeadUnits
187    MUST_TARGET_REVIVABLE_UNITS = error_pb2.ActionResult.MustTargetRevivableUnits
188    CANT_TARGET_REVIVABLE_UNITS = error_pb2.ActionResult.CantTargetRevivableUnits
189    MUST_TARGET_HIDDEN_UNITS = error_pb2.ActionResult.MustTargetHiddenUnits
190    CANT_TARGET_HIDDEN_UNITS = error_pb2.ActionResult.CantTargetHiddenUnits
191    CANT_RECHARGE_OTHER_PLAYERS_UNITS = error_pb2.ActionResult.CantRechargeOtherPlayersUnits
192    MUST_TARGET_HALLUCINATIONS = error_pb2.ActionResult.MustTargetHallucinations
193    CANT_TARGET_HALLUCINATIONS = error_pb2.ActionResult.CantTargetHallucinations
194    MUST_TARGET_INVULNERABLE_UNITS = error_pb2.ActionResult.MustTargetInvulnerableUnits
195    CANT_TARGET_INVULNERABLE_UNITS = error_pb2.ActionResult.CantTargetInvulnerableUnits
196    MUST_TARGET_DETECTED_UNITS = error_pb2.ActionResult.MustTargetDetectedUnits
197    CANT_TARGET_DETECTED_UNITS = error_pb2.ActionResult.CantTargetDetectedUnits
198    CANT_TARGET_UNIT_WITH_ENERGY = error_pb2.ActionResult.CantTargetUnitWithEnergy
199    CANT_TARGET_UNIT_WITH_SHIELDS = error_pb2.ActionResult.CantTargetUnitWithShields
200    MUST_TARGET_UNCOMMANDABLE_UNITS = error_pb2.ActionResult.MustTargetUncommandableUnits
201    CANT_TARGET_UNCOMMANDABLE_UNITS = error_pb2.ActionResult.CantTargetUncommandableUnits
202    MUST_TARGET_PREVENT_DEFEAT_UNITS = error_pb2.ActionResult.MustTargetPreventDefeatUnits
203    CANT_TARGET_PREVENT_DEFEAT_UNITS = error_pb2.ActionResult.CantTargetPreventDefeatUnits
204    MUST_TARGET_PREVENT_REVEAL_UNITS = error_pb2.ActionResult.MustTargetPreventRevealUnits
205    CANT_TARGET_PREVENT_REVEAL_UNITS = error_pb2.ActionResult.CantTargetPreventRevealUnits
206    MUST_TARGET_PASSIVE_UNITS = error_pb2.ActionResult.MustTargetPassiveUnits
207    CANT_TARGET_PASSIVE_UNITS = error_pb2.ActionResult.CantTargetPassiveUnits
208    MUST_TARGET_STUNNED_UNITS = error_pb2.ActionResult.MustTargetStunnedUnits
209    CANT_TARGET_STUNNED_UNITS = error_pb2.ActionResult.CantTargetStunnedUnits
210    MUST_TARGET_SUMMONED_UNITS = error_pb2.ActionResult.MustTargetSummonedUnits
211    CANT_TARGET_SUMMONED_UNITS = error_pb2.ActionResult.CantTargetSummonedUnits
212    MUST_TARGET_USER1 = error_pb2.ActionResult.MustTargetUser1
213    CANT_TARGET_USER1 = error_pb2.ActionResult.CantTargetUser1
214    MUST_TARGET_UNSTOPPABLE_UNITS = error_pb2.ActionResult.MustTargetUnstoppableUnits
215    CANT_TARGET_UNSTOPPABLE_UNITS = error_pb2.ActionResult.CantTargetUnstoppableUnits
216    MUST_TARGET_RESISTANT_UNITS = error_pb2.ActionResult.MustTargetResistantUnits
217    CANT_TARGET_RESISTANT_UNITS = error_pb2.ActionResult.CantTargetResistantUnits
218    MUST_TARGET_DAZED_UNITS = error_pb2.ActionResult.MustTargetDazedUnits
219    CANT_TARGET_DAZED_UNITS = error_pb2.ActionResult.CantTargetDazedUnits
220    CANT_LOCKDOWN = error_pb2.ActionResult.CantLockdown
221    CANT_MIND_CONTROL = error_pb2.ActionResult.CantMindControl
222    MUST_TARGET_DESTRUCTIBLES = error_pb2.ActionResult.MustTargetDestructibles
223    CANT_TARGET_DESTRUCTIBLES = error_pb2.ActionResult.CantTargetDestructibles
224    MUST_TARGET_ITEMS = error_pb2.ActionResult.MustTargetItems
225    CANT_TARGET_ITEMS = error_pb2.ActionResult.CantTargetItems
226    NO_CALLDOWN_AVAILABLE = error_pb2.ActionResult.NoCalldownAvailable
227    WAYPOINT_LIST_FULL = error_pb2.ActionResult.WaypointListFull
228    MUST_TARGET_RACE = error_pb2.ActionResult.MustTargetRace
229    CANT_TARGET_RACE = error_pb2.ActionResult.CantTargetRace
230    MUST_TARGET_SIMILAR_UNITS = error_pb2.ActionResult.MustTargetSimilarUnits
231    CANT_TARGET_SIMILAR_UNITS = error_pb2.ActionResult.CantTargetSimilarUnits
232    CANT_FIND_ENOUGH_TARGETS = error_pb2.ActionResult.CantFindEnoughTargets
233    ALREADY_SPAWNING_LARVA = error_pb2.ActionResult.AlreadySpawningLarva
234    CANT_TARGET_EXHAUSTED_RESOURCES = error_pb2.ActionResult.CantTargetExhaustedResources
235    CANT_USE_MINIMAP = error_pb2.ActionResult.CantUseMinimap
236    CANT_USE_INFO_PANEL = error_pb2.ActionResult.CantUseInfoPanel
237    ORDER_QUEUE_IS_FULL = error_pb2.ActionResult.OrderQueueIsFull
238    CANT_HARVEST_THAT_RESOURCE = error_pb2.ActionResult.CantHarvestThatResource
239    HARVESTERS_NOT_REQUIRED = error_pb2.ActionResult.HarvestersNotRequired
240    ALREADY_TARGETED = error_pb2.ActionResult.AlreadyTargeted
241    CANT_ATTACK_WEAPONS_DISABLED = error_pb2.ActionResult.CantAttackWeaponsDisabled
242    COULDNT_REACH_TARGET = error_pb2.ActionResult.CouldntReachTarget
243    TARGET_IS_OUT_OF_RANGE = error_pb2.ActionResult.TargetIsOutOfRange
244    TARGET_IS_TOO_CLOSE = error_pb2.ActionResult.TargetIsTooClose
245    TARGET_IS_OUT_OF_ARC = error_pb2.ActionResult.TargetIsOutOfArc
246    CANT_FIND_TELEPORT_LOCATION = error_pb2.ActionResult.CantFindTeleportLocation
247    INVALID_ITEM_CLASS = error_pb2.ActionResult.InvalidItemClass
248    CANT_FIND_CANCEL_ORDER = error_pb2.ActionResult.CantFindCancelOrder

The game's answer to an action, or its reason for giving one up.

SUCCESS means the game accepted the action, not that it carried it out: an order it accepts and then drops is still answered SUCCESS (in game).

SUCCESS = <ActionResult.SUCCESS: 1>
NOT_SUPPORTED = <ActionResult.NOT_SUPPORTED: 2>
ERROR = <ActionResult.ERROR: 3>
CANT_QUEUE_THAT_ORDER = <ActionResult.CANT_QUEUE_THAT_ORDER: 4>
RETRY = <ActionResult.RETRY: 5>
COOLDOWN = <ActionResult.COOLDOWN: 6>
QUEUE_IS_FULL = <ActionResult.QUEUE_IS_FULL: 7>
RALLY_QUEUE_IS_FULL = <ActionResult.RALLY_QUEUE_IS_FULL: 8>
NOT_ENOUGH_MINERALS = <ActionResult.NOT_ENOUGH_MINERALS: 9>
NOT_ENOUGH_VESPENE = <ActionResult.NOT_ENOUGH_VESPENE: 10>
NOT_ENOUGH_TERRAZINE = <ActionResult.NOT_ENOUGH_TERRAZINE: 11>
NOT_ENOUGH_CUSTOM = <ActionResult.NOT_ENOUGH_CUSTOM: 12>
NOT_ENOUGH_FOOD = <ActionResult.NOT_ENOUGH_FOOD: 13>
FOOD_USAGE_IMPOSSIBLE = <ActionResult.FOOD_USAGE_IMPOSSIBLE: 14>
NOT_ENOUGH_LIFE = <ActionResult.NOT_ENOUGH_LIFE: 15>
NOT_ENOUGH_SHIELDS = <ActionResult.NOT_ENOUGH_SHIELDS: 16>
NOT_ENOUGH_ENERGY = <ActionResult.NOT_ENOUGH_ENERGY: 17>
LIFE_SUPPRESSED = <ActionResult.LIFE_SUPPRESSED: 18>
SHIELDS_SUPPRESSED = <ActionResult.SHIELDS_SUPPRESSED: 19>
ENERGY_SUPPRESSED = <ActionResult.ENERGY_SUPPRESSED: 20>
NOT_ENOUGH_CHARGES = <ActionResult.NOT_ENOUGH_CHARGES: 21>
CANT_ADD_MORE_CHARGES = <ActionResult.CANT_ADD_MORE_CHARGES: 22>
TOO_MUCH_MINERALS = <ActionResult.TOO_MUCH_MINERALS: 23>
TOO_MUCH_VESPENE = <ActionResult.TOO_MUCH_VESPENE: 24>
TOO_MUCH_TERRAZINE = <ActionResult.TOO_MUCH_TERRAZINE: 25>
TOO_MUCH_CUSTOM = <ActionResult.TOO_MUCH_CUSTOM: 26>
TOO_MUCH_FOOD = <ActionResult.TOO_MUCH_FOOD: 27>
TOO_MUCH_LIFE = <ActionResult.TOO_MUCH_LIFE: 28>
TOO_MUCH_SHIELDS = <ActionResult.TOO_MUCH_SHIELDS: 29>
TOO_MUCH_ENERGY = <ActionResult.TOO_MUCH_ENERGY: 30>
MUST_TARGET_UNIT_WITH_LIFE = <ActionResult.MUST_TARGET_UNIT_WITH_LIFE: 31>
MUST_TARGET_UNIT_WITH_SHIELDS = <ActionResult.MUST_TARGET_UNIT_WITH_SHIELDS: 32>
MUST_TARGET_UNIT_WITH_ENERGY = <ActionResult.MUST_TARGET_UNIT_WITH_ENERGY: 33>
CANT_TRADE = <ActionResult.CANT_TRADE: 34>
CANT_SPEND = <ActionResult.CANT_SPEND: 35>
CANT_TARGET_THAT_UNIT = <ActionResult.CANT_TARGET_THAT_UNIT: 36>
COULDNT_ALLOCATE_UNIT = <ActionResult.COULDNT_ALLOCATE_UNIT: 37>
UNIT_CANT_MOVE = <ActionResult.UNIT_CANT_MOVE: 38>
TRANSPORT_IS_HOLDING_POSITION = <ActionResult.TRANSPORT_IS_HOLDING_POSITION: 39>
BUILD_TECH_REQUIREMENTS_NOT_MET = <ActionResult.BUILD_TECH_REQUIREMENTS_NOT_MET: 40>
CANT_FIND_PLACEMENT_LOCATION = <ActionResult.CANT_FIND_PLACEMENT_LOCATION: 41>
CANT_BUILD_ON_THAT = <ActionResult.CANT_BUILD_ON_THAT: 42>
CANT_BUILD_TOO_CLOSE_TO_DROP_OFF = <ActionResult.CANT_BUILD_TOO_CLOSE_TO_DROP_OFF: 43>
CANT_BUILD_LOCATION_INVALID = <ActionResult.CANT_BUILD_LOCATION_INVALID: 44>
CANT_SEE_BUILD_LOCATION = <ActionResult.CANT_SEE_BUILD_LOCATION: 45>
CANT_BUILD_TOO_CLOSE_TO_CREEP_SOURCE = <ActionResult.CANT_BUILD_TOO_CLOSE_TO_CREEP_SOURCE: 46>
CANT_BUILD_TOO_CLOSE_TO_RESOURCES = <ActionResult.CANT_BUILD_TOO_CLOSE_TO_RESOURCES: 47>
CANT_BUILD_TOO_FAR_FROM_WATER = <ActionResult.CANT_BUILD_TOO_FAR_FROM_WATER: 48>
CANT_BUILD_TOO_FAR_FROM_CREEP_SOURCE = <ActionResult.CANT_BUILD_TOO_FAR_FROM_CREEP_SOURCE: 49>
CANT_BUILD_TOO_FAR_FROM_BUILD_POWER_SOURCE = <ActionResult.CANT_BUILD_TOO_FAR_FROM_BUILD_POWER_SOURCE: 50>
CANT_BUILD_ON_DENSE_TERRAIN = <ActionResult.CANT_BUILD_ON_DENSE_TERRAIN: 51>
CANT_TRAIN_TOO_FAR_FROM_TRAIN_POWER_SOURCE = <ActionResult.CANT_TRAIN_TOO_FAR_FROM_TRAIN_POWER_SOURCE: 52>
CANT_LAND_LOCATION_INVALID = <ActionResult.CANT_LAND_LOCATION_INVALID: 53>
CANT_SEE_LAND_LOCATION = <ActionResult.CANT_SEE_LAND_LOCATION: 54>
CANT_LAND_TOO_CLOSE_TO_CREEP_SOURCE = <ActionResult.CANT_LAND_TOO_CLOSE_TO_CREEP_SOURCE: 55>
CANT_LAND_TOO_CLOSE_TO_RESOURCES = <ActionResult.CANT_LAND_TOO_CLOSE_TO_RESOURCES: 56>
CANT_LAND_TOO_FAR_FROM_WATER = <ActionResult.CANT_LAND_TOO_FAR_FROM_WATER: 57>
CANT_LAND_TOO_FAR_FROM_CREEP_SOURCE = <ActionResult.CANT_LAND_TOO_FAR_FROM_CREEP_SOURCE: 58>
CANT_LAND_TOO_FAR_FROM_BUILD_POWER_SOURCE = <ActionResult.CANT_LAND_TOO_FAR_FROM_BUILD_POWER_SOURCE: 59>
CANT_LAND_TOO_FAR_FROM_TRAIN_POWER_SOURCE = <ActionResult.CANT_LAND_TOO_FAR_FROM_TRAIN_POWER_SOURCE: 60>
CANT_LAND_ON_DENSE_TERRAIN = <ActionResult.CANT_LAND_ON_DENSE_TERRAIN: 61>
ADD_ON_TOO_FAR_FROM_BUILDING = <ActionResult.ADD_ON_TOO_FAR_FROM_BUILDING: 62>
MUST_BUILD_REFINERY_FIRST = <ActionResult.MUST_BUILD_REFINERY_FIRST: 63>
BUILDING_IS_UNDER_CONSTRUCTION = <ActionResult.BUILDING_IS_UNDER_CONSTRUCTION: 64>
CANT_FIND_DROP_OFF = <ActionResult.CANT_FIND_DROP_OFF: 65>
CANT_LOAD_OTHER_PLAYERS_UNITS = <ActionResult.CANT_LOAD_OTHER_PLAYERS_UNITS: 66>
NOT_ENOUGH_ROOM_TO_LOAD_UNIT = <ActionResult.NOT_ENOUGH_ROOM_TO_LOAD_UNIT: 67>
CANT_UNLOAD_UNITS_THERE = <ActionResult.CANT_UNLOAD_UNITS_THERE: 68>
CANT_WARP_IN_UNITS_THERE = <ActionResult.CANT_WARP_IN_UNITS_THERE: 69>
CANT_LOAD_IMMOBILE_UNITS = <ActionResult.CANT_LOAD_IMMOBILE_UNITS: 70>
CANT_RECHARGE_IMMOBILE_UNITS = <ActionResult.CANT_RECHARGE_IMMOBILE_UNITS: 71>
CANT_RECHARGE_UNDER_CONSTRUCTION_UNITS = <ActionResult.CANT_RECHARGE_UNDER_CONSTRUCTION_UNITS: 72>
CANT_LOAD_THAT_UNIT = <ActionResult.CANT_LOAD_THAT_UNIT: 73>
NO_CARGO_TO_UNLOAD = <ActionResult.NO_CARGO_TO_UNLOAD: 74>
LOAD_ALL_NO_TARGETS_FOUND = <ActionResult.LOAD_ALL_NO_TARGETS_FOUND: 75>
NOT_WHILE_OCCUPIED = <ActionResult.NOT_WHILE_OCCUPIED: 76>
CANT_ATTACK_WITHOUT_AMMO = <ActionResult.CANT_ATTACK_WITHOUT_AMMO: 77>
CANT_HOLD_ANY_MORE_AMMO = <ActionResult.CANT_HOLD_ANY_MORE_AMMO: 78>
TECH_REQUIREMENTS_NOT_MET = <ActionResult.TECH_REQUIREMENTS_NOT_MET: 79>
MUST_LOCKDOWN_UNIT_FIRST = <ActionResult.MUST_LOCKDOWN_UNIT_FIRST: 80>
MUST_TARGET_UNIT = <ActionResult.MUST_TARGET_UNIT: 81>
MUST_TARGET_INVENTORY = <ActionResult.MUST_TARGET_INVENTORY: 82>
MUST_TARGET_VISIBLE_UNIT = <ActionResult.MUST_TARGET_VISIBLE_UNIT: 83>
MUST_TARGET_VISIBLE_LOCATION = <ActionResult.MUST_TARGET_VISIBLE_LOCATION: 84>
MUST_TARGET_WALKABLE_LOCATION = <ActionResult.MUST_TARGET_WALKABLE_LOCATION: 85>
MUST_TARGET_PAWNABLE_UNIT = <ActionResult.MUST_TARGET_PAWNABLE_UNIT: 86>
YOU_CANT_CONTROL_THAT_UNIT = <ActionResult.YOU_CANT_CONTROL_THAT_UNIT: 87>
YOU_CANT_ISSUE_COMMANDS_TO_THAT_UNIT = <ActionResult.YOU_CANT_ISSUE_COMMANDS_TO_THAT_UNIT: 88>
MUST_TARGET_RESOURCES = <ActionResult.MUST_TARGET_RESOURCES: 89>
REQUIRES_HEAL_TARGET = <ActionResult.REQUIRES_HEAL_TARGET: 90>
REQUIRES_REPAIR_TARGET = <ActionResult.REQUIRES_REPAIR_TARGET: 91>
NO_ITEMS_TO_DROP = <ActionResult.NO_ITEMS_TO_DROP: 92>
CANT_HOLD_ANY_MORE_ITEMS = <ActionResult.CANT_HOLD_ANY_MORE_ITEMS: 93>
CANT_HOLD_THAT = <ActionResult.CANT_HOLD_THAT: 94>
TARGET_HAS_NO_INVENTORY = <ActionResult.TARGET_HAS_NO_INVENTORY: 95>
CANT_DROP_THIS_ITEM = <ActionResult.CANT_DROP_THIS_ITEM: 96>
CANT_MOVE_THIS_ITEM = <ActionResult.CANT_MOVE_THIS_ITEM: 97>
CANT_PAWN_THIS_UNIT = <ActionResult.CANT_PAWN_THIS_UNIT: 98>
MUST_TARGET_CASTER = <ActionResult.MUST_TARGET_CASTER: 99>
CANT_TARGET_CASTER = <ActionResult.CANT_TARGET_CASTER: 100>
MUST_TARGET_OUTER = <ActionResult.MUST_TARGET_OUTER: 101>
CANT_TARGET_OUTER = <ActionResult.CANT_TARGET_OUTER: 102>
MUST_TARGET_YOUR_OWN_UNITS = <ActionResult.MUST_TARGET_YOUR_OWN_UNITS: 103>
CANT_TARGET_YOUR_OWN_UNITS = <ActionResult.CANT_TARGET_YOUR_OWN_UNITS: 104>
MUST_TARGET_FRIENDLY_UNITS = <ActionResult.MUST_TARGET_FRIENDLY_UNITS: 105>
CANT_TARGET_FRIENDLY_UNITS = <ActionResult.CANT_TARGET_FRIENDLY_UNITS: 106>
MUST_TARGET_NEUTRAL_UNITS = <ActionResult.MUST_TARGET_NEUTRAL_UNITS: 107>
CANT_TARGET_NEUTRAL_UNITS = <ActionResult.CANT_TARGET_NEUTRAL_UNITS: 108>
MUST_TARGET_ENEMY_UNITS = <ActionResult.MUST_TARGET_ENEMY_UNITS: 109>
CANT_TARGET_ENEMY_UNITS = <ActionResult.CANT_TARGET_ENEMY_UNITS: 110>
MUST_TARGET_AIR_UNITS = <ActionResult.MUST_TARGET_AIR_UNITS: 111>
CANT_TARGET_AIR_UNITS = <ActionResult.CANT_TARGET_AIR_UNITS: 112>
MUST_TARGET_GROUND_UNITS = <ActionResult.MUST_TARGET_GROUND_UNITS: 113>
CANT_TARGET_GROUND_UNITS = <ActionResult.CANT_TARGET_GROUND_UNITS: 114>
MUST_TARGET_STRUCTURES = <ActionResult.MUST_TARGET_STRUCTURES: 115>
CANT_TARGET_STRUCTURES = <ActionResult.CANT_TARGET_STRUCTURES: 116>
MUST_TARGET_LIGHT_UNITS = <ActionResult.MUST_TARGET_LIGHT_UNITS: 117>
CANT_TARGET_LIGHT_UNITS = <ActionResult.CANT_TARGET_LIGHT_UNITS: 118>
MUST_TARGET_ARMORED_UNITS = <ActionResult.MUST_TARGET_ARMORED_UNITS: 119>
CANT_TARGET_ARMORED_UNITS = <ActionResult.CANT_TARGET_ARMORED_UNITS: 120>
MUST_TARGET_BIOLOGICAL_UNITS = <ActionResult.MUST_TARGET_BIOLOGICAL_UNITS: 121>
CANT_TARGET_BIOLOGICAL_UNITS = <ActionResult.CANT_TARGET_BIOLOGICAL_UNITS: 122>
MUST_TARGET_HEROIC_UNITS = <ActionResult.MUST_TARGET_HEROIC_UNITS: 123>
CANT_TARGET_HEROIC_UNITS = <ActionResult.CANT_TARGET_HEROIC_UNITS: 124>
MUST_TARGET_ROBOTIC_UNITS = <ActionResult.MUST_TARGET_ROBOTIC_UNITS: 125>
CANT_TARGET_ROBOTIC_UNITS = <ActionResult.CANT_TARGET_ROBOTIC_UNITS: 126>
MUST_TARGET_MECHANICAL_UNITS = <ActionResult.MUST_TARGET_MECHANICAL_UNITS: 127>
CANT_TARGET_MECHANICAL_UNITS = <ActionResult.CANT_TARGET_MECHANICAL_UNITS: 128>
MUST_TARGET_PSIONIC_UNITS = <ActionResult.MUST_TARGET_PSIONIC_UNITS: 129>
CANT_TARGET_PSIONIC_UNITS = <ActionResult.CANT_TARGET_PSIONIC_UNITS: 130>
MUST_TARGET_MASSIVE_UNITS = <ActionResult.MUST_TARGET_MASSIVE_UNITS: 131>
CANT_TARGET_MASSIVE_UNITS = <ActionResult.CANT_TARGET_MASSIVE_UNITS: 132>
MUST_TARGET_MISSILE = <ActionResult.MUST_TARGET_MISSILE: 133>
CANT_TARGET_MISSILE = <ActionResult.CANT_TARGET_MISSILE: 134>
MUST_TARGET_WORKER_UNITS = <ActionResult.MUST_TARGET_WORKER_UNITS: 135>
CANT_TARGET_WORKER_UNITS = <ActionResult.CANT_TARGET_WORKER_UNITS: 136>
MUST_TARGET_ENERGY_CAPABLE_UNITS = <ActionResult.MUST_TARGET_ENERGY_CAPABLE_UNITS: 137>
CANT_TARGET_ENERGY_CAPABLE_UNITS = <ActionResult.CANT_TARGET_ENERGY_CAPABLE_UNITS: 138>
MUST_TARGET_SHIELD_CAPABLE_UNITS = <ActionResult.MUST_TARGET_SHIELD_CAPABLE_UNITS: 139>
CANT_TARGET_SHIELD_CAPABLE_UNITS = <ActionResult.CANT_TARGET_SHIELD_CAPABLE_UNITS: 140>
MUST_TARGET_FLYERS = <ActionResult.MUST_TARGET_FLYERS: 141>
CANT_TARGET_FLYERS = <ActionResult.CANT_TARGET_FLYERS: 142>
MUST_TARGET_BURIED_UNITS = <ActionResult.MUST_TARGET_BURIED_UNITS: 143>
CANT_TARGET_BURIED_UNITS = <ActionResult.CANT_TARGET_BURIED_UNITS: 144>
MUST_TARGET_CLOAKED_UNITS = <ActionResult.MUST_TARGET_CLOAKED_UNITS: 145>
CANT_TARGET_CLOAKED_UNITS = <ActionResult.CANT_TARGET_CLOAKED_UNITS: 146>
MUST_TARGET_UNITS_IN_A_STASIS_FIELD = <ActionResult.MUST_TARGET_UNITS_IN_A_STASIS_FIELD: 147>
CANT_TARGET_UNITS_IN_A_STASIS_FIELD = <ActionResult.CANT_TARGET_UNITS_IN_A_STASIS_FIELD: 148>
MUST_TARGET_UNDER_CONSTRUCTION_UNITS = <ActionResult.MUST_TARGET_UNDER_CONSTRUCTION_UNITS: 149>
CANT_TARGET_UNDER_CONSTRUCTION_UNITS = <ActionResult.CANT_TARGET_UNDER_CONSTRUCTION_UNITS: 150>
MUST_TARGET_DEAD_UNITS = <ActionResult.MUST_TARGET_DEAD_UNITS: 151>
CANT_TARGET_DEAD_UNITS = <ActionResult.CANT_TARGET_DEAD_UNITS: 152>
MUST_TARGET_REVIVABLE_UNITS = <ActionResult.MUST_TARGET_REVIVABLE_UNITS: 153>
CANT_TARGET_REVIVABLE_UNITS = <ActionResult.CANT_TARGET_REVIVABLE_UNITS: 154>
MUST_TARGET_HIDDEN_UNITS = <ActionResult.MUST_TARGET_HIDDEN_UNITS: 155>
CANT_TARGET_HIDDEN_UNITS = <ActionResult.CANT_TARGET_HIDDEN_UNITS: 156>
CANT_RECHARGE_OTHER_PLAYERS_UNITS = <ActionResult.CANT_RECHARGE_OTHER_PLAYERS_UNITS: 157>
MUST_TARGET_HALLUCINATIONS = <ActionResult.MUST_TARGET_HALLUCINATIONS: 158>
CANT_TARGET_HALLUCINATIONS = <ActionResult.CANT_TARGET_HALLUCINATIONS: 159>
MUST_TARGET_INVULNERABLE_UNITS = <ActionResult.MUST_TARGET_INVULNERABLE_UNITS: 160>
CANT_TARGET_INVULNERABLE_UNITS = <ActionResult.CANT_TARGET_INVULNERABLE_UNITS: 161>
MUST_TARGET_DETECTED_UNITS = <ActionResult.MUST_TARGET_DETECTED_UNITS: 162>
CANT_TARGET_DETECTED_UNITS = <ActionResult.CANT_TARGET_DETECTED_UNITS: 163>
CANT_TARGET_UNIT_WITH_ENERGY = <ActionResult.CANT_TARGET_UNIT_WITH_ENERGY: 164>
CANT_TARGET_UNIT_WITH_SHIELDS = <ActionResult.CANT_TARGET_UNIT_WITH_SHIELDS: 165>
MUST_TARGET_UNCOMMANDABLE_UNITS = <ActionResult.MUST_TARGET_UNCOMMANDABLE_UNITS: 166>
CANT_TARGET_UNCOMMANDABLE_UNITS = <ActionResult.CANT_TARGET_UNCOMMANDABLE_UNITS: 167>
MUST_TARGET_PREVENT_DEFEAT_UNITS = <ActionResult.MUST_TARGET_PREVENT_DEFEAT_UNITS: 168>
CANT_TARGET_PREVENT_DEFEAT_UNITS = <ActionResult.CANT_TARGET_PREVENT_DEFEAT_UNITS: 169>
MUST_TARGET_PREVENT_REVEAL_UNITS = <ActionResult.MUST_TARGET_PREVENT_REVEAL_UNITS: 170>
CANT_TARGET_PREVENT_REVEAL_UNITS = <ActionResult.CANT_TARGET_PREVENT_REVEAL_UNITS: 171>
MUST_TARGET_PASSIVE_UNITS = <ActionResult.MUST_TARGET_PASSIVE_UNITS: 172>
CANT_TARGET_PASSIVE_UNITS = <ActionResult.CANT_TARGET_PASSIVE_UNITS: 173>
MUST_TARGET_STUNNED_UNITS = <ActionResult.MUST_TARGET_STUNNED_UNITS: 174>
CANT_TARGET_STUNNED_UNITS = <ActionResult.CANT_TARGET_STUNNED_UNITS: 175>
MUST_TARGET_SUMMONED_UNITS = <ActionResult.MUST_TARGET_SUMMONED_UNITS: 176>
CANT_TARGET_SUMMONED_UNITS = <ActionResult.CANT_TARGET_SUMMONED_UNITS: 177>
MUST_TARGET_USER1 = <ActionResult.MUST_TARGET_USER1: 178>
CANT_TARGET_USER1 = <ActionResult.CANT_TARGET_USER1: 179>
MUST_TARGET_UNSTOPPABLE_UNITS = <ActionResult.MUST_TARGET_UNSTOPPABLE_UNITS: 180>
CANT_TARGET_UNSTOPPABLE_UNITS = <ActionResult.CANT_TARGET_UNSTOPPABLE_UNITS: 181>
MUST_TARGET_RESISTANT_UNITS = <ActionResult.MUST_TARGET_RESISTANT_UNITS: 182>
CANT_TARGET_RESISTANT_UNITS = <ActionResult.CANT_TARGET_RESISTANT_UNITS: 183>
MUST_TARGET_DAZED_UNITS = <ActionResult.MUST_TARGET_DAZED_UNITS: 184>
CANT_TARGET_DAZED_UNITS = <ActionResult.CANT_TARGET_DAZED_UNITS: 185>
CANT_LOCKDOWN = <ActionResult.CANT_LOCKDOWN: 186>
CANT_MIND_CONTROL = <ActionResult.CANT_MIND_CONTROL: 187>
MUST_TARGET_DESTRUCTIBLES = <ActionResult.MUST_TARGET_DESTRUCTIBLES: 188>
CANT_TARGET_DESTRUCTIBLES = <ActionResult.CANT_TARGET_DESTRUCTIBLES: 189>
MUST_TARGET_ITEMS = <ActionResult.MUST_TARGET_ITEMS: 190>
CANT_TARGET_ITEMS = <ActionResult.CANT_TARGET_ITEMS: 191>
NO_CALLDOWN_AVAILABLE = <ActionResult.NO_CALLDOWN_AVAILABLE: 192>
WAYPOINT_LIST_FULL = <ActionResult.WAYPOINT_LIST_FULL: 193>
MUST_TARGET_RACE = <ActionResult.MUST_TARGET_RACE: 194>
CANT_TARGET_RACE = <ActionResult.CANT_TARGET_RACE: 195>
MUST_TARGET_SIMILAR_UNITS = <ActionResult.MUST_TARGET_SIMILAR_UNITS: 196>
CANT_TARGET_SIMILAR_UNITS = <ActionResult.CANT_TARGET_SIMILAR_UNITS: 197>
CANT_FIND_ENOUGH_TARGETS = <ActionResult.CANT_FIND_ENOUGH_TARGETS: 198>
ALREADY_SPAWNING_LARVA = <ActionResult.ALREADY_SPAWNING_LARVA: 199>
CANT_TARGET_EXHAUSTED_RESOURCES = <ActionResult.CANT_TARGET_EXHAUSTED_RESOURCES: 200>
CANT_USE_MINIMAP = <ActionResult.CANT_USE_MINIMAP: 201>
CANT_USE_INFO_PANEL = <ActionResult.CANT_USE_INFO_PANEL: 202>
ORDER_QUEUE_IS_FULL = <ActionResult.ORDER_QUEUE_IS_FULL: 203>
CANT_HARVEST_THAT_RESOURCE = <ActionResult.CANT_HARVEST_THAT_RESOURCE: 204>
HARVESTERS_NOT_REQUIRED = <ActionResult.HARVESTERS_NOT_REQUIRED: 205>
ALREADY_TARGETED = <ActionResult.ALREADY_TARGETED: 206>
CANT_ATTACK_WEAPONS_DISABLED = <ActionResult.CANT_ATTACK_WEAPONS_DISABLED: 207>
COULDNT_REACH_TARGET = <ActionResult.COULDNT_REACH_TARGET: 208>
TARGET_IS_OUT_OF_RANGE = <ActionResult.TARGET_IS_OUT_OF_RANGE: 209>
TARGET_IS_TOO_CLOSE = <ActionResult.TARGET_IS_TOO_CLOSE: 210>
TARGET_IS_OUT_OF_ARC = <ActionResult.TARGET_IS_OUT_OF_ARC: 211>
CANT_FIND_TELEPORT_LOCATION = <ActionResult.CANT_FIND_TELEPORT_LOCATION: 212>
INVALID_ITEM_CLASS = <ActionResult.INVALID_ITEM_CLASS: 213>
CANT_FIND_CANCEL_ORDER = <ActionResult.CANT_FIND_CANCEL_ORDER: 214>
class Alert(sc2nachos._shared.readable_int_enum.ReadableIntEnum):
11class Alert(ReadableIntEnum):
12    """An alert the game raised for this player. An alert names no unit and no position.
13
14    What each docstring says raises the alert was seen in game. The protocol's `AlertError` and `TrainError` have no
15    member: the game raised neither, reporting a failed order as an action error instead. Should it raise either,
16    it is skipped.
17    """
18
19    NUCLEAR_LAUNCH_DETECTED = _ALERT.NuclearLaunchDetected
20    """The enemy launched a nuke, whether or not this player sees where it is aimed. One alert per nuke. This player's
21    own nukes raise nothing."""
22    NYDUS_WORM_DETECTED = _ALERT.NydusWormDetected
23    """The enemy summoned a nydus worm, whether or not this player sees where. One alert per worm. This player's own
24    worms raise only `BUILDING_COMPLETE`."""
25    ADD_ON_COMPLETE = _ALERT.AddOnComplete
26    """An add-on of this player's finished. One alert per add-on."""
27    BUILDING_COMPLETE = _ALERT.BuildingComplete
28    """A structure of this player's finished: built, morphed from a drone, or a nydus worm, but not an add-on. One
29    alert per structure."""
30    BUILDING_UNDER_ATTACK = _ALERT.BuildingUnderAttack
31    """A structure of this player's, off camera, came under attack. See `UNIT_UNDER_ATTACK` for when the game
32    raises none."""
33    LARVA_HATCHED = _ALERT.LarvaHatched
34    """A queen's inject hatched its larva. One alert per inject, a few steps before the larva are seen. Larva a
35    hatchery makes by itself raise none."""
36    MERGE_COMPLETE = _ALERT.MergeComplete
37    """Two templar of this player's merged into an archon. One alert per archon, some 100 steps after the archon is
38    first seen."""
39    MINERALS_EXHAUSTED = _ALERT.MineralsExhausted
40    """A mineral field this player mined ran out. One alert per field, in the observation the field is gone from."""
41    MORPH_COMPLETE = _ALERT.MorphComplete
42    """A unit or structure of this player's finished morphing: a lair, a baneling, an overseer or a ravager. One alert
43    per morph. A hellion becoming a hellbat raises none."""
44    MOTHERSHIP_COMPLETE = _ALERT.MothershipComplete
45    """A mothership of this player's finished. It raises no `TRAIN_UNIT_COMPLETE`."""
46    MULE_EXPIRED = _ALERT.MULEExpired
47    """A MULE of this player's expired. One alert per MULE, in the observation that reports it dead."""
48    NUKE_COMPLETE = _ALERT.NukeComplete
49    """A nuke was armed at a ghost academy of this player's."""
50    RESEARCH_COMPLETE = _ALERT.ResearchComplete
51    """A research of this player's that is not a level finished: stimpack, combat shield, zergling speed, warp gate or
52    charge. One alert per research."""
53    TRAIN_UNIT_COMPLETE = _ALERT.TrainUnitComplete
54    """A unit of this player's other than a worker was trained or hatched. One alert per unit, so two for a pair of
55    zerglings. A mothership, a warp-in and a morph raise alerts of their own."""
56    TRAIN_WORKER_COMPLETE = _ALERT.TrainWorkerComplete
57    """A worker of this player's was trained or hatched. One alert per worker."""
58    TRANSFORMATION_COMPLETE = _ALERT.TransformationComplete
59    """A gateway of this player's became a warp gate, or a warp gate a gateway. One alert per transformation,
60    including the gateways that warp gate research turns by itself."""
61    UNIT_UNDER_ATTACK = _ALERT.UnitUnderAttack
62    """A unit of this player's, off camera, came under attack.
63
64    The game raises none for a unit on camera, and none again for a unit until it has gone some 6000 steps without
65    being attacked, counted per unit.
66
67    The camera starts on the main base, with its townhall, workers, mineral fields and geysers on screen, and stays
68    there until moved, so an attack on the main raises none. `OwnUnitDamagedEvent` reports every unit of this
69    player's that loses health or shields, every turn, whatever the camera shows.
70    """
71    UPGRADE_COMPLETE = _ALERT.UpgradeComplete
72    """A level of this player's weapons or armor finished, or a command center became an orbital command or a
73    planetary fortress. One alert per upgrade."""
74    VESPENE_EXHAUSTED = _ALERT.VespeneExhausted
75    """A geyser this player mined ran out. One alert per geyser."""
76    WARP_IN_COMPLETE = _ALERT.WarpInComplete
77    """A unit of this player's finished warping in. One alert per unit."""

An alert the game raised for this player. An alert names no unit and no position.

What each docstring says raises the alert was seen in game. The protocol's AlertError and TrainError have no member: the game raised neither, reporting a failed order as an action error instead. Should it raise either, it is skipped.

NUCLEAR_LAUNCH_DETECTED = <Alert.NUCLEAR_LAUNCH_DETECTED: 1>

The enemy launched a nuke, whether or not this player sees where it is aimed. One alert per nuke. This player's own nukes raise nothing.

NYDUS_WORM_DETECTED = <Alert.NYDUS_WORM_DETECTED: 2>

The enemy summoned a nydus worm, whether or not this player sees where. One alert per worm. This player's own worms raise only BUILDING_COMPLETE.

ADD_ON_COMPLETE = <Alert.ADD_ON_COMPLETE: 4>

An add-on of this player's finished. One alert per add-on.

BUILDING_COMPLETE = <Alert.BUILDING_COMPLETE: 5>

A structure of this player's finished: built, morphed from a drone, or a nydus worm, but not an add-on. One alert per structure.

BUILDING_UNDER_ATTACK = <Alert.BUILDING_UNDER_ATTACK: 6>

A structure of this player's, off camera, came under attack. See UNIT_UNDER_ATTACK for when the game raises none.

LARVA_HATCHED = <Alert.LARVA_HATCHED: 7>

A queen's inject hatched its larva. One alert per inject, a few steps before the larva are seen. Larva a hatchery makes by itself raise none.

MERGE_COMPLETE = <Alert.MERGE_COMPLETE: 8>

Two templar of this player's merged into an archon. One alert per archon, some 100 steps after the archon is first seen.

MINERALS_EXHAUSTED = <Alert.MINERALS_EXHAUSTED: 9>

A mineral field this player mined ran out. One alert per field, in the observation the field is gone from.

MORPH_COMPLETE = <Alert.MORPH_COMPLETE: 10>

A unit or structure of this player's finished morphing: a lair, a baneling, an overseer or a ravager. One alert per morph. A hellion becoming a hellbat raises none.

MOTHERSHIP_COMPLETE = <Alert.MOTHERSHIP_COMPLETE: 11>

A mothership of this player's finished. It raises no TRAIN_UNIT_COMPLETE.

MULE_EXPIRED = <Alert.MULE_EXPIRED: 12>

A MULE of this player's expired. One alert per MULE, in the observation that reports it dead.

NUKE_COMPLETE = <Alert.NUKE_COMPLETE: 13>

A nuke was armed at a ghost academy of this player's.

RESEARCH_COMPLETE = <Alert.RESEARCH_COMPLETE: 14>

A research of this player's that is not a level finished: stimpack, combat shield, zergling speed, warp gate or charge. One alert per research.

TRAIN_UNIT_COMPLETE = <Alert.TRAIN_UNIT_COMPLETE: 16>

A unit of this player's other than a worker was trained or hatched. One alert per unit, so two for a pair of zerglings. A mothership, a warp-in and a morph raise alerts of their own.

TRAIN_WORKER_COMPLETE = <Alert.TRAIN_WORKER_COMPLETE: 17>

A worker of this player's was trained or hatched. One alert per worker.

TRANSFORMATION_COMPLETE = <Alert.TRANSFORMATION_COMPLETE: 18>

A gateway of this player's became a warp gate, or a warp gate a gateway. One alert per transformation, including the gateways that warp gate research turns by itself.

UNIT_UNDER_ATTACK = <Alert.UNIT_UNDER_ATTACK: 19>

A unit of this player's, off camera, came under attack.

The game raises none for a unit on camera, and none again for a unit until it has gone some 6000 steps without being attacked, counted per unit.

The camera starts on the main base, with its townhall, workers, mineral fields and geysers on screen, and stays there until moved, so an attack on the main raises none. OwnUnitDamagedEvent reports every unit of this player's that loses health or shields, every turn, whatever the camera shows.

UPGRADE_COMPLETE = <Alert.UPGRADE_COMPLETE: 20>

A level of this player's weapons or armor finished, or a command center became an orbital command or a planetary fortress. One alert per upgrade.

VESPENE_EXHAUSTED = <Alert.VESPENE_EXHAUSTED: 21>

A geyser this player mined ran out. One alert per geyser.

WARP_IN_COMPLETE = <Alert.WARP_IN_COMPLETE: 22>

A unit of this player's finished warping in. One alert per unit.

@final
@dataclass(frozen=True, slots=True)
class AutocastToggle(sc2nachos.state.Action):
 87@final
 88@dataclass(frozen=True, slots=True)
 89class AutocastToggle(Action):
 90    """Units of this player's that had an ability's autocast turned on or off."""
 91
 92    ability: AbilityId
 93    units: Units[Unit[Any]]
 94    """The units whose autocast was toggled, leaving out any the game names by a tag it never reported."""
 95
 96    @classmethod
 97    def _from_proto(
 98        cls, time: GameTime, toggle: raw_pb2.ActionRawToggleAutocast, unit_by_tag: Callable[[int], Unit[Any] | None]
 99    ) -> Self:
100        """Read a toggle the observation at `time` reports, looking up its units through `unit_by_tag`, which gives
101        `None` for a tag the game never reported."""
102        return cls(time, AbilityId.read(toggle.ability_id), _units_reported_under(toggle.unit_tags, unit_by_tag))

Units of this player's that had an ability's autocast turned on or off.

AutocastToggle( time: sc2nachos.GameTime, ability: sc2nachos.AbilityId, units: sc2nachos.Units[sc2nachos.Unit[typing.Any]])
units: sc2nachos.Units[sc2nachos.Unit[typing.Any]]

The units whose autocast was toggled, leaving out any the game names by a tag it never reported.

@final
@dataclass(frozen=True, slots=True)
class CameraMove(sc2nachos.state.Action):
105@final
106@dataclass(frozen=True, slots=True)
107class CameraMove(Action):
108    """A move of this player's camera. The game moves it once itself, as a game starts."""
109
110    center: Point
111    """Where the camera was centered."""

A move of this player's camera. The game moves it once itself, as a game starts.

CameraMove( time: sc2nachos.GameTime, center: sc2nachos.Point)
center: sc2nachos.Point

Where the camera was centered.

@final
@dataclass(frozen=True, slots=True)
class CategoryScore:
16@final
17@dataclass(frozen=True, slots=True)
18class CategoryScore:
19    """An amount split by category."""
20
21    none: float
22    """Whatever the game's tables give no category."""
23    army: float
24    """Military units, not workers."""
25    economy: float
26    """Townhalls, supply structures, gas buildings and workers."""
27    technology: float
28    """Structures that produce units or research, such as a barracks or an engineering bay."""
29    upgrade: float
30    """Upgrades, such as warp gate or weapons."""
31
32    @property
33    def total(self) -> float:
34        """The sum over every category."""
35        return self.none + self.army + self.economy + self.technology + self.upgrade
36
37    @classmethod
38    def _from_proto(cls, proto: score_pb2.CategoryScoreDetails) -> Self:
39        return cls(proto.none, proto.army, proto.economy, proto.technology, proto.upgrade)

An amount split by category.

CategoryScore( none: float, army: float, economy: float, technology: float, upgrade: float)
none: float

Whatever the game's tables give no category.

army: float

Military units, not workers.

economy: float

Townhalls, supply structures, gas buildings and workers.

technology: float

Structures that produce units or research, such as a barracks or an engineering bay.

upgrade: float

Upgrades, such as warp gate or weapons.

total: float
32    @property
33    def total(self) -> float:
34        """The sum over every category."""
35        return self.none + self.army + self.economy + self.technology + self.upgrade

The sum over every category.

@final
@dataclass(frozen=True, slots=True)
class Effect:
17@final
18@dataclass(frozen=True, slots=True)
19class Effect:
20    """An effect an ability leaves on the ground for a while, such as a storm or a corrosive bile about to land.
21
22    The game reports force fields, reaper grenades and a parasitic bomb that has left its target as units, not effects.
23    """
24
25    id: EffectId
26    positions: tuple[Point, ...]
27    """Where it is: one point, or several along a line, as for a lurker's spines."""
28    radius: float
29    """How far it reaches from each of its positions."""
30    alliance: Alliance
31    """Whose side its owner is on."""
32    owner_id: int
33    """The id of the player it belongs to."""
34
35    @classmethod
36    def _from_proto(cls, proto: raw_pb2.Effect) -> Self:
37        """Read an effect an observation reports. Raises `UncuratedIdError` for an effect the curated ids leave out."""
38        return cls(
39            id=EffectId.read(proto.effect_id),
40            positions=tuple(Point((position.x, position.y)) for position in proto.pos),
41            radius=proto.radius,
42            alliance=Alliance(proto.alliance),
43            owner_id=proto.owner,
44        )

An effect an ability leaves on the ground for a while, such as a storm or a corrosive bile about to land.

The game reports force fields, reaper grenades and a parasitic bomb that has left its target as units, not effects.

Effect( id: sc2nachos.ids.EffectId, positions: tuple[sc2nachos.Point, ...], radius: float, alliance: sc2nachos.units.Alliance, owner_id: int)
positions: tuple[sc2nachos.Point, ...]

Where it is: one point, or several along a line, as for a lurker's spines.

radius: float

How far it reaches from each of its positions.

Whose side its owner is on.

owner_id: int

The id of the player it belongs to.

@final
@dataclass(frozen=True, slots=True)
class InProduction(sc2nachos.units._progress.Progress[sc2nachos.ids.unit_type.UnitTypeId]):
16@final
17@dataclass(frozen=True, slots=True)
18class InProduction(Progress[UnitTypeId]):
19    """One unit this player is making, started or paid for and on its way, and how far it has got.
20
21    `fraction` is 0 for a queued train, and for a build or an add-on not begun yet, and a structure's morph and a
22    cocoon's, whose progress the game does not report, are at their producer's `Unit.morph_progress`. `total_time` is
23    the tables' build time rounded up, as `UnitTypeData` gives it (in game), but for a warp-in, which takes 256 steps or
24    81 as where it warps in decides, told apart by how far it has gone up since the observation before the one that
25    first listed it (in game): in a realtime game, or on the ladder, a fast one can read slow for its first two
26    observations. `time_left` is exact at the normal rate (in game), and a cocoon's to within a step: a chrono boost
27    makes it sooner, and a Terran structure whose SCV has left stops, its time left with it. A train queued behind
28    another has all its time left and waits for the one ahead first, and a build or an add-on not begun waits for its
29    worker or its host.
30    """
31
32    producer: OwnUnit[Any] | None
33    """What makes it: the structure training it, the egg or cocoon, the worker sent to build it, the structure morphing
34    into it, or for a structure going up, its `builder`: an SCV, an add-on's host, a queen planting a creep tumor, or
35    the drone that became it, which has left the observation. `None` for a unit warping in, for an archon two high
36    templar merged into, and for a structure nobody is building, such as a Protoss one."""
37    unit: OwnUnit[Any] | None
38    """The unit itself while it goes up, warps in or merges into an archon. `None` before it stands: for a train, an
39    egg's or a cocoon's morph, a structure's morph, and a build or an add-on not begun."""

One unit this player is making, started or paid for and on its way, and how far it has got.

fraction is 0 for a queued train, and for a build or an add-on not begun yet, and a structure's morph and a cocoon's, whose progress the game does not report, are at their producer's Unit.morph_progress. total_time is the tables' build time rounded up, as UnitTypeData gives it (in game), but for a warp-in, which takes 256 steps or 81 as where it warps in decides, told apart by how far it has gone up since the observation before the one that first listed it (in game): in a realtime game, or on the ladder, a fast one can read slow for its first two observations. time_left is exact at the normal rate (in game), and a cocoon's to within a step: a chrono boost makes it sooner, and a Terran structure whose SCV has left stops, its time left with it. A train queued behind another has all its time left and waits for the one ahead first, and a build or an add-on not begun waits for its worker or its host.

InProduction( product: 'T', fraction: float, total_time: 'GameTime', time_left: 'GameTime', producer: Optional[sc2nachos.OwnUnit[Any]], unit: Optional[sc2nachos.OwnUnit[Any]])
producer: Optional[sc2nachos.OwnUnit[Any]]

What makes it: the structure training it, the egg or cocoon, the worker sent to build it, the structure morphing into it, or for a structure going up, its builder: an SCV, an add-on's host, a queen planting a creep tumor, or the drone that became it, which has left the observation. None for a unit warping in, for an archon two high templar merged into, and for a structure nobody is building, such as a Protoss one.

unit: Optional[sc2nachos.OwnUnit[Any]]

The unit itself while it goes up, warps in or merges into an archon. None before it stands: for a train, an egg's or a cocoon's morph, a structure's morph, and a build or an add-on not begun.

@final
@dataclass(frozen=True, slots=True)
class Research(sc2nachos.units._progress.Progress[sc2nachos.ids.upgrade.UpgradeId]):
16@final
17@dataclass(frozen=True, slots=True)
18class Research(Progress[UpgradeId]):
19    """One research this player has running, or queued behind another, as a structure's orders show it, and how far it
20    has got.
21
22    `fraction` is the game's, 0 for one queued behind another. `total_time` is the tables' research time, a whole number
23    of steps (in game), and `time_left` is exact at the normal rate (in game): a chrono boost makes it sooner, and one
24    queued behind another has all its time left and waits for the one ahead first.
25    """
26
27    unit: OwnUnit[Any]
28    """The structure researching it."""

One research this player has running, or queued behind another, as a structure's orders show it, and how far it has got.

fraction is the game's, 0 for one queued behind another. total_time is the tables' research time, a whole number of steps (in game), and time_left is exact at the normal rate (in game): a chrono boost makes it sooner, and one queued behind another has all its time left and waits for the one ahead first.

Research( product: 'T', fraction: float, total_time: 'GameTime', time_left: 'GameTime', unit: sc2nachos.OwnUnit[typing.Any])
unit: sc2nachos.OwnUnit[typing.Any]

The structure researching it.

@final
@dataclass(frozen=True, slots=True)
class Score:
 75@final
 76@dataclass(frozen=True, slots=True)
 77class Score:
 78    """The score the game keeps for this player, as of the last observation.
 79
 80    The game's recent APM is left out: it reads zero in a game played through the raw interface.
 81    """
 82
 83    score: int
 84    """The score the game shows at the end of a game: the value of all units and structures, finished or not, plus
 85    the resources in the bank."""
 86    idle_production_time: GameTime
 87    """The time production structures have spent producing nothing, summed over the structures: a whole number of
 88    steps."""
 89    idle_worker_time: GameTime
 90    """The time workers have spent neither mining nor building, summed over the workers: a whole number of steps."""
 91    total_value: ValueScore
 92    """The value of the finished units and structures."""
 93    killed_value: ValueScore
 94    """The value of the opponent's units and structures this player destroyed."""
 95    collected: Resources
 96    collection_rate: Resources
 97    """The current income per minute."""
 98    spent: Resources
 99    """The resources spent. Counted when an order is queued and refunded when it is cancelled."""
100    food_used: CategoryScore
101    """The supply in use."""
102    killed_minerals: CategoryScore
103    """The mineral cost of the opponent's units and structures this player destroyed."""
104    killed_vespene: CategoryScore
105    """The vespene cost of the opponent's units and structures this player destroyed."""
106    lost_minerals: CategoryScore
107    """The mineral cost of this player's units and structures that were destroyed."""
108    lost_vespene: CategoryScore
109    """The vespene cost of this player's units and structures that were destroyed."""
110    friendly_fire_minerals: CategoryScore
111    """The mineral cost of this player's units and structures that it destroyed itself."""
112    friendly_fire_vespene: CategoryScore
113    """The vespene cost of this player's units and structures that it destroyed itself."""
114    used_minerals: CategoryScore
115    """The mineral cost of this player's units, structures and upgrades, less those destroyed."""
116    used_vespene: CategoryScore
117    """The vespene cost of this player's units, structures and upgrades, less those destroyed."""
118    total_used_minerals: CategoryScore
119    """The mineral cost of this player's units, structures and upgrades over the whole game, those destroyed
120    included."""
121    total_used_vespene: CategoryScore
122    """The vespene cost of this player's units, structures and upgrades over the whole game, those destroyed
123    included."""
124    total_damage_dealt: VitalScore
125    """The damage dealt to the opponent."""
126    total_damage_taken: VitalScore
127    """The damage this player's units and structures have taken."""
128    total_healed: VitalScore
129    """The healing and repair this player has done."""
130
131    @classmethod
132    def _from_proto(cls, proto: score_pb2.Score) -> Self:
133        """Read the score an observation reports."""
134        details = proto.score_details
135        category = CategoryScore._from_proto
136        vital = VitalScore._from_proto
137        return cls(
138            score=proto.score,
139            # The game counts these in seconds at Normal speed, always a whole number of steps (corpus).
140            idle_production_time=GameTime(normal_seconds=details.idle_production_time),
141            idle_worker_time=GameTime(normal_seconds=details.idle_worker_time),
142            total_value=ValueScore(details.total_value_units, details.total_value_structures),
143            killed_value=ValueScore(details.killed_value_units, details.killed_value_structures),
144            collected=Resources(details.collected_minerals, details.collected_vespene),
145            collection_rate=Resources(details.collection_rate_minerals, details.collection_rate_vespene),
146            spent=Resources(details.spent_minerals, details.spent_vespene),
147            food_used=category(details.food_used),
148            killed_minerals=category(details.killed_minerals),
149            killed_vespene=category(details.killed_vespene),
150            lost_minerals=category(details.lost_minerals),
151            lost_vespene=category(details.lost_vespene),
152            friendly_fire_minerals=category(details.friendly_fire_minerals),
153            friendly_fire_vespene=category(details.friendly_fire_vespene),
154            used_minerals=category(details.used_minerals),
155            used_vespene=category(details.used_vespene),
156            total_used_minerals=category(details.total_used_minerals),
157            total_used_vespene=category(details.total_used_vespene),
158            total_damage_dealt=vital(details.total_damage_dealt),
159            total_damage_taken=vital(details.total_damage_taken),
160            total_healed=vital(details.total_healed),
161        )

The score the game keeps for this player, as of the last observation.

The game's recent APM is left out: it reads zero in a game played through the raw interface.

Score( score: int, idle_production_time: sc2nachos.GameTime, idle_worker_time: sc2nachos.GameTime, total_value: ValueScore, killed_value: ValueScore, collected: sc2nachos.Resources, collection_rate: sc2nachos.Resources, spent: sc2nachos.Resources, food_used: CategoryScore, killed_minerals: CategoryScore, killed_vespene: CategoryScore, lost_minerals: CategoryScore, lost_vespene: CategoryScore, friendly_fire_minerals: CategoryScore, friendly_fire_vespene: CategoryScore, used_minerals: CategoryScore, used_vespene: CategoryScore, total_used_minerals: CategoryScore, total_used_vespene: CategoryScore, total_damage_dealt: VitalScore, total_damage_taken: VitalScore, total_healed: VitalScore)
score: int

The score the game shows at the end of a game: the value of all units and structures, finished or not, plus the resources in the bank.

idle_production_time: sc2nachos.GameTime

The time production structures have spent producing nothing, summed over the structures: a whole number of steps.

idle_worker_time: sc2nachos.GameTime

The time workers have spent neither mining nor building, summed over the workers: a whole number of steps.

total_value: ValueScore

The value of the finished units and structures.

killed_value: ValueScore

The value of the opponent's units and structures this player destroyed.

collected: sc2nachos.Resources
collection_rate: sc2nachos.Resources

The current income per minute.

The resources spent. Counted when an order is queued and refunded when it is cancelled.

food_used: CategoryScore

The supply in use.

killed_minerals: CategoryScore

The mineral cost of the opponent's units and structures this player destroyed.

killed_vespene: CategoryScore

The vespene cost of the opponent's units and structures this player destroyed.

lost_minerals: CategoryScore

The mineral cost of this player's units and structures that were destroyed.

lost_vespene: CategoryScore

The vespene cost of this player's units and structures that were destroyed.

friendly_fire_minerals: CategoryScore

The mineral cost of this player's units and structures that it destroyed itself.

friendly_fire_vespene: CategoryScore

The vespene cost of this player's units and structures that it destroyed itself.

used_minerals: CategoryScore

The mineral cost of this player's units, structures and upgrades, less those destroyed.

used_vespene: CategoryScore

The vespene cost of this player's units, structures and upgrades, less those destroyed.

total_used_minerals: CategoryScore

The mineral cost of this player's units, structures and upgrades over the whole game, those destroyed included.

total_used_vespene: CategoryScore

The vespene cost of this player's units, structures and upgrades over the whole game, those destroyed included.

total_damage_dealt: VitalScore

The damage dealt to the opponent.

total_damage_taken: VitalScore

The damage this player's units and structures have taken.

total_healed: VitalScore

The healing and repair this player has done.

@final
@dataclass(frozen=True, slots=True)
class Supply:
10@final
11@dataclass(frozen=True, slots=True)
12class Supply:
13    """The supply this player's units take and its structures and units provide."""
14
15    used: float
16    """The supply this player's units take, including those in production. A zergling or a baneling takes half."""
17    cap: int
18    """The supply this player's structures and units provide, up to the game's limit."""
19    army: float
20    """The supply this player's units other than workers take."""
21    workers: int
22    """The supply this player's workers take, not counting those in production."""
23
24    @property
25    def left(self) -> float:
26        """The supply still free under the cap. Negative once units that provided supply are lost."""
27        return self.cap - self.used

The supply this player's units take and its structures and units provide.

Supply(used: float, cap: int, army: float, workers: int)
used: float

The supply this player's units take, including those in production. A zergling or a baneling takes half.

cap: int

The supply this player's structures and units provide, up to the game's limit.

army: float

The supply this player's units other than workers take.

workers: int

The supply this player's workers take, not counting those in production.

left: float
24    @property
25    def left(self) -> float:
26        """The supply still free under the cap. Negative once units that provided supply are lost."""
27        return self.cap - self.used

The supply still free under the cap. Negative once units that provided supply are lost.

@final
@dataclass(frozen=True, slots=True)
class UiUnitCounts:
10@final
11@dataclass(frozen=True, slots=True)
12class UiUnitCounts:
13    """The counts of this player's units the game's interface shows beside the minimap, as the game counts them."""
14
15    idle_workers: int
16    """The workers with nothing to do."""
17    army: int
18    """The units other than workers."""
19    warp_gates: int
20    """The warp gates."""

The counts of this player's units the game's interface shows beside the minimap, as the game counts them.

UiUnitCounts(idle_workers: int, army: int, warp_gates: int)
idle_workers: int

The workers with nothing to do.

army: int

The units other than workers.

warp_gates: int

The warp gates.

@final
@dataclass(frozen=True, slots=True)
class UnitCommand(sc2nachos.state.Action):
34@final
35@dataclass(frozen=True, slots=True)
36class UnitCommand(Action):
37    """An order given to units of this player's."""
38
39    ability: AbilityId
40    """The ability ordered, as the game runs it: an action several types perform reads as that action, whichever
41    type's own id the game names, and a research names its level (in game)."""
42    units: Units[Unit[Any]]
43    """The units that took the order, leaving out any the game names by a tag it never reported."""
44    _target: Target | Literal[_NotReported.TARGET] | None
45    queued: bool
46    """Whether the order was queued behind the units' orders instead of replacing them."""
47
48    @property
49    def target(self) -> Target | None:
50        """The point or unit the order was aimed at, or `None` for an order that takes neither. Raises
51        `NotReportedError` for a unit the game names by a tag it never reports, as it names a mineral field in the fog
52        that a gather was sent to by its snapshot's tag (in game)."""
53        if self._target is _NotReported.TARGET:
54            raise NotReportedError(
55                f"the game names the unit this {self.ability.name} was aimed at by no tag it reports"
56            )
57        return self._target
58
59    @property
60    def known_target(self) -> Target | None:
61        """`target`, or `None` where `target` raises. `None` also for an order aimed at nothing; `target` tells the
62        two apart."""
63        return None if self._target is _NotReported.TARGET else self._target
64
65    @classmethod
66    def _from_proto(
67        cls,
68        time: GameTime,
69        command: raw_pb2.ActionRawUnitCommand,
70        unit_by_tag: Callable[[int], Unit[Any] | None],
71    ) -> Self:
72        """Read a command the observation at `time` reports, looking up the units commanded and the unit it was aimed
73        at through `unit_by_tag`, which gives `None` for a tag the game never reported."""
74        match command.WhichOneof("target"):
75            case "target_world_space_pos":
76                position = command.target_world_space_pos
77                target: Target | Literal[_NotReported.TARGET] | None = Point((position.x, position.y))
78            case "target_unit_tag":
79                target_unit = unit_by_tag(command.target_unit_tag)
80                target = _NotReported.TARGET if target_unit is None else target_unit
81            case _:
82                target = None
83        units = _units_reported_under(command.unit_tags, unit_by_tag)
84        return cls(time, AbilityId.read(command.ability_id), units, target, command.queue_command)

An order given to units of this player's.

UnitCommand( time: sc2nachos.GameTime, ability: sc2nachos.AbilityId, units: sc2nachos.Units[sc2nachos.Unit[typing.Any]], _target: Union[Target, Literal[<_NotReported.TARGET: 0>], NoneType], queued: bool)

The ability ordered, as the game runs it: an action several types perform reads as that action, whichever type's own id the game names, and a research names its level (in game).

units: sc2nachos.Units[sc2nachos.Unit[typing.Any]]

The units that took the order, leaving out any the game names by a tag it never reported.

queued: bool

Whether the order was queued behind the units' orders instead of replacing them.

target: Target | None
48    @property
49    def target(self) -> Target | None:
50        """The point or unit the order was aimed at, or `None` for an order that takes neither. Raises
51        `NotReportedError` for a unit the game names by a tag it never reports, as it names a mineral field in the fog
52        that a gather was sent to by its snapshot's tag (in game)."""
53        if self._target is _NotReported.TARGET:
54            raise NotReportedError(
55                f"the game names the unit this {self.ability.name} was aimed at by no tag it reports"
56            )
57        return self._target

The point or unit the order was aimed at, or None for an order that takes neither. Raises NotReportedError for a unit the game names by a tag it never reports, as it names a mineral field in the fog that a gather was sent to by its snapshot's tag (in game).

known_target: Target | None
59    @property
60    def known_target(self) -> Target | None:
61        """`target`, or `None` where `target` raises. `None` also for an order aimed at nothing; `target` tells the
62        two apart."""
63        return None if self._target is _NotReported.TARGET else self._target

target, or None where target raises. None also for an order aimed at nothing; target tells the two apart.

class UnknownActionResultError(sc2nachos._shared.readable_int_enum.UnknownValueError):
12class UnknownActionResultError(UnknownValueError):
13    """The game answered with a result `ActionResult` lacks, added by a protocol release newer than the one it was
14    generated from. Regenerate it with `tools/generate_action_results.py`."""
15
16    def __init__(self, enum: type[ReadableIntEnum], value: int) -> None:
17        super().__init__(enum, value)
18        self.args = (
19            f"ActionResult has no member for the result {value} the game answered with, so it is older than the "
20            f"game: regenerate it with tools/generate_action_results.py",
21        )

The game answered with a result ActionResult lacks, added by a protocol release newer than the one it was generated from. Regenerate it with tools/generate_action_results.py.

UnknownActionResultError( enum: type[sc2nachos._shared.readable_int_enum.ReadableIntEnum], value: int)
16    def __init__(self, enum: type[ReadableIntEnum], value: int) -> None:
17        super().__init__(enum, value)
18        self.args = (
19            f"ActionResult has no member for the result {value} the game answered with, so it is older than the "
20            f"game: regenerate it with tools/generate_action_results.py",
21        )
args
@final
@dataclass(frozen=True, slots=True)
class ValueScore:
61@final
62@dataclass(frozen=True, slots=True)
63class ValueScore:
64    """The cost of units and structures, minerals and vespene together."""
65
66    units: float
67    structures: float
68
69    @property
70    def total(self) -> float:
71        """The value of the units and structures together."""
72        return self.units + self.structures

The cost of units and structures, minerals and vespene together.

ValueScore(units: float, structures: float)
units: float
structures: float
total: float
69    @property
70    def total(self) -> float:
71        """The value of the units and structures together."""
72        return self.units + self.structures

The value of the units and structures together.

@final
@dataclass(frozen=True, slots=True)
class VitalScore:
42@final
43@dataclass(frozen=True, slots=True)
44class VitalScore:
45    """An amount of damage or healing, split by what it took from or gave back."""
46
47    life: float
48    shields: float
49    energy: float
50
51    @property
52    def total(self) -> float:
53        """The sum over life, shields and energy."""
54        return self.life + self.shields + self.energy
55
56    @classmethod
57    def _from_proto(cls, proto: score_pb2.VitalScoreDetails) -> Self:
58        return cls(proto.life, proto.shields, proto.energy)

An amount of damage or healing, split by what it took from or gave back.

VitalScore(life: float, shields: float, energy: float)
life: float
shields: float
energy: float
total: float
51    @property
52    def total(self) -> float:
53        """The sum over life, shields and energy."""
54        return self.life + self.shields + self.energy

The sum over life, shields and energy.