Beispiel #1
0
def beforeGeneration():
	print "-- beforeGeneration()"
	# Create mapInfo string
	mapInfo = ""
	for opt in range( getNumCustomMapOptions() ):
		nam = getCustomMapOptionName( [opt] )
		sel = CyMap().getCustomMapOption( opt )
		txt = getCustomMapOptionDescAt( [opt,sel] )
		mapInfo += "%27s:   %s\n" % ( nam, txt )
	# Initialize MapScriptTools
	mst.getModInfo( getVersion(), None, mapInfo )
	# Initialize bonus balancing
	balancer.initialize()
	beforeGeneration2()							# call renamed script function
Beispiel #2
0
def getStartPositions():
    gc = CyGlobalContext()
    iPlayers = gc.getGame().countCivPlayersEverAlive()
    coord = []
    for i in range(iPlayers + iPlayers % 2):
        coord.append([])

    if iPlayers > 10: yAdd = 2
    elif iPlayers > 24: yAdd = 3
    elif iPlayers > 40: yAdd = 4
    else: yAdd = 0

    pl = (iPlayers - yAdd + 1) / 2
    for i in range(pl):
        dx1 = -0.025
        dx2 = +0.025
        if i > 0 and i < (pl - 1) and ((i % 2) == 0):
            dx1 = -0.05
            dx2 = +0.05
        elif i > 0 and i < (pl - 1) and ((i % 2) == 1):
            dx1 = 0
            dx2 = 0
        coord[2 * i] = [0.05 + (0.9 * i) / (pl - 1), 0.15 + dx1, 2, 3]
        coord[2 * i + 1] = [0.05 + (0.9 * i) / (pl - 1), 0.85 + dx2, 2, 3]

    for j in range(yAdd):
        dy = j * 0.5 / yAdd + 0.25 + 0.25 / yAdd
        coord[2 * pl + 2 * j] = [0.075, dy, 3, 2]
        coord[2 * pl + 2 * j + 1] = [0.925, dy, 3, 2]

    if len(coord) > iPlayers:
        inx = mst.chooseListIndex(coord)
        del coord[inx]
    print "IniCoords: %3r" % (coord)
    return coord
Beispiel #3
0
def beforeGeneration():
	print "-- beforeGeneration()"
	# create evaluation string for getLatitude(x,y); vars can be x or y
	compGetLat = "0.56 * plotXY(x,y,0,0).getLatitude() + 6.3"
	# Create mapInfo string
	mapInfo = ""
	for opt in range( getNumCustomMapOptions() ):
		nam = getCustomMapOptionName( [opt] )
		sel = CyMap().getCustomMapOption( opt )
		txt = getCustomMapOptionDescAt( [opt,sel] )
		mapInfo += "%27s:   %s\n" % ( nam, txt )
	# Initialize MapScriptTools
	mst.getModInfo( getVersion(), compGetLat, mapInfo )
	# initialize bonus balancing
	balancer.initialize( CyMap().getCustomMapOption(1) == 1 )	# balance boni if desired, place missing boni, move minerals
	beforeGeneration2()														# call renamed script function
Beispiel #4
0
def beforeGeneration():
    print "-- beforeGeneration()"
    # create evaluation string for getLatitude(x,y); vars can be x or y
    compGetLat = "0.56 * plotXY(x,y,0,0).getLatitude() + 6.3"
    # Create mapInfo string
    mapInfo = ""
    for opt in range(getNumCustomMapOptions()):
        nam = getCustomMapOptionName([opt])
        sel = CyMap().getCustomMapOption(opt)
        txt = getCustomMapOptionDescAt([opt, sel])
        mapInfo += "%27s:   %s\n" % (nam, txt)
    # Initialize MapScriptTools
    mst.getModInfo(getVersion(), compGetLat, mapInfo)
    # initialize bonus balancing
    balancer.initialize(CyMap().getCustomMapOption(
        1) == 1)  # balance boni if desired, place missing boni, move minerals
    beforeGeneration2()  # call renamed script function
Beispiel #5
0
def beforeGeneration():
	print "--- beforeGeneration()"
	# Create evaluation string for getLatitude(x,y); vars can be x or y
	cStep = "(y/%5.1f) - %3.1f" % ( CyMap().getGridHeight()-1, shiftMultiplier )
	cDiff = CyMap().getTopLatitude() - CyMap().getBottomLatitude()
	cBott = CyMap().getBottomLatitude()
	compGetLat = "abs(%s) * (%i) + (%i)" % ( cStep, cDiff, cBott )
	# Create mapInfo string
	mapInfo = ""
	for opt in range( getNumCustomMapOptions() ):
		nam = getCustomMapOptionName( [opt] )
		sel = CyMap().getCustomMapOption( opt )
		txt = getCustomMapOptionDescAt( [opt,sel] )
		mapInfo += "%27s:   %s\n" % ( nam, txt )
	# Initialize MapScriptTools
	mst.getModInfo( getVersion(), compGetLat, mapInfo )

	# Initialize bonus balancer
	balancer.initialize(True, True, True)				# balance, add missing, move minerals
Beispiel #6
0
def generateTerrainTypes():
    print "-- generateTerrainTypes()"

    # Choose terrainGenerator
    if mst.bPfall or mst.bMars:
        terraingen = mst.MST_TerrainGenerator(
        )  # for Planetfall/Mars Now! use MST_TerrainGenerator()
    else:
        terraingen = ISTerrainGenerator()
    # Generate terrain
    terrainTypes = terraingen.generateTerrain()
    return terrainTypes
Beispiel #7
0
def normalizeStartingPlotLocations():
    print "-- normalizeStartingPlotLocations()"

    # build Lost Isle
    # - this region needs to be placed after starting-plots are first assigned
    mst.mapRegions.buildLostIsle(bAliens=mst.choose(33, True, False))

    if CyMap().getCustomMapOption(2) == 0:
        # by default civ places teams near to each other
        CyPythonMgr().allowDefaultImpl()
    elif CyMap().getCustomMapOption(2) == 1:
        # shuffle starting-plots to separate teams
        mst.teamStart.placeTeamsTogether(False, True)
    else:
        # randomize starting-plots to ignore teams
        mst.teamStart.placeTeamsTogether(True, True)
Beispiel #8
0
def normalizeStartingPlotLocations():
	print "-- normalizeStartingPlotLocations()"

	# build Lost Isle
	# - this region needs to be placed after starting-plots are first assigned
	mst.mapRegions.buildLostIsle( bAliens = mst.choose(33,True,False) )

	if CyMap().getCustomMapOption(2) == 0:
		# by default civ places teams near to each other
		CyPythonMgr().allowDefaultImpl()
	elif CyMap().getCustomMapOption(2) == 1:
		# shuffle starting-plots to separate teams
		mst.teamStart.placeTeamsTogether( False, True )
	else:
		# randomize starting-plots to ignore teams
		mst.teamStart.placeTeamsTogether( True, True )
Beispiel #9
0
def normalizeStartingPlotLocations():
	print "-- normalizeStartingPlotLocations()"

	# build Lost Isle
	# - this region needs to be placed after starting-plots are first assigned
	mst.mapRegions.buildLostIsle( chance=33, minDist=7, bAliens=mst.choose(33,True,False) )

	if CyMap().getCustomMapOption(3) == 0:
		CyPythonMgr().allowDefaultImpl()							# by default civ places teams near to each other
		# mst.teamStart.placeTeamsTogether( True, True )	# use teamStart to place teams near to each other
	elif CyMap().getCustomMapOption(3) == 1:
		mst.teamStart.placeTeamsTogether( False, True )		# shuffle starting-plots to separate teams
	elif CyMap().getCustomMapOption(3) == 2:
		mst.teamStart.placeTeamsTogether( True, True )		# randomize starting-plots (may be near or not)
	else:
		mst.teamStart.placeTeamsTogether( False, False )	# leave starting-plots alone
Beispiel #10
0
def getStartPositions():
	gc = CyGlobalContext()
	iPlayers = gc.getGame().countCivPlayersEverAlive()
	coord = []
	for i in range( iPlayers + iPlayers%2 ): coord.append( [] )

	if iPlayers >10: yAdd = 2
	elif iPlayers > 24: yAdd = 3
	elif iPlayers > 40: yAdd = 4
	else: yAdd = 0

	pl = (iPlayers - yAdd + 1) / 2
	for i in range( pl ):
		dx1 = -0.025
		dx2 = +0.025
		if i>0 and i<(pl-1) and ((i%2)==0):
			dx1 = -0.05
			dx2 = +0.05
		elif i>0 and i<(pl-1) and ((i%2)==1):
			dx1 = 0
			dx2 = 0
		coord[2*i] = [ 0.05 + (0.9 * i) / (pl-1), 0.15 + dx1, 2, 3 ]
		coord[2*i+1] = [ 0.05 + (0.9 * i) / (pl-1), 0.85 + dx2, 2, 3 ]




	for j in range ( yAdd ):
		dy = j * 0.5 / yAdd + 0.25 + 0.25 / yAdd
		coord[2*pl+2*j] = [ 0.075, dy, 3, 2 ]
		coord[2*pl+2*j+1] = [ 0.925, dy, 3, 2 ]



	if len(coord) > iPlayers:
		inx = mst.chooseListIndex( coord )
		del coord[ inx ]
	print "IniCoords: %3r" % (coord)
	return coord
Beispiel #11
0
def getNumHiddenCustomMapOptions():
	return 1 + mst.iif( mst.bMars, 0, 1 )
Beispiel #12
0
def getNumCustomMapOptions():
	return 2 + mst.iif( mst.bMars, 0, 1 )
Beispiel #13
0
def getNumHiddenCustomMapOptions():
    return 1 + mst.iif(mst.bMars, 0, 1)
Beispiel #14
0
def getNumCustomMapOptions():
    return 2 + mst.iif(mst.bMars, 0, 1)