sc2ai 0.0.8 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/data/sc2ai/protocol/common.proto +1 -1
  3. data/data/sc2ai/protocol/data.proto +4 -1
  4. data/data/sc2ai/protocol/debug.proto +5 -1
  5. data/data/sc2ai/protocol/error.proto +2 -1
  6. data/data/sc2ai/protocol/query.proto +1 -1
  7. data/data/sc2ai/protocol/raw.proto +9 -7
  8. data/data/sc2ai/protocol/sc2api.proto +21 -7
  9. data/data/sc2ai/protocol/score.proto +2 -1
  10. data/data/sc2ai/protocol/spatial.proto +2 -1
  11. data/data/sc2ai/protocol/ui.proto +5 -2
  12. data/lib/docker_build/Dockerfile.ruby +5 -3
  13. data/lib/sc2ai/api/ability_id.rb +6 -1
  14. data/lib/sc2ai/api/data.rb +15 -0
  15. data/lib/sc2ai/api/tech_tree.rb +1 -1
  16. data/lib/sc2ai/api/tech_tree_data.rb +54 -3
  17. data/lib/sc2ai/cli/cli.rb +1 -1
  18. data/lib/sc2ai/connection.rb +1 -1
  19. data/lib/sc2ai/local_play/client_manager.rb +2 -0
  20. data/lib/sc2ai/local_play/match.rb +0 -11
  21. data/lib/sc2ai/overrides/async/process/child.rb +1 -1
  22. data/lib/sc2ai/paths.rb +1 -1
  23. data/lib/sc2ai/player/debug.rb +36 -2
  24. data/lib/sc2ai/player/{geometry.rb → geo.rb} +41 -5
  25. data/lib/sc2ai/player/units.rb +32 -2
  26. data/lib/sc2ai/player.rb +8 -48
  27. data/lib/sc2ai/ports.rb +0 -1
  28. data/lib/sc2ai/protocol/_meta_documentation.rb +249 -4
  29. data/lib/sc2ai/protocol/common_pb.rb +2 -23
  30. data/lib/sc2ai/protocol/data_pb.rb +2 -23
  31. data/lib/sc2ai/protocol/debug_pb.rb +2 -24
  32. data/lib/sc2ai/protocol/error_pb.rb +2 -23
  33. data/lib/sc2ai/protocol/extensions/color.rb +1 -1
  34. data/lib/sc2ai/protocol/extensions/point_2_d.rb +4 -0
  35. data/lib/sc2ai/protocol/extensions/position.rb +1 -1
  36. data/lib/sc2ai/protocol/extensions/unit.rb +45 -4
  37. data/lib/sc2ai/protocol/extensions/unit_type_data.rb +8 -0
  38. data/lib/sc2ai/protocol/query_pb.rb +2 -24
  39. data/lib/sc2ai/protocol/raw_pb.rb +2 -24
  40. data/lib/sc2ai/protocol/sc2api_pb.rb +2 -31
  41. data/lib/sc2ai/protocol/score_pb.rb +2 -23
  42. data/lib/sc2ai/protocol/spatial_pb.rb +2 -24
  43. data/lib/sc2ai/protocol/ui_pb.rb +2 -23
  44. data/lib/sc2ai/unit_group/action_ext.rb +2 -2
  45. data/lib/sc2ai/unit_group/filter_ext.rb +36 -1
  46. data/lib/sc2ai/version.rb +1 -1
  47. data/lib/sc2ai.rb +0 -7
  48. data/lib/templates/new/.ladderignore +15 -5
  49. data/lib/templates/new/api/raw.proto +1 -1
  50. data/lib/templates/new/api/ui.proto +1 -1
  51. data/lib/templates/new/my_bot.rb.tt +1 -1
  52. data/sig/minaswan.rbs +10323 -0
  53. data/sig/sc2ai.rbs +1170 -980
  54. metadata +52 -25
  55. data/lib/sc2ai/data.rb +0 -101
  56. data/lib/sc2ai/protocol/extensions/unit_type.rb +0 -9
data/sig/sc2ai.rbs CHANGED
@@ -23,86 +23,10 @@ module Sc2
23
23
  class Error < StandardError
24
24
  end
25
25
 
26
- # Holds game data from tech tree and Api::ResponseData
27
- # Called once on game start
28
- class Data
29
- # sord warn - Api::ResponseData wasn't able to be resolved to a constant in this project
30
- # _@param_ `data`
31
- def initialize: (Api::ResponseData data) -> void
32
-
33
- # sord warn - Api::AbilityData wasn't able to be resolved to a constant in this project
34
- # sord warn - "Hash<Integer, Api::AbilityData] indexed data" does not appear to be a type
35
- # Indexes ability data by ability id
36
- #
37
- # _@param_ `abilities`
38
- #
39
- # _@return_ — Hash<Integer, Api::AbilityData] indexed data
40
- def abilities_from_proto: (::Array[Api::AbilityData] abilities) -> SORD_ERROR_HashIntegerApiAbilityDataindexeddata
41
-
42
- # Indexes unit data by id
43
- #
44
- # _@param_ `units`
45
- #
46
- # _@return_ — indexed data
47
- def units_from_proto: (::Array[Api::UnitTypeData] units) -> ::Hash[Integer, Api::UnitTypeData]
48
-
49
- # sord warn - Api::UpgradeData wasn't able to be resolved to a constant in this project
50
- # sord warn - "Hash<Integer, Api::UpgradeData] indexed data" does not appear to be a type
51
- # Indexes upgrades data by id
52
- #
53
- # _@param_ `upgrades`
54
- #
55
- # _@return_ — Hash<Integer, Api::UpgradeData] indexed data
56
- def upgrades_from_proto: (::Array[Api::UpgradeData] upgrades) -> SORD_ERROR_HashIntegerApiUpgradeDataindexeddata
57
-
58
- # sord omit - no YARD type given for "effects", using untyped
59
- # sord omit - no YARD return type given, using untyped
60
- def effects_from_proto: (untyped effects) -> untyped
61
-
62
- # sord omit - no YARD type given for "buffs", using untyped
63
- # sord omit - no YARD return type given, using untyped
64
- def buffs_from_proto: (untyped buffs) -> untyped
65
-
66
- # sord omit - no YARD return type given, using untyped
67
- # Overrides unit data from api to implement fixes or change context
68
- # i.e. Api::UnitTypeId::ORBITALCOMMAND cost is cost-to-upgrade instead of CC + Orbital combined cost.
69
- # Run once. Depends on all data already being set.
70
- def override_unit_data: () -> untyped
71
-
72
- # sord omit - no YARD return type given, using untyped
73
- # Fixes mineral_cost, vespene_cost and food_required values
74
- def correct_unit_type_costs: () -> untyped
75
-
76
- # sord omit - no YARD return type given, using untyped
77
- # Fixes mineral_cost_sum, vespene_cost_sum
78
- def correct_unit_type_sum: () -> untyped
79
-
80
- # sord warn - Api::AbilityData wasn't able to be resolved to a constant in this project
81
- # _@return_ — AbilityId => AbilityData
82
- attr_accessor abilities: (::Hash[Integer, Api::AbilityData] | untyped)
83
-
84
- # _@return_ — UnitId => UnitTypeData
85
- attr_accessor units: (::Hash[Integer, Api::UnitTypeData] | untyped)
86
-
87
- # sord warn - Api::UpgradeData wasn't able to be resolved to a constant in this project
88
- # _@return_ — UpgradeId => UpgradeData
89
- attr_accessor upgrades: (::Hash[Integer, Api::UpgradeData] | untyped)
90
-
91
- # sord omit - no YARD type given for :buffs, using untyped
92
- # Not particularly useful data. Just use BuffId directly
93
- # @return [Hash<Integer, Api::BuffData>] BuffId => BuffData
94
- attr_accessor buffs: untyped
95
-
96
- # sord omit - no YARD type given for :effects, using untyped
97
- # Not particularly useful data. Just use EffectId directly
98
- # @return [Hash<Integer, Api::EffectData>] EffectId => EffectData
99
- attr_accessor effects: untyped
100
- end
101
-
102
26
  # Helps determine common paths to sc2 install dir, executable and maps.
103
27
  # It maintains some semblance of compatibility with python-sc2 config
104
28
  #
105
- # ENV['SC2PATH'] can be set manually to Starcraft 2 base directory for Linux
29
+ # ENV['SC2PATH'] can be set manually to StarCraft 2 base directory for Linux
106
30
  # ENV['SC2PF'] can and should be manually set to "WineLinux" when running Wine
107
31
  # Credit to Hannes, Sean and Burny for setting the standard
108
32
  class Paths
@@ -453,28 +377,8 @@ module Sc2
453
377
  # _@see_ `#join_game` — for options
454
378
  attr_accessor interface_options: ::Hash[untyped, untyped]
455
379
 
456
- # sord warn - Api::Race::NoRace wasn't able to be resolved to a constant in this project
457
- # sord warn - Api::Race::Terran wasn't able to be resolved to a constant in this project
458
- # sord warn - Api::Race::Zerg wasn't able to be resolved to a constant in this project
459
- # sord warn - Api::Race::Protoss wasn't able to be resolved to a constant in this project
460
- # sord warn - Api::Race::Random wasn't able to be resolved to a constant in this project
461
- # sord warn - Api::Race::NoRace wasn't able to be resolved to a constant in this project
462
- # sord warn - Api::Race::Terran wasn't able to be resolved to a constant in this project
463
- # sord warn - Api::Race::Zerg wasn't able to be resolved to a constant in this project
464
- # sord warn - Api::Race::Protoss wasn't able to be resolved to a constant in this project
465
- # sord warn - Api::Race::Random wasn't able to be resolved to a constant in this project
466
- # _@return_ — if Observer
467
- #
468
- # _@return_ — if is_a? Bot, Human, BotProcess
469
- #
470
- # _@return_ — if is_a? Bot, Human, BotProcess
471
- #
472
- # _@return_ — if is_a? Bot, Human, BotProcess
473
- #
474
- # _@return_ — if specified random and in-game race hasn't been scouted yet
475
- #
476
- # _@return_ — if is_a? forgetful person
477
- attr_accessor race: (Api::Race::NoRace | Api::Race::Terran | Api::Race::Zerg | Api::Race::Protoss | Api::Race::Random)?
380
+ # _@return_ Api::Race enum
381
+ attr_accessor race: Integer
478
382
 
479
383
  # _@return_ — in-game name
480
384
  attr_accessor name: String
@@ -766,6 +670,35 @@ module Sc2
766
670
  # _@param_ `color` — default white
767
671
  def debug_draw_sphere: (point: Api::Point, ?radius: Float, ?color: Api::Color?) -> void
768
672
 
673
+ # sord warn - Api::Position wasn't able to be resolved to a constant in this project
674
+ # sord omit - no YARD return type given, using untyped
675
+ # Renders a block on the floor, drawn by 4 lines
676
+ # Pass in either a pos (Position/Unit) or exact x * y coordinates
677
+ # Optional indentation adds padding on borders inward
678
+ #
679
+ # _@param_ `pos`
680
+ #
681
+ # _@param_ `x`
682
+ #
683
+ # _@param_ `y`
684
+ #
685
+ # _@param_ `color`
686
+ #
687
+ # _@param_ `indent` — default 0.05. should be lower than < 1.0
688
+ #
689
+ # ```ruby
690
+ # debug_tile(x: 12.3, y: 4.56, color: Api::Color.new(r: 255, g: 0, b: 0))
691
+ # debug_tile(some_unit)
692
+ # debug_tile(some_unit.pos)
693
+ # ```
694
+ def debug_tile: (
695
+ ?(Api::Unit | Api::Position)? pos,
696
+ ?x: (Float | Integer)?,
697
+ ?y: (Float | Integer)?,
698
+ ?color: Api::Color?,
699
+ ?indent: Float
700
+ ) -> untyped
701
+
769
702
  # Possible values:
770
703
  # Api::DebugGameState::Show_map
771
704
  # Api::DebugGameState::Control_enemy
@@ -1058,12 +991,16 @@ module Sc2
1058
991
  # _@return_ — unit tag array
1059
992
  def unit_tags_from_source: ((Integer | ::Array[Integer] | Api::Unit | Sc2::UnitGroup) source) -> ::Array[Integer]
1060
993
 
994
+ # sord omit - no YARD type given for "upgrade_id", using untyped
995
+ # Returns true if this upgrade has finished researching
996
+ def upgrade_completed?: (untyped upgrade_id) -> bool
997
+
1061
998
  # Returns the upgrade ids which are researching or queued
1062
999
  # Not set for enemy.
1063
1000
  def upgrades_in_progress: () -> ::Array[Integer]
1064
1001
 
1065
1002
  # sord omit - no YARD type given for "upgrade_id", using untyped
1066
- # Returns the upgrade ids which are researching or queued
1003
+ # Returns true if the upgrade is busy researching
1067
1004
  def upgrade_in_progress?: (untyped upgrade_id) -> bool
1068
1005
 
1069
1006
  # sord omit - no YARD type given for "unit_type_id", using untyped
@@ -1164,7 +1101,7 @@ module Sc2
1164
1101
  attr_accessor previous: (Sc2::Player::PreviousState | untyped)
1165
1102
 
1166
1103
  # _@return_ — geo and map helper functions
1167
- attr_accessor geo: (Sc2::Player::Geometry | untyped)
1104
+ attr_accessor geo: (Sc2::Player::Geo | untyped)
1168
1105
  end
1169
1106
 
1170
1107
  # A specialized type of player instance which each player has one of
@@ -1187,12 +1124,16 @@ module Sc2
1187
1124
  # _@return_ — Api::Race if race detected, false otherwise
1188
1125
  def detect_race_from_units: () -> (bool | Integer)
1189
1126
 
1127
+ # sord omit - no YARD type given for "upgrade_id", using untyped
1128
+ # Returns true if this upgrade has finished researching
1129
+ def upgrade_completed?: (untyped upgrade_id) -> bool
1130
+
1190
1131
  # Returns the upgrade ids which are researching or queued
1191
1132
  # Not set for enemy.
1192
1133
  def upgrades_in_progress: () -> ::Array[Integer]
1193
1134
 
1194
1135
  # sord omit - no YARD type given for "upgrade_id", using untyped
1195
- # Returns the upgrade ids which are researching or queued
1136
+ # Returns true if the upgrade is busy researching
1196
1137
  def upgrade_in_progress?: (untyped upgrade_id) -> bool
1197
1138
 
1198
1139
  # sord omit - no YARD type given for "unit_type_id", using untyped
@@ -1338,924 +1279,962 @@ module Sc2
1338
1279
  def initialize: (?name: String?) -> void
1339
1280
  end
1340
1281
 
1341
- # WARNING! Debug methods will not be available on Ladder
1342
- # This provides debug helper functions for RequestDebug
1343
- module Debug
1344
- # sord warn - Api::DebugCommand wasn't able to be resolved to a constant in this project
1345
- # Queues debug command for performing later
1346
- #
1347
- # _@param_ `debug_command`
1348
- def queue_debug_command: (Api::DebugCommand debug_command) -> void
1282
+ # Holds map and geography helper functions
1283
+ class Geo
1284
+ # sord omit - no YARD type given for "bot", using untyped
1285
+ def initialize: (untyped _bot) -> void
1349
1286
 
1350
- # sord warn - Size wasn't able to be resolved to a constant in this project
1351
- # Prints debug text top left corner
1352
- #
1353
- # _@param_ `text` — will respect newlines
1287
+ # Gets the map tile width. Range is 1-255.
1288
+ # Effected by crop_to_playable_area
1289
+ def map_width: () -> Integer
1290
+
1291
+ # Gets the map tile height. Range is 1-255.
1292
+ # Effected by crop_to_playable_area
1293
+ def map_height: () -> Integer
1294
+
1295
+ # Center of the map
1296
+ def map_center: () -> Api::Point2D
1297
+
1298
+ # Returns zero to map_width as range
1354
1299
  #
1355
- # _@param_ `size` of font, default 14px
1356
- def debug_print: (String text, ?size: Size) -> void
1300
+ # _@return_0 to map_width
1301
+ def map_range_x: () -> ::Range[untyped]
1357
1302
 
1358
- # sord warn - Size wasn't able to be resolved to a constant in this project
1359
- # Prints text on screen from top and left
1303
+ # Returns zero to map_height as range
1360
1304
  #
1361
- # _@param_ `text` will respect newlines
1305
+ # _@return_0 to map_height
1306
+ def map_range_y: () -> ::Range[untyped]
1307
+
1308
+ # Returns zero to map_width-1 as range
1309
+ def map_tile_range_x: () -> ::Range[untyped]
1310
+
1311
+ # Returns zero to map_height-1 as range
1312
+ def map_tile_range_y: () -> ::Range[untyped]
1313
+
1314
+ # Returns whether a x/y (integer) is placeable as per minimap image data.
1315
+ # It does not say whether a position is occupied by another building.
1316
+ # One pixel covers one whole block. Corrects floats on your behalf
1362
1317
  #
1363
- # _@param_ `left_percent` — range 0..100. percent from left of screen
1318
+ # _@param_ `x`
1364
1319
  #
1365
- # _@param_ `top_percent` — range 0..100. percent from top of screen
1320
+ # _@param_ `y`
1366
1321
  #
1367
- # _@param_ `color` default white
1322
+ # _@return_whether tile is placeable?
1368
1323
  #
1369
- # _@param_ `size`of font, default 14px
1370
- def debug_text_screen: (
1371
- String text,
1372
- ?left_percent: Numeric,
1373
- ?top_percent: Numeric,
1374
- ?color: Api::Color?,
1375
- ?size: Size
1376
- ) -> void
1324
+ # _@see_ `Sc2::Player#pathable?`for detecting obstructions
1325
+ def placeable?: (x: (Float | Integer), y: (Float | Integer)) -> bool
1377
1326
 
1378
- # sord warn - Size wasn't able to be resolved to a constant in this project
1379
- # Prints text on screen at 3d world position
1380
- #
1381
- # _@param_ `text` will respect newlines
1327
+ # sord warn - Numo::Bit wasn't able to be resolved to a constant in this project
1328
+ # Returns a parsed placement_grid from bot.game_info.start_raw.
1329
+ # Each value in [row][column] holds a boolean value represented as an integer
1330
+ # It does not say whether a position is occupied by another building.
1331
+ # One pixel covers one whole block. Rounds fractionated positions down.
1332
+ def parsed_placement_grid: () -> Numo::Bit
1333
+
1334
+ # Whether this tile is where an expansion is supposed to be placed.
1335
+ # To see if a unit/structure is blocking an expansion, pass their coordinates to this method.
1382
1336
  #
1383
- # _@param_ `point` — point in the world, i.e. unit.pos
1337
+ # _@param_ `x`
1384
1338
  #
1385
- # _@param_ `color` — default white
1339
+ # _@param_ `y`
1386
1340
  #
1387
- # _@param_ `size` of font, default 14px
1388
- def debug_text_world: (
1389
- String text,
1390
- point: Api::Point,
1391
- ?color: Api::Color?,
1392
- ?size: Size
1393
- ) -> void
1341
+ # _@return_true if location has creep on it
1342
+ def expo_placement?: (x: (Float | Integer), y: (Float | Integer)) -> bool
1394
1343
 
1395
- # Draws a line between two Api::Point's for color
1344
+ # sord warn - Numo::Bit wasn't able to be resolved to a constant in this project
1345
+ # Returns a grid where only the expo locations are marked
1346
+ def expo_placement_grid: () -> Numo::Bit
1347
+
1348
+ # sord warn - Numo::Bit wasn't able to be resolved to a constant in this project
1349
+ # Returns a grid where only placement obstructions are marked
1350
+ # includes Tumors and lowered Supply Depots
1351
+ def placement_obstruction_grid: () -> Numo::Bit
1352
+
1353
+ # sord warn - Numo::Bit wasn't able to be resolved to a constant in this project
1354
+ # Returns a grid where powered locations are marked true
1355
+ def parsed_power_grid: () -> Numo::Bit
1356
+
1357
+ # Returns whether a x/y block is powered. Only fully covered blocks are true.
1358
+ # One pixel covers one whole block. Corrects float inputs on your behalf.
1396
1359
  #
1397
- # _@param_ `p0` — the first point
1360
+ # _@param_ `x`
1398
1361
  #
1399
- # _@param_ `p1` — the second point
1362
+ # _@param_ `y`
1400
1363
  #
1401
- # _@param_ `color` default white
1402
- def debug_draw_line: (p0: Api::Point, p1: Api::Point, ?color: Api::Color?) -> void
1364
+ # _@return_true if location is powered
1365
+ def powered?: (x: (Float | Integer), y: (Float | Integer)) -> bool
1403
1366
 
1404
- # Draws a box around position xy at base of z. Good for structure boxing.
1367
+ # Returns whether a x/y block is pathable as per minimap
1368
+ # One pixel covers one whole block. Corrects float inputs on your behalf.
1405
1369
  #
1406
- # _@param_ `point`
1370
+ # _@param_ `x`
1407
1371
  #
1408
- # _@param_ `radius` — default one tile wide, 1.0
1372
+ # _@param_ `y`
1409
1373
  #
1410
- # _@param_ `color` default white. min(r,b) is used for both r&b
1374
+ # _@return_whether tile is patahble
1375
+ def pathable?: (x: (Float | Integer), y: (Float | Integer)) -> bool
1376
+
1377
+ # sord warn - Numo::Bit wasn't able to be resolved to a constant in this project
1378
+ # Gets the pathable areas as things stand right now in the game
1379
+ # Buildings, minerals, structures, etc. all result in a nonpathable place
1380
+ #
1381
+ # _@return_ — Numo array
1411
1382
  #
1412
1383
  # ```ruby
1413
- # # Draws a box on structure placement grid
1414
- # debug_draw_box(point: unit.pos, radius: unit.footprint_radius)
1384
+ # parsed_pathing_grid[0,0] # reads bottom left corner
1385
+ # # use helper function #pathable
1386
+ # pathable?(x: 0, y: 0) # reads bottom left corner
1415
1387
  # ```
1416
- #
1417
- # _@note_ — Api::Color RGB is broken for this command. Will use min(r,b)
1418
- #
1419
- # _@note_ — Z index is elevated 0.02 so the line is visible and doesn't clip through terrain
1420
- def debug_draw_box: (point: Api::Point, ?radius: Float, ?color: Api::Color?) -> void
1388
+ def parsed_pathing_grid: () -> Numo::Bit
1421
1389
 
1422
- # Debug draws a sphere at position with a radius in color
1390
+ # sord omit - no YARD return type given, using untyped
1391
+ # Clears pathing-grid dependent objects like placements.
1392
+ # Called when pathing grid gets updated
1393
+ def clear_cached_pathing_grid: () -> untyped
1394
+
1395
+ # Returns the terrain height (z) at position x and y
1396
+ # Granularity is per placement grid block, since this comes from minimap image data.
1423
1397
  #
1424
- # _@param_ `point`
1398
+ # _@param_ `x`
1425
1399
  #
1426
- # _@param_ `radius` — default one tile wide, 1.0
1400
+ # _@param_ `y`
1427
1401
  #
1428
- # _@param_ `color` default white
1429
- def debug_draw_sphere: (point: Api::Point, ?radius: Float, ?color: Api::Color?) -> void
1402
+ # _@return_z axis position between -16 and 16
1403
+ def terrain_height: (x: (Float | Integer), y: (Float | Integer)) -> Float
1430
1404
 
1431
- # Possible values:
1432
- # Api::DebugGameState::Show_map
1433
- # Api::DebugGameState::Control_enemy
1434
- # Api::DebugGameState::Food
1435
- # Api::DebugGameState::Free
1436
- # Api::DebugGameState::All_resources
1437
- # Api::DebugGameState::God
1438
- # Api::DebugGameState::Minerals
1439
- # Api::DebugGameState::Gas
1440
- # Api::DebugGameState::Cooldown
1441
- # Api::DebugGameState::Tech_tree
1442
- # Api::DebugGameState::Upgrade
1443
- # Api::DebugGameState::Fast_build
1405
+ # Returns the terrain height (z) at position x and y for a point
1444
1406
  #
1445
- # _@param_ `command` — one of Api::DebugGameState::*
1446
- def debug_game_state: (Integer command) -> void
1407
+ # _@param_ `position`
1408
+ #
1409
+ # _@return_ — z axis position between -16 and 16
1410
+ def terrain_height_for_pos: (Sc2::Position position) -> Float
1447
1411
 
1448
- # Spawns a quantity of units under an owner at position given
1412
+ # sord warn - Numo::SFloat wasn't able to be resolved to a constant in this project
1413
+ # Returns a parsed terrain_height from bot.game_info.start_raw.
1414
+ # Each value in [row][column] holds a float value which is the z height
1449
1415
  #
1450
- # _@param_ `unit_type_id` Api::UnitTypeId::*
1416
+ # _@return_Numo array
1417
+ def parsed_terrain_height: () -> Numo::SFloat
1418
+
1419
+ # Returns one of three Integer visibility indicators at tile for x & y
1451
1420
  #
1452
- # _@param_ `owner` — typically you are 1 and 2 is enemy (see @common.player_id)
1421
+ # _@param_ `x`
1453
1422
  #
1454
- # _@param_ `pos` — position in 2d
1423
+ # _@param_ `y`
1455
1424
  #
1456
- # _@param_ `quantity` default 1
1457
- def debug_create_unit: (
1458
- unit_type_id: Integer,
1459
- owner: Integer,
1460
- pos: Api::Point2D,
1461
- ?quantity: Integer
1462
- ) -> void
1425
+ # _@return_0=Hidden,1= Snapshot,2=Visible
1426
+ def visibility: (x: (Float | Integer), y: (Float | Integer)) -> Integer
1463
1427
 
1464
- # Kills a target unit or unit tag
1428
+ # Returns whether the point (tile) is currently in vision
1465
1429
  #
1466
- # _@param_ `unit_tags` — one or many unit tags to kill
1467
- def debug_kill_unit: (unit_tags: (Integer | ::Array[Integer])) -> void
1468
-
1469
- # Hangs, crashes and exits the Sc2 client. DO NOT USE.
1430
+ # _@param_ `x`
1470
1431
  #
1471
- # _@param_ `test` — one of Api::DebugTestProcess::Test::Crash, Api::DebugTestProcess::Test::Hang, Api::DebugTestProcess::Test::Exit
1432
+ # _@param_ `y`
1472
1433
  #
1473
- # _@param_ `delay_ms` default 0, how long this test is delayed
1474
- def debug_test_process: (test: Integer, ?delay_ms: Integer) -> void
1434
+ # _@return_true if fog is completely lifted
1435
+ def map_visible?: (x: (Float | Integer), y: (Float | Integer)) -> bool
1475
1436
 
1476
- # sord omit - no YARD return type given, using untyped
1477
- # Useful only for single-player "curriculum" maps
1437
+ # Returns whether point (tile) has been seen before or currently visible
1478
1438
  #
1479
- # _@param_ `score` — sets the score
1480
- def debug_set_score: (?score: Float) -> untyped
1481
-
1482
- # Ends game with a specified result of either Surrender or DeclareVictory
1439
+ # _@param_ `x`
1483
1440
  #
1484
- # _@param_ `end_result` — either 1/2. Api::DebugEndGame::EndResult::Surrender or Api::DebugEndGame::EndResult::DeclareVictory
1485
- def debug_end_game: (end_result: Integer) -> void
1441
+ # _@param_ `y`
1442
+ #
1443
+ # _@return_ — true if partially or fully lifted fog
1444
+ def map_seen?: (x: (Float | Integer), y: (Float | Integer)) -> bool
1486
1445
 
1487
- # Sets unit_value Energy, Life or Shields for a specific unit tag to given value
1446
+ # Returns whether the point (tile) has never been seen/explored before (dark fog)
1488
1447
  #
1489
- # _@param_ `unit_tag`
1448
+ # _@param_ `x`
1490
1449
  #
1491
- # _@param_ `unit_value` — 1=Energy,2=Life,3=Shields one of Api::DebugSetUnitValue::UnitValue::*
1450
+ # _@param_ `y`
1492
1451
  #
1493
- # _@param_ `value` the value which the attribute will be set to
1494
- def debug_set_unit_value: (unit_tag: Integer, unit_value: Integer, value: Float) -> void
1495
-
1496
- # sord omit - no YARD return type given, using untyped
1497
- # Sends actions via api and flushes debug_commands_queue
1498
- def perform_debug_commands: () -> untyped
1499
-
1500
- # Empties and resets @debug_queue
1501
- def clear_debug_command_queue: () -> void
1452
+ # _@return_true if fog of war is fully dark
1453
+ def map_unseen?: (x: (Float | Integer), y: (Float | Integer)) -> bool
1502
1454
 
1503
- # sord omit - no YARD type given for :debug_command_queue, using untyped
1504
- # Holds debug commands which will be queued off each time we step forward
1505
- attr_accessor debug_command_queue: untyped
1455
+ # sord warn - Numo::SFloat wasn't able to be resolved to a constant in this project
1456
+ # Returns a parsed map_state.visibility from bot.observation.raw_data.
1457
+ # Each value in [row][column] holds one of three integers (0,1,2) to flag a vision type
1458
+ #
1459
+ # _@return_ — Numo array
1460
+ #
1461
+ # _@see_ `#visibility` — for reading from this value
1462
+ def parsed_visibility_grid: () -> Numo::SFloat
1506
1463
 
1507
- # sord warn - Api::Action wasn't able to be resolved to a constant in this project
1508
- # sord warn - Api::Action wasn't able to be resolved to a constant in this project
1509
- attr_accessor debug_commands_queue: ::Array[Api::Action]
1510
- end
1464
+ # Returns whether a tile has creep on it, as per minimap
1465
+ # One pixel covers one whole block. Corrects float inputs on your behalf.
1466
+ #
1467
+ # _@param_ `x`
1468
+ #
1469
+ # _@param_ `y`
1470
+ #
1471
+ # _@return_ — true if location has creep on it
1472
+ def creep?: (x: (Float | Integer), y: (Float | Integer)) -> bool
1511
1473
 
1512
- # Helper methods for working with units
1513
- module Units
1514
- # Returns the upgrade ids which are researching or queued
1515
- # Not set for enemy.
1516
- def upgrades_in_progress: () -> ::Array[Integer]
1474
+ # sord warn - Numo::Bit wasn't able to be resolved to a constant in this project
1475
+ # Provides parsed minimap representation of creep spread
1476
+ # Caches for 4 frames
1477
+ #
1478
+ # _@return_ Numo array
1479
+ def parsed_creep: () -> Numo::Bit
1517
1480
 
1518
- # sord omit - no YARD type given for "upgrade_id", using untyped
1519
- # Returns the upgrade ids which are researching or queued
1520
- def upgrade_in_progress?: (untyped upgrade_id) -> bool
1481
+ # sord warn - Numo::Bit wasn't able to be resolved to a constant in this project
1482
+ # sord omit - no YARD return type given, using untyped
1483
+ # TODO: Remove this method if it has no use. Build points uses this code directly for optimization.
1484
+ # Reduce the dimensions of a grid by merging cells using length x length squares.
1485
+ # Merged cell keeps it's 1 value only if all merged cells are equal to 1, else 0
1486
+ #
1487
+ # _@param_ `input_grid` — Bit grid like parsed_pathing_grid or parsed_placement_grid
1488
+ #
1489
+ # _@param_ `length` — how many cells to merge, i.e. 3 for finding 3x3 placement
1490
+ def divide_grid: (Numo::Bit input_grid, Integer length) -> untyped
1521
1491
 
1522
- # sord omit - no YARD type given for "unit_type_id", using untyped
1523
- # For this unit type, tells you how many are in progress by checking orders for all it's sources.
1524
- def units_in_progress: (untyped unit_type_id) -> Integer
1492
+ # Returns own 2d start position as set by initial camera
1493
+ # This differs from position of first base structure
1494
+ def start_position: () -> Api::Point2D
1525
1495
 
1526
- # Returns static [Api::UnitTypeData] for a unit
1527
- #
1528
- # _@param_ `unit` — Api::UnitTypeId or Api::Unit
1529
- def unit_data: ((Integer | Api::Unit) unit) -> Api::UnitTypeData
1496
+ # Returns the enemy 2d start position
1497
+ def enemy_start_position: () -> Api::Point2D
1530
1498
 
1531
- # sord warn - Api::AbilityData wasn't able to be resolved to a constant in this project
1532
- # Returns static [Api::AbilityData] for an ability
1499
+ # Gets expos and surrounding minerals
1500
+ # The index is a build location for an expo and the value is a UnitGroup, which has minerals and geysers
1533
1501
  #
1534
- # _@param_ `ability_id` Api::AbilityId::*
1535
- def ability_data: (Integer ability_id) -> Api::AbilityData
1536
-
1537
- # sord warn - Api::UpgradeData wasn't able to be resolved to a constant in this project
1538
- # Returns static [Api::UpgradeData] for an upgrade id
1502
+ # _@return_Location => UnitGroup of resources (minerals+geysers)
1539
1503
  #
1540
- # _@param_ `upgrade_id` — Api::UpgradeId::*
1541
- def upgrade_data: (Integer upgrade_id) -> Api::UpgradeData
1504
+ # ```ruby
1505
+ # random_expo = geo.expansions.keys.sample #=> Point2D
1506
+ # expo_resources = geo.expansions[random_expo] #=> UnitGroup
1507
+ # alive_minerals = expo_resources.minerals & neutral.minerals
1508
+ # geysers = expo_resources.geysers
1509
+ # ```
1510
+ def expansions: () -> ::Hash[Api::Point2D, UnitGroup]
1542
1511
 
1543
- # Checks unit data for an attribute value
1512
+ # Returns a list of 2d points for expansion build locations
1513
+ # Does not contain mineral info, but the value can be checked against geo.expansions
1544
1514
  #
1545
- # _@param_ `unit` Api::UnitTypeId or Api::Unit
1515
+ # _@return_points where expansions can be placed
1546
1516
  #
1547
- # _@param_ `attribute` — Api::Attribute, i.e. Api::Attribute::Mechanical or :Mechanical
1517
+ # ```ruby
1518
+ # random_expo = expansion_points.sample
1519
+ # expo_resources = geo.expansions[random_expo]
1520
+ # ```
1521
+ def expansion_points: () -> ::Array[Api::Point2D]
1522
+
1523
+ # Returns a slice of #expansions where a base hasn't been built yet
1524
+ # The has index is a build position and the value is a UnitGroup of resources for the base
1548
1525
  #
1549
- # _@return_ — whether unit has attribute
1526
+ # _@return_ — Location => UnitGroup of resources (minerals+geysers)
1550
1527
  #
1551
1528
  # ```ruby
1552
- # unit_has_attribute?(Api::UnitTypeId::SCV, Api::Attribute::Mechanical)
1553
- # unit_has_attribute?(units.workers.first, :Mechanical)
1554
- # unit_has_attribute?(Api::UnitTypeId::SCV, :Mechanical)
1529
+ # # Lets find the nearest unoccupied expo
1530
+ # expo_pos = expansions_unoccupied.keys.min { |p2d| p2d.distance_to(structures.hq.first) }
1531
+ # # What minerals/geysers does it have?
1532
+ # puts expansions_unoccupied[expo_pos].minerals # or expansions[expo_pos]... => UnitGroup
1533
+ # puts expansions_unoccupied[expo_pos].geysers # or expansions[expo_pos]... => UnitGroup
1555
1534
  # ```
1556
- def unit_has_attribute?: ((Integer | Api::Unit) unit, Symbol attribute) -> bool
1535
+ def expansions_unoccupied: () -> ::Hash[Api::Point2D, UnitGroup]
1557
1536
 
1558
- # Creates a unit group from all_units with matching tag
1537
+ # Gets minerals for a base or base position
1559
1538
  #
1560
- # _@param_ `tags` — array of unit tags
1561
- def unit_group_from_tags: (::Array[Integer] tags) -> Sc2::UnitGroup
1562
-
1563
- # sord omit - no YARD type given for "unit_type_id", using untyped
1564
- # Sums the cost (mineral/vespene/supply) of unit type used for internal spend trackers
1565
- # This is called internally when building/morphing/training
1566
- def subtract_cost: (untyped unit_type_id) -> void
1567
-
1568
- # sord omit - no YARD type given for "unit_type_id:", using untyped
1569
- # sord omit - no YARD type given for "quantity:", using untyped
1570
- # Checks whether you have the resources to construct quantity of unit type
1571
- def can_afford?: (unit_type_id: untyped, ?quantity: untyped) -> bool
1539
+ # _@param_ `base` — base Unit or Position
1540
+ #
1541
+ # _@return_ — UnitGroup of minerals for the base
1542
+ def minerals_for_base: ((Api::Unit | Sc2::Position) base) -> Sc2::UnitGroup
1572
1543
 
1573
- # sord omit - no YARD type given for "upgrade_id", using untyped
1574
- # Checks whether you have the resources to
1575
- def can_afford_upgrade?: (untyped upgrade_id) -> bool
1544
+ # Gets geysers for a base or base position
1545
+ #
1546
+ # _@param_ `base` base Unit or Position
1547
+ #
1548
+ # _@return_ — UnitGroup of geysers for the base
1549
+ def geysers_for_base: ((Api::Unit | Sc2::Position) base) -> Sc2::UnitGroup
1576
1550
 
1577
- # Returns whether Query Available Ability is true for unit and tag
1578
- # Queries API if necessary. Uses batching in the background.
1551
+ # Gets geysers which have not been taken for a base or base position
1579
1552
  #
1580
- # _@param_ `unit_tag`
1553
+ # _@param_ `base` — base Unit or Position
1581
1554
  #
1582
- # _@param_ `ability_id`
1583
- def unit_ability_available?: (unit_tag: Integer, ability_id: Integer) -> bool
1555
+ # _@return_ — UnitGroup of geysers for the base
1556
+ def geysers_open_for_base: ((Api::Unit | Sc2::Position) base) -> Sc2::UnitGroup
1584
1557
 
1585
- # sord warn - Api::Observation wasn't able to be resolved to a constant in this project
1586
- # sord omit - no YARD return type given, using untyped
1587
- # Divides raw data units into various attributes on every step
1588
- # Note, this needs to be fast.
1558
+ # _@param_ `base` base Unit or Position
1589
1559
  #
1590
- # _@param_ `observation`
1591
- def parse_observation_units: (Api::Observation observation) -> untyped
1560
+ # _@return_ — UnitGroup of resources (minerals+geysers)
1561
+ def resources_for_base: ((Api::Unit | Sc2::Position) base) -> Sc2::UnitGroup
1592
1562
 
1593
- # Returns alliance based on whether you are a player or an enemy
1563
+ # Gets gasses for a base or base position
1594
1564
  #
1595
- # _@return_:Self or :Enemy from Api::Alliance
1596
- def own_alliance: () -> Symbol
1565
+ # _@param_ `base` base Unit or Position
1566
+ #
1567
+ # _@return_ — UnitGroup of geysers for the base
1568
+ def gas_for_base: ((Api::Unit | Sc2::Position) base) -> Sc2::UnitGroup
1597
1569
 
1598
- # Returns enemy alliance based on whether you are a player or an enemy
1570
+ # sord omit - no YARD type given for "in_power:", using untyped
1571
+ # Gets buildable point grid for squares of size, i.e. 3 = 3x3 placements
1572
+ # Uses pathing grid internally, to ignore taken positions
1573
+ # Does not query the api and is generally fast.
1599
1574
  #
1600
- # _@return_:Self or :Enemy from Api::Alliance
1601
- def enemy_alliance: () -> Symbol
1575
+ # _@param_ `length` length of the building, 2 for depot/pylon, 3 for rax/gate
1576
+ #
1577
+ # _@param_ `on_creep` — whether this build location should be on creep
1578
+ #
1579
+ # _@return_ — Array of [x,y] tuples
1580
+ def build_coordinates: (length: Integer, ?on_creep: bool, ?in_power: untyped) -> ::Array[::Array[[Float, Float]]]
1602
1581
 
1603
- # sord omit - no YARD type given for "unit", using untyped
1604
- # sord omit - no YARD return type given, using untyped
1605
- # Issues units/structure callbacks for units which are new
1606
- def issue_new_unit_callbacks: (untyped unit) -> untyped
1607
-
1608
- # sord omit - no YARD type given for "unit", using untyped
1609
- # sord omit - no YARD type given for "previous_unit", using untyped
1610
- # sord omit - no YARD return type given, using untyped
1611
- # Issues callbacks for units over time, such as damaged or type changed
1612
- def issue_existing_unit_callbacks: (untyped unit, untyped previous_unit) -> untyped
1613
-
1614
- attr_accessor all_units: (Sc2::UnitGroup | untyped)
1615
-
1616
- # _@return_ — a group of placeholder structures
1617
- attr_accessor units: Sc2::UnitGroup
1618
-
1619
- # sord omit - no YARD type given for :structures, using untyped
1620
- # A full list of all your structures (non-units)
1621
- attr_accessor structures: untyped
1622
-
1623
- # sord omit - no YARD type given for :placeholders, using untyped
1624
- # A list of structures which haven't started
1625
- attr_accessor placeholders: untyped
1626
-
1627
- # _@return_ — a group of neutral units
1628
- attr_accessor neutral: Sc2::UnitGroup
1629
-
1630
- # _@return_ — a group of neutral units
1631
- attr_accessor effects: Sc2::UnitGroup
1632
-
1633
- # sord omit - no YARD type given for :upgrades_completed, using untyped
1634
- # Returns the upgrade ids you have acquired such as weapon upgrade and armor upgrade ids.
1635
- # Shorthand for observation.raw_data.player.upgrade_ids
1636
- attr_reader upgrades_completed: untyped
1637
-
1638
- # sord warn - Api::RadarRing wasn't able to be resolved to a constant in this project
1639
- # sord warn - Api::RadarRing wasn't able to be resolved to a constant in this project
1640
- # _@return_ — an array of radar rings sources
1641
- attr_accessor power_sources: ::Array[Api::RadarRing]
1642
-
1643
- # sord omit - no YARD type given for :radar_rings, using untyped
1644
- # An array of Sensor tower rings as per minimap. It has a `pos` and a `radius`
1645
- attr_accessor radar_rings: untyped
1646
-
1647
- # sord omit - no YARD type given for :_all_seen_unit_tags, using untyped
1648
- # Privately keep track of all seen Unit tags (excl structures) in order to detect new created units
1649
- attr_accessor _all_seen_unit_tags: untyped
1650
-
1651
- # sord omit - no YARD type given for :all_seen_unit_tags, using untyped
1652
- # Privately keep track of all seen Unit tags (excl structures) in order to detect new created units
1653
- attr_accessor all_seen_unit_tags: untyped
1654
-
1655
- # _@return_ — group of Units and Structures effected
1656
- attr_accessor event_units_damaged: Sc2::UnitGroup
1657
-
1658
- # sord omit - no YARD type given for :event_units_destroyed, using untyped
1659
- # TODO: Unit buff disabled, because it calls back too often (mineral in hand). Put back if useful
1660
- # Units (Unit/Structure) on which a new buff_ids appeared this frame
1661
- # See which buffs via: unit.buff_ids - unit.previous.buff_ids
1662
- # Read this on_step. Alternative to callback on_unit_buffed
1663
- # attr_accessor :event_units_buffed
1664
- attr_accessor event_units_destroyed: untyped
1665
- end
1582
+ # Gets a buildable location for a square of length, near target. Chooses from random amount of nearest locations.
1583
+ # For robustness, it is advised to set `random` to, i.e. 3, to allow choosing the 3 nearest possible places, should one location be blocked.
1584
+ # For zerg, the buildable locations are only on creep.
1585
+ # Internally creates a kdtree for building locations based on pathable, placeable and creep
1586
+ #
1587
+ # _@param_ `length` length of the building, 2 for depot/pylon, 3 for rax/gate
1588
+ #
1589
+ # _@param_ `target` near where to find a placement
1590
+ #
1591
+ # _@param_ `random` number of nearest points to randomly choose from. 1 for nearest point.
1592
+ #
1593
+ # _@param_ `in_power` whether this must be on a power field
1594
+ #
1595
+ # _@return_ — buildable location, nil if no buildable location found
1596
+ def build_placement_near: (
1597
+ length: Integer,
1598
+ target: (Api::Unit | Sc2::Position),
1599
+ ?random: Integer,
1600
+ ?in_power: bool
1601
+ ) -> Api::Point2D?
1666
1602
 
1667
- # Holds action list and queues batch
1668
- module Actions
1669
- # sord warn - Api::Action wasn't able to be resolved to a constant in this project
1670
- # Queues action for performing end of step
1603
+ # Draws a grid within a unit (pylon/prisms) radius, then selects points which are placeable
1671
1604
  #
1672
- # _@param_ `action`
1673
- def queue_action: (Api::Action action) -> void
1605
+ # _@param_ `source` — either a pylon or a prism
1606
+ #
1607
+ # _@param_ `unit_type_id` — optionally, the unit you wish to place. Stalkers are widest, so use default nil for a mixed composition warp
1608
+ #
1609
+ # _@return_ — an array of 2d points where theoretically placeable
1610
+ def warp_points: (source: Api::Unit, ?unit_type_id: Api::Unit?) -> ::Array[Api::Point2D]
1674
1611
 
1675
- # sord omit - no YARD return type given, using untyped
1676
- # Queues a Api::ActionRaw. Perform ability on unit_tags optionally on target_world_space_pos/target_unit_tag
1612
+ # Finds points in a straight line.
1613
+ # In a line, on the angle of source->target point, starting at source+offset, in increments find points on the line up to max distance
1677
1614
  #
1678
- # _@param_ `unit_tags`
1615
+ # _@param_ `source` — location from which we go
1679
1616
  #
1680
- # _@param_ `ability_id`
1617
+ # _@param_ `target` — location towards which we go
1681
1618
  #
1682
- # _@param_ `queue_command` — shift+command
1619
+ # _@param_ `offset` — how far from source to start
1683
1620
  #
1684
- # _@param_ `target_world_space_pos`
1621
+ # _@param_ `increment` — how far apart to gets, i.e. increment = unit.radius*2 to space units in a line
1685
1622
  #
1686
- # _@param_ `target_unit_tag`
1687
- def action_raw_unit_command: (
1688
- unit_tags: ::Array[Integer],
1689
- ability_id: Integer,
1690
- ?queue_command: bool,
1691
- ?target_world_space_pos: Api::Point2D?,
1692
- ?target_unit_tag: Integer?
1693
- ) -> untyped
1694
-
1695
- # sord omit - no YARD return type given, using untyped
1696
- # Queues a Api::ActionRawUnitCommand.
1697
- # Send accepts a Api::Unit, tag or tags and targets Api::Point2D or unit.tag
1623
+ # _@param_ `count` — number of points to retrieve
1698
1624
  #
1699
- # _@param_ `units` can be an Api::Unit, array of Api::Unit#tag or single tag
1625
+ # _@return_points up to a max of count
1626
+ def points_nearest_linear: (
1627
+ source: Sc2::Position,
1628
+ target: Sc2::Position,
1629
+ ?offset: Float,
1630
+ ?increment: Float,
1631
+ ?count: Integer
1632
+ ) -> ::Array[Api::Point2D]
1633
+
1634
+ # Gets a random point near a location with a positive/negative offset applied to both x and y
1700
1635
  #
1701
- # _@param_ `ability_id`
1636
+ # _@param_ `pos`
1702
1637
  #
1703
- # _@param_ `target` — is a unit, unit tag or a Api::Point2D
1638
+ # _@param_ `offset`
1704
1639
  #
1705
- # _@param_ `queue_command` — shift+command
1706
- def action: (
1707
- units: (::Array[Integer] | Integer | Api::Unit),
1708
- ability_id: Integer,
1709
- ?target: (Api::Unit | Integer | Api::Point2D)?,
1710
- ?queue_command: bool
1711
- ) -> untyped
1640
+ # ```ruby
1641
+ # Randomly randomly adjust both x and y by a range of -3.5 or +3.5
1642
+ # geo.point_random_near(point: structures.hq.first, offset: 3.5)
1643
+ # ```
1644
+ def point_random_near: (pos: Sc2::Position, ?offset: Float) -> Api::Point2D
1712
1645
 
1713
- # sord omit - no YARD return type given, using untyped
1714
- # Builds target unit type using units as source at optional target
1646
+ # _@param_ `pos`
1715
1647
  #
1716
- # _@param_ `units` — can be an Api::Unit, array of Api::Unit#tag or single tag
1648
+ # _@param_ `radius`
1649
+ def point_random_on_circle: (pos: Sc2::Position, ?radius: Float) -> Api::Point2D
1650
+
1651
+ # _@return_ — player with active connection
1652
+ attr_accessor bot: (Sc2::Player | untyped)
1653
+ end
1654
+
1655
+ # WARNING! Debug methods will not be available on Ladder
1656
+ # This provides debug helper functions for RequestDebug
1657
+ module Debug
1658
+ # sord warn - Api::DebugCommand wasn't able to be resolved to a constant in this project
1659
+ # Queues debug command for performing later
1717
1660
  #
1718
- # _@param_ `unit_type_id` — Api::UnitTypeId the unit type you wish to build
1661
+ # _@param_ `debug_command`
1662
+ def queue_debug_command: (Api::DebugCommand debug_command) -> void
1663
+
1664
+ # sord warn - Size wasn't able to be resolved to a constant in this project
1665
+ # Prints debug text top left corner
1719
1666
  #
1720
- # _@param_ `target` — is a unit tag or a Api::Point2D. Nil for addons/orbital
1667
+ # _@param_ `text` — will respect newlines
1721
1668
  #
1722
- # _@param_ `queue_command` — shift+command
1723
- def build: (
1724
- units: (::Array[Integer] | Integer | Api::Unit),
1725
- unit_type_id: Integer,
1726
- ?target: (Api::Point2D | Integer)?,
1727
- ?queue_command: bool
1728
- ) -> untyped
1669
+ # _@param_ `size` — of font, default 14px
1670
+ def debug_print: (String text, ?size: Size) -> void
1729
1671
 
1730
- # sord omit - no YARD return type given, using untyped
1731
- # Warps in unit type at target (location or pylon) with optional source units (warp gates)
1732
- # When not specifying the specific warp gate(s), all warpgates will be used
1672
+ # sord warn - Size wasn't able to be resolved to a constant in this project
1673
+ # Prints text on screen from top and left
1733
1674
  #
1734
- # _@param_ `unit_type_id` — Api::UnitTypeId the unit type you wish to build
1675
+ # _@param_ `text` — will respect newlines
1735
1676
  #
1736
- # _@param_ `queue_command` — shift+command
1677
+ # _@param_ `left_percent` — range 0..100. percent from left of screen
1737
1678
  #
1738
- # _@param_ `target` — is a unit tag or a Api::Point2D
1679
+ # _@param_ `top_percent` — range 0..100. percent from top of screen
1739
1680
  #
1740
- # _@param_ `units`
1741
- def warp: (
1742
- unit_type_id: Integer,
1743
- target: (Api::Point2D | Integer),
1744
- queue_command: bool,
1745
- ?units: (::Array[Integer] | Integer | Api::Unit)?
1746
- ) -> untyped
1681
+ # _@param_ `color` — default white
1682
+ #
1683
+ # _@param_ `size` — of font, default 14px
1684
+ def debug_text_screen: (
1685
+ String text,
1686
+ ?left_percent: Numeric,
1687
+ ?top_percent: Numeric,
1688
+ ?color: Api::Color?,
1689
+ ?size: Size
1690
+ ) -> void
1747
1691
 
1748
- # sord omit - no YARD return type given, using untyped
1749
- # Research a specific upgrade
1692
+ # sord warn - Size wasn't able to be resolved to a constant in this project
1693
+ # Prints text on screen at 3d world position
1750
1694
  #
1751
- # _@param_ `units` — can be an Api::Unit, array of Api::Unit#tag or single tag
1695
+ # _@param_ `text` — will respect newlines
1752
1696
  #
1753
- # _@param_ `upgrade_id` — Api::UpgradeId to research
1697
+ # _@param_ `point` — point in the world, i.e. unit.pos
1754
1698
  #
1755
- # _@param_ `queue_command` — shift+command
1756
- def research: (units: (::Array[Integer] | Integer | Api::Unit), upgrade_id: Integer, ?queue_command: bool) -> untyped
1699
+ # _@param_ `color` — default white
1700
+ #
1701
+ # _@param_ `size` — of font, default 14px
1702
+ def debug_text_world: (
1703
+ String text,
1704
+ point: Api::Point,
1705
+ ?color: Api::Color?,
1706
+ ?size: Size
1707
+ ) -> void
1757
1708
 
1758
- # Toggles auto-cast ability for units
1709
+ # Draws a line between two Api::Point's for color
1759
1710
  #
1760
- # _@param_ `units` — can be an Api::Unit, array of Tags or single Tag
1711
+ # _@param_ `p0` — the first point
1761
1712
  #
1762
- # _@param_ `ability_id`
1763
- def action_raw_toggle_autocast: (units: (::Array[Integer] | Integer | Api::Unit), ability_id: Integer) -> void
1713
+ # _@param_ `p1` — the second point
1714
+ #
1715
+ # _@param_ `color` — default white
1716
+ def debug_draw_line: (p0: Api::Point, p1: Api::Point, ?color: Api::Color?) -> void
1764
1717
 
1765
- # Toggles auto-cast ability for units
1718
+ # Draws a box around position xy at base of z. Good for structure boxing.
1766
1719
  #
1767
1720
  # _@param_ `point`
1768
- def action_raw_camera_move: (point: Api::Point) -> void
1769
-
1770
- # sord warn - Api::Point2I wasn't able to be resolved to a constant in this project
1771
- # sord warn - Api::Point2I wasn't able to be resolved to a constant in this project
1772
- # Issues spatial unit command. Target is either target_screen_coord or target_minimap_coord.
1773
1721
  #
1774
- # _@param_ `ability_id`
1722
+ # _@param_ `radius` — default one tile wide, 1.0
1775
1723
  #
1776
- # _@param_ `target_screen_coord`
1724
+ # _@param_ `color` — default white. min(r,b) is used for both r&b
1777
1725
  #
1778
- # _@param_ `target_minimap_coord`
1726
+ # ```ruby
1727
+ # # Draws a box on structure placement grid
1728
+ # debug_draw_box(point: unit.pos, radius: unit.footprint_radius)
1729
+ # ```
1779
1730
  #
1780
- # _@param_ `queue_command` shift+command
1781
- def action_spatial_unit_command: (
1782
- ability_id: Api::AbilityId,
1783
- ?target_screen_coord: Api::Point2I?,
1784
- ?target_minimap_coord: Api::Point2I?,
1785
- ?queue_command: bool
1786
- ) -> void
1787
-
1788
- # sord warn - Api::Point2I wasn't able to be resolved to a constant in this project
1789
- # Simulates a click on the minimap to move the camera.
1731
+ # _@note_Api::Color RGB is broken for this command. Will use min(r,b)
1790
1732
  #
1791
- # _@param_ `center_minimap`
1792
- def action_spatial_camera_move: (center_minimap: Api::Point2I) -> void
1733
+ # _@note_ — Z index is elevated 0.02 so the line is visible and doesn't clip through terrain
1734
+ def debug_draw_box: (point: Api::Point, ?radius: Float, ?color: Api::Color?) -> void
1793
1735
 
1794
- # Issues spatial unit select point command. Target is either target_screen_coord or target_minimap_coord.
1736
+ # Debug draws a sphere at position with a radius in color
1795
1737
  #
1796
- # _@param_ `type` — 1,2,3,4 = Api::ActionSpatialUnitSelectionPoint::Type::* enum Type { Select = 1; // Equivalent to normal click. Changes selection to unit. Toggle = 2; // Equivalent to shift+click. Toggle selection of unit. AllType = 3; // Equivalent to control+click. Selects all units of a given type. AddAllType = 4; // Equivalent to shift+control+click. Selects all units of a given type. }
1738
+ # _@param_ `point`
1797
1739
  #
1798
- # _@param_ `selection_screen_coord`
1799
- def action_spatial_unit_selection_point: (?_type: Integer, ?selection_screen_coord: Api::PointI?) -> void
1740
+ # _@param_ `radius` — default one tile wide, 1.0
1741
+ #
1742
+ # _@param_ `color` — default white
1743
+ def debug_draw_sphere: (point: Api::Point, ?radius: Float, ?color: Api::Color?) -> void
1800
1744
 
1801
- # sord warn - Api::RectangleI wasn't able to be resolved to a constant in this project
1802
- # Issue rectangle select
1745
+ # sord warn - Api::Position wasn't able to be resolved to a constant in this project
1746
+ # sord omit - no YARD return type given, using untyped
1747
+ # Renders a block on the floor, drawn by 4 lines
1748
+ # Pass in either a pos (Position/Unit) or exact x * y coordinates
1749
+ # Optional indentation adds padding on borders inward
1803
1750
  #
1804
- # _@param_ `selection_screen_coord` — rectangle coordinates
1751
+ # _@param_ `pos`
1805
1752
  #
1806
- # _@param_ `selection_add` — default false Equivalent to shift+drag. Adds units to selection. default false
1807
- def action_spatial_unit_selection_rect: (selection_screen_coord: Api::RectangleI, ?selection_add: bool) -> void
1808
-
1809
- # Perform action on control group like setting or recalling, use in conjunction with unit selection.
1810
- # Populated if Feature Layer or Render interface is enabled.
1753
+ # _@param_ `x`
1811
1754
  #
1812
- # _@param_ `action` — 1-5 = Api::ActionControlGroup::ControlGroupAction::* enum ControlGroupAction { Recall = 1; // Equivalent to number hotkey. Replaces current selection with control group. Set = 2; // Equivalent to Control + number hotkey. Sets control group to current selection. Append = 3; // Equivalent to Shift + number hotkey. Adds current selection into control group. SetAndSteal = 4; // Equivalent to Control + Alt + number hotkey. Sets control group to current selection. Units are removed from other control groups. AppendAndSteal = 5; // Equivalent to Shift + Alt + number hotkey. Adds current selection into control group. Units are removed from other control groups. }
1755
+ # _@param_ `y`
1813
1756
  #
1814
- # _@param_ `control_group_index` — 0-9
1815
- def action_ui_control_group: (action: Integer, control_group_index: Integer) -> void
1816
-
1817
- # Selects army (F2)
1757
+ # _@param_ `color`
1818
1758
  #
1819
- # _@param_ `selection_add` — default false To add to other selected items
1820
- def action_ui_select_army: (?selection_add: bool) -> void
1821
-
1822
- # Selects warp gates (Protoss)
1759
+ # _@param_ `indent` — default 0.05. should be lower than < 1.0
1823
1760
  #
1824
- # _@param_ `selection_add` — default false To add to other selected items
1825
- def action_ui_select_warp_gates: (?selection_add: bool) -> void
1826
-
1827
- # Selects larva (Zerg)
1828
- def action_ui_select_larva: () -> void
1761
+ # ```ruby
1762
+ # debug_tile(x: 12.3, y: 4.56, color: Api::Color.new(r: 255, g: 0, b: 0))
1763
+ # debug_tile(some_unit)
1764
+ # debug_tile(some_unit.pos)
1765
+ # ```
1766
+ def debug_tile: (
1767
+ ?(Api::Unit | Api::Position)? pos,
1768
+ ?x: (Float | Integer)?,
1769
+ ?y: (Float | Integer)?,
1770
+ ?color: Api::Color?,
1771
+ ?indent: Float
1772
+ ) -> untyped
1829
1773
 
1830
- # sord omit - no YARD return type given, using untyped
1831
- # Select idle workers
1774
+ # Possible values:
1775
+ # Api::DebugGameState::Show_map
1776
+ # Api::DebugGameState::Control_enemy
1777
+ # Api::DebugGameState::Food
1778
+ # Api::DebugGameState::Free
1779
+ # Api::DebugGameState::All_resources
1780
+ # Api::DebugGameState::God
1781
+ # Api::DebugGameState::Minerals
1782
+ # Api::DebugGameState::Gas
1783
+ # Api::DebugGameState::Cooldown
1784
+ # Api::DebugGameState::Tech_tree
1785
+ # Api::DebugGameState::Upgrade
1786
+ # Api::DebugGameState::Fast_build
1832
1787
  #
1833
- # _@param_ `type` — 1-4 = Api::ActionSelectIdleWorker::Type::* enum Type { Set = 1; // Equivalent to click with no modifiers. Replaces selection with single idle worker. Add = 2; // Equivalent to shift+click. Adds single idle worker to current selection. All = 3; // Equivalent to control+click. Selects all idle workers. AddAll = 4; // Equivalent to shift+control+click. Adds all idle workers to current selection. }
1834
- def action_ui_select_idle_worker: (_type: Integer) -> untyped
1788
+ # _@param_ `command` — one of Api::DebugGameState::*
1789
+ def debug_game_state: (Integer command) -> void
1835
1790
 
1836
- # sord omit - no YARD return type given, using untyped
1837
- # Multi-panel actions for select/deselect
1838
- # message ActionMultiPanel {
1839
- # optional Type type = 1;
1840
- # optional int32 unit_index = 2;
1841
- # }
1791
+ # Spawns a quantity of units under an owner at position given
1842
1792
  #
1843
- # _@param_ `type` — 1-4 = Api::ActionMultiPanel::Type::*
1793
+ # _@param_ `unit_type_id` — Api::UnitTypeId::*
1844
1794
  #
1845
- # _@param_ `unit_index` — n'th unit on panel enum Type { SingleSelect = 1; // Click on icon DeselectUnit = 2; // Shift Click on icon SelectAllOfType = 3; // Control Click on icon. DeselectAllOfType = 4; // Control+Shift Click on icon. }
1846
- def action_ui_multi_panel: (_type: Integer, unit_index: Integer) -> untyped
1795
+ # _@param_ `owner` — typically you are 1 and 2 is enemy (see @common.player_id)
1796
+ #
1797
+ # _@param_ `pos` — position in 2d
1798
+ #
1799
+ # _@param_ `quantity` — default 1
1800
+ def debug_create_unit: (
1801
+ unit_type_id: Integer,
1802
+ owner: Integer,
1803
+ pos: Api::Point2D,
1804
+ ?quantity: Integer
1805
+ ) -> void
1847
1806
 
1848
- # sord omit - no YARD return type given, using untyped
1849
- # Cargo panel actions for unloading units.
1807
+ # Kills a target unit or unit tag
1850
1808
  #
1851
- # _@param_ `unit_index` — index of unit to unload
1852
- def action_ui_cargo_panel_unload: (unit_index: Integer) -> untyped
1809
+ # _@param_ `unit_tags` — one or many unit tags to kill
1810
+ def debug_kill_unit: (unit_tags: (Integer | ::Array[Integer])) -> void
1811
+
1812
+ # Hangs, crashes and exits the Sc2 client. DO NOT USE.
1813
+ #
1814
+ # _@param_ `test` — one of Api::DebugTestProcess::Test::Crash, Api::DebugTestProcess::Test::Hang, Api::DebugTestProcess::Test::Exit
1815
+ #
1816
+ # _@param_ `delay_ms` — default 0, how long this test is delayed
1817
+ def debug_test_process: (test: Integer, ?delay_ms: Integer) -> void
1853
1818
 
1854
1819
  # sord omit - no YARD return type given, using untyped
1855
- # Remove unit from production queue
1820
+ # Useful only for single-player "curriculum" maps
1856
1821
  #
1857
- # _@param_ `unit_index` — target unit index
1858
- def action_ui_production_panel_remove_from_queue: (unit_index: Integer) -> untyped
1822
+ # _@param_ `score` — sets the score
1823
+ def debug_set_score: (?score: Float) -> untyped
1859
1824
 
1860
- # sord omit - no YARD return type given, using untyped
1861
- # Toggle autocast on selected unit. Also possible with raw actions using a unit target.
1825
+ # Ends game with a specified result of either Surrender or DeclareVictory
1862
1826
  #
1863
- # _@param_ `ability_id` — Api::AbilityId::* ability
1864
- def action_ui_toggle_autocast: (ability_id: Integer) -> untyped
1827
+ # _@param_ `end_result` — either 1/2. Api::DebugEndGame::EndResult::Surrender or Api::DebugEndGame::EndResult::DeclareVictory
1828
+ def debug_end_game: (end_result: Integer) -> void
1865
1829
 
1866
- # sord omit - no YARD return type given, using untyped
1867
- # Send a chat message
1830
+ # Sets unit_value Energy, Life or Shields for a specific unit tag to given value
1868
1831
  #
1869
- # _@param_ `message` — to send
1832
+ # _@param_ `unit_tag`
1870
1833
  #
1871
- # _@param_ `channel` — 1-2, default:Team Api::ActionChat::Channel::Broadcast = 1, Api::ActionChat::Channel::Team = 2
1872
- def action_chat: (String message, ?channel: Integer) -> untyped
1834
+ # _@param_ `unit_value` — 1=Energy,2=Life,3=Shields one of Api::DebugSetUnitValue::UnitValue::*
1835
+ #
1836
+ # _@param_ `value` — the value which the attribute will be set to
1837
+ def debug_set_unit_value: (unit_tag: Integer, unit_value: Integer, value: Float) -> void
1873
1838
 
1874
1839
  # sord omit - no YARD return type given, using untyped
1875
- # Sends actions via api and flushes action_queue
1876
- def perform_actions: () -> untyped
1840
+ # Sends actions via api and flushes debug_commands_queue
1841
+ def perform_debug_commands: () -> untyped
1877
1842
 
1878
- # Empties and resets @action_queue
1879
- def clear_action_queue: () -> void
1843
+ # Empties and resets @debug_queue
1844
+ def clear_debug_command_queue: () -> void
1880
1845
 
1881
- # Returns an array of unit tags from a variety of sources
1882
- # noinspection RubyMismatchedReturnType
1883
- #
1884
- # _@param_ `source` — unit tag, tags, unit or unit group
1885
- #
1886
- # _@return_ — unit tag array
1887
- def unit_tags_from_source: ((Integer | ::Array[Integer] | Api::Unit | Sc2::UnitGroup) source) -> ::Array[Integer]
1846
+ # sord omit - no YARD type given for :debug_command_queue, using untyped
1847
+ # Holds debug commands which will be queued off each time we step forward
1848
+ attr_accessor debug_command_queue: untyped
1888
1849
 
1889
1850
  # sord warn - Api::Action wasn't able to be resolved to a constant in this project
1890
- attr_accessor action_queue: ::Array[Api::Action]
1851
+ # sord warn - Api::Action wasn't able to be resolved to a constant in this project
1852
+ attr_accessor debug_commands_queue: ::Array[Api::Action]
1891
1853
  end
1892
1854
 
1893
- # Holds map and geography helper functions
1894
- class Geometry
1895
- # sord omit - no YARD type given for "bot", using untyped
1896
- def initialize: (untyped _bot) -> void
1855
+ # Helper methods for working with units
1856
+ module Units
1857
+ # sord omit - no YARD type given for "upgrade_id", using untyped
1858
+ # Returns true if this upgrade has finished researching
1859
+ def upgrade_completed?: (untyped upgrade_id) -> bool
1897
1860
 
1898
- # Gets the map tile width. Range is 1-255.
1899
- # Effected by crop_to_playable_area
1900
- def map_width: () -> Integer
1861
+ # Returns the upgrade ids which are researching or queued
1862
+ # Not set for enemy.
1863
+ def upgrades_in_progress: () -> ::Array[Integer]
1901
1864
 
1902
- # Gets the map tile height. Range is 1-255.
1903
- # Effected by crop_to_playable_area
1904
- def map_height: () -> Integer
1865
+ # sord omit - no YARD type given for "upgrade_id", using untyped
1866
+ # Returns true if the upgrade is busy researching
1867
+ def upgrade_in_progress?: (untyped upgrade_id) -> bool
1905
1868
 
1906
- # Center of the map
1907
- def map_center: () -> Api::Point2D
1869
+ # sord omit - no YARD type given for "unit_type_id", using untyped
1870
+ # For this unit type, tells you how many are in progress by checking orders for all it's sources.
1871
+ def units_in_progress: (untyped unit_type_id) -> Integer
1908
1872
 
1909
- # Returns zero to map_width as range
1873
+ # Returns static [Api::UnitTypeData] for a unit
1910
1874
  #
1911
- # _@return_0 to map_width
1912
- def map_range_x: () -> ::Range[untyped]
1875
+ # _@param_ `unit` Api::UnitTypeId or Api::Unit
1876
+ def unit_data: ((Integer | Api::Unit) unit) -> Api::UnitTypeData
1913
1877
 
1914
- # Returns zero to map_height as range
1878
+ # sord warn - Api::AbilityData wasn't able to be resolved to a constant in this project
1879
+ # Returns static [Api::AbilityData] for an ability
1915
1880
  #
1916
- # _@return_0 to map_height
1917
- def map_range_y: () -> ::Range[untyped]
1918
-
1919
- # Returns zero to map_width-1 as range
1920
- def map_tile_range_x: () -> ::Range[untyped]
1881
+ # _@param_ `ability_id` Api::AbilityId::*
1882
+ def ability_data: (Integer ability_id) -> Api::AbilityData
1921
1883
 
1922
- # Returns zero to map_height-1 as range
1923
- def map_tile_range_y: () -> ::Range[untyped]
1884
+ # sord warn - Api::UpgradeData wasn't able to be resolved to a constant in this project
1885
+ # Returns static [Api::UpgradeData] for an upgrade id
1886
+ #
1887
+ # _@param_ `upgrade_id` — Api::UpgradeId::*
1888
+ def upgrade_data: (Integer upgrade_id) -> Api::UpgradeData
1924
1889
 
1925
- # Returns whether a x/y (integer) is placeable as per minimap image data.
1926
- # It does not say whether a position is occupied by another building.
1927
- # One pixel covers one whole block. Corrects floats on your behalf
1890
+ # Checks unit data for an attribute value
1928
1891
  #
1929
- # _@param_ `x`
1892
+ # _@param_ `unit` — Api::UnitTypeId or Api::Unit
1930
1893
  #
1931
- # _@param_ `y`
1894
+ # _@param_ `attribute` — Api::Attribute, i.e. Api::Attribute::Mechanical or :Mechanical
1932
1895
  #
1933
- # _@return_ — whether tile is placeable?
1896
+ # _@return_ — whether unit has attribute
1934
1897
  #
1935
- # _@see_ `Sc2::Player#pathable?` — for detecting obstructions
1936
- def placeable?: (x: (Float | Integer), y: (Float | Integer)) -> bool
1937
-
1938
- # sord warn - Numo::Bit wasn't able to be resolved to a constant in this project
1939
- # Returns a parsed placement_grid from bot.game_info.start_raw.
1940
- # Each value in [row][column] holds a boolean value represented as an integer
1941
- # It does not say whether a position is occupied by another building.
1942
- # One pixel covers one whole block. Rounds fractionated positions down.
1943
- def parsed_placement_grid: () -> Numo::Bit
1898
+ # ```ruby
1899
+ # unit_has_attribute?(Api::UnitTypeId::SCV, Api::Attribute::Mechanical)
1900
+ # unit_has_attribute?(units.workers.first, :Mechanical)
1901
+ # unit_has_attribute?(Api::UnitTypeId::SCV, :Mechanical)
1902
+ # ```
1903
+ def unit_has_attribute?: ((Integer | Api::Unit) unit, Symbol attribute) -> bool
1944
1904
 
1945
- # Whether this tile is where an expansion is supposed to be placed.
1946
- # To see if a unit/structure is blocking an expansion, pass their coordinates to this method.
1947
- #
1948
- # _@param_ `x`
1949
- #
1950
- # _@param_ `y`
1905
+ # Creates a unit group from all_units with matching tag
1951
1906
  #
1952
- # _@return_true if location has creep on it
1953
- def expo_placement?: (x: (Float | Integer), y: (Float | Integer)) -> bool
1907
+ # _@param_ `tags` array of unit tags
1908
+ def unit_group_from_tags: (::Array[Integer] tags) -> Sc2::UnitGroup
1954
1909
 
1955
- # sord warn - Numo::Bit wasn't able to be resolved to a constant in this project
1956
- # Returns a grid where ony the expo locations are marked
1957
- def expo_placement_grid: () -> Numo::Bit
1910
+ # sord omit - no YARD type given for "unit_type_id", using untyped
1911
+ # Sums the cost (mineral/vespene/supply) of unit type used for internal spend trackers
1912
+ # This is called internally when building/morphing/training
1913
+ def subtract_cost: (untyped unit_type_id) -> void
1958
1914
 
1959
- # sord warn - Numo::Bit wasn't able to be resolved to a constant in this project
1960
- # Returns a grid where powered locations are marked true
1961
- def parsed_power_grid: () -> Numo::Bit
1915
+ # sord omit - no YARD type given for "unit_type_id:", using untyped
1916
+ # sord omit - no YARD type given for "quantity:", using untyped
1917
+ # Checks whether you have the resources to construct quantity of unit type
1918
+ def can_afford?: (unit_type_id: untyped, ?quantity: untyped) -> bool
1962
1919
 
1963
- # Returns whether a x/y block is powered. Only fully covered blocks are true.
1964
- # One pixel covers one whole block. Corrects float inputs on your behalf.
1965
- #
1966
- # _@param_ `x`
1967
- #
1968
- # _@param_ `y`
1969
- #
1970
- # _@return_ — true if location is powered
1971
- def powered?: (x: (Float | Integer), y: (Float | Integer)) -> bool
1920
+ # sord omit - no YARD type given for "upgrade_id", using untyped
1921
+ # Checks whether you have the resources to
1922
+ def can_afford_upgrade?: (untyped upgrade_id) -> bool
1972
1923
 
1973
- # Returns whether a x/y block is pathable as per minimap
1974
- # One pixel covers one whole block. Corrects float inputs on your behalf.
1924
+ # Returns whether Query Available Ability is true for unit and tag
1925
+ # Queries API if necessary. Uses batching in the background.
1975
1926
  #
1976
- # _@param_ `x`
1927
+ # _@param_ `unit_tag`
1977
1928
  #
1978
- # _@param_ `y`
1929
+ # _@param_ `ability_id`
1930
+ def unit_ability_available?: (unit_tag: Integer, ability_id: Integer) -> bool
1931
+
1932
+ # sord warn - Api::Observation wasn't able to be resolved to a constant in this project
1933
+ # sord omit - no YARD return type given, using untyped
1934
+ # Divides raw data units into various attributes on every step
1935
+ # Note, this needs to be fast.
1979
1936
  #
1980
- # _@return_ — whether tile is patahble
1981
- def pathable?: (x: (Float | Integer), y: (Float | Integer)) -> bool
1937
+ # _@param_ `observation`
1938
+ def parse_observation_units: (Api::Observation observation) -> untyped
1982
1939
 
1983
- # sord warn - Numo::Bit wasn't able to be resolved to a constant in this project
1984
- # Gets the pathable areas as things stand right now in the game
1985
- # Buildings, minerals, structures, etc. all result in a nonpathable place
1940
+ # Returns alliance based on whether you are a player or an enemy
1986
1941
  #
1987
- # _@return_ — Numo array
1942
+ # _@return_ — :Self or :Enemy from Api::Alliance
1943
+ def own_alliance: () -> Symbol
1944
+
1945
+ # Returns enemy alliance based on whether you are a player or an enemy
1988
1946
  #
1989
- # ```ruby
1990
- # parsed_pathing_grid[0,0] # reads bottom left corner
1991
- # # use helper function #pathable
1992
- # pathable?(x: 0, y: 0) # reads bottom left corner
1993
- # ```
1994
- def parsed_pathing_grid: () -> Numo::Bit
1947
+ # _@return_ — :Self or :Enemy from Api::Alliance
1948
+ def enemy_alliance: () -> Symbol
1995
1949
 
1950
+ # sord omit - no YARD type given for "unit", using untyped
1996
1951
  # sord omit - no YARD return type given, using untyped
1997
- # Clears pathing-grid dependent objects like placements.
1998
- # Called when pathing grid gets updated
1999
- def clear_cached_pathing_grid: () -> untyped
1952
+ # Issues units/structure callbacks for units which are new
1953
+ def issue_new_unit_callbacks: (untyped unit) -> untyped
2000
1954
 
2001
- # Returns the terrain height (z) at position x and y
2002
- # Granularity is per placement grid block, since this comes from minimap image data.
2003
- #
2004
- # _@param_ `x`
2005
- #
2006
- # _@param_ `y`
2007
- #
2008
- # _@return_ — z axis position between -16 and 16
2009
- def terrain_height: (x: (Float | Integer), y: (Float | Integer)) -> Float
1955
+ # sord omit - no YARD type given for "unit", using untyped
1956
+ # sord omit - no YARD type given for "previous_unit", using untyped
1957
+ # sord omit - no YARD return type given, using untyped
1958
+ # Issues callbacks for units over time, such as damaged or type changed
1959
+ def issue_existing_unit_callbacks: (untyped unit, untyped previous_unit) -> untyped
2010
1960
 
2011
- # Returns the terrain height (z) at position x and y for a point
2012
- #
2013
- # _@param_ `position`
2014
- #
2015
- # _@return_ — z axis position between -16 and 16
2016
- def terrain_height_for_pos: (Sc2::Position position) -> Float
1961
+ attr_accessor all_units: (Sc2::UnitGroup | untyped)
2017
1962
 
2018
- # sord warn - Numo::SFloat wasn't able to be resolved to a constant in this project
2019
- # Returns a parsed terrain_height from bot.game_info.start_raw.
2020
- # Each value in [row][column] holds a float value which is the z height
2021
- #
2022
- # _@return_ Numo array
2023
- def parsed_terrain_height: () -> Numo::SFloat
1963
+ # _@return_ a group of placeholder structures
1964
+ attr_accessor units: Sc2::UnitGroup
1965
+
1966
+ # sord omit - no YARD type given for :structures, using untyped
1967
+ # A full list of all your structures (non-units)
1968
+ attr_accessor structures: untyped
1969
+
1970
+ # sord omit - no YARD type given for :placeholders, using untyped
1971
+ # A list of structures which haven't started
1972
+ attr_accessor placeholders: untyped
1973
+
1974
+ # _@return_ — a group of neutral units
1975
+ attr_accessor neutral: Sc2::UnitGroup
1976
+
1977
+ # _@return_ — a group of neutral units
1978
+ attr_accessor effects: Sc2::UnitGroup
1979
+
1980
+ # sord omit - no YARD type given for :upgrades_completed, using untyped
1981
+ # Returns the upgrade ids you have acquired such as weapon upgrade and armor upgrade ids.
1982
+ # Shorthand for observation.raw_data.player.upgrade_ids
1983
+ attr_reader upgrades_completed: untyped
1984
+
1985
+ # sord warn - Api::RadarRing wasn't able to be resolved to a constant in this project
1986
+ # sord warn - Api::RadarRing wasn't able to be resolved to a constant in this project
1987
+ # _@return_ — an array of radar rings sources
1988
+ attr_accessor power_sources: ::Array[Api::RadarRing]
1989
+
1990
+ # sord omit - no YARD type given for :radar_rings, using untyped
1991
+ # An array of Sensor tower rings as per minimap. It has a `pos` and a `radius`
1992
+ attr_accessor radar_rings: untyped
1993
+
1994
+ # sord omit - no YARD type given for :_all_seen_unit_tags, using untyped
1995
+ # Privately keep track of all seen Unit tags (excl structures) in order to detect new created units
1996
+ attr_accessor _all_seen_unit_tags: untyped
1997
+
1998
+ # sord omit - no YARD type given for :all_seen_unit_tags, using untyped
1999
+ # Privately keep track of all seen Unit tags (excl structures) in order to detect new created units
2000
+ attr_accessor all_seen_unit_tags: untyped
2001
+
2002
+ # _@return_ — group of Units and Structures effected
2003
+ attr_accessor event_units_damaged: Sc2::UnitGroup
2004
+
2005
+ # sord omit - no YARD type given for :event_units_destroyed, using untyped
2006
+ # TODO: Unit buff disabled, because it calls back too often (mineral in hand). Put back if useful
2007
+ # Units (Unit/Structure) on which a new buff_ids appeared this frame
2008
+ # See which buffs via: unit.buff_ids - unit.previous.buff_ids
2009
+ # Read this on_step. Alternative to callback on_unit_buffed
2010
+ # attr_accessor :event_units_buffed
2011
+ attr_accessor event_units_destroyed: untyped
2012
+ end
2024
2013
 
2025
- # Returns one of three Integer visibility indicators at tile for x & y
2026
- #
2027
- # _@param_ `x`
2028
- #
2029
- # _@param_ `y`
2014
+ # Holds action list and queues batch
2015
+ module Actions
2016
+ # sord warn - Api::Action wasn't able to be resolved to a constant in this project
2017
+ # Queues action for performing end of step
2030
2018
  #
2031
- # _@return_ — 0=Hidden,1= Snapshot,2=Visible
2032
- def visibility: (x: (Float | Integer), y: (Float | Integer)) -> Integer
2019
+ # _@param_ `action`
2020
+ def queue_action: (Api::Action action) -> void
2033
2021
 
2034
- # Returns whether the point (tile) is currently in vision
2035
- #
2036
- # _@param_ `x`
2022
+ # sord omit - no YARD return type given, using untyped
2023
+ # Queues a Api::ActionRaw. Perform ability on unit_tags optionally on target_world_space_pos/target_unit_tag
2037
2024
  #
2038
- # _@param_ `y`
2025
+ # _@param_ `unit_tags`
2039
2026
  #
2040
- # _@return_ — true if fog is completely lifted
2041
- def map_visible?: (x: (Float | Integer), y: (Float | Integer)) -> bool
2042
-
2043
- # Returns whether point (tile) has been seen before or currently visible
2027
+ # _@param_ `ability_id`
2044
2028
  #
2045
- # _@param_ `x`
2029
+ # _@param_ `queue_command` — shift+command
2046
2030
  #
2047
- # _@param_ `y`
2031
+ # _@param_ `target_world_space_pos`
2048
2032
  #
2049
- # _@return_ — true if partially or fully lifted fog
2050
- def map_seen?: (x: (Float | Integer), y: (Float | Integer)) -> bool
2033
+ # _@param_ `target_unit_tag`
2034
+ def action_raw_unit_command: (
2035
+ unit_tags: ::Array[Integer],
2036
+ ability_id: Integer,
2037
+ ?queue_command: bool,
2038
+ ?target_world_space_pos: Api::Point2D?,
2039
+ ?target_unit_tag: Integer?
2040
+ ) -> untyped
2051
2041
 
2052
- # Returns whether the point (tile) has never been seen/explored before (dark fog)
2053
- #
2054
- # _@param_ `x`
2042
+ # sord omit - no YARD return type given, using untyped
2043
+ # Queues a Api::ActionRawUnitCommand.
2044
+ # Send accepts a Api::Unit, tag or tags and targets Api::Point2D or unit.tag
2055
2045
  #
2056
- # _@param_ `y`
2046
+ # _@param_ `units` — can be an Api::Unit, array of Api::Unit#tag or single tag
2057
2047
  #
2058
- # _@return_ — true if fog of war is fully dark
2059
- def map_unseen?: (x: (Float | Integer), y: (Float | Integer)) -> bool
2060
-
2061
- # sord warn - Numo::SFloat wasn't able to be resolved to a constant in this project
2062
- # Returns a parsed map_state.visibility from bot.observation.raw_data.
2063
- # Each value in [row][column] holds one of three integers (0,1,2) to flag a vision type
2048
+ # _@param_ `ability_id`
2064
2049
  #
2065
- # _@return_Numo array
2050
+ # _@param_ `target` is a unit, unit tag or a Api::Point2D
2066
2051
  #
2067
- # _@see_ `#visibility` — for reading from this value
2068
- def parsed_visibility_grid: () -> Numo::SFloat
2052
+ # _@param_ `queue_command`shift+command
2053
+ def action: (
2054
+ units: (::Array[Integer] | Integer | Api::Unit),
2055
+ ability_id: Integer,
2056
+ ?target: (Api::Unit | Integer | Api::Point2D)?,
2057
+ ?queue_command: bool
2058
+ ) -> untyped
2069
2059
 
2070
- # Returns whether a tile has creep on it, as per minimap
2071
- # One pixel covers one whole block. Corrects float inputs on your behalf.
2060
+ # sord omit - no YARD return type given, using untyped
2061
+ # Builds target unit type using units as source at optional target
2072
2062
  #
2073
- # _@param_ `x`
2063
+ # _@param_ `units` — can be an Api::Unit, array of Api::Unit#tag or single tag
2074
2064
  #
2075
- # _@param_ `y`
2065
+ # _@param_ `unit_type_id` — Api::UnitTypeId the unit type you wish to build
2076
2066
  #
2077
- # _@return_true if location has creep on it
2078
- def creep?: (x: (Float | Integer), y: (Float | Integer)) -> bool
2079
-
2080
- # sord warn - Numo::Bit wasn't able to be resolved to a constant in this project
2081
- # Provides parsed minimap representation of creep spread
2082
- # Caches for 4 frames
2067
+ # _@param_ `target` is a unit tag or a Api::Point2D. Nil for addons/orbital
2083
2068
  #
2084
- # _@return_Numo array
2085
- def parsed_creep: () -> Numo::Bit
2069
+ # _@param_ `queue_command` shift+command
2070
+ def build: (
2071
+ units: (::Array[Integer] | Integer | Api::Unit),
2072
+ unit_type_id: Integer,
2073
+ ?target: (Api::Point2D | Integer)?,
2074
+ ?queue_command: bool
2075
+ ) -> untyped
2086
2076
 
2087
- # sord warn - Numo::Bit wasn't able to be resolved to a constant in this project
2088
2077
  # sord omit - no YARD return type given, using untyped
2089
- # TODO: Remove this method if it has no use. Build points uses this code directly for optimization.
2090
- # Reduce the dimensions of a grid by merging cells using length x length squares.
2091
- # Merged cell keeps it's 1 value only if all merged cells are equal to 1, else 0
2078
+ # Warps in unit type at target (location or pylon) with optional source units (warp gates)
2079
+ # When not specifying the specific warp gate(s), all warpgates will be used
2092
2080
  #
2093
- # _@param_ `input_grid` — Bit grid like parsed_pathing_grid or parsed_placement_grid
2081
+ # _@param_ `unit_type_id` — Api::UnitTypeId the unit type you wish to build
2094
2082
  #
2095
- # _@param_ `length` — how many cells to merge, i.e. 3 for finding 3x3 placement
2096
- def divide_grid: (Numo::Bit input_grid, Integer length) -> untyped
2097
-
2098
- # Returns own 2d start position as set by initial camera
2099
- # This differs from position of first base structure
2100
- def start_position: () -> Api::Point2D
2101
-
2102
- # Returns the enemy 2d start position
2103
- def enemy_start_position: () -> Api::Point2D
2104
-
2105
- # Gets expos and surrounding minerals
2106
- # The index is a build location for an expo and the value is a UnitGroup, which has minerals and geysers
2083
+ # _@param_ `queue_command` — shift+command
2107
2084
  #
2108
- # _@return_Location => UnitGroup of resources (minerals+geysers)
2085
+ # _@param_ `target` is a unit tag or a Api::Point2D
2109
2086
  #
2110
- # ```ruby
2111
- # random_expo = geo.expansions.keys.sample #=> Point2D
2112
- # expo_resources = geo.expansions[random_expo] #=> UnitGroup
2113
- # alive_minerals = expo_resources.minerals & neutral.minerals
2114
- # geysers = expo_resources.geysers
2115
- # ```
2116
- def expansions: () -> ::Hash[Api::Point2D, UnitGroup]
2087
+ # _@param_ `units`
2088
+ def warp: (
2089
+ unit_type_id: Integer,
2090
+ target: (Api::Point2D | Integer),
2091
+ queue_command: bool,
2092
+ ?units: (::Array[Integer] | Integer | Api::Unit)?
2093
+ ) -> untyped
2117
2094
 
2118
- # Returns a list of 2d points for expansion build locations
2119
- # Does not contain mineral info, but the value can be checked against geo.expansions
2095
+ # sord omit - no YARD return type given, using untyped
2096
+ # Research a specific upgrade
2120
2097
  #
2121
- # _@return_points where expansions can be placed
2098
+ # _@param_ `units` can be an Api::Unit, array of Api::Unit#tag or single tag
2122
2099
  #
2123
- # ```ruby
2124
- # random_expo = expansion_points.sample
2125
- # expo_resources = geo.expansions[random_expo]
2126
- # ```
2127
- def expansion_points: () -> ::Array[Api::Point2D]
2100
+ # _@param_ `upgrade_id` — Api::UpgradeId to research
2101
+ #
2102
+ # _@param_ `queue_command` — shift+command
2103
+ def research: (units: (::Array[Integer] | Integer | Api::Unit), upgrade_id: Integer, ?queue_command: bool) -> untyped
2128
2104
 
2129
- # Returns a slice of #expansions where a base hasn't been built yet
2130
- # The has index is a build position and the value is a UnitGroup of resources for the base
2105
+ # Toggles auto-cast ability for units
2131
2106
  #
2132
- # _@return_Location => UnitGroup of resources (minerals+geysers)
2107
+ # _@param_ `units` can be an Api::Unit, array of Tags or single Tag
2133
2108
  #
2134
- # ```ruby
2135
- # # Lets find the nearest unoccupied expo
2136
- # expo_pos = expansions_unoccupied.keys.min { |p2d| p2d.distance_to(structures.hq.first) }
2137
- # # What minerals/geysers does it have?
2138
- # puts expansions_unoccupied[expo_pos].minerals # or expansions[expo_pos]... => UnitGroup
2139
- # puts expansions_unoccupied[expo_pos].geysers # or expansions[expo_pos]... => UnitGroup
2140
- # ```
2141
- def expansions_unoccupied: () -> ::Hash[Api::Point2D, UnitGroup]
2109
+ # _@param_ `ability_id`
2110
+ def action_raw_toggle_autocast: (units: (::Array[Integer] | Integer | Api::Unit), ability_id: Integer) -> void
2142
2111
 
2143
- # Gets minerals for a base or base position
2144
- #
2145
- # _@param_ `base` — base Unit or Position
2112
+ # Toggles auto-cast ability for units
2146
2113
  #
2147
- # _@return_ — UnitGroup of minerals for the base
2148
- def minerals_for_base: ((Api::Unit | Sc2::Position) base) -> Sc2::UnitGroup
2114
+ # _@param_ `point`
2115
+ def action_raw_camera_move: (point: Api::Point) -> void
2149
2116
 
2150
- # Gets geysers for a base or base position
2117
+ # sord warn - Api::Point2I wasn't able to be resolved to a constant in this project
2118
+ # sord warn - Api::Point2I wasn't able to be resolved to a constant in this project
2119
+ # Issues spatial unit command. Target is either target_screen_coord or target_minimap_coord.
2151
2120
  #
2152
- # _@param_ `base` — base Unit or Position
2121
+ # _@param_ `ability_id`
2153
2122
  #
2154
- # _@return_ — UnitGroup of geysers for the base
2155
- def geysers_for_base: ((Api::Unit | Sc2::Position) base) -> Sc2::UnitGroup
2156
-
2157
- # Gets geysers which have not been taken for a base or base position
2123
+ # _@param_ `target_screen_coord`
2158
2124
  #
2159
- # _@param_ `base` — base Unit or Position
2125
+ # _@param_ `target_minimap_coord`
2160
2126
  #
2161
- # _@return_UnitGroup of geysers for the base
2162
- def geysers_open_for_base: ((Api::Unit | Sc2::Position) base) -> Sc2::UnitGroup
2127
+ # _@param_ `queue_command` shift+command
2128
+ def action_spatial_unit_command: (
2129
+ ability_id: Api::AbilityId,
2130
+ ?target_screen_coord: Api::Point2I?,
2131
+ ?target_minimap_coord: Api::Point2I?,
2132
+ ?queue_command: bool
2133
+ ) -> void
2163
2134
 
2164
- # _@param_ `base` base Unit or Position
2135
+ # sord warn - Api::Point2I wasn't able to be resolved to a constant in this project
2136
+ # Simulates a click on the minimap to move the camera.
2165
2137
  #
2166
- # _@return_ — UnitGroup of resources (minerals+geysers)
2167
- def resources_for_base: ((Api::Unit | Sc2::Position) base) -> Sc2::UnitGroup
2138
+ # _@param_ `center_minimap`
2139
+ def action_spatial_camera_move: (center_minimap: Api::Point2I) -> void
2168
2140
 
2169
- # Gets gasses for a base or base position
2141
+ # Issues spatial unit select point command. Target is either target_screen_coord or target_minimap_coord.
2170
2142
  #
2171
- # _@param_ `base` — base Unit or Position
2143
+ # _@param_ `type` — 1,2,3,4 = Api::ActionSpatialUnitSelectionPoint::Type::* enum Type { Select = 1; // Equivalent to normal click. Changes selection to unit. Toggle = 2; // Equivalent to shift+click. Toggle selection of unit. AllType = 3; // Equivalent to control+click. Selects all units of a given type. AddAllType = 4; // Equivalent to shift+control+click. Selects all units of a given type. }
2172
2144
  #
2173
- # _@return_ — UnitGroup of geysers for the base
2174
- def gas_for_base: ((Api::Unit | Sc2::Position) base) -> Sc2::UnitGroup
2145
+ # _@param_ `selection_screen_coord`
2146
+ def action_spatial_unit_selection_point: (?_type: Integer, ?selection_screen_coord: Api::PointI?) -> void
2175
2147
 
2176
- # sord omit - no YARD type given for "in_power:", using untyped
2177
- # Gets buildable point grid for squares of size, i.e. 3 = 3x3 placements
2178
- # Uses pathing grid internally, to ignore taken positions
2179
- # Does not query the api and is generally fast.
2180
- #
2181
- # _@param_ `length` — length of the building, 2 for depot/pylon, 3 for rax/gate
2148
+ # sord warn - Api::RectangleI wasn't able to be resolved to a constant in this project
2149
+ # Issue rectangle select
2182
2150
  #
2183
- # _@param_ `on_creep` — whether this build location should be on creep
2151
+ # _@param_ `selection_screen_coord` — rectangle coordinates
2184
2152
  #
2185
- # _@return_Array of [x,y] tuples
2186
- def build_coordinates: (length: Integer, ?on_creep: bool, ?in_power: untyped) -> ::Array[::Array[[Float, Float]]]
2153
+ # _@param_ `selection_add` default false Equivalent to shift+drag. Adds units to selection. default false
2154
+ def action_spatial_unit_selection_rect: (selection_screen_coord: Api::RectangleI, ?selection_add: bool) -> void
2187
2155
 
2188
- # Gets a buildable location for a square of length, near target. Chooses from random amount of nearest locations.
2189
- # For robustness, it is advised to set `random` to, i.e. 3, to allow choosing the 3 nearest possible places, should one location be blocked.
2190
- # For zerg, the buildable locations are only on creep.
2191
- # Internally creates a kdtree for building locations based on pathable, placeable and creep
2192
- #
2193
- # _@param_ `length` — length of the building, 2 for depot/pylon, 3 for rax/gate
2194
- #
2195
- # _@param_ `target` — near where to find a placement
2196
- #
2197
- # _@param_ `random` — number of nearest points to randomly choose from. 1 for nearest point.
2156
+ # Perform action on control group like setting or recalling, use in conjunction with unit selection.
2157
+ # Populated if Feature Layer or Render interface is enabled.
2198
2158
  #
2199
- # _@param_ `in_power` — whether this must be on a power field
2159
+ # _@param_ `action` — 1-5 = Api::ActionControlGroup::ControlGroupAction::* enum ControlGroupAction { Recall = 1; // Equivalent to number hotkey. Replaces current selection with control group. Set = 2; // Equivalent to Control + number hotkey. Sets control group to current selection. Append = 3; // Equivalent to Shift + number hotkey. Adds current selection into control group. SetAndSteal = 4; // Equivalent to Control + Alt + number hotkey. Sets control group to current selection. Units are removed from other control groups. AppendAndSteal = 5; // Equivalent to Shift + Alt + number hotkey. Adds current selection into control group. Units are removed from other control groups. }
2200
2160
  #
2201
- # _@return_buildable location, nil if no buildable location found
2202
- def build_placement_near: (
2203
- length: Integer,
2204
- target: (Api::Unit | Sc2::Position),
2205
- ?random: Integer,
2206
- ?in_power: bool
2207
- ) -> Api::Point2D?
2161
+ # _@param_ `control_group_index` 0-9
2162
+ def action_ui_control_group: (action: Integer, control_group_index: Integer) -> void
2208
2163
 
2209
- # Draws a grid within a unit (pylon/prisms) radius, then selects points which are placeable
2210
- #
2211
- # _@param_ `source` — either a pylon or a prism
2212
- #
2213
- # _@param_ `unit_type_id` — optionally, the unit you wish to place. Stalkers are widest, so use default nil for a mixed composition warp
2164
+ # Selects army (F2)
2214
2165
  #
2215
- # _@return_an array of 2d points where theoretically placeable
2216
- def warp_points: (source: Api::Unit, ?unit_type_id: Api::Unit?) -> ::Array[Api::Point2D]
2166
+ # _@param_ `selection_add` default false To add to other selected items
2167
+ def action_ui_select_army: (?selection_add: bool) -> void
2217
2168
 
2218
- # Finds points in a straight line.
2219
- # In a line, on the angle of source->target point, starting at source+offset, in increments find points on the line up to max distance
2169
+ # Selects warp gates (Protoss)
2220
2170
  #
2221
- # _@param_ `source` — location from which we go
2171
+ # _@param_ `selection_add` — default false To add to other selected items
2172
+ def action_ui_select_warp_gates: (?selection_add: bool) -> void
2173
+
2174
+ # Selects larva (Zerg)
2175
+ def action_ui_select_larva: () -> void
2176
+
2177
+ # sord omit - no YARD return type given, using untyped
2178
+ # Select idle workers
2222
2179
  #
2223
- # _@param_ `target` — location towards which we go
2180
+ # _@param_ `type` — 1-4 = Api::ActionSelectIdleWorker::Type::* enum Type { Set = 1; // Equivalent to click with no modifiers. Replaces selection with single idle worker. Add = 2; // Equivalent to shift+click. Adds single idle worker to current selection. All = 3; // Equivalent to control+click. Selects all idle workers. AddAll = 4; // Equivalent to shift+control+click. Adds all idle workers to current selection. }
2181
+ def action_ui_select_idle_worker: (_type: Integer) -> untyped
2182
+
2183
+ # sord omit - no YARD return type given, using untyped
2184
+ # Multi-panel actions for select/deselect
2185
+ # message ActionMultiPanel {
2186
+ # optional Type type = 1;
2187
+ # optional int32 unit_index = 2;
2188
+ # }
2224
2189
  #
2225
- # _@param_ `offset` — how far from source to start
2190
+ # _@param_ `type` — 1-4 = Api::ActionMultiPanel::Type::*
2226
2191
  #
2227
- # _@param_ `increment` — how far apart to gets, i.e. increment = unit.radius*2 to space units in a line
2192
+ # _@param_ `unit_index` — n'th unit on panel enum Type { SingleSelect = 1; // Click on icon DeselectUnit = 2; // Shift Click on icon SelectAllOfType = 3; // Control Click on icon. DeselectAllOfType = 4; // Control+Shift Click on icon. }
2193
+ def action_ui_multi_panel: (_type: Integer, unit_index: Integer) -> untyped
2194
+
2195
+ # sord omit - no YARD return type given, using untyped
2196
+ # Cargo panel actions for unloading units.
2228
2197
  #
2229
- # _@param_ `count` — number of points to retrieve
2198
+ # _@param_ `unit_index` — index of unit to unload
2199
+ def action_ui_cargo_panel_unload: (unit_index: Integer) -> untyped
2200
+
2201
+ # sord omit - no YARD return type given, using untyped
2202
+ # Remove unit from production queue
2230
2203
  #
2231
- # _@return_points up to a max of count
2232
- def points_nearest_linear: (
2233
- source: Sc2::Position,
2234
- target: Sc2::Position,
2235
- ?offset: Float,
2236
- ?increment: Float,
2237
- ?count: Integer
2238
- ) -> ::Array[Api::Point2D]
2204
+ # _@param_ `unit_index` target unit index
2205
+ def action_ui_production_panel_remove_from_queue: (unit_index: Integer) -> untyped
2239
2206
 
2240
- # Gets a random point near a location with a positive/negative offset applied to both x and y
2207
+ # sord omit - no YARD return type given, using untyped
2208
+ # Toggle autocast on selected unit. Also possible with raw actions using a unit target.
2241
2209
  #
2242
- # _@param_ `pos`
2210
+ # _@param_ `ability_id` — Api::AbilityId::* ability
2211
+ def action_ui_toggle_autocast: (ability_id: Integer) -> untyped
2212
+
2213
+ # sord omit - no YARD return type given, using untyped
2214
+ # Send a chat message
2243
2215
  #
2244
- # _@param_ `offset`
2216
+ # _@param_ `message` — to send
2245
2217
  #
2246
- # ```ruby
2247
- # Randomly randomly adjust both x and y by a range of -3.5 or +3.5
2248
- # geo.point_random_near(point: structures.hq.first, offset: 3.5)
2249
- # ```
2250
- def point_random_near: (pos: Sc2::Position, ?offset: Float) -> Api::Point2D
2218
+ # _@param_ `channel` — 1-2, default:Team Api::ActionChat::Channel::Broadcast = 1, Api::ActionChat::Channel::Team = 2
2219
+ def action_chat: (String message, ?channel: Integer) -> untyped
2251
2220
 
2252
- # _@param_ `pos`
2221
+ # sord omit - no YARD return type given, using untyped
2222
+ # Sends actions via api and flushes action_queue
2223
+ def perform_actions: () -> untyped
2224
+
2225
+ # Empties and resets @action_queue
2226
+ def clear_action_queue: () -> void
2227
+
2228
+ # Returns an array of unit tags from a variety of sources
2229
+ # noinspection RubyMismatchedReturnType
2253
2230
  #
2254
- # _@param_ `radius`
2255
- def point_random_on_circle: (pos: Sc2::Position, ?radius: Float) -> Api::Point2D
2231
+ # _@param_ `source` — unit tag, tags, unit or unit group
2232
+ #
2233
+ # _@return_ — unit tag array
2234
+ def unit_tags_from_source: ((Integer | ::Array[Integer] | Api::Unit | Sc2::UnitGroup) source) -> ::Array[Integer]
2256
2235
 
2257
- # _@return_ player with active connection
2258
- attr_accessor bot: (Sc2::Player | untyped)
2236
+ # sord warn - Api::Action wasn't able to be resolved to a constant in this project
2237
+ attr_accessor action_queue: ::Array[Api::Action]
2259
2238
  end
2260
2239
 
2261
2240
  # Holds game state
@@ -2360,12 +2339,16 @@ module Sc2
2360
2339
  # _@param_ `bot`
2361
2340
  def after_reset: (Sc2::Player::Bot _bot) -> untyped
2362
2341
 
2342
+ # sord omit - no YARD type given for "upgrade_id", using untyped
2343
+ # Returns true if this upgrade has finished researching
2344
+ def upgrade_completed?: (untyped upgrade_id) -> bool
2345
+
2363
2346
  # Returns the upgrade ids which are researching or queued
2364
2347
  # Not set for enemy.
2365
2348
  def upgrades_in_progress: () -> ::Array[Integer]
2366
2349
 
2367
2350
  # sord omit - no YARD type given for "upgrade_id", using untyped
2368
- # Returns the upgrade ids which are researching or queued
2351
+ # Returns true if the upgrade is busy researching
2369
2352
  def upgrade_in_progress?: (untyped upgrade_id) -> bool
2370
2353
 
2371
2354
  # sord omit - no YARD type given for "unit_type_id", using untyped
@@ -2483,117 +2466,84 @@ module Sc2
2483
2466
  end
2484
2467
  end
2485
2468
 
2486
- # Command line utilities
2487
- class Cli < Thor
2488
- def self.exit_on_failure?: () -> bool
2489
-
2490
- # sord omit - no YARD return type given, using untyped
2491
- # downloads and install SC2 v4.10
2492
- def setup410: () -> untyped
2493
-
2494
- # sord omit - no YARD return type given, using untyped
2495
- def ladderconfig: () -> untyped
2496
-
2497
- # sord omit - no YARD return type given, using untyped
2498
- def laddermatch: () -> untyped
2499
-
2500
- class New < Thor::Group
2501
- include Thor::Actions
2502
-
2503
- # sord omit - no YARD return type given, using untyped
2504
- def self.source_root: () -> untyped
2505
-
2506
- # sord omit - no YARD return type given, using untyped
2507
- def checkname: () -> untyped
2508
-
2509
- # sord omit - no YARD return type given, using untyped
2510
- def create_target: () -> untyped
2511
-
2512
- # sord omit - no YARD return type given, using untyped
2513
- def create_boot: () -> untyped
2514
-
2515
- # sord omit - no YARD return type given, using untyped
2516
- def create_example_match: () -> untyped
2517
-
2518
- # sord omit - no YARD return type given, using untyped
2519
- def create_gemfile: () -> untyped
2520
-
2521
- # sord omit - no YARD return type given, using untyped
2522
- def create_botfile: () -> untyped
2523
-
2524
- # sord omit - no YARD return type given, using untyped
2525
- def create_ignorefile: () -> untyped
2526
-
2527
- # sord omit - no YARD return type given, using untyped
2528
- def copy_api: () -> untyped
2529
-
2530
- # sord omit - no YARD return type given, using untyped
2531
- def bye: () -> untyped
2532
- end
2533
-
2534
- # Populating "./build" with our source...
2535
- # - Symlink executable ./build/bin/ladder to ./.build/botname for ladder
2536
- # - copy our source to .build, sans .ladderignore
2537
- # copy .build to docker
2538
- # bundle install on docker
2539
- # zipping up code + ruby + gems
2540
- # get zip, clean up
2541
- # stop docker
2542
- # standard:disable Style/GlobalVars
2543
- class Ladderzip < Thor::Group
2544
- include Thor::Actions
2545
-
2546
- # sord omit - no YARD return type given, using untyped
2547
- def docker_exists: () -> untyped
2548
-
2549
- # sord omit - no YARD return type given, using untyped
2550
- def set_compose_file: () -> untyped
2551
-
2552
- # sord omit - no YARD return type given, using untyped
2553
- def bot_validation: () -> untyped
2469
+ # Holds game data from tech tree and Api::ResponseData
2470
+ # Called once on game start
2471
+ class Data
2472
+ # sord warn - Api::ResponseData wasn't able to be resolved to a constant in this project
2473
+ # _@param_ `data`
2474
+ def initialize: (Api::ResponseData data) -> void
2554
2475
 
2555
- # sord omit - no YARD return type given, using untyped
2556
- def self.source_paths: () -> untyped
2476
+ # sord warn - Api::AbilityData wasn't able to be resolved to a constant in this project
2477
+ # sord warn - "Hash<Integer, Api::AbilityData] indexed data" does not appear to be a type
2478
+ # Indexes ability data by ability id
2479
+ #
2480
+ # _@param_ `abilities`
2481
+ #
2482
+ # _@return_ — Hash<Integer, Api::AbilityData] indexed data
2483
+ def abilities_from_proto: (::Array[Api::AbilityData] abilities) -> SORD_ERROR_HashIntegerApiAbilityDataindexeddata
2557
2484
 
2558
- # sord omit - no YARD return type given, using untyped
2559
- def self.source_root: () -> untyped
2485
+ # Indexes unit data by id
2486
+ #
2487
+ # _@param_ `units`
2488
+ #
2489
+ # _@return_ — indexed data
2490
+ def units_from_proto: (::Array[Api::UnitTypeData] units) -> ::Hash[Integer, Api::UnitTypeData]
2560
2491
 
2561
- # sord omit - no YARD return type given, using untyped
2562
- def ensure_build_dir: () -> untyped
2492
+ # sord warn - Api::UpgradeData wasn't able to be resolved to a constant in this project
2493
+ # sord warn - "Hash<Integer, Api::UpgradeData] indexed data" does not appear to be a type
2494
+ # Indexes upgrades data by id
2495
+ #
2496
+ # _@param_ `upgrades`
2497
+ #
2498
+ # _@return_ — Hash<Integer, Api::UpgradeData] indexed data
2499
+ def upgrades_from_proto: (::Array[Api::UpgradeData] upgrades) -> SORD_ERROR_HashIntegerApiUpgradeDataindexeddata
2563
2500
 
2564
- # sord omit - no YARD return type given, using untyped
2565
- def create_executable: () -> untyped
2501
+ # sord omit - no YARD type given for "effects", using untyped
2502
+ # sord omit - no YARD return type given, using untyped
2503
+ def effects_from_proto: (untyped effects) -> untyped
2566
2504
 
2567
- # sord omit - no YARD return type given, using untyped
2568
- def start_container: () -> untyped
2505
+ # sord omit - no YARD type given for "buffs", using untyped
2506
+ # sord omit - no YARD return type given, using untyped
2507
+ def buffs_from_proto: (untyped buffs) -> untyped
2569
2508
 
2570
- # sord omit - no YARD return type given, using untyped
2571
- def populate_build: () -> untyped
2509
+ # sord omit - no YARD return type given, using untyped
2510
+ # Overrides unit data from api to implement fixes or change context
2511
+ # i.e. Api::UnitTypeId::ORBITALCOMMAND cost is cost-to-upgrade instead of CC + Orbital combined cost.
2512
+ # Run once. Depends on all data already being set.
2513
+ def override_unit_data: () -> untyped
2572
2514
 
2573
- # sord omit - no YARD return type given, using untyped
2574
- def copy_build_to_docker: () -> untyped
2515
+ # sord omit - no YARD return type given, using untyped
2516
+ # Fixes mineral_cost, vespene_cost and food_required values
2517
+ def correct_unit_type_costs: () -> untyped
2575
2518
 
2576
- # sord omit - no YARD return type given, using untyped
2577
- def link_ladder: () -> untyped
2519
+ # sord omit - no YARD return type given, using untyped
2520
+ # Fixes mineral_cost_sum, vespene_cost_sum
2521
+ def correct_unit_type_sum: () -> untyped
2578
2522
 
2579
- # sord omit - no YARD return type given, using untyped
2580
- def install_gems: () -> untyped
2523
+ # sord omit - no YARD return type given, using untyped
2524
+ # Adds placement_length to units if applicable
2525
+ def decorate_unit_type_placement_length: () -> untyped
2581
2526
 
2582
- # sord omit - no YARD return type given, using untyped
2583
- def compress: () -> untyped
2527
+ # sord warn - Api::AbilityData wasn't able to be resolved to a constant in this project
2528
+ # _@return_ AbilityId => AbilityData
2529
+ attr_accessor abilities: (::Hash[Integer, Api::AbilityData] | untyped)
2584
2530
 
2585
- # sord omit - no YARD return type given, using untyped
2586
- def retreive_zip: () -> untyped
2531
+ # _@return_ UnitId => UnitTypeData
2532
+ attr_accessor units: (::Hash[Integer, Api::UnitTypeData] | untyped)
2587
2533
 
2588
- # sord omit - no YARD return type given, using untyped
2589
- def clean: () -> untyped
2534
+ # sord warn - Api::UpgradeData wasn't able to be resolved to a constant in this project
2535
+ # _@return_ UpgradeId => UpgradeData
2536
+ attr_accessor upgrades: (::Hash[Integer, Api::UpgradeData] | untyped)
2590
2537
 
2591
- # sord omit - no YARD return type given, using untyped
2592
- def stop_container: () -> untyped
2538
+ # sord omit - no YARD type given for :buffs, using untyped
2539
+ # Not particularly useful data. Just use BuffId directly
2540
+ # @return [Hash<Integer, Api::BuffData>] BuffId => BuffData
2541
+ attr_accessor buffs: untyped
2593
2542
 
2594
- # sord omit - no YARD return type given, using untyped
2595
- def bye: () -> untyped
2596
- end
2543
+ # sord omit - no YARD type given for :effects, using untyped
2544
+ # Not particularly useful data. Just use EffectId directly
2545
+ # @return [Hash<Integer, Api::EffectData>] EffectId => EffectData
2546
+ attr_accessor effects: untyped
2597
2547
  end
2598
2548
 
2599
2549
  # Manages client connection to the Api
@@ -2613,13 +2563,12 @@ module Sc2
2613
2563
  # Closes Connection to client
2614
2564
  def close: () -> void
2615
2565
 
2616
- # sord omit - no YARD return type given, using untyped
2617
2566
  # Add a listener of specific callback type
2618
2567
  #
2619
2568
  # _@param_ `listener`
2620
2569
  #
2621
2570
  # _@param_ `klass`
2622
- def add_listener: (Object listener, klass: (Module[Sc2::Connection::ConnectionListener] | Module[Sc2::Connection::StatusListener])) -> untyped
2571
+ def add_listener: (Object listener, klass: (Module[Sc2::Connection::ConnectionListener] | Module[Sc2::Connection::StatusListener])) -> void
2623
2572
 
2624
2573
  # sord omit - no YARD return type given, using untyped
2625
2574
  # Removes a listener of specific callback type
@@ -3275,14 +3224,14 @@ module Sc2
3275
3224
  class UnitGroup
3276
3225
  include Enumerable
3277
3226
  extend Forwardable
3278
- TYPE_WORKER: untyped
3279
- TYPE_GAS_STRUCTURE: untyped
3280
- TYPE_MINERAL: untyped
3281
- TYPE_GEYSER: untyped
3282
- TYPE_REJECT_DEBRIS: untyped
3227
+ TYPE_WORKER: ::Array[Integer]
3228
+ TYPE_GAS_STRUCTURE: ::Array[Integer]
3229
+ TYPE_MINERAL: ::Array[Integer]
3230
+ TYPE_GEYSER: ::Array[Integer]
3231
+ TYPE_REJECT_DEBRIS: ::Array[Integer]
3283
3232
  TYPE_TECHLAB: untyped
3284
- TYPE_REACTOR: untyped
3285
- TYPE_BASES: untyped
3233
+ TYPE_REACTOR: ::Array[Integer]
3234
+ TYPE_BASES: ::Array[Integer]
3286
3235
 
3287
3236
  # _@param_ `units` — default to be added.
3288
3237
  #
@@ -3535,7 +3484,7 @@ module Sc2
3535
3484
  def pos_centroid: () -> Api::Point2D?
3536
3485
 
3537
3486
  # Our first unit's bot object.
3538
- # Returns nil if units are empty, so use safetly operator bot&.method(...)
3487
+ # Returns nil if units are empty, so use safety operator bot&.method(...)
3539
3488
  #
3540
3489
  # _@return_ — player with active connection
3541
3490
  def bot: () -> Sc2::Player?
@@ -3557,7 +3506,7 @@ module Sc2
3557
3506
  # _@param_ `target` — is a unit tag or a Api::Point2D. Nil for addons/orbital
3558
3507
  #
3559
3508
  # _@param_ `queue_command` — shift+command
3560
- def build: (unit_type_id: Integer, ?target: (Api::Point2D | Integer)?, ?queue_command: bool) -> untyped
3509
+ def build: (unit_type_id: Integer, ?target: (Api::Point2D | Api::Unit | Integer)?, ?queue_command: bool) -> untyped
3561
3510
 
3562
3511
  # sord omit - no YARD return type given, using untyped
3563
3512
  # Warps in unit type at target (location or pylon)
@@ -3685,6 +3634,12 @@ module Sc2
3685
3634
  # ```
3686
3635
  def reject_attribute: ((Integer | ::Array[Integer]) attributes) -> UnitGroup
3687
3636
 
3637
+ # Selects units you own
3638
+ # i.e. @bot.all_units.owned # => Units you own
3639
+ #
3640
+ # _@return_ — workers
3641
+ def owned: () -> Sc2::UnitGroup
3642
+
3688
3643
  # Selects worker units
3689
3644
  #
3690
3645
  # _@return_ — workers
@@ -3746,7 +3701,7 @@ module Sc2
3746
3701
  # Selects only units which do not have orders
3747
3702
  def idle: () -> untyped
3748
3703
 
3749
- # Selects units which have this ability available\
3704
+ # Selects units which have this ability available
3750
3705
  # Queries API if necessary
3751
3706
  #
3752
3707
  # _@param_ `ability_id`
@@ -3754,6 +3709,11 @@ module Sc2
3754
3709
  # _@return_ — units which have the ability available
3755
3710
  def ability_available?: (Integer ability_id) -> UnitGroup
3756
3711
 
3712
+ # Checks whether any unit's first order matches these abilities
3713
+ #
3714
+ # _@param_ `ability_ids` — accepts one or an array of Api::AbilityId
3715
+ def is_performing_ability?: ((Integer | ::Array[Integer]) ability_ids) -> bool
3716
+
3757
3717
  # Selects mineral fields
3758
3718
  #
3759
3719
  # _@return_ — mineral fields
@@ -3800,6 +3760,11 @@ module Sc2
3800
3760
  # _@return_ — larva
3801
3761
  def larva: () -> Sc2::UnitGroup
3802
3762
 
3763
+ # Selects eggs. Eggs come from Larva and turn into Units.
3764
+ #
3765
+ # _@return_ — eggs
3766
+ def eggs: () -> Sc2::UnitGroup
3767
+
3803
3768
  # Selects queens
3804
3769
  #
3805
3770
  # _@return_ — queens
@@ -3885,14 +3850,14 @@ module Sc2
3885
3850
  # @private
3886
3851
  # Negative selector allowing unit group "ug.not." filter
3887
3852
  class UnitGroupNotSelector < Sc2::UnitGroup
3888
- TYPE_WORKER: untyped
3889
- TYPE_GAS_STRUCTURE: untyped
3890
- TYPE_MINERAL: untyped
3891
- TYPE_GEYSER: untyped
3892
- TYPE_REJECT_DEBRIS: untyped
3853
+ TYPE_WORKER: ::Array[Integer]
3854
+ TYPE_GAS_STRUCTURE: ::Array[Integer]
3855
+ TYPE_MINERAL: ::Array[Integer]
3856
+ TYPE_GEYSER: ::Array[Integer]
3857
+ TYPE_REJECT_DEBRIS: ::Array[Integer]
3893
3858
  TYPE_TECHLAB: untyped
3894
- TYPE_REACTOR: untyped
3895
- TYPE_BASES: untyped
3859
+ TYPE_REACTOR: ::Array[Integer]
3860
+ TYPE_BASES: ::Array[Integer]
3896
3861
 
3897
3862
  # sord infer - argument name in single @param inferred as "unit_group"
3898
3863
  def initialize: ((Api::Unit | ::Hash[Integer, Api::Unit] | ::Array[Api::Unit] | Sc2::UnitGroup)? unit_group) -> void
@@ -4232,8 +4197,8 @@ module Sc2
4232
4197
  # _@param_ `player_index`
4233
4198
  def stop: (Integer player_index) -> void
4234
4199
 
4235
- # sord omit - no YARD return type given, using untyped
4236
- def stop_all: () -> untyped
4200
+ # Stops all clients
4201
+ def stop_all: () -> void
4237
4202
 
4238
4203
  def initialize: () -> void
4239
4204
 
@@ -8550,6 +8515,17 @@ module Api
8550
8515
  # _@return_ — this unit from the previous frame or nil if it wasn't present
8551
8516
  def previous: () -> Api::Unit?
8552
8517
 
8518
+ # Returns whether a unit is alive or not
8519
+ # Useful for cached Unit objects to see if they are still relevant.
8520
+ #
8521
+ # _@return_ — alive
8522
+ def is_alive?: () -> bool
8523
+
8524
+ # Replaces protobuf values with latest from game
8525
+ #
8526
+ # _@return_ — true if refreshed or false unchanged
8527
+ def refresh!: () -> bool
8528
+
8553
8529
  # sord warn - Api::Attribute wasn't able to be resolved to a constant in this project
8554
8530
  # Returns static [Api::UnitTypeData] for a unit
8555
8531
  def attributes: () -> ::Array[Api::Attribute]
@@ -8690,7 +8666,7 @@ module Api
8690
8666
  # _@param_ `target` — is a unit tag or a Api::Point2D. Nil for addons/orbital
8691
8667
  #
8692
8668
  # _@param_ `queue_command` — shift+command
8693
- def build: (unit_type_id: Integer, ?target: (Api::Point2D | Integer)?, ?queue_command: bool) -> untyped
8669
+ def build: (unit_type_id: Integer, ?target: (Api::Point2D | Api::Unit | Integer)?, ?queue_command: bool) -> untyped
8694
8670
 
8695
8671
  # sord omit - no YARD return type given, using untyped
8696
8672
  # Issues repair command on target
@@ -8756,7 +8732,12 @@ module Api
8756
8732
  # _@param_ `target` — optionally check if unit is engaged with specific target
8757
8733
  def is_repairing?: (?target: (Api::Unit | Integer)?) -> bool
8758
8734
 
8759
- # Checks whether the unit has
8735
+ # Checks whether a unit is gathering or returning gathered minerals/gas
8736
+ #
8737
+ # _@return_ — true if either gathering or returning, false otherwise
8738
+ def is_harvesting?: () -> bool
8739
+
8740
+ # Checks whether a unit's first order for ability
8760
8741
  #
8761
8742
  # _@param_ `ability_ids` — accepts one or an array of Api::AbilityId
8762
8743
  def is_performing_ability?: ((Integer | ::Array[Integer]) ability_ids) -> bool
@@ -8860,6 +8841,9 @@ module Api
8860
8841
  # For Terran builds a tech lab add-on on the current structure
8861
8842
  def build_tech_lab: (?queue_command: untyped) -> void
8862
8843
 
8844
+ # sord omit - no YARD return type given, using untyped
8845
+ def target_for_addon_placement: () -> untyped
8846
+
8863
8847
  # sord omit - no YARD return type given, using untyped
8864
8848
  # Warps in unit type at target (location or pylon)
8865
8849
  # Only works if the source is a Warp Gate
@@ -8916,7 +8900,7 @@ module Api
8916
8900
  # sord omit - no YARD type given for "g:", using untyped
8917
8901
  # sord omit - no YARD type given for "b:", using untyped
8918
8902
  # For lines: r & b are swapped.
8919
- def initialize: (r: untyped, g: untyped, b: untyped) -> void
8903
+ def initialize: (?r: untyped, ?g: untyped, ?b: untyped) -> void
8920
8904
 
8921
8905
  # Adds additional functionality to message class Api::Color
8922
8906
  module ClassMethods
@@ -8969,7 +8953,7 @@ module Api
8969
8953
  # sord omit - no YARD type given for "g:", using untyped
8970
8954
  # sord omit - no YARD type given for "b:", using untyped
8971
8955
  # For lines: r & b are swapped.
8972
- def initialize: (r: untyped, g: untyped, b: untyped) -> void
8956
+ def initialize: (?r: untyped, ?g: untyped, ?b: untyped) -> void
8973
8957
  end
8974
8958
 
8975
8959
  # Protobuf virtual class.
@@ -9158,6 +9142,9 @@ module Api
9158
9142
  # sord omit - no YARD type given for "other", using untyped
9159
9143
  def eql?: (untyped other) -> bool
9160
9144
 
9145
+ # Returns self
9146
+ def to_p2d: () -> self
9147
+
9161
9148
  # sord omit - no YARD type given for "z:", using untyped
9162
9149
  # Create a new 3d Point, by adding a y axis.
9163
9150
  def to_3d: (?z: untyped) -> Api::Point
@@ -9751,6 +9738,17 @@ module Api
9751
9738
  # _@return_ — this unit from the previous frame or nil if it wasn't present
9752
9739
  def previous: () -> Api::Unit?
9753
9740
 
9741
+ # Returns whether a unit is alive or not
9742
+ # Useful for cached Unit objects to see if they are still relevant.
9743
+ #
9744
+ # _@return_ — alive
9745
+ def is_alive?: () -> bool
9746
+
9747
+ # Replaces protobuf values with latest from game
9748
+ #
9749
+ # _@return_ — true if refreshed or false unchanged
9750
+ def refresh!: () -> bool
9751
+
9754
9752
  # sord warn - Api::Attribute wasn't able to be resolved to a constant in this project
9755
9753
  # Returns static [Api::UnitTypeData] for a unit
9756
9754
  def attributes: () -> ::Array[Api::Attribute]
@@ -9891,7 +9889,7 @@ module Api
9891
9889
  # _@param_ `target` — is a unit tag or a Api::Point2D. Nil for addons/orbital
9892
9890
  #
9893
9891
  # _@param_ `queue_command` — shift+command
9894
- def build: (unit_type_id: Integer, ?target: (Api::Point2D | Integer)?, ?queue_command: bool) -> untyped
9892
+ def build: (unit_type_id: Integer, ?target: (Api::Point2D | Api::Unit | Integer)?, ?queue_command: bool) -> untyped
9895
9893
 
9896
9894
  # sord omit - no YARD return type given, using untyped
9897
9895
  # Issues repair command on target
@@ -9957,7 +9955,12 @@ module Api
9957
9955
  # _@param_ `target` — optionally check if unit is engaged with specific target
9958
9956
  def is_repairing?: (?target: (Api::Unit | Integer)?) -> bool
9959
9957
 
9960
- # Checks whether the unit has
9958
+ # Checks whether a unit is gathering or returning gathered minerals/gas
9959
+ #
9960
+ # _@return_ — true if either gathering or returning, false otherwise
9961
+ def is_harvesting?: () -> bool
9962
+
9963
+ # Checks whether a unit's first order for ability
9961
9964
  #
9962
9965
  # _@param_ `ability_ids` — accepts one or an array of Api::AbilityId
9963
9966
  def is_performing_ability?: ((Integer | ::Array[Integer]) ability_ids) -> bool
@@ -10061,6 +10064,9 @@ module Api
10061
10064
  # For Terran builds a tech lab add-on on the current structure
10062
10065
  def build_tech_lab: (?queue_command: untyped) -> void
10063
10066
 
10067
+ # sord omit - no YARD return type given, using untyped
10068
+ def target_for_addon_placement: () -> untyped
10069
+
10064
10070
  # sord omit - no YARD return type given, using untyped
10065
10071
  # Warps in unit type at target (location or pylon)
10066
10072
  # Only works if the source is a Warp Gate
@@ -10085,11 +10091,7 @@ module Api
10085
10091
 
10086
10092
  # Protobuf virtual class.
10087
10093
  class UnitTypeData < Google::Protobuf::AbstractMessage
10088
- include Api::UnitTypeExtension
10089
10094
  include Api::UnitTypeDataExtension
10090
-
10091
- # sord omit - no YARD return type given, using untyped
10092
- def mood: () -> untyped
10093
10095
  end
10094
10096
 
10095
10097
  # Protobuf virtual class.
@@ -10165,19 +10167,261 @@ module Api
10165
10167
  end
10166
10168
 
10167
10169
  # Protobuf virtual enum.
10168
- class Race < Google::Protobuf::AbstractMessage
10170
+ module Race
10171
+ NoRace: untyped
10172
+ Terran: untyped
10173
+ Zerg: untyped
10174
+ Protoss: untyped
10175
+ Random: untyped
10176
+ end
10177
+
10178
+ # Protobuf virtual enum.
10179
+ module PlayerType
10180
+ Participant: untyped
10181
+ Computer: untyped
10182
+ Observer: untyped
10169
10183
  end
10170
10184
 
10171
10185
  # Protobuf virtual enum.
10172
- class PlayerType < Google::Protobuf::AbstractMessage
10186
+ module Difficulty
10187
+ VeryEasy: untyped
10188
+ Easy: untyped
10189
+ Medium: untyped
10190
+ MediumHard: untyped
10191
+ Hard: untyped
10192
+ Harder: untyped
10193
+ VeryHard: untyped
10194
+ CheatVision: untyped
10195
+ CheatMoney: untyped
10196
+ CheatInsane: untyped
10173
10197
  end
10174
10198
 
10175
10199
  # Protobuf virtual enum.
10176
- class Difficulty < Google::Protobuf::AbstractMessage
10200
+ module AIBuild
10201
+ RandomBuild: untyped
10202
+ Rush: untyped
10203
+ Timing: untyped
10204
+ Power: untyped
10205
+ Macro: untyped
10206
+ Air: untyped
10177
10207
  end
10178
10208
 
10179
10209
  # Protobuf virtual enum.
10180
- class AIBuild < Google::Protobuf::AbstractMessage
10210
+ module ActionResult
10211
+ Success: untyped
10212
+ NotSupported: untyped
10213
+ Error: untyped
10214
+ CantQueueThatOrder: untyped
10215
+ Retry: untyped
10216
+ Cooldown: untyped
10217
+ QueueIsFull: untyped
10218
+ RallyQueueIsFull: untyped
10219
+ NotEnoughMinerals: untyped
10220
+ NotEnoughVespene: untyped
10221
+ NotEnoughTerrazine: untyped
10222
+ NotEnoughCustom: untyped
10223
+ NotEnoughFood: untyped
10224
+ FoodUsageImpossible: untyped
10225
+ NotEnoughLife: untyped
10226
+ NotEnoughShields: untyped
10227
+ NotEnoughEnergy: untyped
10228
+ LifeSuppressed: untyped
10229
+ ShieldsSuppressed: untyped
10230
+ EnergySuppressed: untyped
10231
+ NotEnoughCharges: untyped
10232
+ CantAddMoreCharges: untyped
10233
+ TooMuchMinerals: untyped
10234
+ TooMuchVespene: untyped
10235
+ TooMuchTerrazine: untyped
10236
+ TooMuchCustom: untyped
10237
+ TooMuchFood: untyped
10238
+ TooMuchLife: untyped
10239
+ TooMuchShields: untyped
10240
+ TooMuchEnergy: untyped
10241
+ MustTargetUnitWithLife: untyped
10242
+ MustTargetUnitWithShields: untyped
10243
+ MustTargetUnitWithEnergy: untyped
10244
+ CantTrade: untyped
10245
+ CantSpend: untyped
10246
+ CantTargetThatUnit: untyped
10247
+ CouldntAllocateUnit: untyped
10248
+ UnitCantMove: untyped
10249
+ TransportIsHoldingPosition: untyped
10250
+ BuildTechRequirementsNotMet: untyped
10251
+ CantFindPlacementLocation: untyped
10252
+ CantBuildOnThat: untyped
10253
+ CantBuildTooCloseToDropOff: untyped
10254
+ CantBuildLocationInvalid: untyped
10255
+ CantSeeBuildLocation: untyped
10256
+ CantBuildTooCloseToCreepSource: untyped
10257
+ CantBuildTooCloseToResources: untyped
10258
+ CantBuildTooFarFromWater: untyped
10259
+ CantBuildTooFarFromCreepSource: untyped
10260
+ CantBuildTooFarFromBuildPowerSource: untyped
10261
+ CantBuildOnDenseTerrain: untyped
10262
+ CantTrainTooFarFromTrainPowerSource: untyped
10263
+ CantLandLocationInvalid: untyped
10264
+ CantSeeLandLocation: untyped
10265
+ CantLandTooCloseToCreepSource: untyped
10266
+ CantLandTooCloseToResources: untyped
10267
+ CantLandTooFarFromWater: untyped
10268
+ CantLandTooFarFromCreepSource: untyped
10269
+ CantLandTooFarFromBuildPowerSource: untyped
10270
+ CantLandTooFarFromTrainPowerSource: untyped
10271
+ CantLandOnDenseTerrain: untyped
10272
+ AddOnTooFarFromBuilding: untyped
10273
+ MustBuildRefineryFirst: untyped
10274
+ BuildingIsUnderConstruction: untyped
10275
+ CantFindDropOff: untyped
10276
+ CantLoadOtherPlayersUnits: untyped
10277
+ NotEnoughRoomToLoadUnit: untyped
10278
+ CantUnloadUnitsThere: untyped
10279
+ CantWarpInUnitsThere: untyped
10280
+ CantLoadImmobileUnits: untyped
10281
+ CantRechargeImmobileUnits: untyped
10282
+ CantRechargeUnderConstructionUnits: untyped
10283
+ CantLoadThatUnit: untyped
10284
+ NoCargoToUnload: untyped
10285
+ LoadAllNoTargetsFound: untyped
10286
+ NotWhileOccupied: untyped
10287
+ CantAttackWithoutAmmo: untyped
10288
+ CantHoldAnyMoreAmmo: untyped
10289
+ TechRequirementsNotMet: untyped
10290
+ MustLockdownUnitFirst: untyped
10291
+ MustTargetUnit: untyped
10292
+ MustTargetInventory: untyped
10293
+ MustTargetVisibleUnit: untyped
10294
+ MustTargetVisibleLocation: untyped
10295
+ MustTargetWalkableLocation: untyped
10296
+ MustTargetPawnableUnit: untyped
10297
+ YouCantControlThatUnit: untyped
10298
+ YouCantIssueCommandsToThatUnit: untyped
10299
+ MustTargetResources: untyped
10300
+ RequiresHealTarget: untyped
10301
+ RequiresRepairTarget: untyped
10302
+ NoItemsToDrop: untyped
10303
+ CantHoldAnyMoreItems: untyped
10304
+ CantHoldThat: untyped
10305
+ TargetHasNoInventory: untyped
10306
+ CantDropThisItem: untyped
10307
+ CantMoveThisItem: untyped
10308
+ CantPawnThisUnit: untyped
10309
+ MustTargetCaster: untyped
10310
+ CantTargetCaster: untyped
10311
+ MustTargetOuter: untyped
10312
+ CantTargetOuter: untyped
10313
+ MustTargetYourOwnUnits: untyped
10314
+ CantTargetYourOwnUnits: untyped
10315
+ MustTargetFriendlyUnits: untyped
10316
+ CantTargetFriendlyUnits: untyped
10317
+ MustTargetNeutralUnits: untyped
10318
+ CantTargetNeutralUnits: untyped
10319
+ MustTargetEnemyUnits: untyped
10320
+ CantTargetEnemyUnits: untyped
10321
+ MustTargetAirUnits: untyped
10322
+ CantTargetAirUnits: untyped
10323
+ MustTargetGroundUnits: untyped
10324
+ CantTargetGroundUnits: untyped
10325
+ MustTargetStructures: untyped
10326
+ CantTargetStructures: untyped
10327
+ MustTargetLightUnits: untyped
10328
+ CantTargetLightUnits: untyped
10329
+ MustTargetArmoredUnits: untyped
10330
+ CantTargetArmoredUnits: untyped
10331
+ MustTargetBiologicalUnits: untyped
10332
+ CantTargetBiologicalUnits: untyped
10333
+ MustTargetHeroicUnits: untyped
10334
+ CantTargetHeroicUnits: untyped
10335
+ MustTargetRoboticUnits: untyped
10336
+ CantTargetRoboticUnits: untyped
10337
+ MustTargetMechanicalUnits: untyped
10338
+ CantTargetMechanicalUnits: untyped
10339
+ MustTargetPsionicUnits: untyped
10340
+ CantTargetPsionicUnits: untyped
10341
+ MustTargetMassiveUnits: untyped
10342
+ CantTargetMassiveUnits: untyped
10343
+ MustTargetMissile: untyped
10344
+ CantTargetMissile: untyped
10345
+ MustTargetWorkerUnits: untyped
10346
+ CantTargetWorkerUnits: untyped
10347
+ MustTargetEnergyCapableUnits: untyped
10348
+ CantTargetEnergyCapableUnits: untyped
10349
+ MustTargetShieldCapableUnits: untyped
10350
+ CantTargetShieldCapableUnits: untyped
10351
+ MustTargetFlyers: untyped
10352
+ CantTargetFlyers: untyped
10353
+ MustTargetBuriedUnits: untyped
10354
+ CantTargetBuriedUnits: untyped
10355
+ MustTargetCloakedUnits: untyped
10356
+ CantTargetCloakedUnits: untyped
10357
+ MustTargetUnitsInAStasisField: untyped
10358
+ CantTargetUnitsInAStasisField: untyped
10359
+ MustTargetUnderConstructionUnits: untyped
10360
+ CantTargetUnderConstructionUnits: untyped
10361
+ MustTargetDeadUnits: untyped
10362
+ CantTargetDeadUnits: untyped
10363
+ MustTargetRevivableUnits: untyped
10364
+ CantTargetRevivableUnits: untyped
10365
+ MustTargetHiddenUnits: untyped
10366
+ CantTargetHiddenUnits: untyped
10367
+ CantRechargeOtherPlayersUnits: untyped
10368
+ MustTargetHallucinations: untyped
10369
+ CantTargetHallucinations: untyped
10370
+ MustTargetInvulnerableUnits: untyped
10371
+ CantTargetInvulnerableUnits: untyped
10372
+ MustTargetDetectedUnits: untyped
10373
+ CantTargetDetectedUnits: untyped
10374
+ CantTargetUnitWithEnergy: untyped
10375
+ CantTargetUnitWithShields: untyped
10376
+ MustTargetUncommandableUnits: untyped
10377
+ CantTargetUncommandableUnits: untyped
10378
+ MustTargetPreventDefeatUnits: untyped
10379
+ CantTargetPreventDefeatUnits: untyped
10380
+ MustTargetPreventRevealUnits: untyped
10381
+ CantTargetPreventRevealUnits: untyped
10382
+ MustTargetPassiveUnits: untyped
10383
+ CantTargetPassiveUnits: untyped
10384
+ MustTargetStunnedUnits: untyped
10385
+ CantTargetStunnedUnits: untyped
10386
+ MustTargetSummonedUnits: untyped
10387
+ CantTargetSummonedUnits: untyped
10388
+ MustTargetUser1: untyped
10389
+ CantTargetUser1: untyped
10390
+ MustTargetUnstoppableUnits: untyped
10391
+ CantTargetUnstoppableUnits: untyped
10392
+ MustTargetResistantUnits: untyped
10393
+ CantTargetResistantUnits: untyped
10394
+ MustTargetDazedUnits: untyped
10395
+ CantTargetDazedUnits: untyped
10396
+ CantLockdown: untyped
10397
+ CantMindControl: untyped
10398
+ MustTargetDestructibles: untyped
10399
+ CantTargetDestructibles: untyped
10400
+ MustTargetItems: untyped
10401
+ CantTargetItems: untyped
10402
+ NoCalldownAvailable: untyped
10403
+ WaypointListFull: untyped
10404
+ MustTargetRace: untyped
10405
+ CantTargetRace: untyped
10406
+ MustTargetSimilarUnits: untyped
10407
+ CantTargetSimilarUnits: untyped
10408
+ CantFindEnoughTargets: untyped
10409
+ AlreadySpawningLarva: untyped
10410
+ CantTargetExhaustedResources: untyped
10411
+ CantUseMinimap: untyped
10412
+ CantUseInfoPanel: untyped
10413
+ OrderQueueIsFull: untyped
10414
+ CantHarvestThatResource: untyped
10415
+ HarvestersNotRequired: untyped
10416
+ AlreadyTargeted: untyped
10417
+ CantAttackWeaponsDisabled: untyped
10418
+ CouldntReachTarget: untyped
10419
+ TargetIsOutOfRange: untyped
10420
+ TargetIsTooClose: untyped
10421
+ TargetIsOutOfArc: untyped
10422
+ CantFindTeleportLocation: untyped
10423
+ InvalidItemClass: untyped
10424
+ CantFindCancelOrder: untyped
10181
10425
  end
10182
10426
 
10183
10427
  # Adds additional functionality to message object Api::Point2D
@@ -10188,6 +10432,9 @@ module Api
10188
10432
  # sord omit - no YARD type given for "other", using untyped
10189
10433
  def eql?: (untyped other) -> bool
10190
10434
 
10435
+ # Returns self
10436
+ def to_p2d: () -> self
10437
+
10191
10438
  # sord omit - no YARD type given for "z:", using untyped
10192
10439
  # Create a new 3d Point, by adding a y axis.
10193
10440
  def to_3d: (?z: untyped) -> Api::Point
@@ -10205,12 +10452,6 @@ module Api
10205
10452
  end
10206
10453
  end
10207
10454
 
10208
- # Adds additional functionality to message object Api::Unit
10209
- module UnitTypeExtension
10210
- # sord omit - no YARD return type given, using untyped
10211
- def mood: () -> untyped
10212
- end
10213
-
10214
10455
  # Adds additional functionality to message object Api::PowerSource
10215
10456
  module PowerSourceExtension
10216
10457
  include Sc2::Position
@@ -10381,6 +10622,14 @@ module Api
10381
10622
  #
10382
10623
  # _@return_ — sum of vespene gas costs
10383
10624
  attr_accessor vespene_cost_sum: (Integer | untyped)
10625
+
10626
+ # Length of tiles to build.
10627
+ # i.e. 5 for any Base-type (5x5)
10628
+ # i.e. 3 for Barracks (3x3)
10629
+ # i.e. 2 for Supply Depot (2x2)
10630
+ #
10631
+ # _@return_ — side-length for placement
10632
+ attr_accessor placement_length: (Integer | untyped)
10384
10633
  end
10385
10634
 
10386
10635
  # This module make sure that a read from method ability_id always returns the proper source id
@@ -10389,63 +10638,4 @@ module Api
10389
10638
  # i.e. Api::AbilityId::ATTACK_BATTLECRUISER returns generic Api::AbilityId::ATTACK
10390
10639
  def ability_id: () -> Integer
10391
10640
  end
10392
- end
10393
-
10394
- # Array extensions
10395
- class Array
10396
- # Turns an Array of Api::Unit into a Sc2::UnitGroup
10397
- #
10398
- # _@return_ — array converted to a unit group
10399
- def to_unit_group: () -> Sc2::UnitGroup
10400
-
10401
- # Creates a Point2D from 0,1 as x,y
10402
- def to_p2d: () -> Api::Point2D
10403
- end
10404
-
10405
- # Kernel extensions
10406
- module Kernel
10407
- # sord omit - no YARD return type given, using untyped
10408
- # Sets $VERBOSE to +nil+ for the duration of the block and back to its original
10409
- # value afterwards.
10410
- #
10411
- # silence_warnings do
10412
- # value = noisy_call # no warning voiced
10413
- # end
10414
- #
10415
- # noisy_call # warning voiced
10416
- def silence_warnings: () -> untyped
10417
-
10418
- # sord omit - no YARD return type given, using untyped
10419
- # Sets $VERBOSE to +nil+ for the duration of the block and back to its original
10420
- # value afterwards.
10421
- #
10422
- # silence_warnings do
10423
- # value = noisy_call # no warning voiced
10424
- # end
10425
- #
10426
- # noisy_call # warning voiced
10427
- def self.silence_warnings: () -> untyped
10428
-
10429
- # sord omit - no YARD type given for "flag", using untyped
10430
- # sord omit - no YARD return type given, using untyped
10431
- # Sets $VERBOSE for the duration of the block and back to its original
10432
- # value afterwards.
10433
- def with_warnings: (untyped flag) -> untyped
10434
-
10435
- # sord omit - no YARD type given for "flag", using untyped
10436
- # sord omit - no YARD return type given, using untyped
10437
- # Sets $VERBOSE for the duration of the block and back to its original
10438
- # value afterwards.
10439
- # noinspection RubyGlobalVariableNamingConvention
10440
- def self.with_warnings: (untyped flag) -> untyped
10441
- end
10442
-
10443
- module Async
10444
- module Process
10445
- class Child
10446
- # sord omit - no YARD type given for "*args", using untyped
10447
- # sord omit - no YARD type given for "**options", using untyped
10448
- def initialize: (*untyped args, **untyped options) -> void
10449
- end
10450
- end
10451
10641
  end