Last fixes for Indian nation!

Checks for specific buildings now work for all civ-unique buildings as well
This commit is contained in:
Yair Morgenstern
2019-05-24 13:59:00 +03:00
parent 7e6b102f27
commit 25fc1b3c71
8 changed files with 73 additions and 64 deletions

View File

@ -395,19 +395,17 @@
requiredBuilding:"Walls",
requiredTech:"Chivalry"
},
/*
{
name:"Mughal Fort",
replaces:"Castle",
uniqueTo:"India",
cityStrength:7,
cityHealth:25,
culture:2;
culture:2,
hurryCostModifier:25,
requiredBuilding:"Walls",
requiredTech:"Chivalry"
},
*/
{
name:"Angkor Wat",
culture:1,

View File

@ -377,6 +377,40 @@
unique: "Units fight as though they were at full strength even when damaged",
cities:["Kyoto","Osaka","Tokyo","Satsuma","Kagoshima","Nara","Nagoya","Izumo","Nagasaki","Yokohama","Shimonoseki","Matsuyama","Sapporo","Hakodate","Ise","Toyama","Fukushima","Suo","Bizen","Echizen","Izumi","Omi","Echigo","Kozuke","Sado","Kobe","Nagano","Hiroshima","Takayama","Akita","Fukuoka","Aomori","Kamakura","Kochi","Naha","Sendai","Gifu","Yamaguchi","Ota","Tottori"]
},
{
name:"India",
leaderName:"Gandhi",
adjective:["Indian"],
startBias:["Grassland"],
startIntroPart1: "Greetings, President Mahatma Gandhi, great souled leader of India! You are the ruler of one of the oldest countries in the world with history stretching back almost 10'000 years. A spiritual country, India is the birthplace of three of the world's great religions - Hinduism, Buddhism and Jainism. This is a passionate land of music and color, a land of great wealth and grinding poverty. For centuries, India was divided into kingdoms who fought constantly with each other and against outside invaders. That was, horever, after empires such as Maratha, Maurya and Gupta. In the 12th century AD, India was conquered by Muslim Turks fled from the Mongols. In the early 17th century, the English arrived, and thought a combination of shrewd diplomacy and technological supeiority, they conquered your fragmented nation. England remained in power for some two centuries until driven out by a rising wave of Indian nationalism, a peaceful rebellion unlike any before seen in history, one led by you!"
startIntroPart2: "Gandhi, your people look to you to lead them to even greater heights of glory! Can you help your people realize their great potential, to once again become the world's center of arts, culture and religion? Can you build a civilization that will stand the test of time?"
declaringWar:"I have just received a report that large numbers of my troops have crossed your borders."
attacked:"My attempts to avoid violence have failed. An eye for an eye only makes the world blind."
defeated:"You can chain me, you can torture me, you can even destroy this body, but you will never imprison my mind. "
introduction:"Hello, I am Mohandas Gandhi. My people call me Bapu, but please, call me friend."
neutralHello:"I wish you peace."
neutralLetsHearIt:["Go ahead.","Yes?","I'm listening."]
neutralNo:["Absolutely not.","No.","This is unacceptable"]
neutralYes:["Okay.","We agree.","Fine."]
hateHello:"What do you want?"
hateLetsHearIt:["Continue.","And?","Go on."]
hateNo:["This is not acceptable.","You are probably not serious.","This is impossible."]
hateYes:["Oh. Very good.","I think that I should accept.","Very well..."]
afterPeace:"I am happy that it is once again peaceful at our place, even if we had to pay a price for it."
tradeRequest:"My friend, are you interested in this arrangement?"
mainColor:[16,126,5],
secondaryColor:[255,153,51],
unique:"Unhappiness from number of Cities doubled, Unhappiness from number of Citizens halved.",
cities:["Delhi","Mumbai","Vijayanagara","Pataliputra","Varanasi","Agra","Calcutta","Lahore","Bangalore","Hyderabad","Madurai","Ahmedabad",
"Kolhapur","Prayaga","Ayodhya","Indraprastha","Mathura","Ujjain","Gulbarga","Jaunpur","Rajagriha","Sravasti","Tiruchirapalli","Thanjavur",
"Bodhgaya","Kushinagar","Amaravati","Gaur","Gwalior","Jaipur","Karachi"]
},
/*
{
name:"Germany",
@ -415,40 +449,7 @@
"Osnabruck","Ludwingshafen","Leverkusen","Oldenburg","Neuss","Mulheim","Darmstadt","Herne","Wurzburg",
"Recklinghausen","Gצttingen","Wolfsburg","Koblenz","Hildesheim","Erlangen"]
},
{
name:"India",
leaderName:"Gandhi",
adjective:["Indian"],
startBias:["Grassland"],
startIntroPart1: "Greetings, President Mahatma Gandhi, great souled leader of India! You are the ruler of one of the oldest countries in the world with history stretching back almost 10'000 years. A spiritual country, India is the birthplace of three of the world's great religions - Hinduism, Buddhism and Jainism. This is a passionate land of music and color, a land of great wealth and grinding poverty. For centuries, India was divided into kingdoms who fought constantly with each other and against outside invaders. That was, horever, after empires such as Maratha, Maurya and Gupta. In the 12th century AD, India was conquered by Muslim Turks fled from the Mongols. In the early 17th century, the English arrived, and thought a combination of shrewd diplomacy and technological supeiority, they conquered your fragmented nation. England remained in power for some two centuries until driven out by a rising wave of Indian nationalism, a peaceful rebellion unlike any before seen in history, one led by you!"
startIntroPart2: "Gandhi, your people look to you to lead them to even greater heights of glory! Can you help your people realize their great potential, to once again become the world's center of arts, culture and religion? Can you build a civilization that will stand the test of time?"
declaringWar:"I have just received a report that large numbers of my troops have crossed your borders."
attacked:"My attempts to avoid violence have failed. An eye for an eye only makes the world blind."
defeated:"You can chain me, you can torture me, you can even destroy this body, but you will never imprison my mind. "
introduction:"Hello, I am Mohandas Gandhi. My people call me Bapu, but please, call me friend."
neutralHello:"I wish you peace."
neutralLetsHearIt:["Go ahead.","Yes?","I'm listening."]
neutralNo:["Absolutely not.","No.","This is unacceptable"]
neutralYes:["Okay.","We agree.","Fine."]
hateHello:"What do you want?"
hateLetsHearIt:["Continue.","And?","Go on."]
hateNo:["This is not acceptable.","You are probably not serious.","This is impossible."]
hateYes:["Oh. Very good.","I think that I should accept.","Very well..."]
afterPeace:"I am happy that it is once again peaceful at our place, even if we had to pay a price for it."
tradeRequest:"My friend, are you interested in this arrangement?"
mainColor:[0,255,0],
secondaryColor:[255,153,51],
unique:"Unhappiness from number of Cities doubled, Unhappiness from number of Citizens halved.",
cities:["Delhi","Mumbai","Vijayanagara","Pataliputra","Varanasi","Agra","Calcutta","Lahore","Bangalore","Hyderabad","Madurai","Ahmedabad",
"Kolhapur","Prayaga","Ayodhya","Indraprastha","Mathura","Ujjain","Gulbarga","Jaunpur","Rajagriha","Sravasti","Tiruchirapalli","Thanjavur",
"Bodhgaya","Kushinagar","Amaravati","Gaur","Gwalior","Jaipur","Karachi"]
},
{
name:"Aztecs",
leaderName:"Montezuma I",

View File

@ -202,7 +202,6 @@
hurryCostModifier:20,
attackSound:"arrow"
},
/*
{
name:"War Elephant",
unitType:"Ranged",
@ -218,9 +217,7 @@
uniques:["No defensive terrain bonus"],
hurryCostModifier:20,
attackSound:"horse"
//This is the Indian unique unit. It replaces Chariot Archer, moves slower, has no rough terrain penalty and needs no horses.
},
*/
{
name:"Spearman",
unitType:"Melee",

View File

@ -222,7 +222,6 @@ class CityConstructions {
.map { cityInfo.civInfo.getEquivalentBuilding(it) }
val buildableCultureBuildings = basicCultureBuildings
.map { GameBasics.Buildings[it]!! }
.filter { it.isBuildable(this)}
if (buildableCultureBuildings.isEmpty()) return

View File

@ -263,9 +263,9 @@ class CityInfo {
// Transfer unique buildings
for(building in cityConstructions.getBuiltBuildings()) {
val civEquivalentBuilding = newCivInfo.getEquivalentBuilding(building.name)
if(building.name != civEquivalentBuilding) {
if(building != civEquivalentBuilding) {
cityConstructions.removeBuilding(building.name)
cityConstructions.addBuilding(civEquivalentBuilding)
cityConstructions.addBuilding(civEquivalentBuilding.name)
}
}

View File

@ -15,13 +15,10 @@ import com.unciv.logic.map.RoadStatus
import com.unciv.logic.map.TileInfo
import com.unciv.logic.trade.Trade
import com.unciv.models.Counter
import com.unciv.models.gamebasics.Difficulty
import com.unciv.models.gamebasics.GameBasics
import com.unciv.models.gamebasics.Nation
import com.unciv.models.gamebasics.*
import com.unciv.models.gamebasics.tech.TechEra
import com.unciv.models.gamebasics.tile.ResourceType
import com.unciv.models.gamebasics.tile.TileResource
import com.unciv.models.gamebasics.tr
import com.unciv.models.stats.Stat
import com.unciv.models.stats.Stats
import java.util.*
@ -320,13 +317,13 @@ class CivilizationInfo {
return null
}
fun getEquivalentBuilding(buildingName:String): String {
val building = GameBasics.Buildings[buildingName]!!
val baseBuildingName = if(building.replaces==null) buildingName else building.replaces!!
for(blding in GameBasics.Buildings.values)
if(blding.replaces==buildingName && blding.uniqueTo==civName)
return blding.name
return baseBuildingName
fun getEquivalentBuilding(buildingName:String): Building {
val baseBuilding = GameBasics.Buildings[buildingName]!!.getBaseBuilding()
for(building in GameBasics.Buildings.values)
if(building.replaces==baseBuilding.name && building.uniqueTo==civName)
return building
return baseBuilding
}
fun updateViewableTiles() {

View File

@ -40,7 +40,16 @@ class MapUnit {
var action: String? // work, automation, fortifying, I dunno what.
// getter and setter for compatibility: make sure string-based actions still work
get() = (mapUnitAction as? StringAction)?.action ?: mapUnitAction?.let { "" } // null if no action is assigned.
get() {
val mapUnitActionVal=mapUnitAction
if(mapUnitActionVal is StringAction)
return mapUnitActionVal.action
// any other unit action does count as a unit action, thus is not null. The actual logic is not based on an action string, but realized by extending MapUnitAction
if(mapUnitActionVal!=null)
return ""
return null // unit has no action
}
set(value) { mapUnitAction = value?.let{ StringAction(this, value) } } // wrap traditional string-encoded actions into StringAction

View File

@ -1,12 +1,13 @@
package com.unciv.models.gamebasics
import com.unciv.Constants
import com.unciv.logic.city.CityConstructions
import com.unciv.logic.city.IConstruction
import com.unciv.logic.civilization.CivilizationInfo
import com.unciv.Constants
import com.unciv.models.gamebasics.tech.Technology
import com.unciv.models.stats.NamedStats
import com.unciv.models.stats.*
import com.unciv.models.stats.Stat
import com.unciv.models.stats.Stats
class Building : NamedStats(), IConstruction{
@ -124,22 +125,24 @@ class Building : NamedStats(), IConstruction{
val stats = this.clone()
if(civInfo != null) {
val adoptedPolicies = civInfo.policies.adoptedPolicies
if (adoptedPolicies.contains("Organized Religion") && cultureBuildings.contains(name))
val baseBuildingName = getBaseBuilding().name
if (adoptedPolicies.contains("Organized Religion") && cultureBuildings.contains(baseBuildingName ))
stats.happiness += 1
if (adoptedPolicies.contains("Free Religion") && cultureBuildings.contains(name))
if (adoptedPolicies.contains("Free Religion") && cultureBuildings.contains(baseBuildingName ))
stats.culture += 1f
if (adoptedPolicies.contains("Entrepreneurship") && hashSetOf("Mint", "Market", "Bank", "Stock Market").contains(name))
if (adoptedPolicies.contains("Entrepreneurship") && hashSetOf("Mint", "Market", "Bank", "Stock Market").contains(baseBuildingName ))
stats.science += 1f
if (adoptedPolicies.contains("Humanism") && hashSetOf("University", "Observatory", "Public School").contains(name))
if (adoptedPolicies.contains("Humanism") && hashSetOf("University", "Observatory", "Public School").contains(baseBuildingName ))
stats.happiness += 1f
if (adoptedPolicies.contains("Theocracy") && name == "Temple")
if (adoptedPolicies.contains("Theocracy") && baseBuildingName == "Temple")
percentStatBonus = Stats().apply { gold = 10f }
if (adoptedPolicies.contains("Free Thought") && name == "University")
if (adoptedPolicies.contains("Free Thought") && baseBuildingName == "University")
percentStatBonus!!.science = 50f
if (adoptedPolicies.contains("Rationalism Complete") && !isWonder && stats.science > 0)
@ -151,7 +154,7 @@ class Building : NamedStats(), IConstruction{
if (adoptedPolicies.contains("Autocracy Complete") && cityStrength > 0)
stats.happiness += 1
if (hashSetOf("Castle", "Mughal Fort").contains(name)
if (baseBuildingName == "Castle"
&& civInfo.getBuildingUniques().contains("+1 happiness, +2 culture and +3 gold from every Castle")){
stats.happiness+=1
stats.culture+=2
@ -326,4 +329,9 @@ class Building : NamedStats(), IConstruction{
if (specialistSlots!=null && specialistSlots!!.get(stat)>0) return true
return false
}
fun getBaseBuilding(): Building {
if(replaces==null) return this
else return GameBasics.Buildings[replaces!!]!!
}
}