sc2ai 0.0.8 → 0.1.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.
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
@@ -1058,12 +982,16 @@ module Sc2
1058
982
  # _@return_ — unit tag array
1059
983
  def unit_tags_from_source: ((Integer | ::Array[Integer] | Api::Unit | Sc2::UnitGroup) source) -> ::Array[Integer]
1060
984
 
985
+ # sord omit - no YARD type given for "upgrade_id", using untyped
986
+ # Returns true if this upgrade has finished researching
987
+ def upgrade_completed?: (untyped upgrade_id) -> bool
988
+
1061
989
  # Returns the upgrade ids which are researching or queued
1062
990
  # Not set for enemy.
1063
991
  def upgrades_in_progress: () -> ::Array[Integer]
1064
992
 
1065
993
  # sord omit - no YARD type given for "upgrade_id", using untyped
1066
- # Returns the upgrade ids which are researching or queued
994
+ # Returns true if the upgrade is busy researching
1067
995
  def upgrade_in_progress?: (untyped upgrade_id) -> bool
1068
996
 
1069
997
  # sord omit - no YARD type given for "unit_type_id", using untyped
@@ -1164,7 +1092,7 @@ module Sc2
1164
1092
  attr_accessor previous: (Sc2::Player::PreviousState | untyped)
1165
1093
 
1166
1094
  # _@return_ — geo and map helper functions
1167
- attr_accessor geo: (Sc2::Player::Geometry | untyped)
1095
+ attr_accessor geo: (Sc2::Player::Geo | untyped)
1168
1096
  end
1169
1097
 
1170
1098
  # A specialized type of player instance which each player has one of
@@ -1187,12 +1115,16 @@ module Sc2
1187
1115
  # _@return_ — Api::Race if race detected, false otherwise
1188
1116
  def detect_race_from_units: () -> (bool | Integer)
1189
1117
 
1118
+ # sord omit - no YARD type given for "upgrade_id", using untyped
1119
+ # Returns true if this upgrade has finished researching
1120
+ def upgrade_completed?: (untyped upgrade_id) -> bool
1121
+
1190
1122
  # Returns the upgrade ids which are researching or queued
1191
1123
  # Not set for enemy.
1192
1124
  def upgrades_in_progress: () -> ::Array[Integer]
1193
1125
 
1194
1126
  # sord omit - no YARD type given for "upgrade_id", using untyped
1195
- # Returns the upgrade ids which are researching or queued
1127
+ # Returns true if the upgrade is busy researching
1196
1128
  def upgrade_in_progress?: (untyped upgrade_id) -> bool
1197
1129
 
1198
1130
  # sord omit - no YARD type given for "unit_type_id", using untyped
@@ -1338,924 +1270,933 @@ module Sc2
1338
1270
  def initialize: (?name: String?) -> void
1339
1271
  end
1340
1272
 
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
1273
+ # Holds map and geography helper functions
1274
+ class Geo
1275
+ # sord omit - no YARD type given for "bot", using untyped
1276
+ def initialize: (untyped _bot) -> void
1349
1277
 
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
1278
+ # Gets the map tile width. Range is 1-255.
1279
+ # Effected by crop_to_playable_area
1280
+ def map_width: () -> Integer
1281
+
1282
+ # Gets the map tile height. Range is 1-255.
1283
+ # Effected by crop_to_playable_area
1284
+ def map_height: () -> Integer
1285
+
1286
+ # Center of the map
1287
+ def map_center: () -> Api::Point2D
1288
+
1289
+ # Returns zero to map_width as range
1354
1290
  #
1355
- # _@param_ `size` of font, default 14px
1356
- def debug_print: (String text, ?size: Size) -> void
1291
+ # _@return_0 to map_width
1292
+ def map_range_x: () -> ::Range[untyped]
1357
1293
 
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
1294
+ # Returns zero to map_height as range
1360
1295
  #
1361
- # _@param_ `text` will respect newlines
1296
+ # _@return_0 to map_height
1297
+ def map_range_y: () -> ::Range[untyped]
1298
+
1299
+ # Returns zero to map_width-1 as range
1300
+ def map_tile_range_x: () -> ::Range[untyped]
1301
+
1302
+ # Returns zero to map_height-1 as range
1303
+ def map_tile_range_y: () -> ::Range[untyped]
1304
+
1305
+ # Returns whether a x/y (integer) is placeable as per minimap image data.
1306
+ # It does not say whether a position is occupied by another building.
1307
+ # One pixel covers one whole block. Corrects floats on your behalf
1362
1308
  #
1363
- # _@param_ `left_percent` — range 0..100. percent from left of screen
1309
+ # _@param_ `x`
1364
1310
  #
1365
- # _@param_ `top_percent` — range 0..100. percent from top of screen
1311
+ # _@param_ `y`
1366
1312
  #
1367
- # _@param_ `color` default white
1313
+ # _@return_whether tile is placeable?
1368
1314
  #
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
1315
+ # _@see_ `Sc2::Player#pathable?`for detecting obstructions
1316
+ def placeable?: (x: (Float | Integer), y: (Float | Integer)) -> bool
1377
1317
 
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
1318
+ # sord warn - Numo::Bit wasn't able to be resolved to a constant in this project
1319
+ # Returns a parsed placement_grid from bot.game_info.start_raw.
1320
+ # Each value in [row][column] holds a boolean value represented as an integer
1321
+ # It does not say whether a position is occupied by another building.
1322
+ # One pixel covers one whole block. Rounds fractionated positions down.
1323
+ def parsed_placement_grid: () -> Numo::Bit
1324
+
1325
+ # Whether this tile is where an expansion is supposed to be placed.
1326
+ # To see if a unit/structure is blocking an expansion, pass their coordinates to this method.
1382
1327
  #
1383
- # _@param_ `point` — point in the world, i.e. unit.pos
1328
+ # _@param_ `x`
1384
1329
  #
1385
- # _@param_ `color` — default white
1330
+ # _@param_ `y`
1386
1331
  #
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
1332
+ # _@return_true if location has creep on it
1333
+ def expo_placement?: (x: (Float | Integer), y: (Float | Integer)) -> bool
1394
1334
 
1395
- # Draws a line between two Api::Point's for color
1335
+ # sord warn - Numo::Bit wasn't able to be resolved to a constant in this project
1336
+ # Returns a grid where only the expo locations are marked
1337
+ def expo_placement_grid: () -> Numo::Bit
1338
+
1339
+ # sord warn - Numo::Bit wasn't able to be resolved to a constant in this project
1340
+ # Returns a grid where only placement obstructions are marked
1341
+ # includes Tumors and lowered Supply Depots
1342
+ def placement_obstruction_grid: () -> Numo::Bit
1343
+
1344
+ # sord warn - Numo::Bit wasn't able to be resolved to a constant in this project
1345
+ # Returns a grid where powered locations are marked true
1346
+ def parsed_power_grid: () -> Numo::Bit
1347
+
1348
+ # Returns whether a x/y block is powered. Only fully covered blocks are true.
1349
+ # One pixel covers one whole block. Corrects float inputs on your behalf.
1396
1350
  #
1397
- # _@param_ `p0` — the first point
1351
+ # _@param_ `x`
1398
1352
  #
1399
- # _@param_ `p1` — the second point
1353
+ # _@param_ `y`
1400
1354
  #
1401
- # _@param_ `color` default white
1402
- def debug_draw_line: (p0: Api::Point, p1: Api::Point, ?color: Api::Color?) -> void
1355
+ # _@return_true if location is powered
1356
+ def powered?: (x: (Float | Integer), y: (Float | Integer)) -> bool
1403
1357
 
1404
- # Draws a box around position xy at base of z. Good for structure boxing.
1358
+ # Returns whether a x/y block is pathable as per minimap
1359
+ # One pixel covers one whole block. Corrects float inputs on your behalf.
1405
1360
  #
1406
- # _@param_ `point`
1361
+ # _@param_ `x`
1407
1362
  #
1408
- # _@param_ `radius` — default one tile wide, 1.0
1363
+ # _@param_ `y`
1409
1364
  #
1410
- # _@param_ `color` default white. min(r,b) is used for both r&b
1365
+ # _@return_whether tile is patahble
1366
+ def pathable?: (x: (Float | Integer), y: (Float | Integer)) -> bool
1367
+
1368
+ # sord warn - Numo::Bit wasn't able to be resolved to a constant in this project
1369
+ # Gets the pathable areas as things stand right now in the game
1370
+ # Buildings, minerals, structures, etc. all result in a nonpathable place
1371
+ #
1372
+ # _@return_ — Numo array
1411
1373
  #
1412
1374
  # ```ruby
1413
- # # Draws a box on structure placement grid
1414
- # debug_draw_box(point: unit.pos, radius: unit.footprint_radius)
1375
+ # parsed_pathing_grid[0,0] # reads bottom left corner
1376
+ # # use helper function #pathable
1377
+ # pathable?(x: 0, y: 0) # reads bottom left corner
1415
1378
  # ```
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
1379
+ def parsed_pathing_grid: () -> Numo::Bit
1421
1380
 
1422
- # Debug draws a sphere at position with a radius in color
1423
- #
1424
- # _@param_ `point`
1381
+ # sord omit - no YARD return type given, using untyped
1382
+ # Clears pathing-grid dependent objects like placements.
1383
+ # Called when pathing grid gets updated
1384
+ def clear_cached_pathing_grid: () -> untyped
1385
+
1386
+ # Returns the terrain height (z) at position x and y
1387
+ # Granularity is per placement grid block, since this comes from minimap image data.
1425
1388
  #
1426
- # _@param_ `radius` — default one tile wide, 1.0
1389
+ # _@param_ `x`
1427
1390
  #
1428
- # _@param_ `color` — default white
1429
- def debug_draw_sphere: (point: Api::Point, ?radius: Float, ?color: Api::Color?) -> void
1430
-
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
1391
+ # _@param_ `y`
1444
1392
  #
1445
- # _@param_ `command` one of Api::DebugGameState::*
1446
- def debug_game_state: (Integer command) -> void
1393
+ # _@return_z axis position between -16 and 16
1394
+ def terrain_height: (x: (Float | Integer), y: (Float | Integer)) -> Float
1447
1395
 
1448
- # Spawns a quantity of units under an owner at position given
1396
+ # Returns the terrain height (z) at position x and y for a point
1449
1397
  #
1450
- # _@param_ `unit_type_id` — Api::UnitTypeId::*
1398
+ # _@param_ `position`
1451
1399
  #
1452
- # _@param_ `owner` typically you are 1 and 2 is enemy (see @common.player_id)
1453
- #
1454
- # _@param_ `pos` — position in 2d
1455
- #
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
1400
+ # _@return_z axis position between -16 and 16
1401
+ def terrain_height_for_pos: (Sc2::Position position) -> Float
1463
1402
 
1464
- # Kills a target unit or unit tag
1403
+ # sord warn - Numo::SFloat wasn't able to be resolved to a constant in this project
1404
+ # Returns a parsed terrain_height from bot.game_info.start_raw.
1405
+ # Each value in [row][column] holds a float value which is the z height
1465
1406
  #
1466
- # _@param_ `unit_tags` one or many unit tags to kill
1467
- def debug_kill_unit: (unit_tags: (Integer | ::Array[Integer])) -> void
1407
+ # _@return_Numo array
1408
+ def parsed_terrain_height: () -> Numo::SFloat
1468
1409
 
1469
- # Hangs, crashes and exits the Sc2 client. DO NOT USE.
1410
+ # Returns one of three Integer visibility indicators at tile for x & y
1470
1411
  #
1471
- # _@param_ `test` — one of Api::DebugTestProcess::Test::Crash, Api::DebugTestProcess::Test::Hang, Api::DebugTestProcess::Test::Exit
1412
+ # _@param_ `x`
1472
1413
  #
1473
- # _@param_ `delay_ms` — default 0, how long this test is delayed
1474
- def debug_test_process: (test: Integer, ?delay_ms: Integer) -> void
1475
-
1476
- # sord omit - no YARD return type given, using untyped
1477
- # Useful only for single-player "curriculum" maps
1414
+ # _@param_ `y`
1478
1415
  #
1479
- # _@param_ `score` sets the score
1480
- def debug_set_score: (?score: Float) -> untyped
1416
+ # _@return_0=Hidden,1= Snapshot,2=Visible
1417
+ def visibility: (x: (Float | Integer), y: (Float | Integer)) -> Integer
1481
1418
 
1482
- # Ends game with a specified result of either Surrender or DeclareVictory
1419
+ # Returns whether the point (tile) is currently in vision
1483
1420
  #
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
1421
+ # _@param_ `x`
1422
+ #
1423
+ # _@param_ `y`
1424
+ #
1425
+ # _@return_ — true if fog is completely lifted
1426
+ def map_visible?: (x: (Float | Integer), y: (Float | Integer)) -> bool
1486
1427
 
1487
- # Sets unit_value Energy, Life or Shields for a specific unit tag to given value
1428
+ # Returns whether point (tile) has been seen before or currently visible
1488
1429
  #
1489
- # _@param_ `unit_tag`
1430
+ # _@param_ `x`
1490
1431
  #
1491
- # _@param_ `unit_value` — 1=Energy,2=Life,3=Shields one of Api::DebugSetUnitValue::UnitValue::*
1432
+ # _@param_ `y`
1492
1433
  #
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
1434
+ # _@return_true if partially or fully lifted fog
1435
+ def map_seen?: (x: (Float | Integer), y: (Float | Integer)) -> bool
1499
1436
 
1500
- # Empties and resets @debug_queue
1501
- def clear_debug_command_queue: () -> void
1437
+ # Returns whether the point (tile) has never been seen/explored before (dark fog)
1438
+ #
1439
+ # _@param_ `x`
1440
+ #
1441
+ # _@param_ `y`
1442
+ #
1443
+ # _@return_ — true if fog of war is fully dark
1444
+ def map_unseen?: (x: (Float | Integer), y: (Float | Integer)) -> bool
1502
1445
 
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
1446
+ # sord warn - Numo::SFloat wasn't able to be resolved to a constant in this project
1447
+ # Returns a parsed map_state.visibility from bot.observation.raw_data.
1448
+ # Each value in [row][column] holds one of three integers (0,1,2) to flag a vision type
1449
+ #
1450
+ # _@return_ — Numo array
1451
+ #
1452
+ # _@see_ `#visibility` — for reading from this value
1453
+ def parsed_visibility_grid: () -> Numo::SFloat
1506
1454
 
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
1455
+ # Returns whether a tile has creep on it, as per minimap
1456
+ # One pixel covers one whole block. Corrects float inputs on your behalf.
1457
+ #
1458
+ # _@param_ `x`
1459
+ #
1460
+ # _@param_ `y`
1461
+ #
1462
+ # _@return_ — true if location has creep on it
1463
+ def creep?: (x: (Float | Integer), y: (Float | Integer)) -> bool
1511
1464
 
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]
1465
+ # sord warn - Numo::Bit wasn't able to be resolved to a constant in this project
1466
+ # Provides parsed minimap representation of creep spread
1467
+ # Caches for 4 frames
1468
+ #
1469
+ # _@return_ Numo array
1470
+ def parsed_creep: () -> Numo::Bit
1517
1471
 
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
1472
+ # sord warn - Numo::Bit wasn't able to be resolved to a constant in this project
1473
+ # sord omit - no YARD return type given, using untyped
1474
+ # TODO: Remove this method if it has no use. Build points uses this code directly for optimization.
1475
+ # Reduce the dimensions of a grid by merging cells using length x length squares.
1476
+ # Merged cell keeps it's 1 value only if all merged cells are equal to 1, else 0
1477
+ #
1478
+ # _@param_ `input_grid` — Bit grid like parsed_pathing_grid or parsed_placement_grid
1479
+ #
1480
+ # _@param_ `length` — how many cells to merge, i.e. 3 for finding 3x3 placement
1481
+ def divide_grid: (Numo::Bit input_grid, Integer length) -> untyped
1521
1482
 
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
1483
+ # Returns own 2d start position as set by initial camera
1484
+ # This differs from position of first base structure
1485
+ def start_position: () -> Api::Point2D
1525
1486
 
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
1487
+ # Returns the enemy 2d start position
1488
+ def enemy_start_position: () -> Api::Point2D
1530
1489
 
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
1490
+ # Gets expos and surrounding minerals
1491
+ # The index is a build location for an expo and the value is a UnitGroup, which has minerals and geysers
1533
1492
  #
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
1493
+ # _@return_Location => UnitGroup of resources (minerals+geysers)
1539
1494
  #
1540
- # _@param_ `upgrade_id` — Api::UpgradeId::*
1541
- def upgrade_data: (Integer upgrade_id) -> Api::UpgradeData
1495
+ # ```ruby
1496
+ # random_expo = geo.expansions.keys.sample #=> Point2D
1497
+ # expo_resources = geo.expansions[random_expo] #=> UnitGroup
1498
+ # alive_minerals = expo_resources.minerals & neutral.minerals
1499
+ # geysers = expo_resources.geysers
1500
+ # ```
1501
+ def expansions: () -> ::Hash[Api::Point2D, UnitGroup]
1542
1502
 
1543
- # Checks unit data for an attribute value
1503
+ # Returns a list of 2d points for expansion build locations
1504
+ # Does not contain mineral info, but the value can be checked against geo.expansions
1544
1505
  #
1545
- # _@param_ `unit` Api::UnitTypeId or Api::Unit
1506
+ # _@return_points where expansions can be placed
1546
1507
  #
1547
- # _@param_ `attribute` — Api::Attribute, i.e. Api::Attribute::Mechanical or :Mechanical
1508
+ # ```ruby
1509
+ # random_expo = expansion_points.sample
1510
+ # expo_resources = geo.expansions[random_expo]
1511
+ # ```
1512
+ def expansion_points: () -> ::Array[Api::Point2D]
1513
+
1514
+ # Returns a slice of #expansions where a base hasn't been built yet
1515
+ # The has index is a build position and the value is a UnitGroup of resources for the base
1548
1516
  #
1549
- # _@return_ — whether unit has attribute
1517
+ # _@return_ — Location => UnitGroup of resources (minerals+geysers)
1550
1518
  #
1551
1519
  # ```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)
1520
+ # # Lets find the nearest unoccupied expo
1521
+ # expo_pos = expansions_unoccupied.keys.min { |p2d| p2d.distance_to(structures.hq.first) }
1522
+ # # What minerals/geysers does it have?
1523
+ # puts expansions_unoccupied[expo_pos].minerals # or expansions[expo_pos]... => UnitGroup
1524
+ # puts expansions_unoccupied[expo_pos].geysers # or expansions[expo_pos]... => UnitGroup
1555
1525
  # ```
1556
- def unit_has_attribute?: ((Integer | Api::Unit) unit, Symbol attribute) -> bool
1526
+ def expansions_unoccupied: () -> ::Hash[Api::Point2D, UnitGroup]
1557
1527
 
1558
- # Creates a unit group from all_units with matching tag
1528
+ # Gets minerals for a base or base position
1559
1529
  #
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
1572
-
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
1530
+ # _@param_ `base` — base Unit or Position
1531
+ #
1532
+ # _@return_ — UnitGroup of minerals for the base
1533
+ def minerals_for_base: ((Api::Unit | Sc2::Position) base) -> Sc2::UnitGroup
1576
1534
 
1577
- # Returns whether Query Available Ability is true for unit and tag
1578
- # Queries API if necessary. Uses batching in the background.
1535
+ # Gets geysers for a base or base position
1579
1536
  #
1580
- # _@param_ `unit_tag`
1537
+ # _@param_ `base` — base Unit or Position
1581
1538
  #
1582
- # _@param_ `ability_id`
1583
- def unit_ability_available?: (unit_tag: Integer, ability_id: Integer) -> bool
1539
+ # _@return_ — UnitGroup of geysers for the base
1540
+ def geysers_for_base: ((Api::Unit | Sc2::Position) base) -> Sc2::UnitGroup
1584
1541
 
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.
1542
+ # Gets geysers which have not been taken for a base or base position
1589
1543
  #
1590
- # _@param_ `observation`
1591
- def parse_observation_units: (Api::Observation observation) -> untyped
1592
-
1593
- # Returns alliance based on whether you are a player or an enemy
1544
+ # _@param_ `base` — base Unit or Position
1594
1545
  #
1595
- # _@return_ — :Self or :Enemy from Api::Alliance
1596
- def own_alliance: () -> Symbol
1546
+ # _@return_ — UnitGroup of geysers for the base
1547
+ def geysers_open_for_base: ((Api::Unit | Sc2::Position) base) -> Sc2::UnitGroup
1597
1548
 
1598
- # Returns enemy alliance based on whether you are a player or an enemy
1549
+ # _@param_ `base` base Unit or Position
1599
1550
  #
1600
- # _@return_ — :Self or :Enemy from Api::Alliance
1601
- def enemy_alliance: () -> Symbol
1602
-
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
1551
+ # _@return_ — UnitGroup of resources (minerals+geysers)
1552
+ def resources_for_base: ((Api::Unit | Sc2::Position) base) -> Sc2::UnitGroup
1657
1553
 
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
1554
+ # Gets gasses for a base or base position
1555
+ #
1556
+ # _@param_ `base` base Unit or Position
1557
+ #
1558
+ # _@return_ UnitGroup of geysers for the base
1559
+ def gas_for_base: ((Api::Unit | Sc2::Position) base) -> Sc2::UnitGroup
1666
1560
 
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
1561
+ # sord omit - no YARD type given for "in_power:", using untyped
1562
+ # Gets buildable point grid for squares of size, i.e. 3 = 3x3 placements
1563
+ # Uses pathing grid internally, to ignore taken positions
1564
+ # Does not query the api and is generally fast.
1671
1565
  #
1672
- # _@param_ `action`
1673
- def queue_action: (Api::Action action) -> void
1566
+ # _@param_ `length` — length of the building, 2 for depot/pylon, 3 for rax/gate
1567
+ #
1568
+ # _@param_ `on_creep` — whether this build location should be on creep
1569
+ #
1570
+ # _@return_ — Array of [x,y] tuples
1571
+ def build_coordinates: (length: Integer, ?on_creep: bool, ?in_power: untyped) -> ::Array[::Array[[Float, Float]]]
1674
1572
 
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
1573
+ # Gets a buildable location for a square of length, near target. Chooses from random amount of nearest locations.
1574
+ # 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.
1575
+ # For zerg, the buildable locations are only on creep.
1576
+ # Internally creates a kdtree for building locations based on pathable, placeable and creep
1677
1577
  #
1678
- # _@param_ `unit_tags`
1578
+ # _@param_ `length` — length of the building, 2 for depot/pylon, 3 for rax/gate
1679
1579
  #
1680
- # _@param_ `ability_id`
1580
+ # _@param_ `target` — near where to find a placement
1681
1581
  #
1682
- # _@param_ `queue_command` — shift+command
1582
+ # _@param_ `random` — number of nearest points to randomly choose from. 1 for nearest point.
1683
1583
  #
1684
- # _@param_ `target_world_space_pos`
1584
+ # _@param_ `in_power` — whether this must be on a power field
1685
1585
  #
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
1586
+ # _@return_ — buildable location, nil if no buildable location found
1587
+ def build_placement_near: (
1588
+ length: Integer,
1589
+ target: (Api::Unit | Sc2::Position),
1590
+ ?random: Integer,
1591
+ ?in_power: bool
1592
+ ) -> Api::Point2D?
1694
1593
 
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
1698
- #
1699
- # _@param_ `units` — can be an Api::Unit, array of Api::Unit#tag or single tag
1594
+ # Draws a grid within a unit (pylon/prisms) radius, then selects points which are placeable
1700
1595
  #
1701
- # _@param_ `ability_id`
1596
+ # _@param_ `source` — either a pylon or a prism
1702
1597
  #
1703
- # _@param_ `target` — is a unit, unit tag or a Api::Point2D
1598
+ # _@param_ `unit_type_id` — optionally, the unit you wish to place. Stalkers are widest, so use default nil for a mixed composition warp
1704
1599
  #
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
1600
+ # _@return_an array of 2d points where theoretically placeable
1601
+ def warp_points: (source: Api::Unit, ?unit_type_id: Api::Unit?) -> ::Array[Api::Point2D]
1712
1602
 
1713
- # sord omit - no YARD return type given, using untyped
1714
- # Builds target unit type using units as source at optional target
1603
+ # Finds points in a straight line.
1604
+ # 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
1715
1605
  #
1716
- # _@param_ `units` — can be an Api::Unit, array of Api::Unit#tag or single tag
1606
+ # _@param_ `source` — location from which we go
1717
1607
  #
1718
- # _@param_ `unit_type_id` — Api::UnitTypeId the unit type you wish to build
1608
+ # _@param_ `target` — location towards which we go
1719
1609
  #
1720
- # _@param_ `target` — is a unit tag or a Api::Point2D. Nil for addons/orbital
1610
+ # _@param_ `offset` — how far from source to start
1721
1611
  #
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
1612
+ # _@param_ `increment` — how far apart to gets, i.e. increment = unit.radius*2 to space units in a line
1613
+ #
1614
+ # _@param_ `count` number of points to retrieve
1615
+ #
1616
+ # _@return_ points up to a max of count
1617
+ def points_nearest_linear: (
1618
+ source: Sc2::Position,
1619
+ target: Sc2::Position,
1620
+ ?offset: Float,
1621
+ ?increment: Float,
1622
+ ?count: Integer
1623
+ ) -> ::Array[Api::Point2D]
1729
1624
 
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
1625
+ # Gets a random point near a location with a positive/negative offset applied to both x and y
1733
1626
  #
1734
- # _@param_ `unit_type_id` — Api::UnitTypeId the unit type you wish to build
1627
+ # _@param_ `pos`
1735
1628
  #
1736
- # _@param_ `queue_command` — shift+command
1629
+ # _@param_ `offset`
1737
1630
  #
1738
- # _@param_ `target` — is a unit tag or a Api::Point2D
1631
+ # ```ruby
1632
+ # Randomly randomly adjust both x and y by a range of -3.5 or +3.5
1633
+ # geo.point_random_near(point: structures.hq.first, offset: 3.5)
1634
+ # ```
1635
+ def point_random_near: (pos: Sc2::Position, ?offset: Float) -> Api::Point2D
1636
+
1637
+ # _@param_ `pos`
1739
1638
  #
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
1639
+ # _@param_ `radius`
1640
+ def point_random_on_circle: (pos: Sc2::Position, ?radius: Float) -> Api::Point2D
1747
1641
 
1748
- # sord omit - no YARD return type given, using untyped
1749
- # Research a specific upgrade
1642
+ # _@return_ player with active connection
1643
+ attr_accessor bot: (Sc2::Player | untyped)
1644
+ end
1645
+
1646
+ # WARNING! Debug methods will not be available on Ladder
1647
+ # This provides debug helper functions for RequestDebug
1648
+ module Debug
1649
+ # sord warn - Api::DebugCommand wasn't able to be resolved to a constant in this project
1650
+ # Queues debug command for performing later
1750
1651
  #
1751
- # _@param_ `units` — can be an Api::Unit, array of Api::Unit#tag or single tag
1652
+ # _@param_ `debug_command`
1653
+ def queue_debug_command: (Api::DebugCommand debug_command) -> void
1654
+
1655
+ # sord warn - Size wasn't able to be resolved to a constant in this project
1656
+ # Prints debug text top left corner
1752
1657
  #
1753
- # _@param_ `upgrade_id` — Api::UpgradeId to research
1658
+ # _@param_ `text` — will respect newlines
1754
1659
  #
1755
- # _@param_ `queue_command` — shift+command
1756
- def research: (units: (::Array[Integer] | Integer | Api::Unit), upgrade_id: Integer, ?queue_command: bool) -> untyped
1660
+ # _@param_ `size` — of font, default 14px
1661
+ def debug_print: (String text, ?size: Size) -> void
1757
1662
 
1758
- # Toggles auto-cast ability for units
1663
+ # sord warn - Size wasn't able to be resolved to a constant in this project
1664
+ # Prints text on screen from top and left
1759
1665
  #
1760
- # _@param_ `units` — can be an Api::Unit, array of Tags or single Tag
1666
+ # _@param_ `text` — will respect newlines
1761
1667
  #
1762
- # _@param_ `ability_id`
1763
- def action_raw_toggle_autocast: (units: (::Array[Integer] | Integer | Api::Unit), ability_id: Integer) -> void
1764
-
1765
- # Toggles auto-cast ability for units
1668
+ # _@param_ `left_percent` — range 0..100. percent from left of screen
1766
1669
  #
1767
- # _@param_ `point`
1768
- def action_raw_camera_move: (point: Api::Point) -> void
1670
+ # _@param_ `top_percent` — range 0..100. percent from top of screen
1671
+ #
1672
+ # _@param_ `color` — default white
1673
+ #
1674
+ # _@param_ `size` — of font, default 14px
1675
+ def debug_text_screen: (
1676
+ String text,
1677
+ ?left_percent: Numeric,
1678
+ ?top_percent: Numeric,
1679
+ ?color: Api::Color?,
1680
+ ?size: Size
1681
+ ) -> void
1769
1682
 
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.
1683
+ # sord warn - Size wasn't able to be resolved to a constant in this project
1684
+ # Prints text on screen at 3d world position
1773
1685
  #
1774
- # _@param_ `ability_id`
1686
+ # _@param_ `text` — will respect newlines
1775
1687
  #
1776
- # _@param_ `target_screen_coord`
1688
+ # _@param_ `point` — point in the world, i.e. unit.pos
1777
1689
  #
1778
- # _@param_ `target_minimap_coord`
1690
+ # _@param_ `color` — default white
1779
1691
  #
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
1692
+ # _@param_ `size` — of font, default 14px
1693
+ def debug_text_world: (
1694
+ String text,
1695
+ point: Api::Point,
1696
+ ?color: Api::Color?,
1697
+ ?size: Size
1698
+ ) -> void
1787
1699
 
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.
1700
+ # Draws a line between two Api::Point's for color
1790
1701
  #
1791
- # _@param_ `center_minimap`
1792
- def action_spatial_camera_move: (center_minimap: Api::Point2I) -> void
1793
-
1794
- # Issues spatial unit select point command. Target is either target_screen_coord or target_minimap_coord.
1702
+ # _@param_ `p0` — the first point
1795
1703
  #
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. }
1704
+ # _@param_ `p1` — the second point
1797
1705
  #
1798
- # _@param_ `selection_screen_coord`
1799
- def action_spatial_unit_selection_point: (?_type: Integer, ?selection_screen_coord: Api::PointI?) -> void
1706
+ # _@param_ `color` — default white
1707
+ def debug_draw_line: (p0: Api::Point, p1: Api::Point, ?color: Api::Color?) -> void
1800
1708
 
1801
- # sord warn - Api::RectangleI wasn't able to be resolved to a constant in this project
1802
- # Issue rectangle select
1709
+ # Draws a box around position xy at base of z. Good for structure boxing.
1803
1710
  #
1804
- # _@param_ `selection_screen_coord` — rectangle coordinates
1711
+ # _@param_ `point`
1805
1712
  #
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.
1713
+ # _@param_ `radius` — default one tile wide, 1.0
1811
1714
  #
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. }
1715
+ # _@param_ `color` — default white. min(r,b) is used for both r&b
1813
1716
  #
1814
- # _@param_ `control_group_index` — 0-9
1815
- def action_ui_control_group: (action: Integer, control_group_index: Integer) -> void
1717
+ # ```ruby
1718
+ # # Draws a box on structure placement grid
1719
+ # debug_draw_box(point: unit.pos, radius: unit.footprint_radius)
1720
+ # ```
1721
+ #
1722
+ # _@note_ — Api::Color RGB is broken for this command. Will use min(r,b)
1723
+ #
1724
+ # _@note_ — Z index is elevated 0.02 so the line is visible and doesn't clip through terrain
1725
+ def debug_draw_box: (point: Api::Point, ?radius: Float, ?color: Api::Color?) -> void
1816
1726
 
1817
- # Selects army (F2)
1727
+ # Debug draws a sphere at position with a radius in color
1818
1728
  #
1819
- # _@param_ `selection_add` — default false To add to other selected items
1820
- def action_ui_select_army: (?selection_add: bool) -> void
1729
+ # _@param_ `point`
1730
+ #
1731
+ # _@param_ `radius` — default one tile wide, 1.0
1732
+ #
1733
+ # _@param_ `color` — default white
1734
+ def debug_draw_sphere: (point: Api::Point, ?radius: Float, ?color: Api::Color?) -> void
1821
1735
 
1822
- # Selects warp gates (Protoss)
1736
+ # Possible values:
1737
+ # Api::DebugGameState::Show_map
1738
+ # Api::DebugGameState::Control_enemy
1739
+ # Api::DebugGameState::Food
1740
+ # Api::DebugGameState::Free
1741
+ # Api::DebugGameState::All_resources
1742
+ # Api::DebugGameState::God
1743
+ # Api::DebugGameState::Minerals
1744
+ # Api::DebugGameState::Gas
1745
+ # Api::DebugGameState::Cooldown
1746
+ # Api::DebugGameState::Tech_tree
1747
+ # Api::DebugGameState::Upgrade
1748
+ # Api::DebugGameState::Fast_build
1823
1749
  #
1824
- # _@param_ `selection_add` — default false To add to other selected items
1825
- def action_ui_select_warp_gates: (?selection_add: bool) -> void
1750
+ # _@param_ `command` — one of Api::DebugGameState::*
1751
+ def debug_game_state: (Integer command) -> void
1826
1752
 
1827
- # Selects larva (Zerg)
1828
- def action_ui_select_larva: () -> void
1753
+ # Spawns a quantity of units under an owner at position given
1754
+ #
1755
+ # _@param_ `unit_type_id` — Api::UnitTypeId::*
1756
+ #
1757
+ # _@param_ `owner` — typically you are 1 and 2 is enemy (see @common.player_id)
1758
+ #
1759
+ # _@param_ `pos` — position in 2d
1760
+ #
1761
+ # _@param_ `quantity` — default 1
1762
+ def debug_create_unit: (
1763
+ unit_type_id: Integer,
1764
+ owner: Integer,
1765
+ pos: Api::Point2D,
1766
+ ?quantity: Integer
1767
+ ) -> void
1829
1768
 
1830
- # sord omit - no YARD return type given, using untyped
1831
- # Select idle workers
1769
+ # Kills a target unit or unit tag
1832
1770
  #
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
1771
+ # _@param_ `unit_tags` — one or many unit tags to kill
1772
+ def debug_kill_unit: (unit_tags: (Integer | ::Array[Integer])) -> void
1835
1773
 
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
- # }
1774
+ # Hangs, crashes and exits the Sc2 client. DO NOT USE.
1842
1775
  #
1843
- # _@param_ `type` — 1-4 = Api::ActionMultiPanel::Type::*
1776
+ # _@param_ `test` — one of Api::DebugTestProcess::Test::Crash, Api::DebugTestProcess::Test::Hang, Api::DebugTestProcess::Test::Exit
1844
1777
  #
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
1778
+ # _@param_ `delay_ms` — default 0, how long this test is delayed
1779
+ def debug_test_process: (test: Integer, ?delay_ms: Integer) -> void
1847
1780
 
1848
1781
  # sord omit - no YARD return type given, using untyped
1849
- # Cargo panel actions for unloading units.
1782
+ # Useful only for single-player "curriculum" maps
1850
1783
  #
1851
- # _@param_ `unit_index` — index of unit to unload
1852
- def action_ui_cargo_panel_unload: (unit_index: Integer) -> untyped
1784
+ # _@param_ `score` — sets the score
1785
+ def debug_set_score: (?score: Float) -> untyped
1853
1786
 
1854
- # sord omit - no YARD return type given, using untyped
1855
- # Remove unit from production queue
1787
+ # Ends game with a specified result of either Surrender or DeclareVictory
1856
1788
  #
1857
- # _@param_ `unit_index` — target unit index
1858
- def action_ui_production_panel_remove_from_queue: (unit_index: Integer) -> untyped
1789
+ # _@param_ `end_result` — either 1/2. Api::DebugEndGame::EndResult::Surrender or Api::DebugEndGame::EndResult::DeclareVictory
1790
+ def debug_end_game: (end_result: Integer) -> void
1859
1791
 
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.
1792
+ # Sets unit_value Energy, Life or Shields for a specific unit tag to given value
1862
1793
  #
1863
- # _@param_ `ability_id` — Api::AbilityId::* ability
1864
- def action_ui_toggle_autocast: (ability_id: Integer) -> untyped
1865
-
1866
- # sord omit - no YARD return type given, using untyped
1867
- # Send a chat message
1794
+ # _@param_ `unit_tag`
1868
1795
  #
1869
- # _@param_ `message` — to send
1796
+ # _@param_ `unit_value` — 1=Energy,2=Life,3=Shields one of Api::DebugSetUnitValue::UnitValue::*
1870
1797
  #
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
1798
+ # _@param_ `value` — the value which the attribute will be set to
1799
+ def debug_set_unit_value: (unit_tag: Integer, unit_value: Integer, value: Float) -> void
1873
1800
 
1874
1801
  # sord omit - no YARD return type given, using untyped
1875
- # Sends actions via api and flushes action_queue
1876
- def perform_actions: () -> untyped
1802
+ # Sends actions via api and flushes debug_commands_queue
1803
+ def perform_debug_commands: () -> untyped
1877
1804
 
1878
- # Empties and resets @action_queue
1879
- def clear_action_queue: () -> void
1805
+ # Empties and resets @debug_queue
1806
+ def clear_debug_command_queue: () -> void
1880
1807
 
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]
1808
+ # sord omit - no YARD type given for :debug_command_queue, using untyped
1809
+ # Holds debug commands which will be queued off each time we step forward
1810
+ attr_accessor debug_command_queue: untyped
1888
1811
 
1889
1812
  # sord warn - Api::Action wasn't able to be resolved to a constant in this project
1890
- attr_accessor action_queue: ::Array[Api::Action]
1813
+ # sord warn - Api::Action wasn't able to be resolved to a constant in this project
1814
+ attr_accessor debug_commands_queue: ::Array[Api::Action]
1891
1815
  end
1892
1816
 
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
1817
+ # Helper methods for working with units
1818
+ module Units
1819
+ # sord omit - no YARD type given for "upgrade_id", using untyped
1820
+ # Returns true if this upgrade has finished researching
1821
+ def upgrade_completed?: (untyped upgrade_id) -> bool
1897
1822
 
1898
- # Gets the map tile width. Range is 1-255.
1899
- # Effected by crop_to_playable_area
1900
- def map_width: () -> Integer
1823
+ # Returns the upgrade ids which are researching or queued
1824
+ # Not set for enemy.
1825
+ def upgrades_in_progress: () -> ::Array[Integer]
1901
1826
 
1902
- # Gets the map tile height. Range is 1-255.
1903
- # Effected by crop_to_playable_area
1904
- def map_height: () -> Integer
1827
+ # sord omit - no YARD type given for "upgrade_id", using untyped
1828
+ # Returns true if the upgrade is busy researching
1829
+ def upgrade_in_progress?: (untyped upgrade_id) -> bool
1905
1830
 
1906
- # Center of the map
1907
- def map_center: () -> Api::Point2D
1831
+ # sord omit - no YARD type given for "unit_type_id", using untyped
1832
+ # For this unit type, tells you how many are in progress by checking orders for all it's sources.
1833
+ def units_in_progress: (untyped unit_type_id) -> Integer
1908
1834
 
1909
- # Returns zero to map_width as range
1835
+ # Returns static [Api::UnitTypeData] for a unit
1910
1836
  #
1911
- # _@return_0 to map_width
1912
- def map_range_x: () -> ::Range[untyped]
1837
+ # _@param_ `unit` Api::UnitTypeId or Api::Unit
1838
+ def unit_data: ((Integer | Api::Unit) unit) -> Api::UnitTypeData
1913
1839
 
1914
- # Returns zero to map_height as range
1840
+ # sord warn - Api::AbilityData wasn't able to be resolved to a constant in this project
1841
+ # Returns static [Api::AbilityData] for an ability
1915
1842
  #
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]
1843
+ # _@param_ `ability_id` Api::AbilityId::*
1844
+ def ability_data: (Integer ability_id) -> Api::AbilityData
1921
1845
 
1922
- # Returns zero to map_height-1 as range
1923
- def map_tile_range_y: () -> ::Range[untyped]
1846
+ # sord warn - Api::UpgradeData wasn't able to be resolved to a constant in this project
1847
+ # Returns static [Api::UpgradeData] for an upgrade id
1848
+ #
1849
+ # _@param_ `upgrade_id` — Api::UpgradeId::*
1850
+ def upgrade_data: (Integer upgrade_id) -> Api::UpgradeData
1924
1851
 
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
1852
+ # Checks unit data for an attribute value
1928
1853
  #
1929
- # _@param_ `x`
1854
+ # _@param_ `unit` — Api::UnitTypeId or Api::Unit
1930
1855
  #
1931
- # _@param_ `y`
1856
+ # _@param_ `attribute` — Api::Attribute, i.e. Api::Attribute::Mechanical or :Mechanical
1932
1857
  #
1933
- # _@return_ — whether tile is placeable?
1858
+ # _@return_ — whether unit has attribute
1934
1859
  #
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
1860
+ # ```ruby
1861
+ # unit_has_attribute?(Api::UnitTypeId::SCV, Api::Attribute::Mechanical)
1862
+ # unit_has_attribute?(units.workers.first, :Mechanical)
1863
+ # unit_has_attribute?(Api::UnitTypeId::SCV, :Mechanical)
1864
+ # ```
1865
+ def unit_has_attribute?: ((Integer | Api::Unit) unit, Symbol attribute) -> bool
1944
1866
 
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`
1867
+ # Creates a unit group from all_units with matching tag
1951
1868
  #
1952
- # _@return_true if location has creep on it
1953
- def expo_placement?: (x: (Float | Integer), y: (Float | Integer)) -> bool
1869
+ # _@param_ `tags` array of unit tags
1870
+ def unit_group_from_tags: (::Array[Integer] tags) -> Sc2::UnitGroup
1954
1871
 
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
1872
+ # sord omit - no YARD type given for "unit_type_id", using untyped
1873
+ # Sums the cost (mineral/vespene/supply) of unit type used for internal spend trackers
1874
+ # This is called internally when building/morphing/training
1875
+ def subtract_cost: (untyped unit_type_id) -> void
1958
1876
 
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
1877
+ # sord omit - no YARD type given for "unit_type_id:", using untyped
1878
+ # sord omit - no YARD type given for "quantity:", using untyped
1879
+ # Checks whether you have the resources to construct quantity of unit type
1880
+ def can_afford?: (unit_type_id: untyped, ?quantity: untyped) -> bool
1962
1881
 
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
1882
+ # sord omit - no YARD type given for "upgrade_id", using untyped
1883
+ # Checks whether you have the resources to
1884
+ def can_afford_upgrade?: (untyped upgrade_id) -> bool
1972
1885
 
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.
1886
+ # Returns whether Query Available Ability is true for unit and tag
1887
+ # Queries API if necessary. Uses batching in the background.
1975
1888
  #
1976
- # _@param_ `x`
1889
+ # _@param_ `unit_tag`
1977
1890
  #
1978
- # _@param_ `y`
1891
+ # _@param_ `ability_id`
1892
+ def unit_ability_available?: (unit_tag: Integer, ability_id: Integer) -> bool
1893
+
1894
+ # sord warn - Api::Observation wasn't able to be resolved to a constant in this project
1895
+ # sord omit - no YARD return type given, using untyped
1896
+ # Divides raw data units into various attributes on every step
1897
+ # Note, this needs to be fast.
1979
1898
  #
1980
- # _@return_ — whether tile is patahble
1981
- def pathable?: (x: (Float | Integer), y: (Float | Integer)) -> bool
1899
+ # _@param_ `observation`
1900
+ def parse_observation_units: (Api::Observation observation) -> untyped
1982
1901
 
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
1902
+ # Returns alliance based on whether you are a player or an enemy
1986
1903
  #
1987
- # _@return_ — Numo array
1904
+ # _@return_ — :Self or :Enemy from Api::Alliance
1905
+ def own_alliance: () -> Symbol
1906
+
1907
+ # Returns enemy alliance based on whether you are a player or an enemy
1988
1908
  #
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
1909
+ # _@return_ — :Self or :Enemy from Api::Alliance
1910
+ def enemy_alliance: () -> Symbol
1995
1911
 
1912
+ # sord omit - no YARD type given for "unit", using untyped
1996
1913
  # 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
1914
+ # Issues units/structure callbacks for units which are new
1915
+ def issue_new_unit_callbacks: (untyped unit) -> untyped
2000
1916
 
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
1917
+ # sord omit - no YARD type given for "unit", using untyped
1918
+ # sord omit - no YARD type given for "previous_unit", using untyped
1919
+ # sord omit - no YARD return type given, using untyped
1920
+ # Issues callbacks for units over time, such as damaged or type changed
1921
+ def issue_existing_unit_callbacks: (untyped unit, untyped previous_unit) -> untyped
1922
+
1923
+ attr_accessor all_units: (Sc2::UnitGroup | untyped)
1924
+
1925
+ # _@return_ a group of placeholder structures
1926
+ attr_accessor units: Sc2::UnitGroup
1927
+
1928
+ # sord omit - no YARD type given for :structures, using untyped
1929
+ # A full list of all your structures (non-units)
1930
+ attr_accessor structures: untyped
1931
+
1932
+ # sord omit - no YARD type given for :placeholders, using untyped
1933
+ # A list of structures which haven't started
1934
+ attr_accessor placeholders: untyped
1935
+
1936
+ # _@return_ — a group of neutral units
1937
+ attr_accessor neutral: Sc2::UnitGroup
1938
+
1939
+ # _@return_ — a group of neutral units
1940
+ attr_accessor effects: Sc2::UnitGroup
1941
+
1942
+ # sord omit - no YARD type given for :upgrades_completed, using untyped
1943
+ # Returns the upgrade ids you have acquired such as weapon upgrade and armor upgrade ids.
1944
+ # Shorthand for observation.raw_data.player.upgrade_ids
1945
+ attr_reader upgrades_completed: untyped
2010
1946
 
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
1947
+ # sord warn - Api::RadarRing wasn't able to be resolved to a constant in this project
1948
+ # sord warn - Api::RadarRing wasn't able to be resolved to a constant in this project
1949
+ # _@return_ — an array of radar rings sources
1950
+ attr_accessor power_sources: ::Array[Api::RadarRing]
2017
1951
 
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
1952
+ # sord omit - no YARD type given for :radar_rings, using untyped
1953
+ # An array of Sensor tower rings as per minimap. It has a `pos` and a `radius`
1954
+ attr_accessor radar_rings: untyped
2024
1955
 
2025
- # Returns one of three Integer visibility indicators at tile for x & y
2026
- #
2027
- # _@param_ `x`
2028
- #
2029
- # _@param_ `y`
2030
- #
2031
- # _@return_ — 0=Hidden,1= Snapshot,2=Visible
2032
- def visibility: (x: (Float | Integer), y: (Float | Integer)) -> Integer
1956
+ # sord omit - no YARD type given for :_all_seen_unit_tags, using untyped
1957
+ # Privately keep track of all seen Unit tags (excl structures) in order to detect new created units
1958
+ attr_accessor _all_seen_unit_tags: untyped
2033
1959
 
2034
- # Returns whether the point (tile) is currently in vision
2035
- #
2036
- # _@param_ `x`
2037
- #
2038
- # _@param_ `y`
2039
- #
2040
- # _@return_ — true if fog is completely lifted
2041
- def map_visible?: (x: (Float | Integer), y: (Float | Integer)) -> bool
1960
+ # sord omit - no YARD type given for :all_seen_unit_tags, using untyped
1961
+ # Privately keep track of all seen Unit tags (excl structures) in order to detect new created units
1962
+ attr_accessor all_seen_unit_tags: untyped
2042
1963
 
2043
- # Returns whether point (tile) has been seen before or currently visible
2044
- #
2045
- # _@param_ `x`
2046
- #
2047
- # _@param_ `y`
1964
+ # _@return_ group of Units and Structures effected
1965
+ attr_accessor event_units_damaged: Sc2::UnitGroup
1966
+
1967
+ # sord omit - no YARD type given for :event_units_destroyed, using untyped
1968
+ # TODO: Unit buff disabled, because it calls back too often (mineral in hand). Put back if useful
1969
+ # Units (Unit/Structure) on which a new buff_ids appeared this frame
1970
+ # See which buffs via: unit.buff_ids - unit.previous.buff_ids
1971
+ # Read this on_step. Alternative to callback on_unit_buffed
1972
+ # attr_accessor :event_units_buffed
1973
+ attr_accessor event_units_destroyed: untyped
1974
+ end
1975
+
1976
+ # Holds action list and queues batch
1977
+ module Actions
1978
+ # sord warn - Api::Action wasn't able to be resolved to a constant in this project
1979
+ # Queues action for performing end of step
2048
1980
  #
2049
- # _@return_ — true if partially or fully lifted fog
2050
- def map_seen?: (x: (Float | Integer), y: (Float | Integer)) -> bool
1981
+ # _@param_ `action`
1982
+ def queue_action: (Api::Action action) -> void
2051
1983
 
2052
- # Returns whether the point (tile) has never been seen/explored before (dark fog)
1984
+ # sord omit - no YARD return type given, using untyped
1985
+ # Queues a Api::ActionRaw. Perform ability on unit_tags optionally on target_world_space_pos/target_unit_tag
2053
1986
  #
2054
- # _@param_ `x`
1987
+ # _@param_ `unit_tags`
2055
1988
  #
2056
- # _@param_ `y`
1989
+ # _@param_ `ability_id`
2057
1990
  #
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
1991
+ # _@param_ `queue_command` shift+command
2064
1992
  #
2065
- # _@return_ — Numo array
1993
+ # _@param_ `target_world_space_pos`
2066
1994
  #
2067
- # _@see_ `#visibility` — for reading from this value
2068
- def parsed_visibility_grid: () -> Numo::SFloat
1995
+ # _@param_ `target_unit_tag`
1996
+ def action_raw_unit_command: (
1997
+ unit_tags: ::Array[Integer],
1998
+ ability_id: Integer,
1999
+ ?queue_command: bool,
2000
+ ?target_world_space_pos: Api::Point2D?,
2001
+ ?target_unit_tag: Integer?
2002
+ ) -> untyped
2069
2003
 
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.
2004
+ # sord omit - no YARD return type given, using untyped
2005
+ # Queues a Api::ActionRawUnitCommand.
2006
+ # Send accepts a Api::Unit, tag or tags and targets Api::Point2D or unit.tag
2072
2007
  #
2073
- # _@param_ `x`
2008
+ # _@param_ `units` — can be an Api::Unit, array of Api::Unit#tag or single tag
2074
2009
  #
2075
- # _@param_ `y`
2010
+ # _@param_ `ability_id`
2076
2011
  #
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
2012
+ # _@param_ `target` is a unit, unit tag or a Api::Point2D
2083
2013
  #
2084
- # _@return_Numo array
2085
- def parsed_creep: () -> Numo::Bit
2014
+ # _@param_ `queue_command` shift+command
2015
+ def action: (
2016
+ units: (::Array[Integer] | Integer | Api::Unit),
2017
+ ability_id: Integer,
2018
+ ?target: (Api::Unit | Integer | Api::Point2D)?,
2019
+ ?queue_command: bool
2020
+ ) -> untyped
2086
2021
 
2087
- # sord warn - Numo::Bit wasn't able to be resolved to a constant in this project
2088
2022
  # 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
2023
+ # Builds target unit type using units as source at optional target
2092
2024
  #
2093
- # _@param_ `input_grid` — Bit grid like parsed_pathing_grid or parsed_placement_grid
2025
+ # _@param_ `units` — can be an Api::Unit, array of Api::Unit#tag or single tag
2094
2026
  #
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
2027
+ # _@param_ `unit_type_id` — Api::UnitTypeId the unit type you wish to build
2107
2028
  #
2108
- # _@return_Location => UnitGroup of resources (minerals+geysers)
2029
+ # _@param_ `target` is a unit tag or a Api::Point2D. Nil for addons/orbital
2109
2030
  #
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]
2031
+ # _@param_ `queue_command` — shift+command
2032
+ def build: (
2033
+ units: (::Array[Integer] | Integer | Api::Unit),
2034
+ unit_type_id: Integer,
2035
+ ?target: (Api::Point2D | Integer)?,
2036
+ ?queue_command: bool
2037
+ ) -> untyped
2117
2038
 
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
2039
+ # sord omit - no YARD return type given, using untyped
2040
+ # Warps in unit type at target (location or pylon) with optional source units (warp gates)
2041
+ # When not specifying the specific warp gate(s), all warpgates will be used
2120
2042
  #
2121
- # _@return_points where expansions can be placed
2043
+ # _@param_ `unit_type_id` Api::UnitTypeId the unit type you wish to build
2122
2044
  #
2123
- # ```ruby
2124
- # random_expo = expansion_points.sample
2125
- # expo_resources = geo.expansions[random_expo]
2126
- # ```
2127
- def expansion_points: () -> ::Array[Api::Point2D]
2128
-
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
2045
+ # _@param_ `queue_command` — shift+command
2131
2046
  #
2132
- # _@return_Location => UnitGroup of resources (minerals+geysers)
2047
+ # _@param_ `target` is a unit tag or a Api::Point2D
2133
2048
  #
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]
2049
+ # _@param_ `units`
2050
+ def warp: (
2051
+ unit_type_id: Integer,
2052
+ target: (Api::Point2D | Integer),
2053
+ queue_command: bool,
2054
+ ?units: (::Array[Integer] | Integer | Api::Unit)?
2055
+ ) -> untyped
2142
2056
 
2143
- # Gets minerals for a base or base position
2144
- #
2145
- # _@param_ `base` — base Unit or Position
2057
+ # sord omit - no YARD return type given, using untyped
2058
+ # Research a specific upgrade
2146
2059
  #
2147
- # _@return_UnitGroup of minerals for the base
2148
- def minerals_for_base: ((Api::Unit | Sc2::Position) base) -> Sc2::UnitGroup
2149
-
2150
- # Gets geysers for a base or base position
2060
+ # _@param_ `units` can be an Api::Unit, array of Api::Unit#tag or single tag
2151
2061
  #
2152
- # _@param_ `base` — base Unit or Position
2062
+ # _@param_ `upgrade_id` — Api::UpgradeId to research
2153
2063
  #
2154
- # _@return_UnitGroup of geysers for the base
2155
- def geysers_for_base: ((Api::Unit | Sc2::Position) base) -> Sc2::UnitGroup
2064
+ # _@param_ `queue_command` shift+command
2065
+ def research: (units: (::Array[Integer] | Integer | Api::Unit), upgrade_id: Integer, ?queue_command: bool) -> untyped
2156
2066
 
2157
- # Gets geysers which have not been taken for a base or base position
2067
+ # Toggles auto-cast ability for units
2158
2068
  #
2159
- # _@param_ `base` — base Unit or Position
2069
+ # _@param_ `units` — can be an Api::Unit, array of Tags or single Tag
2160
2070
  #
2161
- # _@return_ — UnitGroup of geysers for the base
2162
- def geysers_open_for_base: ((Api::Unit | Sc2::Position) base) -> Sc2::UnitGroup
2071
+ # _@param_ `ability_id`
2072
+ def action_raw_toggle_autocast: (units: (::Array[Integer] | Integer | Api::Unit), ability_id: Integer) -> void
2163
2073
 
2164
- # _@param_ `base` base Unit or Position
2074
+ # Toggles auto-cast ability for units
2165
2075
  #
2166
- # _@return_ — UnitGroup of resources (minerals+geysers)
2167
- def resources_for_base: ((Api::Unit | Sc2::Position) base) -> Sc2::UnitGroup
2076
+ # _@param_ `point`
2077
+ def action_raw_camera_move: (point: Api::Point) -> void
2168
2078
 
2169
- # Gets gasses for a base or base position
2170
- #
2171
- # _@param_ `base` base Unit or Position
2079
+ # sord warn - Api::Point2I wasn't able to be resolved to a constant in this project
2080
+ # sord warn - Api::Point2I wasn't able to be resolved to a constant in this project
2081
+ # Issues spatial unit command. Target is either target_screen_coord or target_minimap_coord.
2172
2082
  #
2173
- # _@return_ — UnitGroup of geysers for the base
2174
- def gas_for_base: ((Api::Unit | Sc2::Position) base) -> Sc2::UnitGroup
2175
-
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.
2083
+ # _@param_ `ability_id`
2180
2084
  #
2181
- # _@param_ `length` — length of the building, 2 for depot/pylon, 3 for rax/gate
2085
+ # _@param_ `target_screen_coord`
2182
2086
  #
2183
- # _@param_ `on_creep` — whether this build location should be on creep
2087
+ # _@param_ `target_minimap_coord`
2184
2088
  #
2185
- # _@return_Array of [x,y] tuples
2186
- def build_coordinates: (length: Integer, ?on_creep: bool, ?in_power: untyped) -> ::Array[::Array[[Float, Float]]]
2089
+ # _@param_ `queue_command` shift+command
2090
+ def action_spatial_unit_command: (
2091
+ ability_id: Api::AbilityId,
2092
+ ?target_screen_coord: Api::Point2I?,
2093
+ ?target_minimap_coord: Api::Point2I?,
2094
+ ?queue_command: bool
2095
+ ) -> void
2187
2096
 
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
2097
+ # sord warn - Api::Point2I wasn't able to be resolved to a constant in this project
2098
+ # Simulates a click on the minimap to move the camera.
2192
2099
  #
2193
- # _@param_ `length` — length of the building, 2 for depot/pylon, 3 for rax/gate
2100
+ # _@param_ `center_minimap`
2101
+ def action_spatial_camera_move: (center_minimap: Api::Point2I) -> void
2102
+
2103
+ # Issues spatial unit select point command. Target is either target_screen_coord or target_minimap_coord.
2194
2104
  #
2195
- # _@param_ `target` — near where to find a placement
2105
+ # _@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. }
2196
2106
  #
2197
- # _@param_ `random` — number of nearest points to randomly choose from. 1 for nearest point.
2107
+ # _@param_ `selection_screen_coord`
2108
+ def action_spatial_unit_selection_point: (?_type: Integer, ?selection_screen_coord: Api::PointI?) -> void
2109
+
2110
+ # sord warn - Api::RectangleI wasn't able to be resolved to a constant in this project
2111
+ # Issue rectangle select
2198
2112
  #
2199
- # _@param_ `in_power` — whether this must be on a power field
2113
+ # _@param_ `selection_screen_coord` — rectangle coordinates
2200
2114
  #
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?
2115
+ # _@param_ `selection_add` default false Equivalent to shift+drag. Adds units to selection. default false
2116
+ def action_spatial_unit_selection_rect: (selection_screen_coord: Api::RectangleI, ?selection_add: bool) -> void
2208
2117
 
2209
- # Draws a grid within a unit (pylon/prisms) radius, then selects points which are placeable
2118
+ # Perform action on control group like setting or recalling, use in conjunction with unit selection.
2119
+ # Populated if Feature Layer or Render interface is enabled.
2210
2120
  #
2211
- # _@param_ `source` — either a pylon or a prism
2121
+ # _@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. }
2212
2122
  #
2213
- # _@param_ `unit_type_id` — optionally, the unit you wish to place. Stalkers are widest, so use default nil for a mixed composition warp
2123
+ # _@param_ `control_group_index` — 0-9
2124
+ def action_ui_control_group: (action: Integer, control_group_index: Integer) -> void
2125
+
2126
+ # Selects army (F2)
2214
2127
  #
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]
2128
+ # _@param_ `selection_add` default false To add to other selected items
2129
+ def action_ui_select_army: (?selection_add: bool) -> void
2217
2130
 
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
2131
+ # Selects warp gates (Protoss)
2220
2132
  #
2221
- # _@param_ `source` — location from which we go
2133
+ # _@param_ `selection_add` — default false To add to other selected items
2134
+ def action_ui_select_warp_gates: (?selection_add: bool) -> void
2135
+
2136
+ # Selects larva (Zerg)
2137
+ def action_ui_select_larva: () -> void
2138
+
2139
+ # sord omit - no YARD return type given, using untyped
2140
+ # Select idle workers
2222
2141
  #
2223
- # _@param_ `target` — location towards which we go
2142
+ # _@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. }
2143
+ def action_ui_select_idle_worker: (_type: Integer) -> untyped
2144
+
2145
+ # sord omit - no YARD return type given, using untyped
2146
+ # Multi-panel actions for select/deselect
2147
+ # message ActionMultiPanel {
2148
+ # optional Type type = 1;
2149
+ # optional int32 unit_index = 2;
2150
+ # }
2224
2151
  #
2225
- # _@param_ `offset` — how far from source to start
2152
+ # _@param_ `type` — 1-4 = Api::ActionMultiPanel::Type::*
2226
2153
  #
2227
- # _@param_ `increment` — how far apart to gets, i.e. increment = unit.radius*2 to space units in a line
2154
+ # _@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. }
2155
+ def action_ui_multi_panel: (_type: Integer, unit_index: Integer) -> untyped
2156
+
2157
+ # sord omit - no YARD return type given, using untyped
2158
+ # Cargo panel actions for unloading units.
2228
2159
  #
2229
- # _@param_ `count` — number of points to retrieve
2160
+ # _@param_ `unit_index` — index of unit to unload
2161
+ def action_ui_cargo_panel_unload: (unit_index: Integer) -> untyped
2162
+
2163
+ # sord omit - no YARD return type given, using untyped
2164
+ # Remove unit from production queue
2230
2165
  #
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]
2166
+ # _@param_ `unit_index` target unit index
2167
+ def action_ui_production_panel_remove_from_queue: (unit_index: Integer) -> untyped
2239
2168
 
2240
- # Gets a random point near a location with a positive/negative offset applied to both x and y
2169
+ # sord omit - no YARD return type given, using untyped
2170
+ # Toggle autocast on selected unit. Also possible with raw actions using a unit target.
2241
2171
  #
2242
- # _@param_ `pos`
2172
+ # _@param_ `ability_id` — Api::AbilityId::* ability
2173
+ def action_ui_toggle_autocast: (ability_id: Integer) -> untyped
2174
+
2175
+ # sord omit - no YARD return type given, using untyped
2176
+ # Send a chat message
2243
2177
  #
2244
- # _@param_ `offset`
2178
+ # _@param_ `message` — to send
2245
2179
  #
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
2180
+ # _@param_ `channel` — 1-2, default:Team Api::ActionChat::Channel::Broadcast = 1, Api::ActionChat::Channel::Team = 2
2181
+ def action_chat: (String message, ?channel: Integer) -> untyped
2251
2182
 
2252
- # _@param_ `pos`
2183
+ # sord omit - no YARD return type given, using untyped
2184
+ # Sends actions via api and flushes action_queue
2185
+ def perform_actions: () -> untyped
2186
+
2187
+ # Empties and resets @action_queue
2188
+ def clear_action_queue: () -> void
2189
+
2190
+ # Returns an array of unit tags from a variety of sources
2191
+ # noinspection RubyMismatchedReturnType
2253
2192
  #
2254
- # _@param_ `radius`
2255
- def point_random_on_circle: (pos: Sc2::Position, ?radius: Float) -> Api::Point2D
2193
+ # _@param_ `source` — unit tag, tags, unit or unit group
2194
+ #
2195
+ # _@return_ — unit tag array
2196
+ def unit_tags_from_source: ((Integer | ::Array[Integer] | Api::Unit | Sc2::UnitGroup) source) -> ::Array[Integer]
2256
2197
 
2257
- # _@return_ player with active connection
2258
- attr_accessor bot: (Sc2::Player | untyped)
2198
+ # sord warn - Api::Action wasn't able to be resolved to a constant in this project
2199
+ attr_accessor action_queue: ::Array[Api::Action]
2259
2200
  end
2260
2201
 
2261
2202
  # Holds game state
@@ -2360,12 +2301,16 @@ module Sc2
2360
2301
  # _@param_ `bot`
2361
2302
  def after_reset: (Sc2::Player::Bot _bot) -> untyped
2362
2303
 
2304
+ # sord omit - no YARD type given for "upgrade_id", using untyped
2305
+ # Returns true if this upgrade has finished researching
2306
+ def upgrade_completed?: (untyped upgrade_id) -> bool
2307
+
2363
2308
  # Returns the upgrade ids which are researching or queued
2364
2309
  # Not set for enemy.
2365
2310
  def upgrades_in_progress: () -> ::Array[Integer]
2366
2311
 
2367
2312
  # sord omit - no YARD type given for "upgrade_id", using untyped
2368
- # Returns the upgrade ids which are researching or queued
2313
+ # Returns true if the upgrade is busy researching
2369
2314
  def upgrade_in_progress?: (untyped upgrade_id) -> bool
2370
2315
 
2371
2316
  # sord omit - no YARD type given for "unit_type_id", using untyped
@@ -2483,117 +2428,80 @@ module Sc2
2483
2428
  end
2484
2429
  end
2485
2430
 
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
2554
-
2555
- # sord omit - no YARD return type given, using untyped
2556
- def self.source_paths: () -> untyped
2431
+ # Holds game data from tech tree and Api::ResponseData
2432
+ # Called once on game start
2433
+ class Data
2434
+ # sord warn - Api::ResponseData wasn't able to be resolved to a constant in this project
2435
+ # _@param_ `data`
2436
+ def initialize: (Api::ResponseData data) -> void
2557
2437
 
2558
- # sord omit - no YARD return type given, using untyped
2559
- def self.source_root: () -> untyped
2438
+ # sord warn - Api::AbilityData wasn't able to be resolved to a constant in this project
2439
+ # sord warn - "Hash<Integer, Api::AbilityData] indexed data" does not appear to be a type
2440
+ # Indexes ability data by ability id
2441
+ #
2442
+ # _@param_ `abilities`
2443
+ #
2444
+ # _@return_ — Hash<Integer, Api::AbilityData] indexed data
2445
+ def abilities_from_proto: (::Array[Api::AbilityData] abilities) -> SORD_ERROR_HashIntegerApiAbilityDataindexeddata
2560
2446
 
2561
- # sord omit - no YARD return type given, using untyped
2562
- def ensure_build_dir: () -> untyped
2447
+ # Indexes unit data by id
2448
+ #
2449
+ # _@param_ `units`
2450
+ #
2451
+ # _@return_ — indexed data
2452
+ def units_from_proto: (::Array[Api::UnitTypeData] units) -> ::Hash[Integer, Api::UnitTypeData]
2563
2453
 
2564
- # sord omit - no YARD return type given, using untyped
2565
- def create_executable: () -> untyped
2454
+ # sord warn - Api::UpgradeData wasn't able to be resolved to a constant in this project
2455
+ # sord warn - "Hash<Integer, Api::UpgradeData] indexed data" does not appear to be a type
2456
+ # Indexes upgrades data by id
2457
+ #
2458
+ # _@param_ `upgrades`
2459
+ #
2460
+ # _@return_ — Hash<Integer, Api::UpgradeData] indexed data
2461
+ def upgrades_from_proto: (::Array[Api::UpgradeData] upgrades) -> SORD_ERROR_HashIntegerApiUpgradeDataindexeddata
2566
2462
 
2567
- # sord omit - no YARD return type given, using untyped
2568
- def start_container: () -> untyped
2463
+ # sord omit - no YARD type given for "effects", using untyped
2464
+ # sord omit - no YARD return type given, using untyped
2465
+ def effects_from_proto: (untyped effects) -> untyped
2569
2466
 
2570
- # sord omit - no YARD return type given, using untyped
2571
- def populate_build: () -> untyped
2467
+ # sord omit - no YARD type given for "buffs", using untyped
2468
+ # sord omit - no YARD return type given, using untyped
2469
+ def buffs_from_proto: (untyped buffs) -> untyped
2572
2470
 
2573
- # sord omit - no YARD return type given, using untyped
2574
- def copy_build_to_docker: () -> untyped
2471
+ # sord omit - no YARD return type given, using untyped
2472
+ # Overrides unit data from api to implement fixes or change context
2473
+ # i.e. Api::UnitTypeId::ORBITALCOMMAND cost is cost-to-upgrade instead of CC + Orbital combined cost.
2474
+ # Run once. Depends on all data already being set.
2475
+ def override_unit_data: () -> untyped
2575
2476
 
2576
- # sord omit - no YARD return type given, using untyped
2577
- def link_ladder: () -> untyped
2477
+ # sord omit - no YARD return type given, using untyped
2478
+ # Fixes mineral_cost, vespene_cost and food_required values
2479
+ def correct_unit_type_costs: () -> untyped
2578
2480
 
2579
- # sord omit - no YARD return type given, using untyped
2580
- def install_gems: () -> untyped
2481
+ # sord omit - no YARD return type given, using untyped
2482
+ # Fixes mineral_cost_sum, vespene_cost_sum
2483
+ def correct_unit_type_sum: () -> untyped
2581
2484
 
2582
- # sord omit - no YARD return type given, using untyped
2583
- def compress: () -> untyped
2485
+ # sord warn - Api::AbilityData wasn't able to be resolved to a constant in this project
2486
+ # _@return_ AbilityId => AbilityData
2487
+ attr_accessor abilities: (::Hash[Integer, Api::AbilityData] | untyped)
2584
2488
 
2585
- # sord omit - no YARD return type given, using untyped
2586
- def retreive_zip: () -> untyped
2489
+ # _@return_ UnitId => UnitTypeData
2490
+ attr_accessor units: (::Hash[Integer, Api::UnitTypeData] | untyped)
2587
2491
 
2588
- # sord omit - no YARD return type given, using untyped
2589
- def clean: () -> untyped
2492
+ # sord warn - Api::UpgradeData wasn't able to be resolved to a constant in this project
2493
+ # _@return_ UpgradeId => UpgradeData
2494
+ attr_accessor upgrades: (::Hash[Integer, Api::UpgradeData] | untyped)
2590
2495
 
2591
- # sord omit - no YARD return type given, using untyped
2592
- def stop_container: () -> untyped
2496
+ # sord omit - no YARD type given for :buffs, using untyped
2497
+ # Not particularly useful data. Just use BuffId directly
2498
+ # @return [Hash<Integer, Api::BuffData>] BuffId => BuffData
2499
+ attr_accessor buffs: untyped
2593
2500
 
2594
- # sord omit - no YARD return type given, using untyped
2595
- def bye: () -> untyped
2596
- end
2501
+ # sord omit - no YARD type given for :effects, using untyped
2502
+ # Not particularly useful data. Just use EffectId directly
2503
+ # @return [Hash<Integer, Api::EffectData>] EffectId => EffectData
2504
+ attr_accessor effects: untyped
2597
2505
  end
2598
2506
 
2599
2507
  # Manages client connection to the Api
@@ -2613,13 +2521,12 @@ module Sc2
2613
2521
  # Closes Connection to client
2614
2522
  def close: () -> void
2615
2523
 
2616
- # sord omit - no YARD return type given, using untyped
2617
2524
  # Add a listener of specific callback type
2618
2525
  #
2619
2526
  # _@param_ `listener`
2620
2527
  #
2621
2528
  # _@param_ `klass`
2622
- def add_listener: (Object listener, klass: (Module[Sc2::Connection::ConnectionListener] | Module[Sc2::Connection::StatusListener])) -> untyped
2529
+ def add_listener: (Object listener, klass: (Module[Sc2::Connection::ConnectionListener] | Module[Sc2::Connection::StatusListener])) -> void
2623
2530
 
2624
2531
  # sord omit - no YARD return type given, using untyped
2625
2532
  # Removes a listener of specific callback type
@@ -3275,14 +3182,14 @@ module Sc2
3275
3182
  class UnitGroup
3276
3183
  include Enumerable
3277
3184
  extend Forwardable
3278
- TYPE_WORKER: untyped
3279
- TYPE_GAS_STRUCTURE: untyped
3280
- TYPE_MINERAL: untyped
3281
- TYPE_GEYSER: untyped
3282
- TYPE_REJECT_DEBRIS: untyped
3185
+ TYPE_WORKER: ::Array[Integer]
3186
+ TYPE_GAS_STRUCTURE: ::Array[Integer]
3187
+ TYPE_MINERAL: ::Array[Integer]
3188
+ TYPE_GEYSER: ::Array[Integer]
3189
+ TYPE_REJECT_DEBRIS: ::Array[Integer]
3283
3190
  TYPE_TECHLAB: untyped
3284
- TYPE_REACTOR: untyped
3285
- TYPE_BASES: untyped
3191
+ TYPE_REACTOR: ::Array[Integer]
3192
+ TYPE_BASES: ::Array[Integer]
3286
3193
 
3287
3194
  # _@param_ `units` — default to be added.
3288
3195
  #
@@ -3535,7 +3442,7 @@ module Sc2
3535
3442
  def pos_centroid: () -> Api::Point2D?
3536
3443
 
3537
3444
  # Our first unit's bot object.
3538
- # Returns nil if units are empty, so use safetly operator bot&.method(...)
3445
+ # Returns nil if units are empty, so use safety operator bot&.method(...)
3539
3446
  #
3540
3447
  # _@return_ — player with active connection
3541
3448
  def bot: () -> Sc2::Player?
@@ -3557,7 +3464,7 @@ module Sc2
3557
3464
  # _@param_ `target` — is a unit tag or a Api::Point2D. Nil for addons/orbital
3558
3465
  #
3559
3466
  # _@param_ `queue_command` — shift+command
3560
- def build: (unit_type_id: Integer, ?target: (Api::Point2D | Integer)?, ?queue_command: bool) -> untyped
3467
+ def build: (unit_type_id: Integer, ?target: (Api::Point2D | Api::Unit | Integer)?, ?queue_command: bool) -> untyped
3561
3468
 
3562
3469
  # sord omit - no YARD return type given, using untyped
3563
3470
  # Warps in unit type at target (location or pylon)
@@ -3800,6 +3707,11 @@ module Sc2
3800
3707
  # _@return_ — larva
3801
3708
  def larva: () -> Sc2::UnitGroup
3802
3709
 
3710
+ # Selects eggs. Eggs come from Larva and turn into Units.
3711
+ #
3712
+ # _@return_ — eggs
3713
+ def eggs: () -> Sc2::UnitGroup
3714
+
3803
3715
  # Selects queens
3804
3716
  #
3805
3717
  # _@return_ — queens
@@ -3885,14 +3797,14 @@ module Sc2
3885
3797
  # @private
3886
3798
  # Negative selector allowing unit group "ug.not." filter
3887
3799
  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
3800
+ TYPE_WORKER: ::Array[Integer]
3801
+ TYPE_GAS_STRUCTURE: ::Array[Integer]
3802
+ TYPE_MINERAL: ::Array[Integer]
3803
+ TYPE_GEYSER: ::Array[Integer]
3804
+ TYPE_REJECT_DEBRIS: ::Array[Integer]
3893
3805
  TYPE_TECHLAB: untyped
3894
- TYPE_REACTOR: untyped
3895
- TYPE_BASES: untyped
3806
+ TYPE_REACTOR: ::Array[Integer]
3807
+ TYPE_BASES: ::Array[Integer]
3896
3808
 
3897
3809
  # sord infer - argument name in single @param inferred as "unit_group"
3898
3810
  def initialize: ((Api::Unit | ::Hash[Integer, Api::Unit] | ::Array[Api::Unit] | Sc2::UnitGroup)? unit_group) -> void
@@ -4232,8 +4144,8 @@ module Sc2
4232
4144
  # _@param_ `player_index`
4233
4145
  def stop: (Integer player_index) -> void
4234
4146
 
4235
- # sord omit - no YARD return type given, using untyped
4236
- def stop_all: () -> untyped
4147
+ # Stops all clients
4148
+ def stop_all: () -> void
4237
4149
 
4238
4150
  def initialize: () -> void
4239
4151
 
@@ -8690,7 +8602,7 @@ module Api
8690
8602
  # _@param_ `target` — is a unit tag or a Api::Point2D. Nil for addons/orbital
8691
8603
  #
8692
8604
  # _@param_ `queue_command` — shift+command
8693
- def build: (unit_type_id: Integer, ?target: (Api::Point2D | Integer)?, ?queue_command: bool) -> untyped
8605
+ def build: (unit_type_id: Integer, ?target: (Api::Point2D | Api::Unit | Integer)?, ?queue_command: bool) -> untyped
8694
8606
 
8695
8607
  # sord omit - no YARD return type given, using untyped
8696
8608
  # Issues repair command on target
@@ -8916,7 +8828,7 @@ module Api
8916
8828
  # sord omit - no YARD type given for "g:", using untyped
8917
8829
  # sord omit - no YARD type given for "b:", using untyped
8918
8830
  # For lines: r & b are swapped.
8919
- def initialize: (r: untyped, g: untyped, b: untyped) -> void
8831
+ def initialize: (?r: untyped, ?g: untyped, ?b: untyped) -> void
8920
8832
 
8921
8833
  # Adds additional functionality to message class Api::Color
8922
8834
  module ClassMethods
@@ -8969,7 +8881,7 @@ module Api
8969
8881
  # sord omit - no YARD type given for "g:", using untyped
8970
8882
  # sord omit - no YARD type given for "b:", using untyped
8971
8883
  # For lines: r & b are swapped.
8972
- def initialize: (r: untyped, g: untyped, b: untyped) -> void
8884
+ def initialize: (?r: untyped, ?g: untyped, ?b: untyped) -> void
8973
8885
  end
8974
8886
 
8975
8887
  # Protobuf virtual class.
@@ -9891,7 +9803,7 @@ module Api
9891
9803
  # _@param_ `target` — is a unit tag or a Api::Point2D. Nil for addons/orbital
9892
9804
  #
9893
9805
  # _@param_ `queue_command` — shift+command
9894
- def build: (unit_type_id: Integer, ?target: (Api::Point2D | Integer)?, ?queue_command: bool) -> untyped
9806
+ def build: (unit_type_id: Integer, ?target: (Api::Point2D | Api::Unit | Integer)?, ?queue_command: bool) -> untyped
9895
9807
 
9896
9808
  # sord omit - no YARD return type given, using untyped
9897
9809
  # Issues repair command on target
@@ -10087,9 +9999,6 @@ module Api
10087
9999
  class UnitTypeData < Google::Protobuf::AbstractMessage
10088
10000
  include Api::UnitTypeExtension
10089
10001
  include Api::UnitTypeDataExtension
10090
-
10091
- # sord omit - no YARD return type given, using untyped
10092
- def mood: () -> untyped
10093
10002
  end
10094
10003
 
10095
10004
  # Protobuf virtual class.
@@ -10207,8 +10116,6 @@ module Api
10207
10116
 
10208
10117
  # Adds additional functionality to message object Api::Unit
10209
10118
  module UnitTypeExtension
10210
- # sord omit - no YARD return type given, using untyped
10211
- def mood: () -> untyped
10212
10119
  end
10213
10120
 
10214
10121
  # Adds additional functionality to message object Api::PowerSource
@@ -10389,63 +10296,4 @@ module Api
10389
10296
  # i.e. Api::AbilityId::ATTACK_BATTLECRUISER returns generic Api::AbilityId::ATTACK
10390
10297
  def ability_id: () -> Integer
10391
10298
  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
10299
  end