sc2ai 0.7.0 → 0.8.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
@@ -197,32 +197,32 @@ module Sc2
197
197
  # _@return_ — range of ports
198
198
  def self.port_range: (Integer from, Integer num_players) -> ::Range[untyped]
199
199
 
200
- # sord omit - no YARD type given for "port", using untyped
201
200
  # Will bind tcp port and return port if successful
202
- # if port is zero, it will return random port bound to
201
+ # when port is zero, it will return random port bound to
202
+ #
203
+ # _@param_ `port`
203
204
  #
204
205
  # _@return_ — port if bind succeeds, false on failure
205
- def self.bind: (untyped port) -> (Integer | bool)
206
+ def self.bind: (Integer port) -> (Integer | bool)
206
207
  end
207
208
 
208
209
  # A port configuration for a Match which allows generating Api::PortSet
209
210
  class PortConfig
210
- # sord omit - no YARD type given for "start_port:", using untyped
211
- # sord omit - no YARD type given for "num_players:", using untyped
212
- # sord omit - no YARD type given for "ports:", using untyped
213
- def initialize: (start_port: untyped, num_players: untyped, ?ports: untyped) -> void
211
+ # _@param_ `start_port`
212
+ #
213
+ # _@param_ `num_players`
214
+ #
215
+ # _@param_ `ports`
216
+ def initialize: (start_port: Integer, num_players: Integer, ?ports: ::Array[Integer]) -> void
214
217
 
215
- # sord omit - no YARD type given for :start_port, using untyped
216
218
  # Returns the value of attribute start_port.
217
- attr_reader start_port: untyped
219
+ attr_accessor start_port: Integer
218
220
 
219
- # sord omit - no YARD type given for :server_port_set, using untyped
220
221
  # Returns the value of attribute server_port_set.
221
- attr_reader server_port_set: untyped
222
+ attr_accessor server_port_set: ::Array[Integer]
222
223
 
223
- # sord omit - no YARD type given for :client_port_sets, using untyped
224
224
  # Returns the value of attribute client_port_sets.
225
- attr_reader client_port_sets: untyped
225
+ attr_accessor client_port_sets: ::Array[Integer]
226
226
  end
227
227
 
228
228
  # Allows defining Ai, Bot, BotProcess (external), Human or Observer for a Match
@@ -396,6 +396,21 @@ module Sc2
396
396
  # _@return_ — ladder matches will set an opponent id
397
397
  attr_accessor opponent_id: String
398
398
 
399
+ # Keeps track of time spent in steps.
400
+ #
401
+ # ```ruby
402
+ # # Useful for step-time as on ladder
403
+ # @timer.avg_step_time
404
+ # # Recent steps time, updated periodically. Good for debug ui
405
+ # @timer.avg_recent_step_time
406
+ # # Step time between now and previous measure and how many steps
407
+ # @timer.previous_on_step_time # Time we spent on step
408
+ # @timer.previous_on_step_count # How many steps we took
409
+ # ```
410
+ #
411
+ # _@see_ `Sc2::StepTimer`
412
+ attr_accessor timer: (Sc2::StepTimer | untyped)
413
+
399
414
  # _@return_ — callbacks implemented on player class
400
415
  attr_accessor callbacks_defined: ::Array[Symbol]
401
416
 
@@ -936,6 +951,10 @@ module Sc2
936
951
  # Sends actions via api and flushes action_queue
937
952
  def perform_actions: () -> Api::ResponseAction?
938
953
 
954
+ # Makes 10x unit moves to the same target turn into one action
955
+ # with many unit_tags
956
+ def combine_similar_actions: () -> void
957
+
939
958
  # Empties and resets @action_queue
940
959
  def clear_action_queue: () -> void
941
960
 
@@ -1381,7 +1400,7 @@ module Sc2
1381
1400
  # Each value in [row][column] holds a float value which is the z height
1382
1401
  #
1383
1402
  # _@return_ — Numo array
1384
- def parsed_terrain_height: () -> ::Numo::SFloat
1403
+ def parsed_terrain_height: () -> ::Numo::DFloat
1385
1404
 
1386
1405
  # Returns one of three Integer visibility indicators at tile for x & y
1387
1406
  #
@@ -1425,7 +1444,7 @@ module Sc2
1425
1444
  # _@return_ — Numo array
1426
1445
  #
1427
1446
  # _@see_ `#visibility` — for reading from this value
1428
- def parsed_visibility_grid: () -> ::Numo::SFloat
1447
+ def parsed_visibility_grid: () -> ::Numo::UInt8
1429
1448
 
1430
1449
  # Returns whether a tile has creep on it, as per minimap
1431
1450
  # One pixel covers one whole block. Corrects float inputs on your behalf.
@@ -1955,27 +1974,24 @@ module Sc2
1955
1974
  attr_accessor radar_rings: untyped
1956
1975
 
1957
1976
  # sord omit - no YARD type given for :_all_seen_unit_tags, using untyped
1958
- # Privately keep track of all seen Unit tags (excl structures) in order to detect new created units
1977
+ # Privately keep track of all seen Unit tags in order to detect new created units
1959
1978
  attr_accessor _all_seen_unit_tags: untyped
1960
1979
 
1961
1980
  # sord omit - no YARD type given for :all_seen_unit_tags, using untyped
1962
- # Privately keep track of all seen Unit tags (excl structures) in order to detect new created units
1981
+ # Privately keep track of all seen Unit tags in order to detect new created units
1963
1982
  attr_accessor all_seen_unit_tags: untyped
1964
1983
 
1965
1984
  # _@return_ — group of Units and Structures effected
1966
1985
  attr_accessor event_units_damaged: Sc2::UnitGroup
1967
1986
 
1968
- # sord omit - no YARD type given for :event_units_destroyed, using untyped
1969
- # TODO: Unit buff disabled, because it calls back too often (mineral in hand). Put back if useful
1970
- # Units (Unit/Structure) on which a new buff_ids appeared this frame
1971
- # See which buffs via: unit.buff_ids - unit.previous.buff_ids
1972
- # Read this on_step. Alternative to callback on_unit_buffed
1973
- # attr_accessor :event_units_buffed
1974
- attr_accessor event_units_destroyed: untyped
1987
+ # _@return_ group of dead units
1988
+ attr_accessor event_units_destroyed: Sc2::UnitGroup
1975
1989
  end
1976
1990
 
1977
1991
  # Holds action list and queues batch
1978
1992
  module Actions
1993
+ COMBINABLE_ABILITIES: untyped
1994
+
1979
1995
  # Queues action for performing end of step
1980
1996
  #
1981
1997
  # _@param_ `action`
@@ -2180,6 +2196,10 @@ module Sc2
2180
2196
  # Sends actions via api and flushes action_queue
2181
2197
  def perform_actions: () -> Api::ResponseAction?
2182
2198
 
2199
+ # Makes 10x unit moves to the same target turn into one action
2200
+ # with many unit_tags
2201
+ def combine_similar_actions: () -> void
2202
+
2183
2203
  # Empties and resets @action_queue
2184
2204
  def clear_action_queue: () -> void
2185
2205
 
@@ -2792,6 +2812,9 @@ module Sc2
2792
2812
  # )[:observation]
2793
2813
  def send_request_for: (**untyped kwargs) -> untyped
2794
2814
 
2815
+ # Total milliseconds spent waiting on SC2 responses
2816
+ attr_accessor external_time: Float
2817
+
2795
2818
  # Returns the value of attribute host.
2796
2819
  attr_accessor host: untyped
2797
2820
 
@@ -3113,6 +3136,68 @@ module Sc2
3113
3136
  end
3114
3137
  end
3115
3138
 
3139
+ # Tracks various metrics about your step time performance.
3140
+ class StepTimer
3141
+ TRUNCATED_TIME_RANGE: untyped
3142
+ HEALTHY_STEP_TIME_MS: untyped
3143
+
3144
+ # _@param_ `bot`
3145
+ def initialize: (Sc2::Player _bot) -> void
3146
+
3147
+ # sord omit - no YARD return type given, using untyped
3148
+ # How much time we have left in this step, to be healthy
3149
+ def allowance: () -> untyped
3150
+
3151
+ # A one-line string summary of all tracked times
3152
+ def summary: () -> String
3153
+
3154
+ # A hash containing :avg_real_time, :avg_step_time, :avg_recent_step_time, :previous_on_step_count, :previous_on_step_time
3155
+ def to_h: () -> ::Hash[untyped, untyped]
3156
+
3157
+ # sord omit - no YARD return type given, using untyped
3158
+ def update: () -> untyped
3159
+
3160
+ # sord omit - no YARD type given for "time", using untyped
3161
+ # _@return_ — time with ansi colour coded
3162
+ def format_time: (untyped time) -> String
3163
+
3164
+ # _@return_ — Realtime average time per step in ms. Includes SC2 wait time
3165
+ attr_reader avg_real_time: Float
3166
+
3167
+ # _@return_ — Total average time per step in ms. "Ladder Time" as measured by aiarena
3168
+ attr_reader avg_step_time: Float
3169
+
3170
+ # _@return_ — Running average time per step in ms for recent couple of steps
3171
+ attr_accessor avg_recent_step_time: Float
3172
+
3173
+ # _@return_ — Running average time per step in ms for recent couple of steps
3174
+ attr_reader recent_average: Float
3175
+
3176
+ # _@return_ — Previous on_step took this amount of ms to run
3177
+ attr_reader previous_on_step_time: Float
3178
+
3179
+ # _@return_ — Number of frames which passed previous on_step
3180
+ attr_reader previous_on_step_count: Integer
3181
+
3182
+ # Returns the value of attribute bot.
3183
+ attr_accessor bot: untyped
3184
+
3185
+ # Returns the value of attribute previous_external_time.
3186
+ attr_accessor previous_external_time: untyped
3187
+
3188
+ # Returns the value of attribute previous_update_time.
3189
+ attr_accessor previous_update_time: untyped
3190
+
3191
+ # Returns the value of attribute recent_sum_time.
3192
+ attr_accessor recent_sum_time: untyped
3193
+
3194
+ # Returns the value of attribute recent_sum_steps.
3195
+ attr_accessor recent_sum_steps: untyped
3196
+
3197
+ # Returns the value of attribute recent_update_counter.
3198
+ attr_accessor recent_update_counter: untyped
3199
+ end
3200
+
3116
3201
  # Manage virtual control groups of units, similar to Hash or Array.
3117
3202
  class UnitGroup
3118
3203
  include Enumerable
@@ -3127,6 +3212,12 @@ module Sc2
3127
3212
  TYPE_BASES: ::Array[Integer]
3128
3213
  TYPE_DETECTORS: ::Array[Integer]
3129
3214
  TYPE_WARPGATE_UNIT: ::Array[Integer]
3215
+ TYPE_MELEE: ::Array[Integer]
3216
+ TYPE_RANGE: untyped
3217
+ TYPE_TERRAN_INFANTRY: ::Array[Integer]
3218
+ TYPE_TERRAN_VEHICLE: ::Array[Integer]
3219
+ TYPE_ZERG_MELEE: ::Array[Integer]
3220
+ TYPE_ZERG_MISSILE: ::Array[Integer]
3130
3221
 
3131
3222
  # _@param_ `units` — default to be added.
3132
3223
  #
@@ -3309,7 +3400,7 @@ module Sc2
3309
3400
  # _@param_ `other_unit_group`
3310
3401
  #
3311
3402
  # _@return_ — new unit group
3312
- def subtract: (UnitGroup other_unit_group) -> UnitGroup
3403
+ def subtract: (UnitGroup other_unit_group) -> Sc2::UnitGroup
3313
3404
 
3314
3405
  # sord omit - no YARD type given for "unit_group", using untyped
3315
3406
  # Merges unit_group with our units and returns a new unit group
@@ -3353,7 +3444,7 @@ module Sc2
3353
3444
  # _@param_ `other_unit_group`
3354
3445
  #
3355
3446
  # _@return_ — new unit group
3356
- def intersection: (UnitGroup other_unit_group) -> UnitGroup
3447
+ def intersection: (UnitGroup other_unit_group) -> Sc2::UnitGroup
3357
3448
 
3358
3449
  # Selects a single random Unit without a parameter or an array of Units with a param, i.e. self.random(2)
3359
3450
  def sample: () -> Api::Unit
@@ -3476,7 +3567,7 @@ module Sc2
3476
3567
  # # Multiple - select space-men
3477
3568
  # ug.select_type([Api::UnitTypeId::MARINE, Api::UnitTypeId::REAPER]) #=> <UnitGroup: ...>
3478
3569
  # ```
3479
- def select_type: ((Integer | ::Array[Integer]) unit_type_ids) -> UnitGroup
3570
+ def select_type: ((Integer | ::Array[Integer]) unit_type_ids) -> Sc2::UnitGroup
3480
3571
 
3481
3572
  # Returns a new UnitGroup excluding all units matching unit type id(s)
3482
3573
  #
@@ -3488,7 +3579,7 @@ module Sc2
3488
3579
  # # Multiple - reject immovable army
3489
3580
  # ug.reject_type([Api::UnitTypeId::SIEGETANKSIEGED, Api::UnitTypeId::WIDOWMINEBURROWED]) #=> <UnitGroup: ...>
3490
3581
  # ```
3491
- def reject_type: ((Integer | ::Array[Integer]) unit_type_ids) -> UnitGroup
3582
+ def reject_type: ((Integer | ::Array[Integer]) unit_type_ids) -> Sc2::UnitGroup
3492
3583
 
3493
3584
  # Creates a negative selector, which will perform the opposite on the current scope
3494
3585
  # for it's next select_type/reject_type call.
@@ -3512,7 +3603,7 @@ module Sc2
3512
3603
  # # Multiple - select mechanical flying units
3513
3604
  # ug.select_attribute([:MECHANICAL, :FLYING]) #=> <UnitGroup: ...>
3514
3605
  # ```
3515
- def select_attribute: ((Integer | ::Array[Integer]) attributes) -> UnitGroup
3606
+ def select_attribute: ((Integer | ::Array[Integer]) attributes) -> Sc2::UnitGroup
3516
3607
 
3517
3608
  # Returns a new UnitGroup containing all units excluding attribute id(s)
3518
3609
  # Multiple values work as an "AND" filter
@@ -3526,7 +3617,7 @@ module Sc2
3526
3617
  # # Multiple - reject mechanical flying units
3527
3618
  # ug.reject_attribute(:Mechanical, :Flying) #=> <UnitGroup: ...>
3528
3619
  # ```
3529
- def reject_attribute: ((Integer | ::Array[Integer]) attributes) -> UnitGroup
3620
+ def reject_attribute: ((Integer | ::Array[Integer]) attributes) -> Sc2::UnitGroup
3530
3621
 
3531
3622
  # Selects units you own
3532
3623
  # i.e. @bot.all_units.owned # => Units you own
@@ -3579,26 +3670,25 @@ module Sc2
3579
3670
  # Selects gas structures (refinery/extractor/assimilator)
3580
3671
  #
3581
3672
  # _@return_ — gas structures
3582
- def gas: () -> UnitGroup
3673
+ def gas: () -> Sc2::UnitGroup
3583
3674
 
3584
3675
  # Selects units passively have Detection
3585
3676
  #
3586
3677
  # _@return_ — gas structures
3587
- def detectors: () -> UnitGroup
3678
+ def detectors: () -> Sc2::UnitGroup
3588
3679
 
3589
3680
  # Selects only units which have finished constructing, i.o.w. build_progress == 1.0
3590
3681
  #
3591
3682
  # _@return_ — complete unit group
3592
- def completed: () -> UnitGroup
3683
+ def completed: () -> Sc2::UnitGroup
3593
3684
 
3594
3685
  # Selects only units which have finished constructing, i.o.w. build_progress != 1.0
3595
3686
  #
3596
3687
  # _@return_ — incomplete unit group
3597
- def incomplete: () -> UnitGroup
3688
+ def incomplete: () -> Sc2::UnitGroup
3598
3689
 
3599
- # sord omit - no YARD return type given, using untyped
3600
3690
  # Selects only units which do not have orders
3601
- def idle: () -> untyped
3691
+ def idle: () -> Sc2::UnitGroup
3602
3692
 
3603
3693
  # Selects units which have this ability available
3604
3694
  # Queries API if necessary
@@ -3606,7 +3696,7 @@ module Sc2
3606
3696
  # _@param_ `ability_id`
3607
3697
  #
3608
3698
  # _@return_ — units which have the ability available
3609
- def ability_available?: (Integer ability_id) -> UnitGroup
3699
+ def ability_available?: (Integer ability_id) -> Sc2::UnitGroup
3610
3700
 
3611
3701
  # Checks whether any unit's first order matches these abilities
3612
3702
  #
@@ -3718,18 +3808,19 @@ module Sc2
3718
3808
  # _@return_ — return group or single unit if amount is not supplied
3719
3809
  def nearest_to: (pos: Sc2::Position, ?amount: untyped) -> (Sc2::UnitGroup | Api::Unit)?
3720
3810
 
3721
- # sord omit - no YARD return type given, using untyped
3722
3811
  # Selects units which are in a particular circle
3723
3812
  #
3724
3813
  # _@param_ `point` — center of circle
3725
3814
  #
3726
3815
  # _@param_ `radius`
3727
- def select_in_circle: (point: (Api::Point2D | Api::Point), radius: Float) -> untyped
3816
+ #
3817
+ # _@return_ — new unit group
3818
+ def select_in_circle: (point: (Api::Point2D | Api::Point), radius: Float) -> Sc2::UnitGroup
3728
3819
 
3729
- # sord omit - no YARD type given for :units, using untyped
3730
3820
  # A hash of units by tag.
3731
- # @return [Hash<Integer, Api::Unit>] Api::Unit.tag => Api::Unit
3732
- attr_accessor units: untyped
3821
+ #
3822
+ # _@return_ — Api::Unit.tag => Api::Unit
3823
+ attr_accessor units: ::Hash[Integer, Api::Unit]
3733
3824
 
3734
3825
  # Returns the value of attribute _cache_hash.
3735
3826
  attr_accessor _cache_hash: untyped
@@ -3758,6 +3849,12 @@ module Sc2
3758
3849
  TYPE_BASES: ::Array[Integer]
3759
3850
  TYPE_DETECTORS: ::Array[Integer]
3760
3851
  TYPE_WARPGATE_UNIT: ::Array[Integer]
3852
+ TYPE_MELEE: ::Array[Integer]
3853
+ TYPE_RANGE: untyped
3854
+ TYPE_TERRAN_INFANTRY: ::Array[Integer]
3855
+ TYPE_TERRAN_VEHICLE: ::Array[Integer]
3856
+ TYPE_ZERG_MELEE: ::Array[Integer]
3857
+ TYPE_ZERG_MISSILE: ::Array[Integer]
3761
3858
 
3762
3859
  # _@param_ `unit_group`
3763
3860
  def initialize: (Sc2::UnitGroup unit_group) -> void
@@ -3904,6 +4001,25 @@ module Sc2
3904
4001
  class Client
3905
4002
  include Sc2::Client::ConfigurableOptions
3906
4003
 
4004
+ # Reads bundled versions.json
4005
+ # See tact archive or blizztrack for update config file
4006
+ # https://github.com/mdX7/tact_configs/blob/77ecc4176689ab6c50be342e1ad73127ffe358d7/tpr/sc2/config/08/b3/08b331b39d9fbe95c338ec370e63f2e2#L4
4007
+ # https://blizztrack.com/config/s2/bc/8453c2f1c98b955334c7284215429c36
4008
+ #
4009
+ # _@return_ — JSON contents of versions.json
4010
+ #
4011
+ # ```ruby
4012
+ # {
4013
+ # "base-version": 92028, # <- from "build-name" [1..-1] = "B92028"
4014
+ # "data-hash": "2B7746A6706F919775EF1BADFC95EA1C", # <- from "root"
4015
+ # "fixed-hash": "163B1CDF46F09B621F6312CD6901228E", # <- from "build-fixed-hash"
4016
+ # "label": "5.0.13", # <- check game client
4017
+ # "replay-hash": "BE64E420B329BD2A7D10EEBC0039D6E5", # <- from "build-replay-hash"
4018
+ # "version": 92028 <- always same as base-version these days
4019
+ # },
4020
+ # ```
4021
+ def self.versions_json: () -> ::Array[untyped]
4022
+
3907
4023
  # Whether the Sc2 process is running or not
3908
4024
  def running?: () -> bool
3909
4025
 
@@ -3944,25 +4060,6 @@ module Sc2
3944
4060
  # _@return_ — command to launch Sc2
3945
4061
  def command_string: () -> String
3946
4062
 
3947
- # Reads bundled versions.json
3948
- # See tact archive or blizztrack for update config file
3949
- # https://github.com/mdX7/tact_configs/blob/77ecc4176689ab6c50be342e1ad73127ffe358d7/tpr/sc2/config/08/b3/08b331b39d9fbe95c338ec370e63f2e2#L4
3950
- # https://blizztrack.com/config/s2/bc/8453c2f1c98b955334c7284215429c36return
3951
- #
3952
- # _@return_ — JSON contents of versions.json
3953
- #
3954
- # ```ruby
3955
- # {
3956
- # "base-version": 92028, # <- from "build-name" [1..-1] = "B92028"
3957
- # "data-hash": "2B7746A6706F919775EF1BADFC95EA1C", # <- from "root"
3958
- # "fixed-hash": "163B1CDF46F09B621F6312CD6901228E", # <- from "build-fixed-hash"
3959
- # "label": "5.0.13", # <- check game client
3960
- # "replay-hash": "BE64E420B329BD2A7D10EEBC0039D6E5", # <- from "build-replay-hash"
3961
- # "version": 92028 <- always same as base-version these days
3962
- # },
3963
- # ```
3964
- def versions_json: () -> ::Array[untyped]
3965
-
3966
4063
  # sord omit - no YARD return type given, using untyped
3967
4064
  # Resets configurable launch options to their defaults
3968
4065
  def load_default_launch_options: () -> untyped
@@ -4048,7 +4145,7 @@ module Sc2
4048
4145
  # top position of window if windowed
4049
4146
  attr_accessor windowy: Integer
4050
4147
 
4051
- # Version number such as "4.10". Leave blank to use latest
4148
+ # Version number such as "ladder" or "4.10". Leave blank to use latest
4052
4149
  attr_accessor version: String?
4053
4150
  end
4054
4151
  end
@@ -4128,6 +4225,15 @@ module Sc2
4128
4225
  module Position
4129
4226
  TOLERANCE: untyped
4130
4227
 
4228
+ # Returns self.
4229
+ # If you're ever unsure if you have a Unit or Position in hand,
4230
+ # this method allows safely calling `unknown_target.pos` to return a position.
4231
+ #
4232
+ # ```ruby
4233
+ # target.pos
4234
+ # ```
4235
+ def pos: () -> Sc2::Position
4236
+
4131
4237
  # Loose equality matches on floats x and y.
4132
4238
  # We never check z-axis, because the map is single-level.
4133
4239
  # TODO: We should almost certainly introduce TOLERANCE here, but verify it's cost first.
@@ -4162,11 +4268,13 @@ module Sc2
4162
4268
  # _@return_ — new Position
4163
4269
  def random_offset: (Float offset) -> Sc2::Position
4164
4270
 
4165
- # sord omit - no YARD type given for "offset", using untyped
4166
- # Changes this point's x and y by the supplied offset
4271
+ # Randomly change this point's x and y by the supplied offset.
4272
+ # i.e. offset=2 can adjust x and y by any number in range -2..2
4273
+ #
4274
+ # _@param_ `offset`
4167
4275
  #
4168
4276
  # _@return_ — self
4169
- def random_offset!: (untyped offset) -> Sc2::Position
4277
+ def random_offset!: (Float offset) -> Sc2::Position
4170
4278
 
4171
4279
  # Creates a new point with x and y which is offset
4172
4280
  #
@@ -4207,12 +4315,13 @@ module Sc2
4207
4315
  # A new point representing the normalized version of this vector (unit length).
4208
4316
  def normalize: () -> Api::Point2D
4209
4317
 
4210
- # sord omit - no YARD type given for "other", using untyped
4211
4318
  # Linear interpolation between this point and another for scale
4212
4319
  # Finds a point on a line between two points at % along the way. 0.0 returns self, 1.0 returns other, 0.5 is halfway.
4213
4320
  #
4321
+ # _@param_ `other`
4322
+ #
4214
4323
  # _@param_ `scale` — a value between 0.0..1.0
4215
- def lerp: (untyped other, Float scale) -> Api::Point2D
4324
+ def lerp: (Sc2::Position other, Float scale) -> Api::Point2D
4216
4325
 
4217
4326
  # Calculates the distance between self and other
4218
4327
  #
@@ -4253,16 +4362,13 @@ module Sc2
4253
4362
  def away_from: (Api::Point2D other, Float distance) -> Api::Point2D
4254
4363
 
4255
4364
  # Returns [x,y] array tuple
4256
- def to_axy: () -> ::Array[(Float | Float)]
4365
+ def to_axy: () -> ::Array[Float]
4257
4366
 
4258
4367
  # Returns [x,y] array tuple where floats are cast to ints
4259
4368
  # Useful when trying to find the tile which something is on
4260
- #
4261
- # _@return_ — Array<Integer, Integer>
4262
- def to_atile: () -> ::Array[(Integer | Integer)]
4369
+ def to_atile: () -> ::Array[Integer]
4263
4370
 
4264
- # sord omit - no YARD return type given, using untyped
4265
- def to_s: () -> untyped
4371
+ def to_s: () -> String
4266
4372
  end
4267
4373
  end
4268
4374
 
@@ -4570,8 +4676,6 @@ module Api
4570
4676
  TAKENDAMAGE: untyped
4571
4677
  RAVENSCRAMBLERMISSILECARRIER: untyped
4572
4678
  BATTERYOVERCHARGE: untyped
4573
- LOADOUTSPRAYTRACKER: untyped
4574
- HYDRALISKFRENZY: untyped
4575
4679
  DUMMYBUFF002: untyped
4576
4680
  DUMMYBUFF001: untyped
4577
4681
  DUMMYBUFF003: untyped
@@ -4882,6 +4986,7 @@ module Api
4882
4986
  LOAD_BUNKER: untyped
4883
4987
  UNLOADALL_BUNKER: untyped
4884
4988
  UNLOADUNIT_BUNKER: untyped
4989
+ COMMANDCENTERTRANSPORT_COMMANDCENTERTRANSPORT: untyped
4885
4990
  UNLOADALL_COMMANDCENTER: untyped
4886
4991
  UNLOADUNIT_COMMANDCENTER: untyped
4887
4992
  LOADALL_COMMANDCENTER: untyped
@@ -4909,6 +5014,7 @@ module Api
4909
5014
  BARRACKSTRAIN_REAPER: untyped
4910
5015
  BARRACKSTRAIN_GHOST: untyped
4911
5016
  BARRACKSTRAIN_MARAUDER: untyped
5017
+ FACTORYTRAIN_FACTORYTRAIN: untyped
4912
5018
  FACTORYTRAIN_SIEGETANK: untyped
4913
5019
  FACTORYTRAIN_THOR: untyped
4914
5020
  FACTORYTRAIN_HELLION: untyped
@@ -5173,9 +5279,11 @@ module Api
5173
5279
  TRAINQUEEN_QUEEN: untyped
5174
5280
  BURROWCREEPTUMORDOWN_BURROWDOWN: untyped
5175
5281
  TRANSFUSION_TRANSFUSION: untyped
5282
+ TECHLABMORPH_TECHLABMORPH: untyped
5176
5283
  BARRACKSTECHLABMORPH_TECHLABBARRACKS: untyped
5177
5284
  FACTORYTECHLABMORPH_TECHLABFACTORY: untyped
5178
5285
  STARPORTTECHLABMORPH_TECHLABSTARPORT: untyped
5286
+ REACTORMORPH_REACTORMORPH: untyped
5179
5287
  BARRACKSREACTORMORPH_REACTOR: untyped
5180
5288
  FACTORYREACTORMORPH_REACTOR: untyped
5181
5289
  STARPORTREACTORMORPH_REACTOR: untyped
@@ -5203,17 +5311,23 @@ module Api
5203
5311
  BUILD_NYDUSWORM: untyped
5204
5312
  BUILDNYDUSCANAL_SUMMONNYDUSCANALATTACKER: untyped
5205
5313
  BUILDNYDUSCANAL_CANCEL: untyped
5314
+ BROODLORDHANGAR_BROODLORDHANGAR: untyped
5206
5315
  EFFECT_CHARGE: untyped
5316
+ TOWERCAPTURE_TOWERCAPTURE: untyped
5207
5317
  HERDINTERACT_HERD: untyped
5208
5318
  CONTAMINATE_CONTAMINATE: untyped
5319
+ SHATTER_SHATTER: untyped
5209
5320
  CANCEL_QUEUEPASIVE: untyped
5210
5321
  CANCELSLOT_QUEUEPASSIVE: untyped
5211
5322
  CANCEL_QUEUEPASSIVECANCELTOSELECTION: untyped
5212
5323
  CANCELSLOT_QUEUEPASSIVECANCELTOSELECTION: untyped
5213
5324
  MORPHTOGHOSTNOVA_MOVE: untyped
5214
5325
  DIGESTERCREEPSPRAY_DIGESTERCREEPSPRAY: untyped
5326
+ MORPHTOCOLLAPSIBLETERRANTOWERDEBRIS_MORPHTOCOLLAPSIBLETERRANTOWERDEBRIS: untyped
5215
5327
  MORPHTOCOLLAPSIBLETERRANTOWERDEBRIS_CANCEL: untyped
5328
+ MORPHTOCOLLAPSIBLETERRANTOWERDEBRISRAMPLEFT_MORPHTOCOLLAPSIBLETERRANTOWERDEBRISRAMPLEFT: untyped
5216
5329
  MORPHTOCOLLAPSIBLETERRANTOWERDEBRISRAMPLEFT_CANCEL: untyped
5330
+ MORPHTOCOLLAPSIBLETERRANTOWERDEBRISRAMPRIGHT_MORPHTOCOLLAPSIBLETERRANTOWERDEBRISRAMPRIGHT: untyped
5217
5331
  MORPHTOCOLLAPSIBLETERRANTOWERDEBRISRAMPRIGHT_CANCEL: untyped
5218
5332
  MORPH_MOTHERSHIP: untyped
5219
5333
  CANCEL_MORPHMOTHERSHIP: untyped
@@ -5221,6 +5335,7 @@ module Api
5221
5335
  NEXUSINVULNERABILITY_NEXUSINVULNERABILITY: untyped
5222
5336
  EFFECT_MASSRECALL_MOTHERSHIPCORE: untyped
5223
5337
  MORPH_HELLION: untyped
5338
+ MORPHTOCOLLAPSIBLEROCKTOWERDEBRIS_MORPHTOCOLLAPSIBLEROCKTOWERDEBRIS: untyped
5224
5339
  MORPHTOCOLLAPSIBLEROCKTOWERDEBRIS_CANCEL: untyped
5225
5340
  MORPH_HELLBAT: untyped
5226
5341
  BURROWDOWN_SWARMHOST: untyped
@@ -5236,6 +5351,7 @@ module Api
5236
5351
  BLINDINGCLOUD_BLINDINGCLOUD: untyped
5237
5352
  EFFECT_ABDUCT: untyped
5238
5353
  VIPERCONSUMESTRUCTURE_VIPERCONSUME: untyped
5354
+ TESTZERG_TESTZERG: untyped
5239
5355
  TESTZERG_CANCEL: untyped
5240
5356
  BEHAVIOR_BUILDINGATTACKON: untyped
5241
5357
  BEHAVIOR_BUILDINGATTACKOFF: untyped
@@ -5256,7 +5372,9 @@ module Api
5256
5372
  HALLUCINATION_ORACLE: untyped
5257
5373
  EFFECT_MEDIVACIGNITEAFTERBURNERS: untyped
5258
5374
  ORACLEREVELATION_ORACLEREVELATION: untyped
5375
+ MORPHTOCOLLAPSIBLEROCKTOWERDEBRISRAMPRIGHT_MORPHTOCOLLAPSIBLEROCKTOWERDEBRISRAMPRIGHT: untyped
5259
5376
  MORPHTOCOLLAPSIBLEROCKTOWERDEBRISRAMPRIGHT_CANCEL: untyped
5377
+ MORPHTOCOLLAPSIBLEROCKTOWERDEBRISRAMPLEFT_MORPHTOCOLLAPSIBLEROCKTOWERDEBRISRAMPLEFT: untyped
5260
5378
  MORPHTOCOLLAPSIBLEROCKTOWERDEBRISRAMPLEFT_CANCEL: untyped
5261
5379
  ULTRALISKWEAPONCOOLDOWN_ULTRALISKWEAPONCOOLDOWN: untyped
5262
5380
  EFFECT_PHOTONOVERCHARGE: untyped
@@ -5268,6 +5386,22 @@ module Api
5268
5386
  XELNAGA_CAVERNS_DOORSWOPENED_XELNAGA_CAVERNS_DOORDEFAULTOPEN: untyped
5269
5387
  XELNAGA_CAVERNS_DOORWOPENED_XELNAGA_CAVERNS_DOORDEFAULTOPEN: untyped
5270
5388
  EFFECT_TIMEWARP: untyped
5389
+ TARSONIS_DOORN_TARSONIS_DOORN: untyped
5390
+ TARSONIS_DOORNLOWERED_TARSONIS_DOORNLOWERED: untyped
5391
+ TARSONIS_DOORNE_TARSONIS_DOORNE: untyped
5392
+ TARSONIS_DOORNELOWERED_TARSONIS_DOORNELOWERED: untyped
5393
+ TARSONIS_DOORE_TARSONIS_DOORE: untyped
5394
+ TARSONIS_DOORELOWERED_TARSONIS_DOORELOWERED: untyped
5395
+ TARSONIS_DOORNW_TARSONIS_DOORNW: untyped
5396
+ TARSONIS_DOORNWLOWERED_TARSONIS_DOORNWLOWERED: untyped
5397
+ COMPOUNDMANSION_DOORN_COMPOUNDMANSION_DOORN: untyped
5398
+ COMPOUNDMANSION_DOORNLOWERED_COMPOUNDMANSION_DOORNLOWERED: untyped
5399
+ COMPOUNDMANSION_DOORNE_COMPOUNDMANSION_DOORNE: untyped
5400
+ COMPOUNDMANSION_DOORNELOWERED_COMPOUNDMANSION_DOORNELOWERED: untyped
5401
+ COMPOUNDMANSION_DOORE_COMPOUNDMANSION_DOORE: untyped
5402
+ COMPOUNDMANSION_DOORELOWERED_COMPOUNDMANSION_DOORELOWERED: untyped
5403
+ COMPOUNDMANSION_DOORNW_COMPOUNDMANSION_DOORNW: untyped
5404
+ COMPOUNDMANSION_DOORNWLOWERED_COMPOUNDMANSION_DOORNWLOWERED: untyped
5271
5405
  CAUSTICSPRAY_CAUSTICSPRAY: untyped
5272
5406
  MORPHTORAVAGER_RAVAGER: untyped
5273
5407
  CANCEL_MORPHRAVAGER: untyped
@@ -5296,6 +5430,7 @@ module Api
5296
5430
  HALLUCINATION_DISRUPTOR: untyped
5297
5431
  HALLUCINATION_ADEPT: untyped
5298
5432
  EFFECT_VOIDRAYPRISMATICALIGNMENT: untyped
5433
+ SEEKERDUMMYCHANNEL_SEEKERDUMMYCHANNEL: untyped
5299
5434
  VOIDMPIMMORTALREVIVEREBUILD_IMMORTAL: untyped
5300
5435
  ARBITERMPSTASISFIELD_ARBITERMPSTASISFIELD: untyped
5301
5436
  ARBITERMPRECALL_ARBITERMPRECALL: untyped
@@ -5329,6 +5464,7 @@ module Api
5329
5464
  CANCEL_ADEPTPHASESHIFT: untyped
5330
5465
  CANCEL_ADEPTSHADEPHASESHIFT: untyped
5331
5466
  SLAYNELEMENTALGRAB_SLAYNELEMENTALGRAB: untyped
5467
+ MORPHTOCOLLAPSIBLEPURIFIERTOWERDEBRIS_MORPHTOCOLLAPSIBLEPURIFIERTOWERDEBRIS: untyped
5332
5468
  MORPHTOCOLLAPSIBLEPURIFIERTOWERDEBRIS_CANCEL: untyped
5333
5469
  EFFECT_SHADOWSTRIDE: untyped
5334
5470
  EFFECT_SPAWNLOCUSTS: untyped
@@ -5403,8 +5539,11 @@ module Api
5403
5539
  MOVE: untyped
5404
5540
  PATROL: untyped
5405
5541
  UNLOADUNIT: untyped
5542
+ MORPHTOCOLLAPSIBLEROCKTOWERDEBRISRAMPLEFTGREEN_MORPHTOCOLLAPSIBLEROCKTOWERDEBRISRAMPLEFTGREEN: untyped
5406
5543
  MORPHTOCOLLAPSIBLEROCKTOWERDEBRISRAMPLEFTGREEN_CANCEL: untyped
5544
+ MORPHTOCOLLAPSIBLEROCKTOWERDEBRISRAMPRIGHTGREEN_MORPHTOCOLLAPSIBLEROCKTOWERDEBRISRAMPRIGHTGREEN: untyped
5407
5545
  MORPHTOCOLLAPSIBLEROCKTOWERDEBRISRAMPRIGHTGREEN_CANCEL: untyped
5546
+ HYDRALISKFRENZY_HYDRALISKFRENZY: untyped
5408
5547
  AMORPHOUSARMORCLOUD_AMORPHOUSARMORCLOUD: untyped
5409
5548
  SHIELDBATTERYRECHARGEEX5_SHIELDBATTERYRECHARGE: untyped
5410
5549
  SHIELDBATTERYRECHARGEEX5_STOP: untyped
@@ -5414,7 +5553,6 @@ module Api
5414
5553
  ENERGYRECHARGE_ENERGYRECHARGE: untyped
5415
5554
  SALVAGEEFFECT_SALVAGE: untyped
5416
5555
  WORKERSTOPIDLEABILITYVESPENE_GATHER: untyped
5417
- FRENZY: untyped
5418
5556
 
5419
5557
  # Returns an array of all constants
5420
5558
  def self.ids: () -> ::Array[Integer]
@@ -7041,11 +7179,13 @@ module Api
7041
7179
  # _@return_ — new Position
7042
7180
  def random_offset: (Float offset) -> Sc2::Position
7043
7181
 
7044
- # sord omit - no YARD type given for "offset", using untyped
7045
- # Changes this point's x and y by the supplied offset
7182
+ # Randomly change this point's x and y by the supplied offset.
7183
+ # i.e. offset=2 can adjust x and y by any number in range -2..2
7184
+ #
7185
+ # _@param_ `offset`
7046
7186
  #
7047
7187
  # _@return_ — self
7048
- def random_offset!: (untyped offset) -> Sc2::Position
7188
+ def random_offset!: (Float offset) -> Sc2::Position
7049
7189
 
7050
7190
  # Creates a new point with x and y which is offset
7051
7191
  #
@@ -7086,12 +7226,13 @@ module Api
7086
7226
  # A new point representing the normalized version of this vector (unit length).
7087
7227
  def normalize: () -> Api::Point2D
7088
7228
 
7089
- # sord omit - no YARD type given for "other", using untyped
7090
7229
  # Linear interpolation between this point and another for scale
7091
7230
  # Finds a point on a line between two points at % along the way. 0.0 returns self, 1.0 returns other, 0.5 is halfway.
7092
7231
  #
7232
+ # _@param_ `other`
7233
+ #
7093
7234
  # _@param_ `scale` — a value between 0.0..1.0
7094
- def lerp: (untyped other, Float scale) -> Api::Point2D
7235
+ def lerp: (Sc2::Position other, Float scale) -> Api::Point2D
7095
7236
 
7096
7237
  # Calculates the distance between self and other
7097
7238
  #
@@ -7132,16 +7273,13 @@ module Api
7132
7273
  def away_from: (Api::Point2D other, Float distance) -> Api::Point2D
7133
7274
 
7134
7275
  # Returns [x,y] array tuple
7135
- def to_axy: () -> ::Array[(Float | Float)]
7276
+ def to_axy: () -> ::Array[Float]
7136
7277
 
7137
7278
  # Returns [x,y] array tuple where floats are cast to ints
7138
7279
  # Useful when trying to find the tile which something is on
7139
- #
7140
- # _@return_ — Array<Integer, Integer>
7141
- def to_atile: () -> ::Array[(Integer | Integer)]
7280
+ def to_atile: () -> ::Array[Integer]
7142
7281
 
7143
- # sord omit - no YARD return type given, using untyped
7144
- def to_s: () -> untyped
7282
+ def to_s: () -> String
7145
7283
 
7146
7284
  # sord omit - no YARD type given for :pos, using untyped
7147
7285
  # optional field readers
@@ -8013,9 +8151,6 @@ module Api
8013
8151
  # For Terran builds a tech lab add-on on the current structure
8014
8152
  def build_tech_lab: (?queue_command: untyped) -> void
8015
8153
 
8016
- # sord omit - no YARD return type given, using untyped
8017
- def target_for_addon_placement: () -> untyped
8018
-
8019
8154
  # sord omit - no YARD return type given, using untyped
8020
8155
  # Warps in unit type at target (location or pylon)
8021
8156
  # Only works if the source is a Warp Gate
@@ -10614,32 +10749,6 @@ module Api
10614
10749
  MECHABATTLECARRIERLORDACGLUESCREENDUMMY_2: untyped
10615
10750
  MECHASPINECRAWLERACGLUESCREENDUMMY_2: untyped
10616
10751
  MECHASPORECRAWLERACGLUESCREENDUMMY_2: untyped
10617
- TROOPERMENGSKACGLUESCREENDUMMY_2: untyped
10618
- MEDIVACMENGSKACGLUESCREENDUMMY_2: untyped
10619
- BLIMPMENGSKACGLUESCREENDUMMY_2: untyped
10620
- MARAUDERMENGSKACGLUESCREENDUMMY_2: untyped
10621
- GHOSTMENGSKACGLUESCREENDUMMY_2: untyped
10622
- SIEGETANKMENGSKACGLUESCREENDUMMY_2: untyped
10623
- THORMENGSKACGLUESCREENDUMMY_2: untyped
10624
- VIKINGMENGSKACGLUESCREENDUMMY_2: untyped
10625
- BATTLECRUISERMENGSKACGLUESCREENDUMMY_2: untyped
10626
- BUNKERDEPOTMENGSKACGLUESCREENDUMMY_2: untyped
10627
- MISSILETURRETMENGSKACGLUESCREENDUMMY_2: untyped
10628
- ARTILLERYMENGSKACGLUESCREENDUMMY_2: untyped
10629
- LOADOUTSPRAY1_2: untyped
10630
- LOADOUTSPRAY2_2: untyped
10631
- LOADOUTSPRAY3_2: untyped
10632
- LOADOUTSPRAY4_2: untyped
10633
- LOADOUTSPRAY5_2: untyped
10634
- LOADOUTSPRAY6_2: untyped
10635
- LOADOUTSPRAY7_2: untyped
10636
- LOADOUTSPRAY8_2: untyped
10637
- LOADOUTSPRAY9_2: untyped
10638
- LOADOUTSPRAY10_2: untyped
10639
- LOADOUTSPRAY11_2: untyped
10640
- LOADOUTSPRAY12_2: untyped
10641
- LOADOUTSPRAY13_2: untyped
10642
- LOADOUTSPRAY14_2: untyped
10643
10752
  COLLAPSIBLEROCKTOWERDEBRISRAMPLEFTGREEN: untyped
10644
10753
  COLLAPSIBLEROCKTOWERDEBRISRAMPRIGHTGREEN: untyped
10645
10754
  COLLAPSIBLEROCKTOWERPUSHUNITRAMPLEFTGREEN: untyped
@@ -13725,6 +13834,15 @@ module Api
13725
13834
  # sord omit - no YARD return type given, using untyped
13726
13835
  def to_json: (?untyped as_json_options) -> untyped
13727
13836
 
13837
+ # Returns self.
13838
+ # If you're ever unsure if you have a Unit or Position in hand,
13839
+ # this method allows safely calling `unknown_target.pos` to return a position.
13840
+ #
13841
+ # ```ruby
13842
+ # target.pos
13843
+ # ```
13844
+ def pos: () -> Sc2::Position
13845
+
13728
13846
  # Loose equality matches on floats x and y.
13729
13847
  # We never check z-axis, because the map is single-level.
13730
13848
  # TODO: We should almost certainly introduce TOLERANCE here, but verify it's cost first.
@@ -13759,11 +13877,13 @@ module Api
13759
13877
  # _@return_ — new Position
13760
13878
  def random_offset: (Float offset) -> Sc2::Position
13761
13879
 
13762
- # sord omit - no YARD type given for "offset", using untyped
13763
- # Changes this point's x and y by the supplied offset
13880
+ # Randomly change this point's x and y by the supplied offset.
13881
+ # i.e. offset=2 can adjust x and y by any number in range -2..2
13882
+ #
13883
+ # _@param_ `offset`
13764
13884
  #
13765
13885
  # _@return_ — self
13766
- def random_offset!: (untyped offset) -> Sc2::Position
13886
+ def random_offset!: (Float offset) -> Sc2::Position
13767
13887
 
13768
13888
  # Creates a new point with x and y which is offset
13769
13889
  #
@@ -13804,12 +13924,13 @@ module Api
13804
13924
  # A new point representing the normalized version of this vector (unit length).
13805
13925
  def normalize: () -> Api::Point2D
13806
13926
 
13807
- # sord omit - no YARD type given for "other", using untyped
13808
13927
  # Linear interpolation between this point and another for scale
13809
13928
  # Finds a point on a line between two points at % along the way. 0.0 returns self, 1.0 returns other, 0.5 is halfway.
13810
13929
  #
13930
+ # _@param_ `other`
13931
+ #
13811
13932
  # _@param_ `scale` — a value between 0.0..1.0
13812
- def lerp: (untyped other, Float scale) -> Api::Point2D
13933
+ def lerp: (Sc2::Position other, Float scale) -> Api::Point2D
13813
13934
 
13814
13935
  # Calculates the distance between self and other
13815
13936
  #
@@ -13850,16 +13971,13 @@ module Api
13850
13971
  def away_from: (Api::Point2D other, Float distance) -> Api::Point2D
13851
13972
 
13852
13973
  # Returns [x,y] array tuple
13853
- def to_axy: () -> ::Array[(Float | Float)]
13974
+ def to_axy: () -> ::Array[Float]
13854
13975
 
13855
13976
  # Returns [x,y] array tuple where floats are cast to ints
13856
13977
  # Useful when trying to find the tile which something is on
13857
- #
13858
- # _@return_ — Array<Integer, Integer>
13859
- def to_atile: () -> ::Array[(Integer | Integer)]
13978
+ def to_atile: () -> ::Array[Integer]
13860
13979
 
13861
- # sord omit - no YARD return type given, using untyped
13862
- def to_s: () -> untyped
13980
+ def to_s: () -> String
13863
13981
 
13864
13982
  # sord omit - no YARD type given for :x, using untyped
13865
13983
  # optional field readers
@@ -13982,6 +14100,15 @@ module Api
13982
14100
  # ```
13983
14101
  def self.[]: ((Float | Integer) x, (Float | Integer) y) -> Api::Point2D
13984
14102
 
14103
+ # Returns self.
14104
+ # If you're ever unsure if you have a Unit or Position in hand,
14105
+ # this method allows safely calling `unknown_target.pos` to return a position.
14106
+ #
14107
+ # ```ruby
14108
+ # target.pos
14109
+ # ```
14110
+ def pos: () -> Sc2::Position
14111
+
13985
14112
  # Loose equality matches on floats x and y.
13986
14113
  # We never check z-axis, because the map is single-level.
13987
14114
  # TODO: We should almost certainly introduce TOLERANCE here, but verify it's cost first.
@@ -14016,11 +14143,13 @@ module Api
14016
14143
  # _@return_ — new Position
14017
14144
  def random_offset: (Float offset) -> Sc2::Position
14018
14145
 
14019
- # sord omit - no YARD type given for "offset", using untyped
14020
- # Changes this point's x and y by the supplied offset
14146
+ # Randomly change this point's x and y by the supplied offset.
14147
+ # i.e. offset=2 can adjust x and y by any number in range -2..2
14148
+ #
14149
+ # _@param_ `offset`
14021
14150
  #
14022
14151
  # _@return_ — self
14023
- def random_offset!: (untyped offset) -> Sc2::Position
14152
+ def random_offset!: (Float offset) -> Sc2::Position
14024
14153
 
14025
14154
  # Creates a new point with x and y which is offset
14026
14155
  #
@@ -14061,12 +14190,13 @@ module Api
14061
14190
  # A new point representing the normalized version of this vector (unit length).
14062
14191
  def normalize: () -> Api::Point2D
14063
14192
 
14064
- # sord omit - no YARD type given for "other", using untyped
14065
14193
  # Linear interpolation between this point and another for scale
14066
14194
  # Finds a point on a line between two points at % along the way. 0.0 returns self, 1.0 returns other, 0.5 is halfway.
14067
14195
  #
14196
+ # _@param_ `other`
14197
+ #
14068
14198
  # _@param_ `scale` — a value between 0.0..1.0
14069
- def lerp: (untyped other, Float scale) -> Api::Point2D
14199
+ def lerp: (Sc2::Position other, Float scale) -> Api::Point2D
14070
14200
 
14071
14201
  # Calculates the distance between self and other
14072
14202
  #
@@ -14107,16 +14237,13 @@ module Api
14107
14237
  def away_from: (Api::Point2D other, Float distance) -> Api::Point2D
14108
14238
 
14109
14239
  # Returns [x,y] array tuple
14110
- def to_axy: () -> ::Array[(Float | Float)]
14240
+ def to_axy: () -> ::Array[Float]
14111
14241
 
14112
14242
  # Returns [x,y] array tuple where floats are cast to ints
14113
14243
  # Useful when trying to find the tile which something is on
14114
- #
14115
- # _@return_ — Array<Integer, Integer>
14116
- def to_atile: () -> ::Array[(Integer | Integer)]
14244
+ def to_atile: () -> ::Array[Integer]
14117
14245
 
14118
- # sord omit - no YARD return type given, using untyped
14119
- def to_s: () -> untyped
14246
+ def to_s: () -> String
14120
14247
 
14121
14248
  # sord omit - no YARD return type given, using untyped
14122
14249
  # Hashes on x and y
@@ -14207,6 +14334,15 @@ module Api
14207
14334
  # ```
14208
14335
  def self.[]: (Float x, Float y, Float z) -> Api::Point
14209
14336
 
14337
+ # Returns self.
14338
+ # If you're ever unsure if you have a Unit or Position in hand,
14339
+ # this method allows safely calling `unknown_target.pos` to return a position.
14340
+ #
14341
+ # ```ruby
14342
+ # target.pos
14343
+ # ```
14344
+ def pos: () -> Sc2::Position
14345
+
14210
14346
  # Loose equality matches on floats x and y.
14211
14347
  # We never check z-axis, because the map is single-level.
14212
14348
  # TODO: We should almost certainly introduce TOLERANCE here, but verify it's cost first.
@@ -14241,11 +14377,13 @@ module Api
14241
14377
  # _@return_ — new Position
14242
14378
  def random_offset: (Float offset) -> Sc2::Position
14243
14379
 
14244
- # sord omit - no YARD type given for "offset", using untyped
14245
- # Changes this point's x and y by the supplied offset
14380
+ # Randomly change this point's x and y by the supplied offset.
14381
+ # i.e. offset=2 can adjust x and y by any number in range -2..2
14382
+ #
14383
+ # _@param_ `offset`
14246
14384
  #
14247
14385
  # _@return_ — self
14248
- def random_offset!: (untyped offset) -> Sc2::Position
14386
+ def random_offset!: (Float offset) -> Sc2::Position
14249
14387
 
14250
14388
  # Creates a new point with x and y which is offset
14251
14389
  #
@@ -14286,12 +14424,13 @@ module Api
14286
14424
  # A new point representing the normalized version of this vector (unit length).
14287
14425
  def normalize: () -> Api::Point2D
14288
14426
 
14289
- # sord omit - no YARD type given for "other", using untyped
14290
14427
  # Linear interpolation between this point and another for scale
14291
14428
  # Finds a point on a line between two points at % along the way. 0.0 returns self, 1.0 returns other, 0.5 is halfway.
14292
14429
  #
14430
+ # _@param_ `other`
14431
+ #
14293
14432
  # _@param_ `scale` — a value between 0.0..1.0
14294
- def lerp: (untyped other, Float scale) -> Api::Point2D
14433
+ def lerp: (Sc2::Position other, Float scale) -> Api::Point2D
14295
14434
 
14296
14435
  # Calculates the distance between self and other
14297
14436
  #
@@ -14332,16 +14471,13 @@ module Api
14332
14471
  def away_from: (Api::Point2D other, Float distance) -> Api::Point2D
14333
14472
 
14334
14473
  # Returns [x,y] array tuple
14335
- def to_axy: () -> ::Array[(Float | Float)]
14474
+ def to_axy: () -> ::Array[Float]
14336
14475
 
14337
14476
  # Returns [x,y] array tuple where floats are cast to ints
14338
14477
  # Useful when trying to find the tile which something is on
14339
- #
14340
- # _@return_ — Array<Integer, Integer>
14341
- def to_atile: () -> ::Array[(Integer | Integer)]
14478
+ def to_atile: () -> ::Array[Integer]
14342
14479
 
14343
- # sord omit - no YARD return type given, using untyped
14344
- def to_s: () -> untyped
14480
+ def to_s: () -> String
14345
14481
 
14346
14482
  # sord omit - no YARD return type given, using untyped
14347
14483
  def hash: () -> untyped
@@ -14412,6 +14548,15 @@ module Api
14412
14548
  # sord omit - no YARD return type given, using untyped
14413
14549
  def to_json: (?untyped as_json_options) -> untyped
14414
14550
 
14551
+ # Returns self.
14552
+ # If you're ever unsure if you have a Unit or Position in hand,
14553
+ # this method allows safely calling `unknown_target.pos` to return a position.
14554
+ #
14555
+ # ```ruby
14556
+ # target.pos
14557
+ # ```
14558
+ def pos: () -> Sc2::Position
14559
+
14415
14560
  # Loose equality matches on floats x and y.
14416
14561
  # We never check z-axis, because the map is single-level.
14417
14562
  # TODO: We should almost certainly introduce TOLERANCE here, but verify it's cost first.
@@ -14446,11 +14591,13 @@ module Api
14446
14591
  # _@return_ — new Position
14447
14592
  def random_offset: (Float offset) -> Sc2::Position
14448
14593
 
14449
- # sord omit - no YARD type given for "offset", using untyped
14450
- # Changes this point's x and y by the supplied offset
14594
+ # Randomly change this point's x and y by the supplied offset.
14595
+ # i.e. offset=2 can adjust x and y by any number in range -2..2
14596
+ #
14597
+ # _@param_ `offset`
14451
14598
  #
14452
14599
  # _@return_ — self
14453
- def random_offset!: (untyped offset) -> Sc2::Position
14600
+ def random_offset!: (Float offset) -> Sc2::Position
14454
14601
 
14455
14602
  # Creates a new point with x and y which is offset
14456
14603
  #
@@ -14491,12 +14638,13 @@ module Api
14491
14638
  # A new point representing the normalized version of this vector (unit length).
14492
14639
  def normalize: () -> Api::Point2D
14493
14640
 
14494
- # sord omit - no YARD type given for "other", using untyped
14495
14641
  # Linear interpolation between this point and another for scale
14496
14642
  # Finds a point on a line between two points at % along the way. 0.0 returns self, 1.0 returns other, 0.5 is halfway.
14497
14643
  #
14644
+ # _@param_ `other`
14645
+ #
14498
14646
  # _@param_ `scale` — a value between 0.0..1.0
14499
- def lerp: (untyped other, Float scale) -> Api::Point2D
14647
+ def lerp: (Sc2::Position other, Float scale) -> Api::Point2D
14500
14648
 
14501
14649
  # Calculates the distance between self and other
14502
14650
  #
@@ -14537,16 +14685,13 @@ module Api
14537
14685
  def away_from: (Api::Point2D other, Float distance) -> Api::Point2D
14538
14686
 
14539
14687
  # Returns [x,y] array tuple
14540
- def to_axy: () -> ::Array[(Float | Float)]
14688
+ def to_axy: () -> ::Array[Float]
14541
14689
 
14542
14690
  # Returns [x,y] array tuple where floats are cast to ints
14543
14691
  # Useful when trying to find the tile which something is on
14544
- #
14545
- # _@return_ — Array<Integer, Integer>
14546
- def to_atile: () -> ::Array[(Integer | Integer)]
14692
+ def to_atile: () -> ::Array[Integer]
14547
14693
 
14548
- # sord omit - no YARD return type given, using untyped
14549
- def to_s: () -> untyped
14694
+ def to_s: () -> String
14550
14695
 
14551
14696
  # sord omit - no YARD type given for :x, using untyped
14552
14697
  # optional field readers
@@ -20013,9 +20158,6 @@ module Api
20013
20158
  # For Terran builds a tech lab add-on on the current structure
20014
20159
  def build_tech_lab: (?queue_command: untyped) -> void
20015
20160
 
20016
- # sord omit - no YARD return type given, using untyped
20017
- def target_for_addon_placement: () -> untyped
20018
-
20019
20161
  # sord omit - no YARD return type given, using untyped
20020
20162
  # Warps in unit type at target (location or pylon)
20021
20163
  # Only works if the source is a Warp Gate
@@ -20052,6 +20194,17 @@ module Api
20052
20194
 
20053
20195
  attr_reader full_energy?: bool
20054
20196
 
20197
+ # Returns whether this is a melee (non-ranged) attacker
20198
+ # Archon isn't melee; 3 range
20199
+ # Hellbat is melee, but Hellion isn't melee; 5 range
20200
+ # Roach isn't melee; just an attack animation when nearby
20201
+ attr_reader is_melee?: bool
20202
+
20203
+ # Returns ranged attack units
20204
+ #
20205
+ # _@see_ `Sc2::UnitGroup::TYPE_RANGE`
20206
+ attr_reader is_ranged?: bool
20207
+
20055
20208
  attr_reader is_flying?: bool
20056
20209
 
20057
20210
  attr_reader is_burrowed?: bool
@@ -20175,6 +20328,15 @@ module Api
20175
20328
  module PowerSourceExtension
20176
20329
  include Sc2::Position
20177
20330
 
20331
+ # Returns self.
20332
+ # If you're ever unsure if you have a Unit or Position in hand,
20333
+ # this method allows safely calling `unknown_target.pos` to return a position.
20334
+ #
20335
+ # ```ruby
20336
+ # target.pos
20337
+ # ```
20338
+ def pos: () -> Sc2::Position
20339
+
20178
20340
  # Loose equality matches on floats x and y.
20179
20341
  # We never check z-axis, because the map is single-level.
20180
20342
  # TODO: We should almost certainly introduce TOLERANCE here, but verify it's cost first.
@@ -20209,11 +20371,13 @@ module Api
20209
20371
  # _@return_ — new Position
20210
20372
  def random_offset: (Float offset) -> Sc2::Position
20211
20373
 
20212
- # sord omit - no YARD type given for "offset", using untyped
20213
- # Changes this point's x and y by the supplied offset
20374
+ # Randomly change this point's x and y by the supplied offset.
20375
+ # i.e. offset=2 can adjust x and y by any number in range -2..2
20376
+ #
20377
+ # _@param_ `offset`
20214
20378
  #
20215
20379
  # _@return_ — self
20216
- def random_offset!: (untyped offset) -> Sc2::Position
20380
+ def random_offset!: (Float offset) -> Sc2::Position
20217
20381
 
20218
20382
  # Creates a new point with x and y which is offset
20219
20383
  #
@@ -20254,12 +20418,13 @@ module Api
20254
20418
  # A new point representing the normalized version of this vector (unit length).
20255
20419
  def normalize: () -> Api::Point2D
20256
20420
 
20257
- # sord omit - no YARD type given for "other", using untyped
20258
20421
  # Linear interpolation between this point and another for scale
20259
20422
  # Finds a point on a line between two points at % along the way. 0.0 returns self, 1.0 returns other, 0.5 is halfway.
20260
20423
  #
20424
+ # _@param_ `other`
20425
+ #
20261
20426
  # _@param_ `scale` — a value between 0.0..1.0
20262
- def lerp: (untyped other, Float scale) -> Api::Point2D
20427
+ def lerp: (Sc2::Position other, Float scale) -> Api::Point2D
20263
20428
 
20264
20429
  # Calculates the distance between self and other
20265
20430
  #
@@ -20300,16 +20465,13 @@ module Api
20300
20465
  def away_from: (Api::Point2D other, Float distance) -> Api::Point2D
20301
20466
 
20302
20467
  # Returns [x,y] array tuple
20303
- def to_axy: () -> ::Array[(Float | Float)]
20468
+ def to_axy: () -> ::Array[Float]
20304
20469
 
20305
20470
  # Returns [x,y] array tuple where floats are cast to ints
20306
20471
  # Useful when trying to find the tile which something is on
20307
- #
20308
- # _@return_ — Array<Integer, Integer>
20309
- def to_atile: () -> ::Array[(Integer | Integer)]
20472
+ def to_atile: () -> ::Array[Integer]
20310
20473
 
20311
- # sord omit - no YARD return type given, using untyped
20312
- def to_s: () -> untyped
20474
+ def to_s: () -> String
20313
20475
 
20314
20476
  # Adds additional functionality to message class Api::PowerSource
20315
20477
  module ClassMethods