sc2simulator/scenarioMgr/scenario.py
def newBaseUnits(self, playerID):
        """define a set of new 'base' units for the specified player"""
        player = self.players[playerID]
        if player.baseUnits: return player.baseUnits # don't generate more base units after the first time
        location = player.position
        x0, y0 = location[:2]
        if player.race == c.ZERG:
            off = 2 # zergOffset for creep tumors
            for i in range(0,2):
                newUnit = self.updateUnit(tag=0, base=True, # add units to scenario
                    nametype = "NydusNetwork",
                    code     = 95,
                    owner    = playerID,
                    position = pickCloserLoc(location, 5*i), # the game handles attempting to place multiple units on top of each other
                    energy   = 0,
                    life     = 850,
                    shields  = 0)
            for x, y in [(  0 ,-off), (-off,  0 ), (off,  0 ), ( 0 , off)]:
                          #(-off,-off), (-off, off), (off,-off), (off, off)]:
                targetX, targetY = location[:2]
                unitLoc = (targetX + x, targetY + y)
                newUnit = self.updateUnit(tag=0, base=True, # add units to scenario
                    nametype = "CreepTumorBurrowed",
                    code     = 137,
                    owner    = playerID,
                    position = unitLoc, # the game handles attempting to place multiple units on top of each other
                    energy   = 0,
                    life     = 50,
                    shields  = 0)
        elif player.race == c.PROTOSS:
            for i in range(0,4):
                newUnit = self.updateUnit(tag=0, base=True, # add units to scenario
                    nametype = "Pylon",
                    code     = 60,
                    owner    = playerID,
                    position = pickCloserLoc(location, 4*i), # the game handles attempting to place multiple units on top of each other
                    energy   = 0,
                    life     = 200,
                    shields  = 200)
        elif player.race == c.TERRAN:
            for i in range(0,4):
                newUnit = self.updateUnit(tag=0, base=True, # add units to scenario
                    nametype = "SupplyDepot",
                    code     = 19,
                    owner    = playerID,
                    position = pickCloserLoc(location, 4*i), # the game handles attempting to place multiple units on top of each other
                    energy   = 0,
                    life     = 400,
                    shields  = 0)
        else:  raise ValueError("bad race value: %s"%(player.race))
        return player.baseUnits
define a set of new 'base' units for the specified player
define a set of new 'base' units for the specified player
define a set of new ' base ' units for the specified player
def newBaseUnits(self, playerID):
        player = self.players[playerID]
        if player.baseUnits: return player.baseUnits 
        location = player.position
        x0, y0 = location[:2]
        if player.race == c.ZERG:
            off = 2 
            for i in range(0,2):
                newUnit = self.updateUnit(tag=0, base=True, 
                    nametype = "NydusNetwork",
                    code     = 95,
                    owner    = playerID,
                    position = pickCloserLoc(location, 5*i), 
                    energy   = 0,
                    life     = 850,
                    shields  = 0)
            for x, y in [(  0 ,-off), (-off,  0 ), (off,  0 ), ( 0 , off)]:
                targetX, targetY = location[:2]
                unitLoc = (targetX + x, targetY + y)
                newUnit = self.updateUnit(tag=0, base=True, 
                    nametype = "CreepTumorBurrowed",
                    code     = 137,
                    owner    = playerID,
                    position = unitLoc, 
                    energy   = 0,
                    life     = 50,
                    shields  = 0)
        elif player.race == c.PROTOSS:
            for i in range(0,4):
                newUnit = self.updateUnit(tag=0, base=True, 
                    nametype = "Pylon",
                    code     = 60,
                    owner    = playerID,
                    position = pickCloserLoc(location, 4*i), 
                    energy   = 0,
                    life     = 200,
                    shields  = 200)
        elif player.race == c.TERRAN:
            for i in range(0,4):
                newUnit = self.updateUnit(tag=0, base=True, 
                    nametype = "SupplyDepot",
                    code     = 19,
                    owner    = playerID,
                    position = pickCloserLoc(location, 4*i), 
                    energy   = 0,
                    life     = 400,
                    shields  = 0)
        else:  raise ValueError("bad race value: %s"%(player.race))
        return player.baseUnits
def newBaseUnits ( self , playerID ) : player = self . players [ playerID ] if player . baseUnits : return player . baseUnits location = player . position x0 , y0 = location [ : 2 ] if player . race == c . ZERG : off = 2 for i in range ( 0 , 2 ) : newUnit = self . updateUnit ( tag = 0 , base = True , nametype = "NydusNetwork" , code = 95 , owner = playerID , position = pickCloserLoc ( location , 5 * i ) , energy = 0 , life = 850 , shields = 0 ) for x , y in [ ( 0 , - off ) , ( - off , 0 ) , ( off , 0 ) , ( 0 , off ) ] : targetX , targetY = location [ : 2 ] unitLoc = ( targetX + x , targetY + y ) newUnit = self . updateUnit ( tag = 0 , base = True , nametype = "CreepTumorBurrowed" , code = 137 , owner = playerID , position = unitLoc , energy = 0 , life = 50 , shields = 0 ) elif player . race == c . PROTOSS : for i in range ( 0 , 4 ) : newUnit = self . updateUnit ( tag = 0 , base = True , nametype = "Pylon" , code = 60 , owner = playerID , position = pickCloserLoc ( location , 4 * i ) , energy = 0 , life = 200 , shields = 200 ) elif player . race == c . TERRAN : for i in range ( 0 , 4 ) : newUnit = self . updateUnit ( tag = 0 , base = True , nametype = "SupplyDepot" , code = 19 , owner = playerID , position = pickCloserLoc ( location , 4 * i ) , energy = 0 , life = 400 , shields = 0 ) else : raise ValueError ( "bad race value: %s" % ( player . race ) ) return player . baseUnits
define a set of new 'base' units for the specified player
define a set of new ' base ' units for the specified player
"""define a set of new 'base' units for the specified player""" # don't generate more base units after the first time # zergOffset for creep tumors # add units to scenario # the game handles attempting to place multiple units on top of each other #(-off,-off), (-off, off), (off,-off), (off, off)]: # add units to scenario # the game handles attempting to place multiple units on top of each other # add units to scenario # the game handles attempting to place multiple units on top of each other # add units to scenario # the game handles attempting to place multiple units on top of each other
self
playerID