def BuildSatts(PlanetList, TechList, FleetList, IdealPlanet, i, n): CrystalCost = 2000 * n / IdealPlanet[0].ResScaleFactor DeutCost = 500 * n / IdealPlanet[0].ResScaleFactor TotalMetal, TotalCrystal, TotalDeut = TotalRes(PlanetList, IdealPlanet) if TotalDeut > 0: if TotalCrystal >= CrystalCost and TotalDeut >= DeutCost and ( PlanetList[i].Resource[1] < CrystalCost or PlanetList[i].Resource[2] < DeutCost ) and PlanetList[i].Shipyard >= 1: CrystalCost -= PlanetList[i].Resource[1] DeutCost -= PlanetList[i].Resource[2] if CrystalCost < 0: CrystalCost = 0 if DeutCost < 0: DeutCost = 0 if CrystalCost > 0 or DeutCost > 0: CheckToMove(PlanetList, TechList, FleetList, IdealPlanet, 0, CrystalCost, DeutCost, i) if PlanetList[i].Resource[1] > CrystalCost and PlanetList[i].Resource[ 2] > DeutCost and PlanetList[i].Shipyard >= 1: print "Built " + str(n) + " Solar Satellites on Planet " + str(i) PlanetList[i].Resource[2] -= DeutCost PlanetList[i].Resource[1] -= CrystalCost PlanetList[i].Satellites += n calcenergy(PlanetList, TechList, FleetList, IdealPlanet, i) IdealPlanet[0].WaitingFlag = 0 else: if IdealPlanet[0].WaitingFlag == 0 and PlanetList[i].Shipyard >= 1: print "Flagged Satts" IdealPlanet[0].WaitingFlag = 1 IdealPlanet[0].WaitingMetal = 0 IdealPlanet[0].WaitingCrystal = CrystalCost IdealPlanet[0].WaitingDeut = DeutCost if PlanetList[i].Shipyard < 1: IdealPlanet[0].Shipyard = 1
def CheckUpSolar(PlanetList, TechList, FleetList, IdealPlanet, i): MetalCost = 75 * 1.5**PlanetList[i].SolarPlant / IdealPlanet[ 0].ResScaleFactor CrystalCost = 30 * 1.5**PlanetList[i].SolarPlant / IdealPlanet[ 0].ResScaleFactor checkupstores(PlanetList, TechList, IdealPlanet, FleetList, MetalCost, CrystalCost, 0, i) TotalMetal, TotalCrystal, TotalDeut = TotalRes(PlanetList, IdealPlanet) CheckToMove(PlanetList, TechList, FleetList, IdealPlanet, MetalCost, CrystalCost, 0, i) if PlanetList[i].Resource[0] >= MetalCost and PlanetList[i].Resource[ 1] >= CrystalCost: print "Built Solar Plant Level " + str( PlanetList[i].SolarPlant + 1) + " on Planet " + str(i) + "!" PlanetList[i].Resource[0] -= MetalCost PlanetList[i].Resource[1] -= CrystalCost PlanetList[i].SolarPlant += 1 calcenergy(PlanetList, TechList, FleetList, IdealPlanet, i) IdealPlanet[0].WaitingFlag = 0 else: if IdealPlanet[0].WaitingFlag == 0: print "Flagged Solar" IdealPlanet[0].WaitingFlag = 1 IdealPlanet[0].WaitingMetal = MetalCost IdealPlanet[0].WaitingCrystal = CrystalCost IdealPlanet[0].WaitingDeut = 0
def CheckUpAstrophysics(PlanetList, FleetList, IdealPlanet, TechList): MetalCost = 100 * round( 40 * 1.75**TechList[0].Astrophysics) / IdealPlanet[0].ResScaleFactor CrystalCost = 100 * round( 80 * 1.75**TechList[0].Astrophysics) / IdealPlanet[0].ResScaleFactor DeutCost = 100 * round( 40 * 1.75**TechList[0].Astrophysics) / IdealPlanet[0].ResScaleFactor TMetal, TCrystal, TDeut = TotalRes(PlanetList, IdealPlanet) if TMetal >= MetalCost and TCrystal >= CrystalCost and TDeut >= DeutCost and PlanetList[ 0].ResearchLab >= 3: CheckToMove(PlanetList, TechList, FleetList, IdealPlanet, MetalCost, CrystalCost, DeutCost, 0) print "Consolidated resources!" else: if IdealPlanet[0].WaitingFlag == 0 and TCrystal >= 0.8 * CrystalCost: IdealPlanet[0].WaitingFlag = 1 IdealPlanet[0].WaitingMetal = MetalCost IdealPlanet[0].WaitingCrystal = CrystalCost IdealPlanet[0].WaitingDeut = DeutCost if PlanetList[0].Resource[0] >= MetalCost and PlanetList[0].Resource[ 1] >= CrystalCost and PlanetList[0].Resource[ 2] >= DeutCost and PlanetList[0].ResearchLab >= 3: IdealPlanet[0].WaitingFlag = 0 print "Found Planet was enough for astro!" print "Researched Astrophysics level " + str(TechList[0].Astrophysics + 1) + "!" PlanetList[0].Resource[0] -= MetalCost PlanetList[0].Resource[1] -= CrystalCost PlanetList[0].Resource[2] -= DeutCost TechList[0].Astrophysics += 1 IdealPlanet[0].WaitingFlag = 0
def CheckRocketLaunchers(PlanetList, TechList, FleetList, IdealPlanet, i): if PlanetList[i].Shipyard == 0: checkupshipyard(PlanetList, TechList, FleetList, IdealPlanet, i) else: TMetal, TCrystal, TDeut = TotalRes(PlanetList) if PlanetList[i].RocketLauncher < IdealPlanet[0].RocketLauncher: Rockets = IdealPlanet[0].RocketLauncher - PlanetList[ i].RocketLauncher RocketCost = Rockets * 2000 if RocketCost > PlanetList[i].Resource[0]: CheckToMove(PlanetList, TechList, FleetList, RocketCost, 0, 0, i) if RocketCost < PlanetList[i].Resource[0]: PlanetList[i].RocketLauncher += Rockets PlanetList[i].Resource[0] -= 2000 * Rockets print "Built " + str( Rockets) + " Rocket Launchers on Planet " + str(i) + "!" IdealPlanet[0].WaitingFlag = 0 else: IdealPlanet[0].WaitingFlag = 1 IdealPlanet[0].WaitingMetal = RocketCost IdealPlanet[0].WaitingCrystal = 0 IdealPlanet[0].WaitingDeut = 0 elif (PlanetList[i].Resource[0] > (0.6 * PlanetList[i].MetalCap) and (PlanetList[i].Resource[1] < (0.3 * PlanetList[i].CrystalCap) or PlanetList[i].Resource[2] < (0.3 * PlanetList[i].DeuteriumCap)) ) or PlanetList[i].Resource[0] > (0.80 * PlanetList[i].MetalCap): Rockets = int(PlanetList[i].Resource[0] / 4000) PlanetList[i].RocketLauncher += Rockets PlanetList[i].Resource[0] -= 2000 * Rockets print "Built " + str( Rockets) + " Rocket Launchers on Planet " + str(i) + "!"
def CheckUpMissileSilo(PlanetList, TechList, FleetList, IdealPlanet, i): MetalCost = 20000 * 2**PlanetList[i].MissileSilo CrystalCost = 20000 * 2**PlanetList[i].MissileSilo DeutCost = 1000 * 2**PlanetList[i].MissileSilo checkupstores(PlanetList, TechList, IdealPlanet, FleetList, MetalCost, CrystalCost, DeutCost, i) CheckToMove(PlanetList, TechList, FleetList, IdealPlanet, MetalCost, CrystalCost, DeutCost, i) if PlanetList[i].Resource[0] >= MetalCost and PlanetList[i].Resource[ 1] >= CrystalCost and PlanetList[i].Resource[2] >= DeutCost: print "Built Missile Silo Level " + str( PlanetList[i].MissileSilo + 1) + " on Planet " + str(i) + "!" PlanetList[i].Resource[0] -= MetalCost PlanetList[i].Resource[1] -= CrystalCost PlanetList[i].Resource[2] -= DeutCost PlanetList[i].MissileSilo += 1
def CheckUpTerraformer(PlanetList, TechList, FleetList, IdealPlanet, i): CrystalCost = 50000 * 2**PlanetList[i].Terraformer DeutCost = 100000 * 2**PlanetList[i].Terraformer EnergyCost = 1000 * 2**PlanetList[i].Terraformer checkupstores(PlanetList, TechList, IdealPlanet, FleetList, 0, CrystalCost, DeutCost, i) CheckToMove(PlanetList, TechList, FleetList, IdealPlanet, 0, CrystalCost, DeutCost, i) if PlanetList[i].Resource[1] >= CrystalCost and PlanetList[i].Resource[ 2] >= DeutCost and PlanetList[ i].EnergyProd >= EnergyCost and PlanetList[ i].Nanites >= 1 and TechList[0].Computer >= 12: print "Built Terraformer Level " + str( PlanetList[i].Terraformer + 1) + " on Planet " + str(i) + "!" PlanetList[i].Resource[1] -= CrystalCost PlanetList[i].Resource[2] -= DeutCost PlanetList[i].Terraformer += 1
def CheckUpCombustion(PlanetList, FleetList, TechList, IdealPlanet): TMetal, TCrystal, TDeut = TotalRes(PlanetList, IdealPlanet) MetalCost = 400 * 2**TechList[0].CombustionDrive / IdealPlanet[ 0].ResScaleFactor DeutCost = 600 * 2**TechList[0].CombustionDrive / IdealPlanet[ 0].ResScaleFactor if TMetal >= MetalCost and TDeut >= DeutCost and PlanetList[ 0].ResearchLab >= 1 and TechList[0].CombustionDrive >= 2 and ( PlanetList[0].Resource[0] < MetalCost or PlanetList[0].Resource[2] < DeutCost): CheckToMove(PlanetList, TechList, FleetList, IdealPlanet, MetalCost, 0, DeutCost, 0) print "Consolidated resources!" if PlanetList[0].Resource[0] > MetalCost and PlanetList[0].Resource[ 2] > DeutCost: print "Researched Combustion Drive level " + str( TechList[0].CombustionDrive + 1) + " on planet 1!" PlanetList[0].Resource[0] -= MetalCost PlanetList[0].Resource[2] -= DeutCost TechList[0].CombustionDrive += 1
def CheckUpFusion(PlanetList, TechList, FleetList, IdealPlanet, i): TotalMetal, TotalCrystal, TotalDeut = TotalRes(PlanetList, IdealPlanet) if PlanetList[i].DeuteriumMine >= 5 and TechList[0].Energy >= 3: MetalCost = 900 * 1.8**PlanetList[i].FusionPlant / IdealPlanet[ 0].ResScaleFactor CrystalCost = 360 * 1.8**PlanetList[i].FusionPlant / IdealPlanet[ 0].ResScaleFactor DeutCost = 180 * 1.8**PlanetList[i].FusionPlant / IdealPlanet[ 0].ResScaleFactor checkupstores(PlanetList, TechList, IdealPlanet, FleetList, MetalCost, CrystalCost, DeutCost, i) CheckToMove(PlanetList, TechList, FleetList, IdealPlanet, MetalCost, CrystalCost, DeutCost, i) if PlanetList[i].Resource[0] >= MetalCost and PlanetList[i].Resource[ 1] >= CrystalCost and PlanetList[i].Resource[2] >= DeutCost: print "Built Fusion Plant Level " + str( PlanetList[i].FusionPlant + 1) + " on Planet " + str(i) + "!" PlanetList[i].Resource[0] -= MetalCost PlanetList[i].Resource[1] -= CrystalCost PlanetList[i].Resource[2] -= DeutCost PlanetList[i].FusionPlant += 1 calcenergy(PlanetList, TechList, FleetList, IdealPlanet, i) IdealPlanet[0].WaitingFlag = 0 else: if IdealPlanet[0].WaitingFlag == 0: print "Flagged Fusion" IdealPlanet[0].WaitingFlag = 1 IdealPlanet[0].WaitingMetal = MetalCost IdealPlanet[0].WaitingCrystal = CrystalCost IdealPlanet[0].WaitingDeut = DeutCost else: if PlanetList[i].DeuteriumMine < 5 and IdealPlanet[0].DeuteriumMine < 5: IdealPlanet[0].DeuteriumMine = 5 if PlanetList[i].DeuteriumMine < 5 and IdealPlanet[ 0].DeuteriumMine >= 5: CheckUpDeut(PlanetList, TechList, FleetList, IdealPlanet, i) if TechList[0].Energy < 3: TechList[1].Energy = 3
def CheckUpNanites(PlanetList, TechList, FleetList, IdealPlanet, i): MetalCost = 1000000 * 2**PlanetList[i].Nanites CrystalCost = 500000 * 2**PlanetList[i].Nanites DeutCost = 100000 * 2**PlanetList[1].Nanites if PlanetList[i].Robots == 10 and TechLst[0].Computer >= 10: checkupstores(PlanetList, TechList, IdealPlanet, FleetList, MetalCost, CrystalCost, DeutCost, i) CheckToMove(PlanetList, TechList, FleetList, IdealPlanet, MetalCost, CrystalCost, 0, i) if PlanetList[i].Resource[0] >= MetalCost and PlanetList[i].Resource[ 1] >= CrystalCost and PlanetList[i].Resource[2] >= DeutCost: print "Built Nanites Level " + str( PlanetList[i].Nanites + 1) + " on Planet " + str(i) + "!" PlanetList[i].Resource[0] -= MetalCost PlanetList[i].Resource[1] -= CrystalCost PlanetList[i].Resource[2] -= DeutCost PlanetList[i].Nanites += 1 else: print "Flagged Nanites" IdealPlanet[0].WaitingFlag = 1 IdealPlanet[0].WaitingMetal = MetalCost IdealPlanet[0].WaitingCrystal = CrystalCost IdealPlanet[0].WaitingDeut = DeutCost
def CheckUpDeut(PlanetList, TechList, FleetList, IdealPlanet, i): MetalCost = 225 * 1.5**PlanetList[i].DeuteriumMine / IdealPlanet[ 0].ResScaleFactor CrystalCost = 75 * 1.5**PlanetList[i].DeuteriumMine / IdealPlanet[ 0].ResScaleFactor SparePower = PlanetList[i].EnergyProd - PlanetList[i].EnergyUsed + 10 PowerBoost = 10 * (PlanetList[i].DeuteriumMine + 1) * 1.1**( PlanetList[i].DeuteriumMine + 1 ) - 10 * PlanetList[i].DeuteriumMine * 1.1**PlanetList[i].DeuteriumMine checkupstores(PlanetList, TechList, IdealPlanet, FleetList, MetalCost, CrystalCost, 0, i) if SparePower > PowerBoost: CheckToMove(PlanetList, TechList, FleetList, IdealPlanet, MetalCost, CrystalCost, 0, i) if PlanetList[i].Resource[0] > MetalCost and PlanetList[i].Resource[ 1] > CrystalCost: print "Built Deuterium Mine Level " + str( PlanetList[i].DeuteriumMine + 1) + " on Planet " + str(i) + "!" PlanetList[i].Resource[0] -= MetalCost PlanetList[i].Resource[1] -= CrystalCost PlanetList[i].EnergyUsed += PowerBoost PlanetList[i].DeuteriumMine += 2 PlanetList[i].Prod[2] = unispeed * ( 20 * PlanetList[i].DeuteriumMine * 1.1**PlanetList[i].DeuteriumMine) IdealPlanet[0].WaitingFlag = 0 else: if IdealPlanet[0].WaitingFlag == 0: print "Flagged DM" IdealPlanet[0].WaitingFlag = 1 IdealPlanet[0].WaitingMetal = MetalCost IdealPlanet[0].WaitingCrystal = CrystalCost IdealPlanet[0].WaitingDeut = 0 else: CheckUpPower(PlanetList, TechList, FleetList, IdealPlanet, i, PowerBoost - SparePower)
def checkupstores(PlanetList, TechList, IdealPlanet, FleetList, Metal, Crystal, Deut, i): calcstores(PlanetList, TechList, FleetList, IdealPlanet) if Metal >= PlanetList[i].MetalCap - PlanetList[i].Prod[0] / 60: TMetal, TCrystal, TDeut = TotalRes(PlanetList, IdealPlanet) MetalCost = 1000 * 2**PlanetList[i].MetalStorage / IdealPlanet[ 0].ResScaleFactor CheckToMove(PlanetList, TechList, FleetList, IdealPlanet, MetalCost, 0, 0, i) if PlanetList[i].Resource[0] >= MetalCost: print "Built Metal Storage Level " + str( PlanetList[i].MetalStorage + 1) + " on Planet " + str(i) + "!" PlanetList[i].Resource[0] -= MetalCost PlanetList[i].MetalStorage += 1 IdealPlanet[0].WaitingFlag = 0 else: if IdealPlanet[0].WaitingFlag == 0: IdealPlanet[0].WaitingFlag = 1 IdealPlanet[0].WaitingMetal = MetalCost if Crystal >= PlanetList[i].CrystalCap - PlanetList[i].Prod[1] / 60: TMetal, TCrystal, TDeut = TotalRes(PlanetList, IdealPlanet) MetalCost = 1000 * 2**PlanetList[i].CrystalStorage / IdealPlanet[ 0].ResScaleFactor CrystalCost = 500 * 2**PlanetList[i].CrystalStorage / IdealPlanet[ 0].ResScaleFactor CheckToMove(PlanetList, TechList, FleetList, IdealPlanet, MetalCost, CrystalCost, 0, i) if PlanetList[i].Resource[0] >= MetalCost and PlanetList[i].Resource[ 1] >= CrystalCost: print "Built Crystal Storage Level " + str( PlanetList[i].CrystalStorage + 1) + " on Planet " + str(i) + "!" PlanetList[i].Resource[0] -= MetalCost PlanetList[i].Resource[1] -= CrystalCost PlanetList[i].CrystalStorage += 1 IdealPlanet[0].WaitingFlag = 0 else: if IdealPlanet[0].WaitingFlag == 0: IdealPlanet[0].WaitingFlag = 1 IdealPlanet[0].WaitingMetal = MetalCost IdealPlanet[0].WaitingCrystal = CrystalCost if Deut >= PlanetList[i].DeuteriumCap - PlanetList[i].Prod[2] / 60: TMetal, TCrystal, TDeut = TotalRes(PlanetList, IdealPlanet) MetalCost = 1000 * 2**PlanetList[i].CrystalStorage / IdealPlanet[ 0].ResScaleFactor CrystalCost = 1000 * 2**PlanetList[i].CrystalStorage / IdealPlanet[ 0].ResScaleFactor CheckToMove(PlanetList, TechList, FleetList, IdealPlanet, MetalCost, CrystalCost, 0, i) if PlanetList[i].Resource[0] >= MetalCost and PlanetList[i].Resource[ 1] >= CrystalCost: print "Built Deuterium Storage Level " + str( PlanetList[i].DeuteriumStorage + 1) + " on Planet " + str(i) + "!" PlanetList[i].Resource[0] -= MetalCost PlanetList[i].Resource[1] -= CrystalCost PlanetList[i].DeuteriumStorage += 1 IdealPlanet[0].WaitingFlag = 0 else: if IdealPlanet[0].WaitingFlag == 0: IdealPlanet[0].WaitingFlag = 1 IdealPlanet[0].WaitingMetal = MetalCost IdealPlanet[0].WaitingCrystal = CrystalCost calcstores(PlanetList, TechList, FleetList, IdealPlanet)