Resource icon

Andromeda Unit / Terraforming Ability (XML+Python) 2016-10-05

NOTE: I NEED TO CLEAN UP THIS MODCOMP'S CODE AS THERE IS A LOT OF USELESS CODE CURRENTLY IN THE UPLOAD. I WILL GET TO THIS WHEN I HAVE TIME.

I was asked if I could isolate the Andromeda unit and it's ability that currently exits in my big mod Thomas' War.

This is in the form of a mod but basically all it does is add that unit to the core BTS 3.17 game.

Anything that was added to the python is labeled:

##GodsofOld / Andromeda##

Anything that was added to the XML is at the very end of the file.

In my big mod, the Andromeda Strain unit functioned as an ICBM strength biological warfare missile. Basically, it had a modified version of the Blight ability found in Gods of Old, so:



In the area of effect,

Grasslands was converted to Plains with any animal resource of a grassland tile destroyed (along with jungle).

Plains was converted to Grassland with any plant or animal resource on the Plains tile destroyed (along with any forest or jungle)

Any resource on a desert tile is destroyed.

However, I've found this code to be a lot more useful than it originally seems. Why? Well also coded is that if used on Snow or tundra, the tile actually gets upgraded. So snow turns to tundra and tundra to grassland, allowing some late game terraforming.

In fact if you change this section of the EventManager python file:

Spoiler :

Code:
	def doBlightDevastation( self, plotX, plotY ):
	
		plot = gc.getMap().plot( plotX, plotY )

#Melts Ice
		if plot.getTerrainType() == CvUtil.findInfoTypeNum(gc.getTerrainInfo, gc.getNumTerrainInfos(), "TERRAIN_OCEAN") or plot.getTerrainType() == CvUtil.findInfoTypeNum(gc.getTerrainInfo, gc.getNumTerrainInfos(), "TERRAIN_COAST"):
			if plot.getFeatureType() == CvUtil.findInfoTypeNum(gc.getFeatureInfo, gc.getNumFeatureInfos(), "FEATURE_ICE"):
				plot.setFeatureType(-1, 0)

#Degrades Coast
		if plot.getTerrainType() == CvUtil.findInfoTypeNum(gc.getTerrainInfo, gc.getNumTerrainInfos(), "TERRAIN_COAST"):
			plot.setTerrainType(CvUtil.findInfoTypeNum(gc.getTerrainInfo, gc.getNumTerrainInfos(), "TERRAIN_OCEAN"), 1, 1)	

#Destroys Ocean Resources
		if plot.getTerrainType() == CvUtil.findInfoTypeNum(gc.getTerrainInfo, gc.getNumTerrainInfos(), "TERRAIN_OCEAN"):
			plot.setTerrainType(CvUtil.findInfoTypeNum(gc.getTerrainInfo, gc.getNumTerrainInfos(), "TERRAIN_OCEAN"), 1, 1)	
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_FISH"):
				self.doBlightBonus( plot )				
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_CLAM"):
				self.doBlightBonus( plot )	
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_CRAB"):
				self.doBlightBonus( plot )
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_WHALE"):
				self.doBlightBonus( plot )

#Degrades Plains, Destroys Plants & Animals		
		if plot.getTerrainType() == CvUtil.findInfoTypeNum(gc.getTerrainInfo, gc.getNumTerrainInfos(), "TERRAIN_PLAINS"):
			plot.setTerrainType(CvUtil.findInfoTypeNum(gc.getTerrainInfo, gc.getNumTerrainInfos(), "TERRAIN_DESERT"), 1, 1)
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_RICE"):
				self.doBlightBonus( plot )
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_WHEAT"):
				self.doBlightBonus( plot )				
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_WINE"):
				self.doBlightBonus( plot )				
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_SUGAR"):
				self.doBlightBonus( plot )
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_HORSE"):
				self.doBlightBonus( plot )			
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_CORN"):
				self.doBlightBonus( plot )			
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_COW"):
				self.doBlightBonus( plot )				
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_DEER"):
				self.doBlightBonus( plot )	
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_PIG"):
				self.doBlightBonus( plot )			
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_SHEEP"):
				self.doBlightBonus( plot )	
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_FUR"):
				self.doBlightBonus( plot )
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_BANANA"):
				self.doBlightBonus( plot )
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_DYE"):
				self.doBlightBonus( plot )
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_IVORY"):
				self.doBlightBonus( plot )
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_SILK"):
				self.doBlightBonus( plot )
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_SPICES"):
				self.doBlightBonus( plot )
			if plot.getFeatureType() == CvUtil.findInfoTypeNum(gc.getFeatureInfo, gc.getNumFeatureInfos(), "FEATURE_FOREST"):
				self.doBlightFeature( plot )
			if plot.getFeatureType() == CvUtil.findInfoTypeNum(gc.getFeatureInfo, gc.getNumFeatureInfos(), "FEATURE_JUNGLE"):
				self.doBlightFeature( plot )

#Degrades Grasslands, Destroys Animals	
		if plot.getTerrainType() == CvUtil.findInfoTypeNum(gc.getTerrainInfo, gc.getNumTerrainInfos(), "TERRAIN_GRASS"):
			plot.setTerrainType(CvUtil.findInfoTypeNum(gc.getTerrainInfo, gc.getNumTerrainInfos(), "TERRAIN_PLAINS"), 1, 1)	
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_HORSE"):
				self.doBlightBonus( plot )				
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_COW"):
				self.doBlightBonus( plot )	
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_DEER"):
				self.doBlightBonus( plot )
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_FUR"):
				self.doBlightBonus( plot )
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_IVORY"):
				self.doBlightBonus( plot )
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_PIG"):
				self.doBlightBonus( plot )
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_SHEEP"):
				self.doBlightBonus( plot )
			if plot.getFeatureType() == CvUtil.findInfoTypeNum(gc.getFeatureInfo, gc.getNumFeatureInfos(), "FEATURE_JUNGLE"):
				self.doBlightFeature( plot )

#Destroys any resource left on a Desert tile
		if plot.getTerrainType() == CvUtil.findInfoTypeNum(gc.getTerrainInfo, gc.getNumTerrainInfos(), "TERRAIN_DESERT"):
			plot.setTerrainType(CvUtil.findInfoTypeNum(gc.getTerrainInfo, gc.getNumTerrainInfos(), "TERRAIN_DESERT"), 1, 1)	
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_INCENSE"):
				self.doBlightBonus( plot )
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_RICE"):
				self.doBlightBonus( plot )
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_WHEAT"):
				self.doBlightBonus( plot )				
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_WINE"):
				self.doBlightBonus( plot )				
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_SUGAR"):
				self.doBlightBonus( plot )
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_HORSE"):
				self.doBlightBonus( plot )			
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_CORN"):
				self.doBlightBonus( plot )			
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_COW"):
				self.doBlightBonus( plot )				
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_DEER"):
				self.doBlightBonus( plot )	
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_PIG"):
				self.doBlightBonus( plot )			
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_SHEEP"):
				self.doBlightBonus( plot )	
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_FUR"):
				self.doBlightBonus( plot )
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_BANANA"):
				self.doBlightBonus( plot )
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_DYE"):
				self.doBlightBonus( plot )
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_IVORY"):
				self.doBlightBonus( plot )
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_SILK"):
				self.doBlightBonus( plot )
			if plot.getBonusType(-1) == CvUtil.findInfoTypeNum(gc.getBonusInfo, gc.getNumBonusInfos(), "BONUS_SPICES"):
				self.doBlightBonus( plot )
			if plot.getFeatureType() == CvUtil.findInfoTypeNum(gc.getFeatureInfo, gc.getNumFeatureInfos(), "FEATURE_FOREST"):
				self.doBlightFeature( plot )
			if plot.getFeatureType() == CvUtil.findInfoTypeNum(gc.getFeatureInfo, gc.getNumFeatureInfos(), "FEATURE_JUNGLE"):
				self.doBlightFeature( plot )

#Melts Tundra to Grassland		
		if plot.getTerrainType() == CvUtil.findInfoTypeNum(gc.getTerrainInfo, gc.getNumTerrainInfos(), "TERRAIN_TUNDRA"):
			plot.setTerrainType(CvUtil.findInfoTypeNum(gc.getTerrainInfo, gc.getNumTerrainInfos(), "TERRAIN_GRASS"), 1, 1)

#Melts Snow to Tundra	
		if plot.getTerrainType() == CvUtil.findInfoTypeNum(gc.getTerrainInfo, gc.getNumTerrainInfos(), "TERRAIN_SNOW"):
			plot.setTerrainType(CvUtil.findInfoTypeNum(gc.getTerrainInfo, gc.getNumTerrainInfos(), "TERRAIN_TUNDRA"), 1, 1)


You can basically change terrain to anything you want.

For example, turning it into this:

Spoiler :

Code:
	def doBlightDevastation( self, plotX, plotY ):
	
		plot = gc.getMap().plot( plotX, plotY )

#Ice
		if plot.getTerrainType() == CvUtil.findInfoTypeNum(gc.getTerrainInfo, gc.getNumTerrainInfos(), "TERRAIN_OCEAN") or plot.getTerrainType() == CvUtil.findInfoTypeNum(gc.getTerrainInfo, gc.getNumTerrainInfos(), "TERRAIN_COAST"):
			if plot.getFeatureType() == CvUtil.findInfoTypeNum(gc.getFeatureInfo, gc.getNumFeatureInfos(), "FEATURE_ICE"):
				plot.setFeatureType(-1, 0)

#Coast
		if plot.getTerrainType() == CvUtil.findInfoTypeNum(gc.getTerrainInfo, gc.getNumTerrainInfos(), "TERRAIN_COAST"):
			plot.setTerrainType(CvUtil.findInfoTypeNum(gc.getTerrainInfo, gc.getNumTerrainInfos(), "TERRAIN_COAST"), 1, 1)	

#Ocean
		if plot.getTerrainType() == CvUtil.findInfoTypeNum(gc.getTerrainInfo, gc.getNumTerrainInfos(), "TERRAIN_OCEAN"):
			plot.setTerrainType(CvUtil.findInfoTypeNum(gc.getTerrainInfo, gc.getNumTerrainInfos(), "TERRAIN_OCEAN"), 1, 1)	

#Plains		
		if plot.getTerrainType() == CvUtil.findInfoTypeNum(gc.getTerrainInfo, gc.getNumTerrainInfos(), "TERRAIN_PLAINS"):
			plot.setTerrainType(CvUtil.findInfoTypeNum(gc.getTerrainInfo, gc.getNumTerrainInfos(), "TERRAIN_GRASS"), 1, 1)


#Grassland
		if plot.getTerrainType() == CvUtil.findInfoTypeNum(gc.getTerrainInfo, gc.getNumTerrainInfos(), "TERRAIN_GRASS"):
			plot.setTerrainType(CvUtil.findInfoTypeNum(gc.getTerrainInfo, gc.getNumTerrainInfos(), "TERRAIN_GRASS"), 1, 1)	


#Desert
		if plot.getTerrainType() == CvUtil.findInfoTypeNum(gc.getTerrainInfo, gc.getNumTerrainInfos(), "TERRAIN_DESERT"):
			plot.setTerrainType(CvUtil.findInfoTypeNum(gc.getTerrainInfo, gc.getNumTerrainInfos(), "TERRAIN_PLAINS"), 1, 1)	


#Tundra		
		if plot.getTerrainType() == CvUtil.findInfoTypeNum(gc.getTerrainInfo, gc.getNumTerrainInfos(), "TERRAIN_TUNDRA"):
			plot.setTerrainType(CvUtil.findInfoTypeNum(gc.getTerrainInfo, gc.getNumTerrainInfos(), "TERRAIN_GRASS"), 1, 1)

#Snow
		if plot.getTerrainType() == CvUtil.findInfoTypeNum(gc.getTerrainInfo, gc.getNumTerrainInfos(), "TERRAIN_SNOW"):
			plot.setTerrainType(CvUtil.findInfoTypeNum(gc.getTerrainInfo, gc.getNumTerrainInfos(), "TERRAIN_TUNDRA"), 1, 1)


The ability now has no negative effect. Instead, it only improves terrain so Desert becomes Plains which in turn changes to Grassland. Similarly Snow goes to Tundra to Grassland.

This functions as a great Terraforming ability to give a Great Agriculturalist unit or for Mods taking place on foreign planets.

It's also really easy to set to make it add or remove resources, mountains, forests, etc.

I figured all of this might be useful for moders.

Uhmm, the thread I'm just linking to my Thomas War v2.1 thread as that's where I had this unit originally. I've been very busy recently so if you ask something in any of my threads and I don't respond in a timely matter, just pm me. I'll get to you a lot quicker.

Thread
  • a1_z81.jpg
    a1_z81.jpg
    298.6 KB · Views: 362
Author
tsentom1
Downloads
361
Views
361
First release
Last update
Rating
4.00 star(s) 1 ratings

More resources from tsentom1

Top Bottom