Skip to content

Commit

Permalink
Workaround fix for 4.9.0 support
Browse files Browse the repository at this point in the history
This implements the fixes mentioned by BurnySc2 in issue comment:
Dentosal#283 (comment)

I'm going to use this as my bot's dependency before the python-sc2
library is patched to use the latest SC2 version.
  • Loading branch information
Juuso Strömberg committed Jun 16, 2019
1 parent 307e576 commit 875afef
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 30 deletions.
2 changes: 1 addition & 1 deletion sc2/game_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def __init__(self, game_data, proto):
self._game_data = game_data
self._proto = proto

assert self.id != 0
# assert self.id != 0

def __repr__(self) -> str:
return f"AbilityData(name={self._proto.button_name})"
Expand Down
2 changes: 1 addition & 1 deletion sc2/game_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def __init__(self, response_observation):
# self.visibility[point]: 0=Hidden, 1=Fogged, 2=Visible
self.visibility: PixelMap = PixelMap(self.observation_raw.map_state.visibility, mirrored=True)
# self.creep[point]: 0=No creep, 1=creep
self.creep: PixelMap = PixelMap(self.observation_raw.map_state.creep, mirrored=True)
self.creep: PixelMap = PixelMap(self.observation_raw.map_state.creep, in_bits=True, mirrored=True)

# Effects like ravager bile shot, lurker attack, everything in effect_id.py
self.effects: Set[EffectData] = {EffectData(effect) for effect in self.observation_raw.effects}
Expand Down
37 changes: 23 additions & 14 deletions sc2/ids/ability_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ class AbilityId(enum.Enum):
STOP_DANCE = 7
HOLDFIRE_STOPSPECIAL = 10
HOLDFIRE_HOLDFIRE = 11
MOVE = 16
PATROL = 17
HOLDPOSITION = 18
MOVE_MOVE = 16
PATROL_PATROL = 17
HOLDPOSITION_HOLD = 18
SCAN_MOVE = 19
MOVE_TURN = 20
BEACON_CANCEL = 21
Expand Down Expand Up @@ -44,7 +44,7 @@ class AbilityId(enum.Enum):
MORPHZERGLINGTOBANELING_BANELING = 80
NEXUSTRAINMOTHERSHIP_MOTHERSHIP = 110
FEEDBACK_FEEDBACK = 140
MASSRECALL_MASSRECALL = 142
EFFECT_MASSRECALL_STRATEGICRECALL = 142
PLACEPOINTDEFENSEDRONE_POINTDEFENSEDRONE = 144
HALLUCINATION_ARCHON = 146
HALLUCINATION_COLOSSUS = 148
Expand Down Expand Up @@ -93,7 +93,7 @@ class AbilityId(enum.Enum):
_250MMSTRIKECANNONS_CANCEL = 258
TEMPORALRIFT_TEMPORALRIFT = 259
EFFECT_CHRONOBOOST = 261
ULTRALISKCAVERNRESEARCH_EVOLVEANABOLICSYNTHESIS2 = 263
RESEARCH_ANABOLICSYNTHESIS = 263
RESEARCH_CHITINOUSPLATING = 265
WORMHOLETRANSIT_WORMHOLETRANSIT = 293
HARVEST_GATHER_SCV = 295
Expand Down Expand Up @@ -143,13 +143,16 @@ class AbilityId(enum.Enum):
BEHAVIOR_CLOAKOFF_BANSHEE = 393
LOAD_MEDIVAC = 394
UNLOADALLAT_MEDIVAC = 396
UNLOADUNIT_MEDIVAC = 397
SCANNERSWEEP_SCAN = 399
YAMATO_YAMATOGUN = 401
MORPH_VIKINGASSAULTMODE = 403
MORPH_VIKINGFIGHTERMODE = 405
LOAD_BUNKER = 407
UNLOADALL_BUNKER = 408
UNLOADUNIT_BUNKER = 410
UNLOADALL_COMMANDCENTER = 413
UNLOADUNIT_COMMANDCENTER = 415
LOADALL_COMMANDCENTER = 416
LIFT_COMMANDCENTER = 417
LAND_COMMANDCENTER = 419
Expand Down Expand Up @@ -208,7 +211,7 @@ class AbilityId(enum.Enum):
RESEARCH_SMARTSERVOS = 766
FACTORYTECHLABRESEARCH_RESEARCHARMORPIERCINGROCKETS = 767
RESEARCH_CYCLONERAPIDFIRELAUNCHERS = 768
FACTORYTECHLABRESEARCH_CYCLONERESEARCHLOCKONDAMAGEUPGRADE = 769
RESEARCH_CYCLONELOCKONDAMAGE = 769
RESEARCH_BANSHEECLOAKINGFIELD = 790
STARPORTTECHLABRESEARCH_RESEARCHMEDIVACENERGYUPGRADE = 792
RESEARCH_RAVENCORVIDREACTOR = 793
Expand Down Expand Up @@ -257,6 +260,7 @@ class AbilityId(enum.Enum):
LOAD_WARPPRISM = 911
UNLOADALL_WARPPRISM = 912
UNLOADALLAT_WARPPRISM = 913
UNLOADUNIT_WARPPRISM = 914
GATEWAYTRAIN_ZEALOT = 916
GATEWAYTRAIN_STALKER = 917
GATEWAYTRAIN_HIGHTEMPLAR = 919
Expand Down Expand Up @@ -377,6 +381,7 @@ class AbilityId(enum.Enum):
REDSTONELAVACRITTERINJUREDUNBURROW_BURROWUP = 1404
LOAD_OVERLORD = 1406
UNLOADALLAT_OVERLORD = 1408
UNLOADUNIT_OVERLORD = 1409
MERGEABLE_CANCEL = 1411
WARPABLE_CANCEL = 1412
WARPGATETRAIN_ZEALOT = 1413
Expand All @@ -390,6 +395,7 @@ class AbilityId(enum.Enum):
BURROWUP_QUEEN = 1435
LOAD_NYDUSNETWORK = 1437
UNLOADALL_NYDASNETWORK = 1438
UNLOADUNIT_NYDASNETWORK = 1440
EFFECT_BLINK_STALKER = 1442
BURROWDOWN_INFESTOR = 1444
BURROWINFESTORDOWN_CANCEL = 1445
Expand Down Expand Up @@ -1211,7 +1217,7 @@ class AbilityId(enum.Enum):
RESEARCH_ZERGGROUNDARMOR = 3704
RESEARCH_ZERGMELEEWEAPONS = 3705
RESEARCH_ZERGMISSILEWEAPONS = 3706
VOIDRAYSWARMDAMAGEBOOSTCANCEL_CANCEL = 3707
CANCEL_VOIDRAYPRISMATICALIGNMENT = 3707
RESEARCH_ADAPTIVETALONS = 3709
MORPH_OBSERVERMODE = 3739
MORPH_SURVEILLANCEMODE = 3741
Expand All @@ -1229,24 +1235,27 @@ class AbilityId(enum.Enum):
EFFECT_RESTORE = 3765
NEXUSSHIELDOVERCHARGE_NEXUSSHIELDOVERCHARGE = 3767
NEXUSSHIELDOVERCHARGEOFF_NEXUSSHIELDOVERCHARGEOFF = 3769
BATTLECRUISERATTACK_ATTACK = 3771
ATTACK_BATTLECRUISER = 3771
BATTLECRUISERATTACK_ATTACKTOWARDS = 3772
BATTLECRUISERATTACK_ATTACKBARRAGE = 3773
BATTLECRUISERATTACKEVALUATOR_MOTHERSHIPCOREATTACK = 3774
BATTLECRUISERMOVE_MOVE = 3776
BATTLECRUISERMOVE_MOVEPATROL = 3777
BATTLECRUISERMOVE_MOVEHOLDPOSITION = 3778
MOVE_BATTLECRUISER = 3776
PATROL_BATTLECRUISER = 3777
HOLDPOSITION_BATTLECRUISER = 3778
BATTLECRUISERMOVE_ACQUIREMOVE = 3779
BATTLECRUISERMOVE_TURN = 3780
BATTLECRUISERSTOPEVALUATOR_STOP = 3781
BATTLECRUISERSTOP_STOP = 3783
STOP_BATTLECRUISER = 3783
BATTLECRUISERSTOP_HOLDFIRE = 3784
BATTLECRUISERSTOP_CHEER = 3785
BATTLECRUISERSTOP_DANCE = 3786
VIPERPARASITICBOMBRELAY_PARASITICBOMB = 3789
PARASITICBOMBRELAYDODGE_PARASITICBOMB = 3791
MORPHTOCOLLAPSIBLEROCKTOWERDEBRISRAMPLEFTGREEN_CANCEL = 3794
MORPHTOCOLLAPSIBLEROCKTOWERDEBRISRAMPRIGHTGREEN_CANCEL = 3796
HOLDPOSITION = 3793
MOVE = 3794
PATROL = 3795
MORPHTOCOLLAPSIBLEROCKTOWERDEBRISRAMPLEFTGREEN_CANCEL = 3798
MORPHTOCOLLAPSIBLEROCKTOWERDEBRISRAMPRIGHTGREEN_CANCEL = 3800


for item in AbilityId:
Expand Down
39 changes: 25 additions & 14 deletions sc2/ids/unit_typeid.py
Original file line number Diff line number Diff line change
Expand Up @@ -1948,20 +1948,31 @@ class UnitTypeId(enum.Enum):
VIKING = 1940
RENEGADEMISSILETURRET = 1941
PARASITICBOMBRELAYDUMMY = 1942
PREVIEWBUNKERUPGRADED = 1943
ASSIMILATORRICH = 1944
EXTRACTORRICH = 1945
INHIBITORZONESMALL = 1946
INHIBITORZONEMEDIUM = 1947
INHIBITORZONELARGE = 1948
REFINERYRICH = 1949
MINERALFIELD450 = 1950
COLLAPSIBLEROCKTOWERDEBRISRAMPLEFTGREEN = 1951
COLLAPSIBLEROCKTOWERDEBRISRAMPRIGHTGREEN = 1952
COLLAPSIBLEROCKTOWERPUSHUNITRAMPLEFTGREEN = 1953
COLLAPSIBLEROCKTOWERPUSHUNITRAMPRIGHTGREEN = 1954
COLLAPSIBLEROCKTOWERRAMPLEFTGREEN = 1955
COLLAPSIBLEROCKTOWERRAMPRIGHTGREEN = 1956
MECHAZERGLINGACGLUESCREENDUMMY = 1943
MECHABANELINGACGLUESCREENDUMMY = 1944
MECHAHYDRALISKACGLUESCREENDUMMY = 1945
MECHAINFESTORACGLUESCREENDUMMY = 1946
MECHACORRUPTORACGLUESCREENDUMMY = 1947
MECHAULTRALISKACGLUESCREENDUMMY = 1948
MECHAOVERSEERACGLUESCREENDUMMY = 1949
MECHALURKERACGLUESCREENDUMMY = 1950
MECHABATTLECARRIERLORDACGLUESCREENDUMMY = 1951
MECHASPINECRAWLERACGLUESCREENDUMMY = 1952
MECHASPORECRAWLERACGLUESCREENDUMMY = 1953
PREVIEWBUNKERUPGRADED = 1954
ASSIMILATORRICH = 1955
EXTRACTORRICH = 1956
INHIBITORZONESMALL = 1957
INHIBITORZONEMEDIUM = 1958
INHIBITORZONELARGE = 1959
REFINERYRICH = 1960
MINERALFIELD450 = 1961
COLLAPSIBLEROCKTOWERDEBRISRAMPLEFTGREEN = 1962
COLLAPSIBLEROCKTOWERDEBRISRAMPRIGHTGREEN = 1963
COLLAPSIBLEROCKTOWERPUSHUNITRAMPLEFTGREEN = 1964
COLLAPSIBLEROCKTOWERPUSHUNITRAMPRIGHTGREEN = 1965
COLLAPSIBLEROCKTOWERRAMPLEFTGREEN = 1966
COLLAPSIBLEROCKTOWERRAMPRIGHTGREEN = 1967


for item in UnitTypeId:
Expand Down

0 comments on commit 875afef

Please sign in to comment.