God-Emperor
Deity
This thread is for development discussion and "between version" experimental updates.
def onNukeExplosion(self, argsList):
'Nuke Explosion'
pPlot, pNukeUnit = argsList
if (pPlot.isCity()):
pCity = pPlot.getPlotCity()
pSystem = self.getSystemAt(pPlot.getX(), pPlot.getY())
pBestPlanet = pSystem.getPlanetByIndex(getBestPlanetInSystem(pSystem))
pBestPlanet.setDisabled(true)
pBestPlanet.setPopulation(0)
for iBuilding in range(gc.getNumBuildingInfos()):
if pBestPlanet.isHasBuilding(iBuilding):
if (gc.getBuildingInfo(iBuilding).isCapital()):
pPlayer = gc.getPlayer(pCity.getOwner())
if (pPlayer.getNumCities () > 1):
# The following call moves the capitol building, removing it from this city's data
# in the DLL (which is why there is no manual setNumRealBuilding in here)
# and adding it to the new capital city's data in the DLL plus adding it to that system's
# current build planet to get it into the Python planet data.
printd("Nuked: finding new capial system")
pPlayer.findNewCapital()
else :
# This is this civ's only system so we can't move the capitol building to a different one.
# Try to move it to a different planet instead.
printd("Nuked: moving capitol to different planet in same system")
if (pSystem.getBuildingPlanetRing() == pBestPlanet.getOrbitRing()):
# This system's current build ring is the planet being wiped out,
# change it to some other planet and set that planet to have the building
# select the planet as the largest planet (using production as tie breaker)
# that is not the planet being wiped out
aiPlanetList = pSystem.getSizeYieldPlanetIndexList(1) # 1 is production, arbitrarily selected
for iLoopPlanet in range( len(aiPlanetList)):
pLoopPlanet = pSystem.getPlanetByIndex(aiPlanetList[iLoopPlanet][2])
if (pLoopPlanet.getOrbitRing() != pBestPlanet.getOrbitRing()):
pSystem.setBuildingPlanetRing(pLoopPlanet.getOrbitRing())
pLoopPlanet.setHasBuilding(iBuilding, true)
break
else :
pCity.setNumRealBuilding(iBuilding, pCity.getNumRealBuilding(iBuilding)-1)
pBestPlanet.setHasBuilding(iBuilding, false)
if (pBestPlanet.isBonus()): # planet being nuked has a bonus, remove it from the planet and the plot
pBestPlanet.setBonusType(-1)
pPlot.setBonusType(-1)
self.getAI().doCityAIUpdate(pPlot.getPlotCity())
pSystem.updateDisplay()
# Add on-map Star System-based buildings
aiArray = self.getSingleBuildingLocations()
for aiBuildingLocation in aiArray:
iBuildingType = aiBuildingLocation[0]
iRing = aiBuildingLocation[1]
iXMLOverride = gc.getBuildingInfo(iBuildingType).getSingleRingBuildingLocation()
if iXMLOverride != -1:
szBuildingString = "FEATURE_DUMMY_TAG_BUILDING_" + str(iXMLOverride)
else:
szBuildingString = aszBuildingDummyTypes[iRing-1]
szBuilding = gc.getBuildingInfo(iBuildingType).getSystemArtTag()
pPlot.addFeatureDummyModel(szBuildingString, szBuilding)
#XML override (use iRing = 0 to avoid cluttering the real rings, for the Star Fortress)
iXMLOverride = gc.getBuildingInfo(iBuildingType).getSingleRingBuildingLocation()
if iXMLOverride != -1:
iRing = 0
<TradeRouteYieldChanges>
<iYield>1</iYield>
<iYield>0</iYield>
<iYield>-1</iYield>
</TradeRouteYieldChanges>
- If the population of a star system is above the actual limit of how many can
currently work the planets then don't count unhappy citizens over that limit
in the weighting system. They just don't matter because they couldn't do any
work even if they were not unhappy.
Also check to see if the remedy to unhappy population that we use (build a
Sports Arena) is possible by counting them. If we can not currently build
any more then drop the weight to 0 so that we do not mask some other problem
that we could actually do something about.
Also change the wight reduction for each existing sports arena from -10 to
-15 for each.
Note: if specialists are ever implemented, or this is used in a modmod that
has them, then the first change that checks the system's population
limit for planets should not be done.
- Check to see if the remedy to unhealthy population that we use (build a
Recycling Center) is possible by counting them. If we can not currently
build any more then drop the weight to 0 so that we do not mask some other
problem that we could actually do something about.
Also change the wight reduction for each existing recycling center from -10
to -15 for each.
- Likewise for food. If we can't currently build any more Nutrition Facilities
then zero the weight.
Also zero the weight if the current population is above the system's
population limit. If we ahve more population than can work the planets
then we don't need any more food.
Note: If specialists are ever implemented, or this is used in a modmod that
has them, then that 2nd "if population is above the system's population
limit" condition for zeroing the weight should be removed.
This is intended to be part of v1.65 but it works just fine with 1.64 (and probably most earlier versions).
It is an new CvAI.py file. It is based on the one that comes with 1.64, not the experimental one in post #6 above (which I had actually forgotten about and have never tested - partly because my download of it wasn't even in the right folder).
This update should give a small improvement to the AIs behavior in the mid to late game, once its system populations are up at (or over) the limit of the population that can actually work on the planets and it can build the various buildings that it uses to solve health, happiness, and food issues.
#Wrong
for object in range(objects):
#Right
for object in objects:
- PROMOTION_PREDICTIVE_ALGORITHMS added
Predictive Algorithms (button: navigation2.dds from Planetfall)
Requires Trained Officers
Available at Extended Range Systems
Available to light ships, carrier ships, and capital ships
+5% withdraw
+5% strength
+1 first strike chance
+10% attack and defense in asteroid fields
- PROMOTION_IMPROVED_TRACKING_SYSTEM added
Improved Tracking System
(based on Jabie's DEFLECTOR ARRAY in his Part upgrades mod)
Available at Space Exploration Tech
Available to recon ships, light ships, carrier ships, and capital ships
+20% attack and +20% defense in asteroid fields
- PROMOTION_ADVANCED_TRACKING_SYSTEM aded
Advanced Tracking System
(modified from Jabie's IMPROVED DEFELCTOR ARRAY in his Part upgrades mod)
Requires Improved Tracking System
Available at Intuitive Computers (Light Craft Manufacture was rather early)
Available to recon ships, light ships, carrier ships, and capital ships
+30% attack and +10% defense in asteroid fields
double move in asteroid fields
- PROMOTION_WARP_PM added
Warp Phase Modulator (button: Commando from BtS)
(based on Jabie's WARP CONDUITS in his Part upgrades mod)
Requires Upgraded Engines
Available at Space Elevator
Available to recon ships and light ships
can use enemy routes
Some things I'm considering for v1.8.
Part Upgrade adjustments (plus another new one):
The current state of the repair promotions doesn't make much sense to me. A ship repairing itself out to be easier than repairing another ship. It also ought to be easier to heal while moving.
Currently the 3 "x Repair Staff" promotions each give +10% heal to all units in plot, and the Repair Facilities give +10% heal to units in adjacent plots and the ability to heal while moving. This gives a theoretical maximum (with all 4 on one ship) of +30% to all units in same plot and +10% to units in adjacent plots.
The adjusted version, if all 5 are on one ship, gives the ship +20% healing rate for self everywhere, +20% to all units in same plot (including self, for a total of 40%), and +10% to units in adjacent plots and the ability to heal while moving. This would actually be 10% more healing for itself and 10% less healing for other units on the same plot, but it would require 1 more part upgrade. I expect very few ships would get all 5.
So:
Change the "x Repair Staff" promotions from healing all in plot to just the unit itself (mostly).
Rename them from "x Repair Staff" to "x Damage Control" (not really necessary, but it sounds better to me).
Change the existing Repair Facilities to remove repair while moving and give +10% to units in same plot (not adjacent). It would no longer require the 3 Repair Staff part upgrades, probably just upgraded weapons or armor.
Add 2nd level Repair Facilities (Improved Repair Facilities) for another +5% in same plot, +10% in adjacent.
Starbases would be adjusted to start with Upgraded Damage Control and Repair Facilites for free.
This makes it look like this:
Upgraded Damage Control
+10% heal in friendly/neutral/enemy territory
Improved Damage Control
+5% heal in friendly/neutral/enemy territory
can heal while moving
Advanced Damage Control
+5% heal in friendly/neutral/enemy territory
heals units in same plot +5%
Repair Facilities - now only requires Upgraded Weapons or Upgraded Armor
heal units in same plot +10%
Improved Repair Facilities - new part upgrade, req. Repair Facilities, available at Terrestrial Networking (?)
heal units in same plot +5%
heal units in adjacent plot +10%
In addition to this possible set of changes, I have already added 4 promotions to the SVN:
Code:
- PROMOTION_PREDICTIVE_ALGORITHMS added
Predictive Algorithms (button: navigation2.dds from Planetfall)
Requires Trained Officers
Available at Extended Range Systems
Available to light ships, carrier ships, and capital ships
+5% withdraw
+5% strength
+1 first strike chance
+10% attack and defense in asteroid fields
- PROMOTION_IMPROVED_TRACKING_SYSTEM added
Improved Tracking System
(based on Jabie's DEFLECTOR ARRAY in his Part upgrades mod)
Available at Space Exploration Tech
Available to recon ships, light ships, carrier ships, and capital ships
+20% attack and +20% defense in asteroid fields
- PROMOTION_ADVANCED_TRACKING_SYSTEM aded
Advanced Tracking System
(modified from Jabie's IMPROVED DEFELCTOR ARRAY in his Part upgrades mod)
Requires Improved Tracking System
Available at Intuitive Computers (Light Craft Manufacture was rather early)
Available to recon ships, light ships, carrier ships, and capital ships
+30% attack and +10% defense in asteroid fields
double move in asteroid fields
- PROMOTION_WARP_PM added
Warp Phase Modulator (button: Commando from BtS)
(based on Jabie's WARP CONDUITS in his Part upgrades mod)
Requires Upgraded Engines
Available at Space Elevator
Available to recon ships and light ships
can use enemy routes
Some things I'm considering for v1.8.
Part Upgrade adjustments (plus another new one):
The current state of the repair promotions doesn't make much sense to me. A ship repairing itself out to be easier than repairing another ship. It also ought to be easier to heal while moving.
Currently the 3 "x Repair Staff" promotions each give +10% heal to all units in plot, and the Repair Facilities give +10% heal to units in adjacent plots and the ability to heal while moving. This gives a theoretical maximum (with all 4 on one ship) of +30% to all units in same plot and +10% to units in adjacent plots.
The adjusted version, if all 5 are on one ship, gives the ship +20% healing rate for self everywhere, +20% to all units in same plot (including self, for a total of 40%), and +10% to units in adjacent plots and the ability to heal while moving. This would actually be 10% more healing for itself and 10% less healing for other units on the same plot, but it would require 1 more part upgrade. I expect very few ships would get all 5.
So:
This makes it look like this:
- Change the "x Repair Staff" promotions from healing all in plot to just the unit itself (mostly).
- Rename them from "x Repair Staff" to "x Damage Control" (not really necessary, but it sounds better to me).
- Change the existing Repair Facilities to remove repair while moving and give +10% to units in same plot (not adjacent). It would no longer require the 3 Repair Staff part upgrades, probably just upgraded weapons or armor.
- Add 2nd level Repair Facilities (Improved Repair Facilities) for another +5% in same plot, +10% in adjacent.
- Starbases would be adjusted to start with Upgraded Damage Control and Repair Facilites for free.
- Upgraded Damage Control
+10% heal in friendly/neutral/enemy territory
- Improved Damage Control
+5% heal in friendly/neutral/enemy territory
can heal while moving
- Advanced Damage Control
+5% heal in friendly/neutral/enemy territory
heals units in same plot +5%
- Repair Facilities - now only requires Upgraded Weapons or Upgraded Armor
heal units in same plot +10%
- Improved Repair Facilities - new part upgrade, req. Repair Facilities, available at Terrestrial Networking (?)
heal units in same plot +5%
heal units in adjacent plot +10%
In addition to this possible set of changes, I have already added 4 promotions to the SVN:
Code:- PROMOTION_PREDICTIVE_ALGORITHMS added Predictive Algorithms (button: navigation2.dds from Planetfall) Requires Trained Officers Available at Extended Range Systems Available to light ships, carrier ships, and capital ships +5% withdraw +5% strength +1 first strike chance +10% attack and defense in asteroid fields - PROMOTION_IMPROVED_TRACKING_SYSTEM added Improved Tracking System (based on Jabie's DEFLECTOR ARRAY in his Part upgrades mod) Available at Space Exploration Tech Available to recon ships, light ships, carrier ships, and capital ships +20% attack and +20% defense in asteroid fields - PROMOTION_ADVANCED_TRACKING_SYSTEM aded Advanced Tracking System (modified from Jabie's IMPROVED DEFELCTOR ARRAY in his Part upgrades mod) Requires Improved Tracking System Available at Intuitive Computers (Light Craft Manufacture was rather early) Available to recon ships, light ships, carrier ships, and capital ships +30% attack and +10% defense in asteroid fields double move in asteroid fields - PROMOTION_WARP_PM added Warp Phase Modulator (button: Commando from BtS) (based on Jabie's WARP CONDUITS in his Part upgrades mod) Requires Upgraded Engines Available at Space Elevator Available to recon ships and light ships can use enemy routes
Here's an opportunity for opinions on more things being considered for 1.8.
Last post it was promotions. This time we get buildings. Bunches of buildings.
Early in the life of a new colony it has issues with low production and influence. Therefore I plan to add a new relatively cheap building to give a little boost. Enough to be useful when a star system has a low population, but low enough to be nearly irrelevant in a well developed star system. I also don't think it should be available at the start of the game, so the initial parts of the game are unchanged. Therefore...
Precision Instruments Maker
- one per star system
- +1 production, +1 commerce, +1 influence
- cost 30
- prereq tech of TECH_MISC_0 (Vacuum Engineering) (?)
- maybe obsolete with TECH_INDUSTRY_10 (Advanced Nanite Construction)
A little production to speed up everything after it, plus some influence to get the borders popped for access to the outer planet zones quicker. The commerce is more or less just an add-on and not really a vital part of it. This is a lot cheaper than building a second mine (since you get one for free, the the first one you actually build is really the second one and gets the higher cost for repeating buildings) and can be started, maybe finished, before the population grows to a second planet, but the bonus is a flat +1, not +1 per population. (The name came to me during my first game with the Caveman to Cosmos mod when I initially misread the "Percussion Instrument Maker" and wondered just how precise of an instrument a caveman could make.)
And a bigger thing. I'm considering expanding the buildings related to the resources, at least the planetary resources.
Each planetary resource would get a 2nd building which requires the first and is only available after some early-to-mid-game tech, possibly Domestic Development but perhaps something a little later (maybe Space Elevator).
Each would cost something like 100 (the current resource buildings are set to a cost of 50, so double that cost but still not very expensive considering the benefits).
The specific buildings would be something like this:
Grain allows: Agricultural Center
Note: this is a flat bonus, not per population, to even out the variations from planet size. The same is true for all these buildings' yield bonuses.
- requires Farm on the planet
- +2 food, +1 commerce
- +1 trade route
- +1 population limit
Cattle allows: Cattleman's Association
- requires Ranch on the planet
- +1 food, +1 production, +1 commerce
- +1 trade route
- +1 population limit
Seafood allows: Aquaculture Bureau
- requires Harbor on the planet
- +1 food, +2 commerce
- +1 trade route
- +1 population limit
Cotton allows: Textile Industry
- requires Cotton Mill on the planet
- +3 commerce
- +25% trade route yield
Spices allows: Spice Merchant Network
- requires Plantation on the planet
- +2 commerce
- +1 trade route
- +25% trade route yield
Wine allows: Vintners' Association
- requires Winery on the planet
- +3 commerce, +1 influence
- +25% trade route yield
The 2nd buildings for the luxury resources could (but probably won't) also allow a +1 population since the presence of non-food plants from Earth would still indicate that the planet has a relatively good environment for the descendants of Earth.
I might also adjust the names of the existing buildings to indicate that they are not a single thing ("Farm", "Ranch", etc.), but an entire system or network of such things ("Farming Industry", "Ranching Industry", etc.).
And now an even more drastic addition:
Buildings that can be built in any system that has access to the resource while they are being built. One per resource (planetary and not, maybe) and only 1 of each in a system (for simplicity and balance). These should be a little more expensive, perhaps 120 or 150 , and probably only available after some mid-game tech like Space Elevator or Environmentalism.
Access to Grain allows: Local Farms
- requires Grain resource to build
- one per star system
- can not build on planet with Farm
- +1 food
- +1 population limit
- +1 health
Access to Cattle allows: Local Ranches
- requires Cattle resource to build
- one per star system
- can not build on planet with Ranch
- +1 food
- +1 population limit
- +1 health
Access to Seafood allows: Local Fishfarms
- requires Seafood resource to build
- one per star system
- can not build on planet with Harbor
- +1 food
- +1 population limit
- +1 health
Access to Cotton allows: Local Cotton Mill
- requires Cotton resource to build
- one per star system
- can not build on planet with Cotton Mill
- +1 commerce/population
- +1 happy
Access to Spices allows: Local Plantations
- requires Spices resource to build
- one per star system
- can not build on planet with Plantation
- +1 commerce/population
- +1 happy
Access to Wine allows: Local Vinyards
- requires Wine resource to build
- one per star system
- can not build on planet with Winery
- +1 commerce/population
- +1 happy
Similarly, the non-planetary resources could allow buildings. I'm not sure that it makes sense, though. The planetary resources are all biological and the local buildings represent keeping a local stock of animals or growing plants locally, presumably in specialized buildings of some sort to provide the proper environment. But the non-planetary resources are not things that you can grow, they are things that are mined or otherwise extracted. If the supply for these is cut off, the building should stop working. There is no such functionality at this time, so it would need to be added to the DLL and I'm not sure it is currently worth the effort.
Anyhow, a possible set of non-planetary resource buildings. Their cost would probably be the same as the planetary resource type. The tech they become available would probably be the same or close as well - possibly Industrialism.
Access to Oil allows: Oil Refinery
- requires Oil
- one per star system
- +1 production, +5% military unit production
Access to Titanium allows: Titanium Purification Plant
- requires Titanium
- one per star system
- +1 production, +1 research
Access to Iron allows: Iron Smelter
- requires Iron
- one per star system
- +2 production
Access to Hydrogen allows: Hydrogen Liquifier
- requires Hydrogen
- one per star system
- +1 production, +1 commerce
Access to Uranium allows: Uranium Enrichment Plant
- requires Uranium
- one per star system
- +1 production, +1 production at TECH_INDUSTRY_10 (Advanced Nanite Construction)
Access to Crystals allows: Jeweler
- requires Crystals
- one per star system
- +1 commerce
Access to Gold allows: Goldsmith
- requires Gold
- one per star system
- +1 commerce
Access to Water allows: Water Purification Plant
- requires Water
- one per star system
- +1 food
Access to Oxygen allows: Oxygen Extractor
- requires Oxygen
- one per star system
- +1 production
These non-planetary resource buildings have a low probability of being added, at least for 1.8.