sc2ai 0.0.7 → 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
@@ -627,7 +551,7 @@ module Sc2
627
551
  # sord omit - no YARD return type given, using untyped
628
552
  # Callback for unit destroyed. Tags might be found in `previous.all_units`
629
553
  # This excludes unknown objects, like projectiles and only shows things the API has "seen" as a unit
630
- # Override to use in your bot class or use Player.event_units_destroyed
554
+ # Override to use in your bot class or use Player.
631
555
  #
632
556
  # _@param_ `unit`
633
557
  #
@@ -644,7 +568,7 @@ module Sc2
644
568
  # sord omit - no YARD return type given, using untyped
645
569
  # Callback for unit type changing.
646
570
  # To detect certain unit creations, you should use this method to watch morphs.
647
- # Override to use in your bot class or use Player.event_structures_started
571
+ # Override to use in your bot class or use Player.
648
572
  #
649
573
  # _@param_ `unit`
650
574
  #
@@ -660,14 +584,14 @@ module Sc2
660
584
 
661
585
  # sord omit - no YARD return type given, using untyped
662
586
  # Callback for structure building is completed
663
- # Override to use in your bot class or use Player.event_structures_completed
587
+ # Override to use in your bot class or use Player.
664
588
  #
665
589
  # _@param_ `unit`
666
590
  def on_structure_completed: (Api::Unit unit) -> untyped
667
591
 
668
592
  # sord omit - no YARD return type given, using untyped
669
593
  # Callback for unit (Unit/Structure) taking damage
670
- # Override to use in your bot class or use Player.event_units_damaged
594
+ # Override to use in your bot class or use Player.
671
595
  #
672
596
  # _@param_ `unit`
673
597
  #
@@ -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,941 +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]
1551
+ # _@return_ — UnitGroup of resources (minerals+geysers)
1552
+ def resources_for_base: ((Api::Unit | Sc2::Position) base) -> Sc2::UnitGroup
1642
1553
 
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
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
1646
1560
 
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
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.
1565
+ #
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]]]
1650
1572
 
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
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
1577
+ #
1578
+ # _@param_ `length` — length of the building, 2 for depot/pylon, 3 for rax/gate
1579
+ #
1580
+ # _@param_ `target` — near where to find a placement
1581
+ #
1582
+ # _@param_ `random` — number of nearest points to randomly choose from. 1 for nearest point.
1583
+ #
1584
+ # _@param_ `in_power` — whether this must be on a power field
1585
+ #
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?
1654
1593
 
1655
- # sord omit - no YARD type given for :event_units_created, using untyped
1656
- # Units created since last frame (visible only, units not structures)
1657
- # Read this on_step. Alternative to callback on_unit_created
1594
+ # Draws a grid within a unit (pylon/prisms) radius, then selects points which are placeable
1658
1595
  #
1659
- # _@note_Morphed units should watch #event_units_type_changed
1660
- # @return [Sc2::UnitGroup] group of created units
1661
- attr_accessor event_units_created: untyped
1662
-
1663
- # _@return_ — group effected
1664
- attr_accessor event_units_type_changed: Sc2::UnitGroup
1665
-
1666
- # _@return_ — a group of structures started
1667
- attr_accessor event_structures_started: Sc2::UnitGroup
1668
-
1669
- # _@return_ — a group of structures started
1670
- attr_accessor event_structures_completed: Sc2::UnitGroup
1671
-
1672
- # _@return_ — group of Units and Structures effected
1673
- attr_accessor event_units_damaged: Sc2::UnitGroup
1674
-
1675
- # sord omit - no YARD type given for :event_units_destroyed, using untyped
1676
- # TODO: Unit buff disabled, because it calls back too often (mineral in hand). Put back if useful
1677
- # Units (Unit/Structure) on which a new buff_ids appeared this frame
1678
- # See which buffs via: unit.buff_ids - unit.previous.buff_ids
1679
- # Read this on_step. Alternative to callback on_unit_buffed
1680
- # attr_accessor :event_units_buffed
1681
- attr_accessor event_units_destroyed: untyped
1682
- end
1683
-
1684
- # Holds action list and queues batch
1685
- module Actions
1686
- # sord warn - Api::Action wasn't able to be resolved to a constant in this project
1687
- # Queues action for performing end of step
1596
+ # _@param_ `source` either a pylon or a prism
1688
1597
  #
1689
- # _@param_ `action`
1690
- def queue_action: (Api::Action action) -> void
1598
+ # _@param_ `unit_type_id` — optionally, the unit you wish to place. Stalkers are widest, so use default nil for a mixed composition warp
1599
+ #
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]
1691
1602
 
1692
- # sord omit - no YARD return type given, using untyped
1693
- # Queues a Api::ActionRaw. Perform ability on unit_tags optionally on target_world_space_pos/target_unit_tag
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
1694
1605
  #
1695
- # _@param_ `unit_tags`
1606
+ # _@param_ `source` — location from which we go
1696
1607
  #
1697
- # _@param_ `ability_id`
1608
+ # _@param_ `target` — location towards which we go
1698
1609
  #
1699
- # _@param_ `queue_command` — shift+command
1610
+ # _@param_ `offset` — how far from source to start
1700
1611
  #
1701
- # _@param_ `target_world_space_pos`
1612
+ # _@param_ `increment` — how far apart to gets, i.e. increment = unit.radius*2 to space units in a line
1702
1613
  #
1703
- # _@param_ `target_unit_tag`
1704
- def action_raw_unit_command: (
1705
- unit_tags: ::Array[Integer],
1706
- ability_id: Integer,
1707
- ?queue_command: bool,
1708
- ?target_world_space_pos: Api::Point2D?,
1709
- ?target_unit_tag: Integer?
1710
- ) -> untyped
1711
-
1712
- # sord omit - no YARD return type given, using untyped
1713
- # Queues a Api::ActionRawUnitCommand.
1714
- # Send accepts a Api::Unit, tag or tags and targets Api::Point2D or unit.tag
1614
+ # _@param_ `count` — number of points to retrieve
1715
1615
  #
1716
- # _@param_ `units` can be an Api::Unit, array of Api::Unit#tag or single tag
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]
1624
+
1625
+ # Gets a random point near a location with a positive/negative offset applied to both x and y
1717
1626
  #
1718
- # _@param_ `ability_id`
1627
+ # _@param_ `pos`
1719
1628
  #
1720
- # _@param_ `target` — is a unit, unit tag or a Api::Point2D
1629
+ # _@param_ `offset`
1721
1630
  #
1722
- # _@param_ `queue_command` — shift+command
1723
- def action: (
1724
- units: (::Array[Integer] | Integer | Api::Unit),
1725
- ability_id: Integer,
1726
- ?target: (Api::Unit | Integer | Api::Point2D)?,
1727
- ?queue_command: bool
1728
- ) -> untyped
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
1729
1636
 
1730
- # sord omit - no YARD return type given, using untyped
1731
- # Builds target unit type using units as source at optional target
1637
+ # _@param_ `pos`
1732
1638
  #
1733
- # _@param_ `units` — can be an Api::Unit, array of Api::Unit#tag or single tag
1639
+ # _@param_ `radius`
1640
+ def point_random_on_circle: (pos: Sc2::Position, ?radius: Float) -> Api::Point2D
1641
+
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
1734
1651
  #
1735
- # _@param_ `unit_type_id` — Api::UnitTypeId the unit type you wish to build
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
1736
1657
  #
1737
- # _@param_ `target` — is a unit tag or a Api::Point2D. Nil for addons/orbital
1658
+ # _@param_ `text` — will respect newlines
1738
1659
  #
1739
- # _@param_ `queue_command` — shift+command
1740
- def build: (
1741
- units: (::Array[Integer] | Integer | Api::Unit),
1742
- unit_type_id: Integer,
1743
- ?target: (Api::Point2D | Integer)?,
1744
- ?queue_command: bool
1745
- ) -> untyped
1660
+ # _@param_ `size` — of font, default 14px
1661
+ def debug_print: (String text, ?size: Size) -> void
1746
1662
 
1747
- # sord omit - no YARD return type given, using untyped
1748
- # Warps in unit type at target (location or pylon) with optional source units (warp gates)
1749
- # When not specifying the specific warp gate(s), all warpgates will be used
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
1750
1665
  #
1751
- # _@param_ `unit_type_id` — Api::UnitTypeId the unit type you wish to build
1666
+ # _@param_ `text` — will respect newlines
1752
1667
  #
1753
- # _@param_ `queue_command` — shift+command
1668
+ # _@param_ `left_percent` — range 0..100. percent from left of screen
1754
1669
  #
1755
- # _@param_ `target` — is a unit tag or a Api::Point2D
1670
+ # _@param_ `top_percent` — range 0..100. percent from top of screen
1756
1671
  #
1757
- # _@param_ `units`
1758
- def warp: (
1759
- unit_type_id: Integer,
1760
- target: (Api::Point2D | Integer),
1761
- queue_command: bool,
1762
- ?units: (::Array[Integer] | Integer | Api::Unit)?
1763
- ) -> untyped
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
1764
1682
 
1765
- # sord omit - no YARD return type given, using untyped
1766
- # Research a specific upgrade
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
1767
1685
  #
1768
- # _@param_ `units` — can be an Api::Unit, array of Api::Unit#tag or single tag
1686
+ # _@param_ `text` — will respect newlines
1769
1687
  #
1770
- # _@param_ `upgrade_id` — Api::UpgradeId to research
1688
+ # _@param_ `point` — point in the world, i.e. unit.pos
1771
1689
  #
1772
- # _@param_ `queue_command` — shift+command
1773
- def research: (units: (::Array[Integer] | Integer | Api::Unit), upgrade_id: Integer, ?queue_command: bool) -> untyped
1690
+ # _@param_ `color` — default white
1691
+ #
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
1774
1699
 
1775
- # Toggles auto-cast ability for units
1700
+ # Draws a line between two Api::Point's for color
1776
1701
  #
1777
- # _@param_ `units` — can be an Api::Unit, array of Tags or single Tag
1702
+ # _@param_ `p0` — the first point
1778
1703
  #
1779
- # _@param_ `ability_id`
1780
- def action_raw_toggle_autocast: (units: (::Array[Integer] | Integer | Api::Unit), ability_id: Integer) -> void
1704
+ # _@param_ `p1` — the second point
1705
+ #
1706
+ # _@param_ `color` — default white
1707
+ def debug_draw_line: (p0: Api::Point, p1: Api::Point, ?color: Api::Color?) -> void
1781
1708
 
1782
- # Toggles auto-cast ability for units
1709
+ # Draws a box around position xy at base of z. Good for structure boxing.
1783
1710
  #
1784
1711
  # _@param_ `point`
1785
- def action_raw_camera_move: (point: Api::Point) -> void
1786
-
1787
- # sord warn - Api::Point2I wasn't able to be resolved to a constant in this project
1788
- # sord warn - Api::Point2I wasn't able to be resolved to a constant in this project
1789
- # Issues spatial unit command. Target is either target_screen_coord or target_minimap_coord.
1790
1712
  #
1791
- # _@param_ `ability_id`
1713
+ # _@param_ `radius` — default one tile wide, 1.0
1792
1714
  #
1793
- # _@param_ `target_screen_coord`
1715
+ # _@param_ `color` — default white. min(r,b) is used for both r&b
1794
1716
  #
1795
- # _@param_ `target_minimap_coord`
1717
+ # ```ruby
1718
+ # # Draws a box on structure placement grid
1719
+ # debug_draw_box(point: unit.pos, radius: unit.footprint_radius)
1720
+ # ```
1796
1721
  #
1797
- # _@param_ `queue_command` shift+command
1798
- def action_spatial_unit_command: (
1799
- ability_id: Api::AbilityId,
1800
- ?target_screen_coord: Api::Point2I?,
1801
- ?target_minimap_coord: Api::Point2I?,
1802
- ?queue_command: bool
1803
- ) -> void
1804
-
1805
- # sord warn - Api::Point2I wasn't able to be resolved to a constant in this project
1806
- # Simulates a click on the minimap to move the camera.
1722
+ # _@note_Api::Color RGB is broken for this command. Will use min(r,b)
1807
1723
  #
1808
- # _@param_ `center_minimap`
1809
- def action_spatial_camera_move: (center_minimap: Api::Point2I) -> void
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
1810
1726
 
1811
- # Issues spatial unit select point command. Target is either target_screen_coord or target_minimap_coord.
1727
+ # Debug draws a sphere at position with a radius in color
1812
1728
  #
1813
- # _@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. }
1729
+ # _@param_ `point`
1814
1730
  #
1815
- # _@param_ `selection_screen_coord`
1816
- def action_spatial_unit_selection_point: (?_type: Integer, ?selection_screen_coord: Api::PointI?) -> void
1817
-
1818
- # sord warn - Api::RectangleI wasn't able to be resolved to a constant in this project
1819
- # Issue rectangle select
1731
+ # _@param_ `radius` — default one tile wide, 1.0
1820
1732
  #
1821
- # _@param_ `selection_screen_coord` — rectangle coordinates
1733
+ # _@param_ `color` — default white
1734
+ def debug_draw_sphere: (point: Api::Point, ?radius: Float, ?color: Api::Color?) -> void
1735
+
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
1822
1749
  #
1823
- # _@param_ `selection_add` — default false Equivalent to shift+drag. Adds units to selection. default false
1824
- def action_spatial_unit_selection_rect: (selection_screen_coord: Api::RectangleI, ?selection_add: bool) -> void
1750
+ # _@param_ `command` — one of Api::DebugGameState::*
1751
+ def debug_game_state: (Integer command) -> void
1825
1752
 
1826
- # Perform action on control group like setting or recalling, use in conjunction with unit selection.
1827
- # Populated if Feature Layer or Render interface is enabled.
1753
+ # Spawns a quantity of units under an owner at position given
1828
1754
  #
1829
- # _@param_ `action` — 1-5 = Api::ActionControlGroup::ControlGroupAction::* enum ControlGroupAction { Recall = 1; // Equivalent to number hotkey. Replaces current selection with control group. Set = 2; // Equivalent to Control + number hotkey. Sets control group to current selection. Append = 3; // Equivalent to Shift + number hotkey. Adds current selection into control group. SetAndSteal = 4; // Equivalent to Control + Alt + number hotkey. Sets control group to current selection. Units are removed from other control groups. AppendAndSteal = 5; // Equivalent to Shift + Alt + number hotkey. Adds current selection into control group. Units are removed from other control groups. }
1755
+ # _@param_ `unit_type_id` — Api::UnitTypeId::*
1830
1756
  #
1831
- # _@param_ `control_group_index` — 0-9
1832
- def action_ui_control_group: (action: Integer, control_group_index: Integer) -> void
1833
-
1834
- # Selects army (F2)
1757
+ # _@param_ `owner` — typically you are 1 and 2 is enemy (see @common.player_id)
1835
1758
  #
1836
- # _@param_ `selection_add` — default false To add to other selected items
1837
- def action_ui_select_army: (?selection_add: bool) -> void
1838
-
1839
- # Selects warp gates (Protoss)
1759
+ # _@param_ `pos` — position in 2d
1840
1760
  #
1841
- # _@param_ `selection_add` — default false To add to other selected items
1842
- def action_ui_select_warp_gates: (?selection_add: bool) -> void
1843
-
1844
- # Selects larva (Zerg)
1845
- def action_ui_select_larva: () -> void
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
1846
1768
 
1847
- # sord omit - no YARD return type given, using untyped
1848
- # Select idle workers
1769
+ # Kills a target unit or unit tag
1849
1770
  #
1850
- # _@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. }
1851
- 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
1852
1773
 
1853
- # sord omit - no YARD return type given, using untyped
1854
- # Multi-panel actions for select/deselect
1855
- # message ActionMultiPanel {
1856
- # optional Type type = 1;
1857
- # optional int32 unit_index = 2;
1858
- # }
1774
+ # Hangs, crashes and exits the Sc2 client. DO NOT USE.
1859
1775
  #
1860
- # _@param_ `type` — 1-4 = Api::ActionMultiPanel::Type::*
1776
+ # _@param_ `test` — one of Api::DebugTestProcess::Test::Crash, Api::DebugTestProcess::Test::Hang, Api::DebugTestProcess::Test::Exit
1861
1777
  #
1862
- # _@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. }
1863
- 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
1864
1780
 
1865
1781
  # sord omit - no YARD return type given, using untyped
1866
- # Cargo panel actions for unloading units.
1782
+ # Useful only for single-player "curriculum" maps
1867
1783
  #
1868
- # _@param_ `unit_index` — index of unit to unload
1869
- def action_ui_cargo_panel_unload: (unit_index: Integer) -> untyped
1784
+ # _@param_ `score` — sets the score
1785
+ def debug_set_score: (?score: Float) -> untyped
1870
1786
 
1871
- # sord omit - no YARD return type given, using untyped
1872
- # Remove unit from production queue
1787
+ # Ends game with a specified result of either Surrender or DeclareVictory
1873
1788
  #
1874
- # _@param_ `unit_index` — target unit index
1875
- 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
1876
1791
 
1877
- # sord omit - no YARD return type given, using untyped
1878
- # 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
1879
1793
  #
1880
- # _@param_ `ability_id` — Api::AbilityId::* ability
1881
- def action_ui_toggle_autocast: (ability_id: Integer) -> untyped
1882
-
1883
- # sord omit - no YARD return type given, using untyped
1884
- # Send a chat message
1794
+ # _@param_ `unit_tag`
1885
1795
  #
1886
- # _@param_ `message` — to send
1796
+ # _@param_ `unit_value` — 1=Energy,2=Life,3=Shields one of Api::DebugSetUnitValue::UnitValue::*
1887
1797
  #
1888
- # _@param_ `channel` — 1-2, default:Team Api::ActionChat::Channel::Broadcast = 1, Api::ActionChat::Channel::Team = 2
1889
- 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
1890
1800
 
1891
1801
  # sord omit - no YARD return type given, using untyped
1892
- # Sends actions via api and flushes action_queue
1893
- def perform_actions: () -> untyped
1802
+ # Sends actions via api and flushes debug_commands_queue
1803
+ def perform_debug_commands: () -> untyped
1894
1804
 
1895
- # Empties and resets @action_queue
1896
- def clear_action_queue: () -> void
1805
+ # Empties and resets @debug_queue
1806
+ def clear_debug_command_queue: () -> void
1897
1807
 
1898
- # Returns an array of unit tags from a variety of sources
1899
- # noinspection RubyMismatchedReturnType
1900
- #
1901
- # _@param_ `source` — unit tag, tags, unit or unit group
1902
- #
1903
- # _@return_ — unit tag array
1904
- 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
1905
1811
 
1906
1812
  # sord warn - Api::Action wasn't able to be resolved to a constant in this project
1907
- 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]
1908
1815
  end
1909
1816
 
1910
- # Holds map and geography helper functions
1911
- class Geometry
1912
- # sord omit - no YARD type given for "bot", using untyped
1913
- 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
1914
1822
 
1915
- # Gets the map tile width. Range is 1-255.
1916
- # Effected by crop_to_playable_area
1917
- 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]
1918
1826
 
1919
- # Gets the map tile height. Range is 1-255.
1920
- # Effected by crop_to_playable_area
1921
- 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
1922
1830
 
1923
- # Center of the map
1924
- 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
1925
1834
 
1926
- # Returns zero to map_width as range
1835
+ # Returns static [Api::UnitTypeData] for a unit
1927
1836
  #
1928
- # _@return_0 to map_width
1929
- def map_range_x: () -> ::Range[untyped]
1837
+ # _@param_ `unit` Api::UnitTypeId or Api::Unit
1838
+ def unit_data: ((Integer | Api::Unit) unit) -> Api::UnitTypeData
1930
1839
 
1931
- # 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
1932
1842
  #
1933
- # _@return_0 to map_height
1934
- def map_range_y: () -> ::Range[untyped]
1935
-
1936
- # Returns zero to map_width-1 as range
1937
- def map_tile_range_x: () -> ::Range[untyped]
1843
+ # _@param_ `ability_id` Api::AbilityId::*
1844
+ def ability_data: (Integer ability_id) -> Api::AbilityData
1938
1845
 
1939
- # Returns zero to map_height-1 as range
1940
- 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
1941
1851
 
1942
- # Returns whether a x/y (integer) is placeable as per minimap image data.
1943
- # It does not say whether a position is occupied by another building.
1944
- # One pixel covers one whole block. Corrects floats on your behalf
1852
+ # Checks unit data for an attribute value
1945
1853
  #
1946
- # _@param_ `x`
1854
+ # _@param_ `unit` — Api::UnitTypeId or Api::Unit
1947
1855
  #
1948
- # _@param_ `y`
1856
+ # _@param_ `attribute` — Api::Attribute, i.e. Api::Attribute::Mechanical or :Mechanical
1949
1857
  #
1950
- # _@return_ — whether tile is placeable?
1858
+ # _@return_ — whether unit has attribute
1951
1859
  #
1952
- # _@see_ `Sc2::Player#pathable?` — for detecting obstructions
1953
- def placeable?: (x: (Float | Integer), y: (Float | Integer)) -> bool
1954
-
1955
- # sord warn - Numo::Bit wasn't able to be resolved to a constant in this project
1956
- # Returns a parsed placement_grid from bot.game_info.start_raw.
1957
- # Each value in [row][column] holds a boolean value represented as an integer
1958
- # It does not say whether a position is occupied by another building.
1959
- # One pixel covers one whole block. Rounds fractionated positions down.
1960
- 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
1961
1866
 
1962
- # Whether this tile is where an expansion is supposed to be placed.
1963
- # To see if a unit/structure is blocking an expansion, pass their coordinates to this method.
1964
- #
1965
- # _@param_ `x`
1966
- #
1967
- # _@param_ `y`
1867
+ # Creates a unit group from all_units with matching tag
1968
1868
  #
1969
- # _@return_true if location has creep on it
1970
- 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
1971
1871
 
1972
- # sord warn - Numo::Bit wasn't able to be resolved to a constant in this project
1973
- # Returns a grid where ony the expo locations are marked
1974
- 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
1975
1876
 
1976
- # sord warn - Numo::Bit wasn't able to be resolved to a constant in this project
1977
- # Returns a grid where powered locations are marked true
1978
- 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
1979
1881
 
1980
- # Returns whether a x/y block is powered. Only fully covered blocks are true.
1981
- # One pixel covers one whole block. Corrects float inputs on your behalf.
1982
- #
1983
- # _@param_ `x`
1984
- #
1985
- # _@param_ `y`
1986
- #
1987
- # _@return_ — true if location is powered
1988
- 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
1989
1885
 
1990
- # Returns whether a x/y block is pathable as per minimap
1991
- # 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.
1992
1888
  #
1993
- # _@param_ `x`
1889
+ # _@param_ `unit_tag`
1994
1890
  #
1995
- # _@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.
1996
1898
  #
1997
- # _@return_ — whether tile is patahble
1998
- def pathable?: (x: (Float | Integer), y: (Float | Integer)) -> bool
1899
+ # _@param_ `observation`
1900
+ def parse_observation_units: (Api::Observation observation) -> untyped
1999
1901
 
2000
- # sord warn - Numo::Bit wasn't able to be resolved to a constant in this project
2001
- # Gets the pathable areas as things stand right now in the game
2002
- # Buildings, minerals, structures, etc. all result in a nonpathable place
1902
+ # Returns alliance based on whether you are a player or an enemy
2003
1903
  #
2004
- # _@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
2005
1908
  #
2006
- # ```ruby
2007
- # parsed_pathing_grid[0,0] # reads bottom left corner
2008
- # # use helper function #pathable
2009
- # pathable?(x: 0, y: 0) # reads bottom left corner
2010
- # ```
2011
- def parsed_pathing_grid: () -> Numo::Bit
1909
+ # _@return_ — :Self or :Enemy from Api::Alliance
1910
+ def enemy_alliance: () -> Symbol
2012
1911
 
1912
+ # sord omit - no YARD type given for "unit", using untyped
2013
1913
  # sord omit - no YARD return type given, using untyped
2014
- # Clears pathing-grid dependent objects like placements.
2015
- # Called when pathing grid gets updated
2016
- 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
2017
1916
 
2018
- # Returns the terrain height (z) at position x and y
2019
- # Granularity is per placement grid block, since this comes from minimap image data.
2020
- #
2021
- # _@param_ `x`
2022
- #
2023
- # _@param_ `y`
2024
- #
2025
- # _@return_ — z axis position between -16 and 16
2026
- 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
2027
1946
 
2028
- # Returns the terrain height (z) at position x and y for a point
2029
- #
2030
- # _@param_ `position`
2031
- #
2032
- # _@return_ — z axis position between -16 and 16
2033
- 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]
2034
1951
 
2035
- # sord warn - Numo::SFloat wasn't able to be resolved to a constant in this project
2036
- # Returns a parsed terrain_height from bot.game_info.start_raw.
2037
- # Each value in [row][column] holds a float value which is the z height
2038
- #
2039
- # _@return_ — Numo array
2040
- 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
2041
1955
 
2042
- # Returns one of three Integer visibility indicators at tile for x & y
2043
- #
2044
- # _@param_ `x`
2045
- #
2046
- # _@param_ `y`
2047
- #
2048
- # _@return_ — 0=Hidden,1= Snapshot,2=Visible
2049
- 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
2050
1959
 
2051
- # Returns whether the point (tile) is currently in vision
2052
- #
2053
- # _@param_ `x`
2054
- #
2055
- # _@param_ `y`
2056
- #
2057
- # _@return_ — true if fog is completely lifted
2058
- 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
2059
1963
 
2060
- # Returns whether point (tile) has been seen before or currently visible
2061
- #
2062
- # _@param_ `x`
2063
- #
2064
- # _@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
2065
1980
  #
2066
- # _@return_ — true if partially or fully lifted fog
2067
- def map_seen?: (x: (Float | Integer), y: (Float | Integer)) -> bool
1981
+ # _@param_ `action`
1982
+ def queue_action: (Api::Action action) -> void
2068
1983
 
2069
- # 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
2070
1986
  #
2071
- # _@param_ `x`
1987
+ # _@param_ `unit_tags`
2072
1988
  #
2073
- # _@param_ `y`
1989
+ # _@param_ `ability_id`
2074
1990
  #
2075
- # _@return_true if fog of war is fully dark
2076
- def map_unseen?: (x: (Float | Integer), y: (Float | Integer)) -> bool
2077
-
2078
- # sord warn - Numo::SFloat wasn't able to be resolved to a constant in this project
2079
- # Returns a parsed map_state.visibility from bot.observation.raw_data.
2080
- # Each value in [row][column] holds one of three integers (0,1,2) to flag a vision type
1991
+ # _@param_ `queue_command` shift+command
2081
1992
  #
2082
- # _@return_ — Numo array
1993
+ # _@param_ `target_world_space_pos`
2083
1994
  #
2084
- # _@see_ `#visibility` — for reading from this value
2085
- 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
2086
2003
 
2087
- # Returns whether a tile has creep on it, as per minimap
2088
- # 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
2089
2007
  #
2090
- # _@param_ `x`
2008
+ # _@param_ `units` — can be an Api::Unit, array of Api::Unit#tag or single tag
2091
2009
  #
2092
- # _@param_ `y`
2010
+ # _@param_ `ability_id`
2093
2011
  #
2094
- # _@return_true if location has creep on it
2095
- def creep?: (x: (Float | Integer), y: (Float | Integer)) -> bool
2096
-
2097
- # sord warn - Numo::Bit wasn't able to be resolved to a constant in this project
2098
- # Provides parsed minimap representation of creep spread
2099
- # Caches for 4 frames
2012
+ # _@param_ `target` is a unit, unit tag or a Api::Point2D
2100
2013
  #
2101
- # _@return_Numo array
2102
- 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
2103
2021
 
2104
- # sord warn - Numo::Bit wasn't able to be resolved to a constant in this project
2105
2022
  # sord omit - no YARD return type given, using untyped
2106
- # TODO: Remove this method if it has no use. Build points uses this code directly for optimization.
2107
- # Reduce the dimensions of a grid by merging cells using length x length squares.
2108
- # 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
2109
2024
  #
2110
- # _@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
2111
2026
  #
2112
- # _@param_ `length` — how many cells to merge, i.e. 3 for finding 3x3 placement
2113
- def divide_grid: (Numo::Bit input_grid, Integer length) -> untyped
2114
-
2115
- # Returns own 2d start position as set by initial camera
2116
- # This differs from position of first base structure
2117
- def start_position: () -> Api::Point2D
2118
-
2119
- # Returns the enemy 2d start position
2120
- def enemy_start_position: () -> Api::Point2D
2121
-
2122
- # Gets expos and surrounding minerals
2123
- # 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
2124
2028
  #
2125
- # _@return_Location => UnitGroup of resources (minerals+geysers)
2029
+ # _@param_ `target` is a unit tag or a Api::Point2D. Nil for addons/orbital
2126
2030
  #
2127
- # ```ruby
2128
- # random_expo = geo.expansions.keys.sample #=> Point2D
2129
- # expo_resources = geo.expansions[random_expo] #=> UnitGroup
2130
- # alive_minerals = expo_resources.minerals & neutral.minerals
2131
- # geysers = expo_resources.geysers
2132
- # ```
2133
- 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
2134
2038
 
2135
- # Returns a list of 2d points for expansion build locations
2136
- # 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
2137
2042
  #
2138
- # _@return_points where expansions can be placed
2043
+ # _@param_ `unit_type_id` Api::UnitTypeId the unit type you wish to build
2139
2044
  #
2140
- # ```ruby
2141
- # random_expo = expansion_points.sample
2142
- # expo_resources = geo.expansions[random_expo]
2143
- # ```
2144
- def expansion_points: () -> ::Array[Api::Point2D]
2145
-
2146
- # Returns a slice of #expansions where a base hasn't been built yet
2147
- # The has index is a build position and the value is a UnitGroup of resources for the base
2045
+ # _@param_ `queue_command` — shift+command
2148
2046
  #
2149
- # _@return_Location => UnitGroup of resources (minerals+geysers)
2047
+ # _@param_ `target` is a unit tag or a Api::Point2D
2150
2048
  #
2151
- # ```ruby
2152
- # # Lets find the nearest unoccupied expo
2153
- # expo_pos = expansions_unoccupied.keys.min { |p2d| p2d.distance_to(structures.hq.first) }
2154
- # # What minerals/geysers does it have?
2155
- # puts expansions_unoccupied[expo_pos].minerals # or expansions[expo_pos]... => UnitGroup
2156
- # puts expansions_unoccupied[expo_pos].geysers # or expansions[expo_pos]... => UnitGroup
2157
- # ```
2158
- 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
2159
2056
 
2160
- # Gets minerals for a base or base position
2161
- #
2162
- # _@param_ `base` — base Unit or Position
2057
+ # sord omit - no YARD return type given, using untyped
2058
+ # Research a specific upgrade
2163
2059
  #
2164
- # _@return_UnitGroup of minerals for the base
2165
- def minerals_for_base: ((Api::Unit | Sc2::Position) base) -> Sc2::UnitGroup
2166
-
2167
- # Gets geysers for a base or base position
2060
+ # _@param_ `units` can be an Api::Unit, array of Api::Unit#tag or single tag
2168
2061
  #
2169
- # _@param_ `base` — base Unit or Position
2062
+ # _@param_ `upgrade_id` — Api::UpgradeId to research
2170
2063
  #
2171
- # _@return_UnitGroup of geysers for the base
2172
- 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
2173
2066
 
2174
- # Gets geysers which have not been taken for a base or base position
2067
+ # Toggles auto-cast ability for units
2175
2068
  #
2176
- # _@param_ `base` — base Unit or Position
2069
+ # _@param_ `units` — can be an Api::Unit, array of Tags or single Tag
2177
2070
  #
2178
- # _@return_ — UnitGroup of geysers for the base
2179
- 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
2180
2073
 
2181
- # _@param_ `base` base Unit or Position
2074
+ # Toggles auto-cast ability for units
2182
2075
  #
2183
- # _@return_ — UnitGroup of resources (minerals+geysers)
2184
- def resources_for_base: ((Api::Unit | Sc2::Position) base) -> Sc2::UnitGroup
2076
+ # _@param_ `point`
2077
+ def action_raw_camera_move: (point: Api::Point) -> void
2185
2078
 
2186
- # Gets gasses for a base or base position
2187
- #
2188
- # _@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.
2189
2082
  #
2190
- # _@return_ — UnitGroup of geysers for the base
2191
- def gas_for_base: ((Api::Unit | Sc2::Position) base) -> Sc2::UnitGroup
2192
-
2193
- # sord omit - no YARD type given for "in_power:", using untyped
2194
- # Gets buildable point grid for squares of size, i.e. 3 = 3x3 placements
2195
- # Uses pathing grid internally, to ignore taken positions
2196
- # Does not query the api and is generally fast.
2083
+ # _@param_ `ability_id`
2197
2084
  #
2198
- # _@param_ `length` — length of the building, 2 for depot/pylon, 3 for rax/gate
2085
+ # _@param_ `target_screen_coord`
2199
2086
  #
2200
- # _@param_ `on_creep` — whether this build location should be on creep
2087
+ # _@param_ `target_minimap_coord`
2201
2088
  #
2202
- # _@return_Array of [x,y] tuples
2203
- 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
2204
2096
 
2205
- # Gets a buildable location for a square of length, near target. Chooses from random amount of nearest locations.
2206
- # 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.
2207
- # For zerg, the buildable locations are only on creep.
2208
- # 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.
2209
2099
  #
2210
- # _@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.
2211
2104
  #
2212
- # _@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. }
2213
2106
  #
2214
- # _@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
2215
2112
  #
2216
- # _@param_ `in_power` — whether this must be on a power field
2113
+ # _@param_ `selection_screen_coord` — rectangle coordinates
2217
2114
  #
2218
- # _@return_buildable location, nil if no buildable location found
2219
- def build_placement_near: (
2220
- length: Integer,
2221
- target: (Api::Unit | Sc2::Position),
2222
- ?random: Integer,
2223
- ?in_power: bool
2224
- ) -> 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
2225
2117
 
2226
- # 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.
2227
2120
  #
2228
- # _@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. }
2229
2122
  #
2230
- # _@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)
2231
2127
  #
2232
- # _@return_an array of 2d points where theoretically placeable
2233
- 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
2234
2130
 
2235
- # Finds points in a straight line.
2236
- # 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)
2237
2132
  #
2238
- # _@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
2239
2141
  #
2240
- # _@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
+ # }
2241
2151
  #
2242
- # _@param_ `offset` — how far from source to start
2152
+ # _@param_ `type` — 1-4 = Api::ActionMultiPanel::Type::*
2243
2153
  #
2244
- # _@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.
2245
2159
  #
2246
- # _@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
2247
2165
  #
2248
- # _@return_points up to a max of count
2249
- def points_nearest_linear: (
2250
- source: Sc2::Position,
2251
- target: Sc2::Position,
2252
- ?offset: Float,
2253
- ?increment: Float,
2254
- ?count: Integer
2255
- ) -> ::Array[Api::Point2D]
2166
+ # _@param_ `unit_index` target unit index
2167
+ def action_ui_production_panel_remove_from_queue: (unit_index: Integer) -> untyped
2256
2168
 
2257
- # 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.
2258
2171
  #
2259
- # _@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
2260
2177
  #
2261
- # _@param_ `offset`
2178
+ # _@param_ `message` — to send
2262
2179
  #
2263
- # ```ruby
2264
- # Randomly randomly adjust both x and y by a range of -3.5 or +3.5
2265
- # geo.point_random_near(point: structures.hq.first, offset: 3.5)
2266
- # ```
2267
- 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
2268
2182
 
2269
- # _@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
2270
2192
  #
2271
- # _@param_ `radius`
2272
- 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]
2273
2197
 
2274
- # _@return_ player with active connection
2275
- 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]
2276
2200
  end
2277
2201
 
2278
2202
  # Holds game state
@@ -2377,12 +2301,16 @@ module Sc2
2377
2301
  # _@param_ `bot`
2378
2302
  def after_reset: (Sc2::Player::Bot _bot) -> untyped
2379
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
+
2380
2308
  # Returns the upgrade ids which are researching or queued
2381
2309
  # Not set for enemy.
2382
2310
  def upgrades_in_progress: () -> ::Array[Integer]
2383
2311
 
2384
2312
  # sord omit - no YARD type given for "upgrade_id", using untyped
2385
- # Returns the upgrade ids which are researching or queued
2313
+ # Returns true if the upgrade is busy researching
2386
2314
  def upgrade_in_progress?: (untyped upgrade_id) -> bool
2387
2315
 
2388
2316
  # sord omit - no YARD type given for "unit_type_id", using untyped
@@ -2500,117 +2428,80 @@ module Sc2
2500
2428
  end
2501
2429
  end
2502
2430
 
2503
- # Command line utilities
2504
- class Cli < Thor
2505
- def self.exit_on_failure?: () -> bool
2506
-
2507
- # sord omit - no YARD return type given, using untyped
2508
- # downloads and install SC2 v4.10
2509
- def setup410: () -> untyped
2510
-
2511
- # sord omit - no YARD return type given, using untyped
2512
- def ladderconfig: () -> untyped
2513
-
2514
- # sord omit - no YARD return type given, using untyped
2515
- def laddermatch: () -> untyped
2516
-
2517
- class New < Thor::Group
2518
- include Thor::Actions
2519
-
2520
- # sord omit - no YARD return type given, using untyped
2521
- def self.source_root: () -> untyped
2522
-
2523
- # sord omit - no YARD return type given, using untyped
2524
- def checkname: () -> untyped
2525
-
2526
- # sord omit - no YARD return type given, using untyped
2527
- def create_target: () -> untyped
2528
-
2529
- # sord omit - no YARD return type given, using untyped
2530
- def create_boot: () -> untyped
2531
-
2532
- # sord omit - no YARD return type given, using untyped
2533
- def create_example_match: () -> untyped
2534
-
2535
- # sord omit - no YARD return type given, using untyped
2536
- def create_gemfile: () -> untyped
2537
-
2538
- # sord omit - no YARD return type given, using untyped
2539
- def create_botfile: () -> untyped
2540
-
2541
- # sord omit - no YARD return type given, using untyped
2542
- def create_ignorefile: () -> untyped
2543
-
2544
- # sord omit - no YARD return type given, using untyped
2545
- def copy_api: () -> untyped
2546
-
2547
- # sord omit - no YARD return type given, using untyped
2548
- def bye: () -> untyped
2549
- end
2550
-
2551
- # Populating "./build" with our source...
2552
- # - Symlink executable ./build/bin/ladder to ./.build/botname for ladder
2553
- # - copy our source to .build, sans .ladderignore
2554
- # copy .build to docker
2555
- # bundle install on docker
2556
- # zipping up code + ruby + gems
2557
- # get zip, clean up
2558
- # stop docker
2559
- # standard:disable Style/GlobalVars
2560
- class Ladderzip < Thor::Group
2561
- include Thor::Actions
2562
-
2563
- # sord omit - no YARD return type given, using untyped
2564
- def docker_exists: () -> untyped
2565
-
2566
- # sord omit - no YARD return type given, using untyped
2567
- def set_compose_file: () -> untyped
2568
-
2569
- # sord omit - no YARD return type given, using untyped
2570
- def bot_validation: () -> untyped
2571
-
2572
- # sord omit - no YARD return type given, using untyped
2573
- 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
2574
2437
 
2575
- # sord omit - no YARD return type given, using untyped
2576
- 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
2577
2446
 
2578
- # sord omit - no YARD return type given, using untyped
2579
- 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]
2580
2453
 
2581
- # sord omit - no YARD return type given, using untyped
2582
- 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
2583
2462
 
2584
- # sord omit - no YARD return type given, using untyped
2585
- 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
2586
2466
 
2587
- # sord omit - no YARD return type given, using untyped
2588
- 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
2589
2470
 
2590
- # sord omit - no YARD return type given, using untyped
2591
- 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
2592
2476
 
2593
- # sord omit - no YARD return type given, using untyped
2594
- 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
2595
2480
 
2596
- # sord omit - no YARD return type given, using untyped
2597
- 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
2598
2484
 
2599
- # sord omit - no YARD return type given, using untyped
2600
- 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)
2601
2488
 
2602
- # sord omit - no YARD return type given, using untyped
2603
- def retreive_zip: () -> untyped
2489
+ # _@return_ UnitId => UnitTypeData
2490
+ attr_accessor units: (::Hash[Integer, Api::UnitTypeData] | untyped)
2604
2491
 
2605
- # sord omit - no YARD return type given, using untyped
2606
- 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)
2607
2495
 
2608
- # sord omit - no YARD return type given, using untyped
2609
- 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
2610
2500
 
2611
- # sord omit - no YARD return type given, using untyped
2612
- def bye: () -> untyped
2613
- 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
2614
2505
  end
2615
2506
 
2616
2507
  # Manages client connection to the Api
@@ -2630,13 +2521,12 @@ module Sc2
2630
2521
  # Closes Connection to client
2631
2522
  def close: () -> void
2632
2523
 
2633
- # sord omit - no YARD return type given, using untyped
2634
2524
  # Add a listener of specific callback type
2635
2525
  #
2636
2526
  # _@param_ `listener`
2637
2527
  #
2638
2528
  # _@param_ `klass`
2639
- 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
2640
2530
 
2641
2531
  # sord omit - no YARD return type given, using untyped
2642
2532
  # Removes a listener of specific callback type
@@ -3292,14 +3182,14 @@ module Sc2
3292
3182
  class UnitGroup
3293
3183
  include Enumerable
3294
3184
  extend Forwardable
3295
- TYPE_WORKER: untyped
3296
- TYPE_GAS_STRUCTURE: untyped
3297
- TYPE_MINERAL: untyped
3298
- TYPE_GEYSER: untyped
3299
- 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]
3300
3190
  TYPE_TECHLAB: untyped
3301
- TYPE_REACTOR: untyped
3302
- TYPE_BASES: untyped
3191
+ TYPE_REACTOR: ::Array[Integer]
3192
+ TYPE_BASES: ::Array[Integer]
3303
3193
 
3304
3194
  # _@param_ `units` — default to be added.
3305
3195
  #
@@ -3552,7 +3442,7 @@ module Sc2
3552
3442
  def pos_centroid: () -> Api::Point2D?
3553
3443
 
3554
3444
  # Our first unit's bot object.
3555
- # 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(...)
3556
3446
  #
3557
3447
  # _@return_ — player with active connection
3558
3448
  def bot: () -> Sc2::Player?
@@ -3574,7 +3464,7 @@ module Sc2
3574
3464
  # _@param_ `target` — is a unit tag or a Api::Point2D. Nil for addons/orbital
3575
3465
  #
3576
3466
  # _@param_ `queue_command` — shift+command
3577
- 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
3578
3468
 
3579
3469
  # sord omit - no YARD return type given, using untyped
3580
3470
  # Warps in unit type at target (location or pylon)
@@ -3817,6 +3707,11 @@ module Sc2
3817
3707
  # _@return_ — larva
3818
3708
  def larva: () -> Sc2::UnitGroup
3819
3709
 
3710
+ # Selects eggs. Eggs come from Larva and turn into Units.
3711
+ #
3712
+ # _@return_ — eggs
3713
+ def eggs: () -> Sc2::UnitGroup
3714
+
3820
3715
  # Selects queens
3821
3716
  #
3822
3717
  # _@return_ — queens
@@ -3902,14 +3797,14 @@ module Sc2
3902
3797
  # @private
3903
3798
  # Negative selector allowing unit group "ug.not." filter
3904
3799
  class UnitGroupNotSelector < Sc2::UnitGroup
3905
- TYPE_WORKER: untyped
3906
- TYPE_GAS_STRUCTURE: untyped
3907
- TYPE_MINERAL: untyped
3908
- TYPE_GEYSER: untyped
3909
- 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]
3910
3805
  TYPE_TECHLAB: untyped
3911
- TYPE_REACTOR: untyped
3912
- TYPE_BASES: untyped
3806
+ TYPE_REACTOR: ::Array[Integer]
3807
+ TYPE_BASES: ::Array[Integer]
3913
3808
 
3914
3809
  # sord infer - argument name in single @param inferred as "unit_group"
3915
3810
  def initialize: ((Api::Unit | ::Hash[Integer, Api::Unit] | ::Array[Api::Unit] | Sc2::UnitGroup)? unit_group) -> void
@@ -4249,8 +4144,8 @@ module Sc2
4249
4144
  # _@param_ `player_index`
4250
4145
  def stop: (Integer player_index) -> void
4251
4146
 
4252
- # sord omit - no YARD return type given, using untyped
4253
- def stop_all: () -> untyped
4147
+ # Stops all clients
4148
+ def stop_all: () -> void
4254
4149
 
4255
4150
  def initialize: () -> void
4256
4151
 
@@ -8707,7 +8602,7 @@ module Api
8707
8602
  # _@param_ `target` — is a unit tag or a Api::Point2D. Nil for addons/orbital
8708
8603
  #
8709
8604
  # _@param_ `queue_command` — shift+command
8710
- 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
8711
8606
 
8712
8607
  # sord omit - no YARD return type given, using untyped
8713
8608
  # Issues repair command on target
@@ -8933,7 +8828,7 @@ module Api
8933
8828
  # sord omit - no YARD type given for "g:", using untyped
8934
8829
  # sord omit - no YARD type given for "b:", using untyped
8935
8830
  # For lines: r & b are swapped.
8936
- def initialize: (r: untyped, g: untyped, b: untyped) -> void
8831
+ def initialize: (?r: untyped, ?g: untyped, ?b: untyped) -> void
8937
8832
 
8938
8833
  # Adds additional functionality to message class Api::Color
8939
8834
  module ClassMethods
@@ -8986,7 +8881,7 @@ module Api
8986
8881
  # sord omit - no YARD type given for "g:", using untyped
8987
8882
  # sord omit - no YARD type given for "b:", using untyped
8988
8883
  # For lines: r & b are swapped.
8989
- def initialize: (r: untyped, g: untyped, b: untyped) -> void
8884
+ def initialize: (?r: untyped, ?g: untyped, ?b: untyped) -> void
8990
8885
  end
8991
8886
 
8992
8887
  # Protobuf virtual class.
@@ -9908,7 +9803,7 @@ module Api
9908
9803
  # _@param_ `target` — is a unit tag or a Api::Point2D. Nil for addons/orbital
9909
9804
  #
9910
9805
  # _@param_ `queue_command` — shift+command
9911
- 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
9912
9807
 
9913
9808
  # sord omit - no YARD return type given, using untyped
9914
9809
  # Issues repair command on target
@@ -10104,9 +9999,6 @@ module Api
10104
9999
  class UnitTypeData < Google::Protobuf::AbstractMessage
10105
10000
  include Api::UnitTypeExtension
10106
10001
  include Api::UnitTypeDataExtension
10107
-
10108
- # sord omit - no YARD return type given, using untyped
10109
- def mood: () -> untyped
10110
10002
  end
10111
10003
 
10112
10004
  # Protobuf virtual class.
@@ -10224,8 +10116,6 @@ module Api
10224
10116
 
10225
10117
  # Adds additional functionality to message object Api::Unit
10226
10118
  module UnitTypeExtension
10227
- # sord omit - no YARD return type given, using untyped
10228
- def mood: () -> untyped
10229
10119
  end
10230
10120
 
10231
10121
  # Adds additional functionality to message object Api::PowerSource
@@ -10406,63 +10296,4 @@ module Api
10406
10296
  # i.e. Api::AbilityId::ATTACK_BATTLECRUISER returns generic Api::AbilityId::ATTACK
10407
10297
  def ability_id: () -> Integer
10408
10298
  end
10409
- end
10410
-
10411
- # Array extensions
10412
- class Array
10413
- # Turns an Array of Api::Unit into a Sc2::UnitGroup
10414
- #
10415
- # _@return_ — array converted to a unit group
10416
- def to_unit_group: () -> Sc2::UnitGroup
10417
-
10418
- # Creates a Point2D from 0,1 as x,y
10419
- def to_p2d: () -> Api::Point2D
10420
- end
10421
-
10422
- # Kernel extensions
10423
- module Kernel
10424
- # sord omit - no YARD return type given, using untyped
10425
- # Sets $VERBOSE to +nil+ for the duration of the block and back to its original
10426
- # value afterwards.
10427
- #
10428
- # silence_warnings do
10429
- # value = noisy_call # no warning voiced
10430
- # end
10431
- #
10432
- # noisy_call # warning voiced
10433
- def silence_warnings: () -> untyped
10434
-
10435
- # sord omit - no YARD return type given, using untyped
10436
- # Sets $VERBOSE to +nil+ for the duration of the block and back to its original
10437
- # value afterwards.
10438
- #
10439
- # silence_warnings do
10440
- # value = noisy_call # no warning voiced
10441
- # end
10442
- #
10443
- # noisy_call # warning voiced
10444
- def self.silence_warnings: () -> untyped
10445
-
10446
- # sord omit - no YARD type given for "flag", using untyped
10447
- # sord omit - no YARD return type given, using untyped
10448
- # Sets $VERBOSE for the duration of the block and back to its original
10449
- # value afterwards.
10450
- def with_warnings: (untyped flag) -> untyped
10451
-
10452
- # sord omit - no YARD type given for "flag", using untyped
10453
- # sord omit - no YARD return type given, using untyped
10454
- # Sets $VERBOSE for the duration of the block and back to its original
10455
- # value afterwards.
10456
- # noinspection RubyGlobalVariableNamingConvention
10457
- def self.with_warnings: (untyped flag) -> untyped
10458
- end
10459
-
10460
- module Async
10461
- module Process
10462
- class Child
10463
- # sord omit - no YARD type given for "*args", using untyped
10464
- # sord omit - no YARD type given for "**options", using untyped
10465
- def initialize: (*untyped args, **untyped options) -> void
10466
- end
10467
- end
10468
10299
  end