From: <dil...@us...> - 2013-07-10 03:22:33
|
Revision: 6229 http://sourceforge.net/p/freeorion/code/6229 Author: dilvish-fo Date: 2013-07-10 03:22:29 +0000 (Wed, 10 Jul 2013) Log Message: ----------- AI tweaks Modified Paths: -------------- trunk/FreeOrion/default/AI/ColonisationAI.py trunk/FreeOrion/default/AI/ResearchAI.py trunk/FreeOrion/default/AI/TechsListsAI.py Modified: trunk/FreeOrion/default/AI/ColonisationAI.py =================================================================== --- trunk/FreeOrion/default/AI/ColonisationAI.py 2013-07-08 16:48:59 UTC (rev 6228) +++ trunk/FreeOrion/default/AI/ColonisationAI.py 2013-07-10 03:22:29 UTC (rev 6229) @@ -28,6 +28,7 @@ annexablePlanetIDs=set([]) curBestMilShipRating = 20 allColonyOpportunities = {} +gotRuins=False environs = { str(fo.planetEnvironment.uninhabitable): 0, str(fo.planetEnvironment.hostile): 1, str(fo.planetEnvironment.poor): 2, str(fo.planetEnvironment.adequate): 3, str(fo.planetEnvironment.good):4 } @@ -69,7 +70,7 @@ allColonyOpportunities.clear() def getColonyFleets(): - global curBestMilShipRating + global curBestMilShipRating, gotRuins curBestMilShipRating = ProductionAI.curBestMilShipRating() @@ -186,6 +187,8 @@ planet=universe.getPlanet(pid) if planet: AIstate.colonizedSystems.setdefault(planet.systemID, []).append(pid) # track these to plan Solar Generators and Singularity Generators, etc. + if "ANCIENT_RUINS_SPECIAL" in planet.specials: + gotRuins = True AIstate.empireStars.clear() for sysID in AIstate.colonizedSystems: system = universe.getSystem(sysID) @@ -588,11 +591,12 @@ fixedRes += discountMultiplier*2*3 detail.append( "ECCENTRIC_ORBIT_SPECIAL %.1f"%(discountMultiplier*2*3 ) ) - if ( "ANCIENT_RUINS_SPECIAL" in planet.specials ): #TODO: add value for depleted ancient ruins - retval += discountMultiplier*20 - detail.append("Undepleted Ruins %.1f"%discountMultiplier*20) + if (missionType == AIFleetMissionType.FLEET_MISSION_OUTPOST ): - if (missionType == AIFleetMissionType.FLEET_MISSION_OUTPOST ): + if ( "ANCIENT_RUINS_SPECIAL" in planet.specials ): #TODO: add value for depleted ancient ruins + retval += discountMultiplier*30 + detail.append("Undepleted Ruins %.1f"%discountMultiplier*30) + for special in planetSpecials: nestVal = 0 if "_NEST_" in special: @@ -665,6 +669,11 @@ else: #colonization mission if not species: return 0 + + if ( "ANCIENT_RUINS_SPECIAL" in planet.specials ): #TODO: add value for depleted ancient ruins + retval += discountMultiplier*50 + detail.append("Undepleted Ruins %.1f"%discountMultiplier*50) + popTagMod = 1.0 indTagMod = 1.0 resTagMod = 1.0 Modified: trunk/FreeOrion/default/AI/ResearchAI.py =================================================================== --- trunk/FreeOrion/default/AI/ResearchAI.py 2013-07-08 16:48:59 UTC (rev 6228) +++ trunk/FreeOrion/default/AI/ResearchAI.py 2013-07-10 03:22:29 UTC (rev 6229) @@ -184,12 +184,34 @@ elif fo.currentTurn() >100: generateDefaultResearchOrders() - #researchQueueList = getResearchQueueTechs() + researchQueueList = getResearchQueueTechs() if fo.currentTurn() >50 and len (AIstate.empireStars.get(fo.starType.blackHole, []))!=0 and foAI.foAIstate.aggression > fo.aggression.cautious: for singTech in [ "CON_ARCH_PSYCH", "CON_CONC_CAMP", "LRN_GRAVITONICS" , "PRO_SINGULAR_GEN"]: if (empire.getTechStatus(singTech) != fo.techStatus.complete) and ( singTech not in researchQueueList[:4]) : res=fo.issueEnqueueTechOrder(singTech,0) print "have a black hole star outpost/colony, so attempted to fast-track %s, got result %d"%(singTech, res) + researchQueueList = getResearchQueueTechs() + + if ColonisationAI.gotRuins: + if empire.getTechStatus("LRN_XENOARCH") != fo.techStatus.complete and "LRN_XENOARCH" not in researchQueueList[:4]: + for xenoTech in [ "LRN_XENOARCH", "LRN_TRANSLING_THT", "LRN_PHYS_BRAIN" , "LRN_ALGO_ELEGANCE"]: + if (empire.getTechStatus(xenoTech) != fo.techStatus.complete) and ( xenoTech not in researchQueueList[:4]) : + res=fo.issueEnqueueTechOrder(xenoTech,0) + print "ANCIENT_RUINS: have an ancient ruins, so attempted to fast-track %s to enable LRN_XENOARCH, got result %d"%(xenoTech, res) + + if empire.getTechStatus("SHP_WEAPON_4_1" ) == fo.techStatus.complete: + thisTech=fo.getTech("SHP_WEAPON_4_1") + if thisTech: + missingPrereqs = [preReq for preReq in thisTech.recursivePrerequisites(empireID) if preReq in researchQueueList] + if len(missingPrereqs) > 2 : + for preReq in sorted(missingPrereqs, reverse=True)[2:]: #leave plasma 4 and 3 + if preReq not in researchQueueList: + break + res = fo.issueDequeueTechOrder(preReq) + researchQueueList = getResearchQueueTechs() + if "SHP_WEAPON_4_2" in researchQueueList: #(should be) + idx = researchQueueList.index("SHP_WEAPON_4_2") + res=fo.issueEnqueueTechOrder("SHP_WEAPON_4_2", max(0, idx-15) ) def generateResearchOrders_old(): "generate research orders" Modified: trunk/FreeOrion/default/AI/TechsListsAI.py =================================================================== --- trunk/FreeOrion/default/AI/TechsListsAI.py 2013-07-08 16:48:59 UTC (rev 6228) +++ trunk/FreeOrion/default/AI/TechsListsAI.py 2013-07-10 03:22:29 UTC (rev 6229) @@ -100,8 +100,8 @@ "SHP_BIOADAPTIVE_SPEC", "PRO_SINGULAR_GEN", "CON_NDIM_STRC", + "GRO_XENO_HYBRIDS", "SHP_PLASMA_SHIELD", - "GRO_XENO_HYBRIDS", "SHP_CONT_BIOADAPT", "SHP_SENT_HULL", "LRN_TIME_MECH", @@ -214,8 +214,8 @@ "SHP_MONOCELL_EXP", "SHP_BIOADAPTIVE_SPEC", "PRO_SINGULAR_GEN", + "GRO_XENO_HYBRIDS", "SHP_PLASMA_SHIELD", - "GRO_XENO_HYBRIDS", "SHP_CONT_BIOADAPT", "SHP_SENT_HULL", "LRN_TIME_MECH", |