Add 2 more type of city-states.

This commit is contained in:
Duan Tao
2019-05-09 20:05:44 +08:00
committed by Yair Morgenstern
parent 0b6422f9e7
commit c221d50e01
4 changed files with 101 additions and 6 deletions

View File

@ -813,7 +813,64 @@
mainColor:[255, 250, 240],
secondaryColor:[238, 44, 44],
cities:["Florence"]
}
},
{
name:"Rio de Janeiro",
adjective:["Rio de Janeiro"],
cityStateType:"Maritime",
startBias:["Coast"],
//TO DO : better dialogs
declaringWar:"Declare war.",
attacked:"Let's fight.",
defeated:"GoodBye.",
introduction:"Hi.",
neutralHello:"Greetings.",
neutralLetsHearIt:["I'm listening.","What do you want?"],
neutralNo:["No!","Certainly not.","Unacceptable!"],
neutralYes:["Completed!","Yes!","Agreed!"],
hateHello:"What do YOU want?!",
hateLetsHearIt:["I'm certainly listening.","I'm listening!"],
hateNo:["No!","Certainly not!","Unacceptable!"],
hateYes:["Yes!"],
afterPeace:"Peace then.",
tradeRequest:"Trade?",
mainColor:[32, 178, 170],
secondaryColor:[255, 255, 224],
cities:["Rio de Janeiro"]
},
{
name:"Antwerp",
adjective:["Antwerp"],
cityStateType:"Mercantile",
//TO DO : better dialogs
declaringWar:"Declare war.",
attacked:"Let's fight.",
defeated:"GoodBye.",
introduction:"Hi.",
neutralHello:"Greetings.",
neutralLetsHearIt:["I'm listening.","What do you want?"],
neutralNo:["No!","Certainly not.","Unacceptable!"],
neutralYes:["Completed!","Yes!","Agreed!"],
hateHello:"What do YOU want?!",
hateLetsHearIt:["I'm certainly listening.","I'm listening!"],
hateNo:["No!","Certainly not!","Unacceptable!"],
hateYes:["Yes!"],
afterPeace:"Peace then.",
tradeRequest:"Trade?",
mainColor:[250, 250, 210],
secondaryColor:[250, 128, 114],
cities:["Rio de Janeiro"]
},
//Barbarian
{

View File

@ -4,6 +4,7 @@ import com.unciv.UnCivGame
import com.unciv.logic.map.BFS
import com.unciv.logic.map.RoadStatus
import com.unciv.Constants
import com.unciv.logic.civilization.CityStateType
import com.unciv.models.gamebasics.Building
import com.unciv.models.gamebasics.GameBasics
import com.unciv.models.gamebasics.unit.BaseUnit
@ -119,6 +120,24 @@ class CityStats {
return stats
}
private fun getStatsFromCityStates(): Stats {
val stats = Stats()
for (otherCivName in cityInfo.civInfo.diplomacy.keys) {
val otherCiv = cityInfo.civInfo.gameInfo.getCivilization(otherCivName)
if (otherCiv.isCityState() && otherCiv.getCityStateType() == CityStateType.Maritime
&& otherCiv.diplomacy[cityInfo.civInfo.civName]!!.influence >= 60) {
if (cityInfo.isCapital()) {
stats.food = stats.food + 3
} else {
stats.food = stats.food + 1
}
}
}
return stats
}
private fun getStatPercentBonusesFromNationUnique(): Stats {
val stats = Stats()
@ -321,6 +340,7 @@ class CityStats {
newBaseStatList["Buildings"] = cityInfo.cityConstructions.getStats()
newBaseStatList["Policies"] = getStatsFromPolicies(civInfo.policies.adoptedPolicies)
newBaseStatList["National ability"] = getStatsFromNationUnique()
newBaseStatList["CityStates"] = getStatsFromCityStates()
baseStatList = newBaseStatList
}

View File

@ -37,7 +37,9 @@ enum class PlayerType{
}
enum class CityStateType{
Cultured
Cultured,
Maritime,
Mercantile
}
class TradeRequest(val requestingCiv:String,
@ -152,7 +154,7 @@ class CivilizationInfo {
//City states culture bonus
for (otherCivName in diplomacy.keys) {
val otherCiv = gameInfo.getCivilization(otherCivName)
if (otherCiv.isCityState() && otherCiv.diplomacy[civName]!!.influence > 60) {
if (otherCiv.isCityState() && otherCiv.getCityStateType() == CityStateType.Cultured && otherCiv.diplomacy[civName]!!.influence >= 60) {
val cultureBonus = Stats()
cultureBonus.add(Stat.Culture, 5.0f * getEra().ordinal)
if (statMap.containsKey("City States"))
@ -244,6 +246,17 @@ class CivilizationInfo {
policies.getAdoptedPolicies().count { !it.endsWith("Complete") }.toFloat()
}
//From city-states
for (otherCivName in diplomacy.keys) {
val otherCiv = gameInfo.getCivilization(otherCivName)
if (otherCiv.isCityState() && otherCiv.getCityStateType() == CityStateType.Mercantile && otherCiv.diplomacy[civName]!!.influence >= 60) {
if (statMap.containsKey("City-states"))
statMap["City-states"] = statMap["City-states"]!! + 3f
else
statMap["City-states"] = 3f
}
}
return statMap
}

View File

@ -95,9 +95,14 @@ class DiplomacyScreen:CameraStageBaseScreen() {
diplomacyTable.add(otherCiv.getNation().getLeaderDisplayName().toLabel())
diplomacyTable.add(("Type : " + otherCiv.getCityStateType().toString()).toLabel()).row()
diplomacyTable.add(("Influence : " + otherCiv.getDiplomacyManager(currentPlayerCiv).influence.toInt().toString()).toLabel()).row()
if (otherCiv.getDiplomacyManager(currentPlayerCiv).influence > 60) {
if (otherCiv.getCityStateType() == CityStateType.Cultured) {
diplomacyTable.add(("Providing " + (5.0f * currentPlayerCiv.getEra().ordinal).toString() + " culture each turn").toLabel())
if (otherCiv.getDiplomacyManager(currentPlayerCiv).influence >= 60) {
when(otherCiv.getCityStateType()) {
CityStateType.Cultured -> diplomacyTable.add(
("Providing " + (5.0f * currentPlayerCiv.getEra().ordinal).toString() + " culture each turn").toLabel())
CityStateType.Maritime -> diplomacyTable.add(
("Providing 3 food in capital and 1 food in other cities.").toLabel())
CityStateType.Mercantile -> diplomacyTable.add(
("Providing 3 happiness.").toLabel())
}
}
} else {