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

Document correct upgrade procedure for Terran buildings #33

Open
hsalokor opened this issue Feb 19, 2018 · 5 comments
Open

Document correct upgrade procedure for Terran buildings #33

hsalokor opened this issue Feb 19, 2018 · 5 comments

Comments

@hsalokor
Copy link

Terran buildings seemed to be fairly picky for applying upgrades. The correct way to do this seems to be like this:

if self.units(BARRACKSTECHLAB).ready.exists:
  for lab in self.units(BARRACKSTECHLAB).ready:
    abilities = await self.get_available_abilities(lab)
    if AbilityId.RESEARCH_COMBATSHIELD in abilities and \
       self.can_afford(AbilityId.RESEARCH_COMBATSHIELD):
       await self.do(lab(AbilityId.RESEARCH_COMBATSHIELD))

Add example for building the basic upgrades.

@Dentosal Dentosal self-assigned this Feb 22, 2018
@vgainullin
Copy link

could you also add example of building TECHLAB / BARRACKSTECHLAB

@alexander-kazakov
Copy link
Contributor

alexander-kazakov commented Jul 25, 2018

@vgainullin You can do it like this

         for sp in self.units(STARPORT).ready:
         if sp.add_on_tag == 0:
           await self.do(sp.build(STARPORTTECHLAB))

You can check the existence of addon like this

def add_on_name(self, structure):
        if structure.add_on_tag != 0:
            return self.units.find_by_tag(structure.add_on_tag).name
        else:
            return "None"

e.g.

if ((len(barrack.orders) < 1) or (self.add_on_name(barrack) == "BarracksReactor" and len(barrack.orders) < 2)):
          await self.train_unit_try(barrack, MARINE)

@david-x-chen
Copy link

@alexander-kazakov I tried this 'add_on_tag' on the Command Center to check if the Command Center has Orbital Command. But failed, always got 0. Can it be using the same way to check on Command Center?

@alexander-kazakov
Copy link
Contributor

Orbital command works differently. It actually converts the command center unit into orbital command one.

So all your code where you select command center will not work for orbital command. To interact with orbital command, just use a selector for units(orbital command constant)

@david-x-chen
Copy link

@alexander-kazakov Thanks!

@Dentosal Dentosal removed their assignment Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants