Minor code reorg. Adjust tech trade value with game speed.

This commit is contained in:
Duan Tao 2019-09-25 23:27:55 +08:00 committed by Yair Morgenstern
parent 4ca32a0523
commit fc5c7235c5
4 changed files with 12 additions and 15 deletions

View File

@ -271,10 +271,8 @@ class CityInfo {
getCenterTile().improvement="City ruins" getCenterTile().improvement="City ruins"
} }
fun annexCity(conqueringCiv: CivilizationInfo) { fun annexCity() {
puppetCity(conqueringCiv) if(!civInfo.policies.isAdopted("Police State")) {
if(!conqueringCiv.policies.isAdopted("Police State")) {
expansion.cultureStored = 0 expansion.cultureStored = 0
expansion.reset() expansion.reset()
} }
@ -327,7 +325,8 @@ class CityInfo {
/* Liberating is returning a city to its founder - makes you LOSE warmongering points **/ /* Liberating is returning a city to its founder - makes you LOSE warmongering points **/
fun liberateCity(conqueringCiv: CivilizationInfo) { fun liberateCity(conqueringCiv: CivilizationInfo) {
if (foundingCiv == "") { // this should never happen but just in case... if (foundingCiv == "") { // this should never happen but just in case...
annexCity(conqueringCiv) puppetCity(conqueringCiv)
annexCity()
return return
} }

View File

@ -117,7 +117,9 @@ class TradeEvaluation{
return 50 * amountToBuyInOffer return 50 * amountToBuyInOffer
} }
TradeType.Technology -> return sqrt(GameBasics.Technologies[offer.name]!!.cost.toDouble()).toInt()*20 TradeType.Technology ->
return (sqrt(GameBasics.Technologies[offer.name]!!.cost.toDouble())
* civInfo.gameInfo.gameParameters.gameSpeed.getModifier()).toInt()*20
TradeType.Introduction -> return 250 TradeType.Introduction -> return 250
TradeType.WarDeclaration -> { TradeType.WarDeclaration -> {
val nameOfCivToDeclareWarOn = offer.name.removePrefix("Declare war on ") val nameOfCivToDeclareWarOn = offer.name.removePrefix("Declare war on ")

View File

@ -168,13 +168,7 @@ class CityScreen(internal val city: CityInfo) : CameraStageBaseScreen() {
val annexCityButton = TextButton("Annex city".tr(), skin) val annexCityButton = TextButton("Annex city".tr(), skin)
annexCityButton.labelCell.pad(10f) annexCityButton.labelCell.pad(10f)
annexCityButton.onClick { annexCityButton.onClick {
if(!city.civInfo.policies.isAdopted("Police State")) { city.annexCity()
city.expansion.cultureStored = 0
city.expansion.reset()
}
city.isPuppet=false
city.isBeingRazed=false
update() update()
} }
razeCityButtonHolder.add(annexCityButton).colspan(cityPickerTable.columns) razeCityButtonHolder.add(annexCityButton).colspan(cityPickerTable.columns)

View File

@ -72,7 +72,8 @@ class AlertPopup(val worldScreen: WorldScreen, val popupAlert: PopupAlert): Popu
}).row() }).row()
} }
add(TextButton("Annex".tr(), skin).onClick { add(TextButton("Annex".tr(), skin).onClick {
city.annexCity(conqueringCiv) city.puppetCity(conqueringCiv)
city.annexCity()
worldScreen.shouldUpdate=true worldScreen.shouldUpdate=true
close() close()
}).row() }).row()
@ -82,7 +83,8 @@ class AlertPopup(val worldScreen: WorldScreen, val popupAlert: PopupAlert): Popu
close() close()
}).row() }).row()
add(TextButton("Raze".tr(), skin).onClick { add(TextButton("Raze".tr(), skin).onClick {
city.annexCity(conqueringCiv) city.puppetCity(conqueringCiv)
city.annexCity()
city.isBeingRazed = true city.isBeingRazed = true
worldScreen.shouldUpdate=true worldScreen.shouldUpdate=true
close() close()