Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make _prepare_step async and add Unit.abilities #163

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

BurnySc2
Copy link
Owner

@BurnySc2 BurnySc2 commented Jan 14, 2023

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
Copy link

codecov-commenter commented Jan 14, 2023

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 Files Coverage Δ
sc2/main.py 15.54% <0.00%> (ø)
test/autotest_bot.py 0.00% <0.00%> (ø)
test/benchmark_bot_ai_init.py 0.00% <0.00%> (ø)
test/benchmark_prepare_units.py 0.00% <0.00%> (ø)
sc2/unit.py 79.94% <33.33%> (-0.42%) ⬇️
sc2/bot_ai_internal.py 60.07% <80.00%> (+0.07%) ⬆️
sc2/constants.py 98.64% <100.00%> (+0.01%) ⬆️
test/test_pickled_data.py 99.40% <100.00%> (+<0.01%) ⬆️
test/test_pickled_ramp.py 100.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 free to 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