Skip to content

Make _prepare_step async and add Unit.abilities - #163

Draft
BurnySc2 wants to merge 2 commits into
developfrom
query-and-cache-abilities
Draft

Make _prepare_step async and add Unit.abilities#163
BurnySc2 wants to merge 2 commits into
developfrom
query-and-cache-abilities

Conversation

@BurnySc2

@BurnySc2BurnySc2 commented Jan 14, 2023

Copy link
Copy Markdown
Owner

Fixes#157

This PR adds the Unit.abilities property which returns a set of AbilityId for all own units. Returns an empty set and a warning for neutral and enemy units.
This is useful so you don't have to handle querying abilities yourself, to check if tech requirement is met or if an ability is on cooldown (e.g. blink). However this sends one query to the API on each iteration before on_step is called.

@codecov-commenter

codecov-commenter commented Jan 14, 2023

Copy link
Copy Markdown

Codecov Report

Merging #163 (2ee5387) into develop (731c12c) will decrease coverage by 0.00%.
The diff coverage is 65.00%.

@@ Coverage Diff @@## develop #163 +/- ##
===========================================
- Coverage 60.16% 60.15% -0.01% 
===========================================
Files 107 107 Lines 13974 14011 +37 ===========================================
+ Hits 8408 8429 +21 - Misses 5566 5582 +16 
Impacted FilesCoverage Δ
sc2/main.py15.54% <0.00%> (ø)
test/autotest_bot.py0.00% <0.00%> (ø)
test/benchmark_bot_ai_init.py0.00% <0.00%> (ø)
test/benchmark_prepare_units.py0.00% <0.00%> (ø)
sc2/unit.py79.94% <33.33%> (-0.42%)⬇️
sc2/bot_ai_internal.py60.07% <80.00%> (+0.07%)⬆️
sc2/constants.py98.64% <100.00%> (+0.01%)⬆️
test/test_pickled_data.py99.40% <100.00%> (+<0.01%)⬆️
test/test_pickled_ramp.py100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Get and cache abilities for all own units

2 participants

@BurnySc2@codecov-commenter