mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-29 06:51:30 -04:00
Improvements that provide resources now specified in the improvement picker screen
Tutorials for resources now specify that a specific improvement is needed
This commit is contained in:
parent
7d14c0924b
commit
b661308a9d
@ -226,13 +226,12 @@
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
"There are three ways to win in Unciv. They are:",
|
"There are three ways to win in Unciv. They are:",
|
||||||
"Cultural Victory: Complete 4 Social Policy Trees",
|
" - Cultural Victory: Complete 4 Social Policy Trees",
|
||||||
"Domination Victory: Survive as the last civilization",
|
" - Domination Victory: Survive as the last civilization",
|
||||||
"Science Victory: Be the first to construct a spaceship to Alpha Centauri"
|
" - Science Victory: Be the first to construct a spaceship to Alpha Centauri"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"So to sum it up, these are the basics of Unciv – ",
|
"So to sum it up, these are the basics of Unciv – Found a prosperous first city, expand slowly to manage happiness,",
|
||||||
"Found a prosperous first city, expand slowly to manage happiness,",
|
|
||||||
" and set yourself up for the victory condition you wish to pursue.",
|
" and set yourself up for the victory condition you wish to pursue.",
|
||||||
"Obviously, there is much more to it than that, but it is important not to jump into the deep end before you know how to swim.",
|
"Obviously, there is much more to it than that, but it is important not to jump into the deep end before you know how to swim.",
|
||||||
]
|
]
|
||||||
@ -249,6 +248,7 @@
|
|||||||
|
|
||||||
Luxury_Resource: [
|
Luxury_Resource: [
|
||||||
[
|
[
|
||||||
|
"Luxury resources within your domain and with their specific improvement are connected to your trade network.",
|
||||||
"Each unique Luxury resource you have adds 5 happiness to your civilization,",
|
"Each unique Luxury resource you have adds 5 happiness to your civilization,",
|
||||||
" but extra resources of the same type don't add anything, ",
|
" but extra resources of the same type don't add anything, ",
|
||||||
" so use them for trading with other civilizations!"
|
" so use them for trading with other civilizations!"
|
||||||
@ -257,6 +257,7 @@
|
|||||||
|
|
||||||
Strategic_Resource: [
|
Strategic_Resource: [
|
||||||
[
|
[
|
||||||
|
"Strategic resources within your domain and with their specific improvement are connected to your trade network.",
|
||||||
"Strategic resources allow you to train units and construct buildings that",
|
"Strategic resources allow you to train units and construct buildings that",
|
||||||
" require those specific resources, for example the Horseman requires Horses."
|
" require those specific resources, for example the Horseman requires Horses."
|
||||||
"Each unit 'consumes' a copy of that resource, but if the unit is killed you can ",
|
"Each unit 'consumes' a copy of that resource, but if the unit is killed you can ",
|
||||||
|
@ -17,6 +17,7 @@ class Constants{
|
|||||||
const val ancientRuins = "Ancient ruins"
|
const val ancientRuins = "Ancient ruins"
|
||||||
|
|
||||||
const val peaceTreaty = "Peace Treaty"
|
const val peaceTreaty = "Peace Treaty"
|
||||||
|
const val openBorders = "Open Borders"
|
||||||
const val random = "Random"
|
const val random = "Random"
|
||||||
val greatImprovements = listOf("Academy", "Landmark", "Manufactory", "Customs house")
|
val greatImprovements = listOf("Academy", "Landmark", "Manufactory", "Customs house")
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@ import com.unciv.logic.trade.Trade
|
|||||||
import com.unciv.logic.trade.TradeType
|
import com.unciv.logic.trade.TradeType
|
||||||
import com.unciv.models.gamebasics.GameBasics
|
import com.unciv.models.gamebasics.GameBasics
|
||||||
import com.unciv.models.gamebasics.tile.ResourceSupplyList
|
import com.unciv.models.gamebasics.tile.ResourceSupplyList
|
||||||
import com.unciv.models.gamebasics.tr
|
|
||||||
|
|
||||||
enum class RelationshipLevel{
|
enum class RelationshipLevel{
|
||||||
Unforgivable,
|
Unforgivable,
|
||||||
@ -195,7 +194,7 @@ class DiplomacyManager() {
|
|||||||
// for performance reasons we don't want to call this every time we want to see if a unit can move through a tile
|
// for performance reasons we don't want to call this every time we want to see if a unit can move through a tile
|
||||||
fun updateHasOpenBorders(){
|
fun updateHasOpenBorders(){
|
||||||
val newHasOpenBorders = trades.flatMap { it.theirOffers }
|
val newHasOpenBorders = trades.flatMap { it.theirOffers }
|
||||||
.any { it.name == "Open Borders" && it.duration > 0 }
|
.any { it.name == Constants.openBorders && it.duration > 0 }
|
||||||
|
|
||||||
val bordersWereClosed = hasOpenBorders && !newHasOpenBorders
|
val bordersWereClosed = hasOpenBorders && !newHasOpenBorders
|
||||||
hasOpenBorders=newHasOpenBorders
|
hasOpenBorders=newHasOpenBorders
|
||||||
@ -209,10 +208,46 @@ class DiplomacyManager() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun nextTurn(){
|
fun nextTurn(){
|
||||||
for(trade in trades.toList()){
|
nextTurnTrades()
|
||||||
for(offer in trade.ourOffers.union(trade.theirOffers).filter { it.duration>0 }) {
|
removeUntenebleTrades()
|
||||||
|
updateHasOpenBorders()
|
||||||
|
nextTurnDiplomaticModifiers()
|
||||||
|
nextTurnFlags()
|
||||||
|
nextTurnCityStateInfluence()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun nextTurnCityStateInfluence() {
|
||||||
|
val hasCityStateInfluenceBonus =
|
||||||
|
civInfo.nation.unique == "City-State Influence degrades at half and recovers at twice the normal rate"
|
||||||
|
if (influence > 1) {
|
||||||
|
if (hasCityStateInfluenceBonus) influence -= 0.5f
|
||||||
|
else influence -= 1
|
||||||
|
} else if (influence < 1) {
|
||||||
|
if (hasCityStateInfluenceBonus) influence += 2
|
||||||
|
else influence += 1
|
||||||
|
} else influence = 0f
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun nextTurnFlags() {
|
||||||
|
for (flag in flagsCountdown.keys.toList()) {
|
||||||
|
flagsCountdown[flag] = flagsCountdown[flag]!! - 1
|
||||||
|
if (flagsCountdown[flag] == 0) {
|
||||||
|
if (flag == DiplomacyFlags.ProvideMilitaryUnit.name && civInfo.cities.isEmpty() || otherCiv().cities.isEmpty())
|
||||||
|
continue
|
||||||
|
flagsCountdown.remove(flag)
|
||||||
|
if (flag == DiplomacyFlags.AgreedToNotSettleNearUs.name)
|
||||||
|
addModifier(DiplomaticModifiers.FulfilledPromiseToNotSettleCitiesNearUs, 10f)
|
||||||
|
else if (flag == DiplomacyFlags.ProvideMilitaryUnit.name)
|
||||||
|
civInfo.giftMilitaryUnitTo(otherCiv())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun nextTurnTrades() {
|
||||||
|
for (trade in trades.toList()) {
|
||||||
|
for (offer in trade.ourOffers.union(trade.theirOffers).filter { it.duration > 0 }) {
|
||||||
offer.duration--
|
offer.duration--
|
||||||
if(offer.duration==0) {
|
if (offer.duration == 0) {
|
||||||
civInfo.addNotification("[" + offer.name + "] from [$otherCivName] has ended", null, Color.GOLD)
|
civInfo.addNotification("[" + offer.name + "] from [$otherCivName] has ended", null, Color.GOLD)
|
||||||
|
|
||||||
civInfo.updateStatsForNextTurn() // if they were bringing us gold per turn
|
civInfo.updateStatsForNextTurn() // if they were bringing us gold per turn
|
||||||
@ -220,70 +255,43 @@ class DiplomacyManager() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(trade.ourOffers.all { it.duration<=0 } && trade.theirOffers.all { it.duration<=0 }) {
|
if (trade.ourOffers.all { it.duration <= 0 } && trade.theirOffers.all { it.duration <= 0 }) {
|
||||||
trades.remove(trade)
|
trades.remove(trade)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
removeUntenebleTrades()
|
}
|
||||||
updateHasOpenBorders()
|
|
||||||
|
|
||||||
if(diplomaticStatus==DiplomaticStatus.Peace) {
|
private fun nextTurnDiplomaticModifiers() {
|
||||||
if(getModifier(DiplomaticModifiers.YearsOfPeace)< 30)
|
if (diplomaticStatus == DiplomaticStatus.Peace) {
|
||||||
|
if (getModifier(DiplomaticModifiers.YearsOfPeace) < 30)
|
||||||
addModifier(DiplomaticModifiers.YearsOfPeace, 0.5f)
|
addModifier(DiplomaticModifiers.YearsOfPeace, 0.5f)
|
||||||
}
|
} else revertToZero(DiplomaticModifiers.YearsOfPeace, 0.5f) // war makes you forget the good ol' days
|
||||||
else revertToZero(DiplomaticModifiers.YearsOfPeace,0.5f) // war makes you forget the good ol' days
|
|
||||||
|
|
||||||
var openBorders = 0
|
var openBorders = 0
|
||||||
if(hasOpenBorders) openBorders+=1
|
if (hasOpenBorders) openBorders += 1
|
||||||
|
|
||||||
if(otherCivDiplomacy().hasOpenBorders) openBorders+=1
|
if (otherCivDiplomacy().hasOpenBorders) openBorders += 1
|
||||||
if(openBorders>0) addModifier(DiplomaticModifiers.OpenBorders,openBorders/8f) // so if we both have open borders it'll grow by 0.25 per turn
|
if (openBorders > 0) addModifier(DiplomaticModifiers.OpenBorders, openBorders / 8f) // so if we both have open borders it'll grow by 0.25 per turn
|
||||||
else revertToZero(DiplomaticModifiers.OpenBorders, 1/8f)
|
else revertToZero(DiplomaticModifiers.OpenBorders, 1 / 8f)
|
||||||
|
|
||||||
revertToZero(DiplomaticModifiers.DeclaredWarOnUs,1/8f) // this disappears real slow - it'll take 160 turns to really forget, this is war declaration we're talking about
|
revertToZero(DiplomaticModifiers.DeclaredWarOnUs, 1 / 8f) // this disappears real slow - it'll take 160 turns to really forget, this is war declaration we're talking about
|
||||||
revertToZero(DiplomaticModifiers.WarMongerer,1/2f) // warmongering gives a big negative boost when it happens but they're forgotten relatively quickly, like WWII amirite
|
revertToZero(DiplomaticModifiers.WarMongerer, 1 / 2f) // warmongering gives a big negative boost when it happens but they're forgotten relatively quickly, like WWII amirite
|
||||||
revertToZero(DiplomaticModifiers.CapturedOurCities,1/4f) // if you captured our cities, though, that's harder to forget
|
revertToZero(DiplomaticModifiers.CapturedOurCities, 1 / 4f) // if you captured our cities, though, that's harder to forget
|
||||||
revertToZero(DiplomaticModifiers.BetrayedDeclarationOfFriendship,1/8f) // That's a bastardly thing to do
|
revertToZero(DiplomaticModifiers.BetrayedDeclarationOfFriendship, 1 / 8f) // That's a bastardly thing to do
|
||||||
revertToZero(DiplomaticModifiers.RefusedToNotSettleCitiesNearUs,1/4f)
|
revertToZero(DiplomaticModifiers.RefusedToNotSettleCitiesNearUs, 1 / 4f)
|
||||||
revertToZero(DiplomaticModifiers.BetrayedPromiseToNotSettleCitiesNearUs,1/8f) // That's a bastardly thing to do
|
revertToZero(DiplomaticModifiers.BetrayedPromiseToNotSettleCitiesNearUs, 1 / 8f) // That's a bastardly thing to do
|
||||||
revertToZero(DiplomaticModifiers.UnacceptableDemands,1/4f)
|
revertToZero(DiplomaticModifiers.UnacceptableDemands, 1 / 4f)
|
||||||
|
|
||||||
if(!hasFlag(DiplomacyFlags.DeclarationOfFriendship))
|
if (!hasFlag(DiplomacyFlags.DeclarationOfFriendship))
|
||||||
revertToZero(DiplomaticModifiers.DeclarationOfFriendship, 1/2f) //decreases slowly and will revert to full if it is declared later
|
revertToZero(DiplomaticModifiers.DeclarationOfFriendship, 1 / 2f) //decreases slowly and will revert to full if it is declared later
|
||||||
|
|
||||||
if(otherCiv().isCityState() && otherCiv().getCityStateType() == CityStateType.Militaristic) {
|
if (otherCiv().isCityState() && otherCiv().getCityStateType() == CityStateType.Militaristic) {
|
||||||
if (relationshipLevel() < RelationshipLevel.Friend) {
|
if (relationshipLevel() < RelationshipLevel.Friend) {
|
||||||
if (hasFlag(DiplomacyFlags.ProvideMilitaryUnit)) removeFlag(DiplomacyFlags.ProvideMilitaryUnit)
|
if (hasFlag(DiplomacyFlags.ProvideMilitaryUnit)) removeFlag(DiplomacyFlags.ProvideMilitaryUnit)
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (!hasFlag(DiplomacyFlags.ProvideMilitaryUnit)) setFlag(DiplomacyFlags.ProvideMilitaryUnit, 20)
|
if (!hasFlag(DiplomacyFlags.ProvideMilitaryUnit)) setFlag(DiplomacyFlags.ProvideMilitaryUnit, 20)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(flag in flagsCountdown.keys.toList()) {
|
|
||||||
flagsCountdown[flag] = flagsCountdown[flag]!! - 1
|
|
||||||
if(flagsCountdown[flag]==0) {
|
|
||||||
if(flag==DiplomacyFlags.ProvideMilitaryUnit.name && civInfo.cities.isEmpty() || otherCiv().cities.isEmpty())
|
|
||||||
continue
|
|
||||||
flagsCountdown.remove(flag)
|
|
||||||
if(flag==DiplomacyFlags.AgreedToNotSettleNearUs.name)
|
|
||||||
addModifier(DiplomaticModifiers.FulfilledPromiseToNotSettleCitiesNearUs,10f)
|
|
||||||
else if(flag==DiplomacyFlags.ProvideMilitaryUnit.name)
|
|
||||||
civInfo.giftMilitaryUnitTo(otherCiv())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// City-state influence
|
|
||||||
val hasCityStateInfluenceBonus =
|
|
||||||
civInfo.nation.unique=="City-State Influence degrades at half and recovers at twice the normal rate"
|
|
||||||
if (influence > 1) {
|
|
||||||
if(hasCityStateInfluenceBonus) influence -= 0.5f
|
|
||||||
else influence -= 1
|
|
||||||
} else if (influence < 1) {
|
|
||||||
if(hasCityStateInfluenceBonus) influence += 2
|
|
||||||
else influence += 1
|
|
||||||
} else influence = 0f
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Everything that happens to both sides equally when war is delcared by one side on the other */
|
/** Everything that happens to both sides equally when war is delcared by one side on the other */
|
||||||
@ -401,6 +409,9 @@ class DiplomacyManager() {
|
|||||||
setFlag(DiplomacyFlags.Denunceation,30)
|
setFlag(DiplomacyFlags.Denunceation,30)
|
||||||
otherCivDiplomacy().setFlag(DiplomacyFlags.Denunceation,30)
|
otherCivDiplomacy().setFlag(DiplomacyFlags.Denunceation,30)
|
||||||
|
|
||||||
|
otherCiv().addNotification("[${civInfo.civName}] has denounced us!", Color.RED)
|
||||||
|
|
||||||
|
// We, A, are denouncing B. What do other major civs (C,D, etc) think of this?
|
||||||
for(thirdCiv in civInfo.getKnownCivs().filter { it.isMajorCiv() }){
|
for(thirdCiv in civInfo.getKnownCivs().filter { it.isMajorCiv() }){
|
||||||
if(thirdCiv==otherCiv() || !thirdCiv.knows(otherCivName)) continue
|
if(thirdCiv==otherCiv() || !thirdCiv.knows(otherCivName)) continue
|
||||||
val thirdCivRelationshipWithOtherCiv = thirdCiv.getDiplomacyManager(otherCiv()).relationshipLevel()
|
val thirdCivRelationshipWithOtherCiv = thirdCiv.getDiplomacyManager(otherCiv()).relationshipLevel()
|
||||||
@ -411,7 +422,6 @@ class DiplomacyManager() {
|
|||||||
RelationshipLevel.Ally -> addModifier(DiplomaticModifiers.DenouncedOurAllies,-15f)
|
RelationshipLevel.Ally -> addModifier(DiplomaticModifiers.DenouncedOurAllies,-15f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
otherCiv().addNotification("[${civInfo.civName}] has denounced us!", Color.RED)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun agreeNotToSettleNear(){
|
fun agreeNotToSettleNear(){
|
||||||
|
@ -145,7 +145,7 @@ class TradeEvaluation{
|
|||||||
return sumOfStats.toInt() * 100
|
return sumOfStats.toInt() * 100
|
||||||
}
|
}
|
||||||
TradeType.Agreement -> {
|
TradeType.Agreement -> {
|
||||||
if(offer.name=="Open Borders") return 100
|
if(offer.name==Constants.openBorders) return 100
|
||||||
throw Exception("Invalid agreement type!")
|
throw Exception("Invalid agreement type!")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -211,7 +211,7 @@ class TradeEvaluation{
|
|||||||
return sumOfStats.toInt() * 100
|
return sumOfStats.toInt() * 100
|
||||||
}
|
}
|
||||||
TradeType.Agreement -> {
|
TradeType.Agreement -> {
|
||||||
if(offer.name == "Open Borders"){
|
if(offer.name == Constants.openBorders){
|
||||||
when(civInfo.getDiplomacyManager(tradePartner).relationshipLevel()){
|
when(civInfo.getDiplomacyManager(tradePartner).relationshipLevel()){
|
||||||
RelationshipLevel.Unforgivable -> return 10000
|
RelationshipLevel.Unforgivable -> return 10000
|
||||||
RelationshipLevel.Enemy -> return 2000
|
RelationshipLevel.Enemy -> return 2000
|
||||||
|
@ -25,7 +25,7 @@ class TradeLogic(val ourCivilization:CivilizationInfo, val otherCivilization: Ci
|
|||||||
&& otherCivilization.tech.getTechUniques().contains("Enables Open Borders agreements")) {
|
&& otherCivilization.tech.getTechUniques().contains("Enables Open Borders agreements")) {
|
||||||
val relationshipLevel = otherCivilization.getDiplomacyManager(civInfo).relationshipLevel()
|
val relationshipLevel = otherCivilization.getDiplomacyManager(civInfo).relationshipLevel()
|
||||||
|
|
||||||
offers.add(TradeOffer("Open Borders", TradeType.Agreement, 30))
|
offers.add(TradeOffer(Constants.openBorders, TradeType.Agreement, 30))
|
||||||
}
|
}
|
||||||
|
|
||||||
for(entry in civInfo.getCivResources()
|
for(entry in civInfo.getCivResources()
|
||||||
|
@ -3,7 +3,6 @@ package com.unciv.ui.pickerscreens
|
|||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.badlogic.gdx.scenes.scene2d.Touchable
|
import com.badlogic.gdx.scenes.scene2d.Touchable
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Button
|
import com.badlogic.gdx.scenes.scene2d.ui.Button
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Label
|
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup
|
import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup
|
||||||
import com.unciv.logic.map.TileInfo
|
import com.unciv.logic.map.TileInfo
|
||||||
@ -51,8 +50,11 @@ class ImprovementPickerScreen(tileInfo: TileInfo, onAccept: ()->Unit) : PickerSc
|
|||||||
|
|
||||||
group.add(image).size(30f).pad(10f)
|
group.add(image).size(30f).pad(10f)
|
||||||
|
|
||||||
group.add(Label(improvement.name.tr() + " - " + improvement.getTurnsToBuild(currentPlayerCiv) + " {turns}".tr(),skin)
|
var labelText = improvement.name.tr() + " - " + improvement.getTurnsToBuild(currentPlayerCiv) + " {turns}"
|
||||||
.setFontColor(Color.WHITE)).pad(10f)
|
if(tileInfo.hasViewableResource(currentPlayerCiv) && tileInfo.getTileResource().improvement == improvement.name)
|
||||||
|
labelText += "\n"+"Provides [${tileInfo.resource}]".tr()
|
||||||
|
|
||||||
|
group.add(labelText.toLabel().setFontColor(Color.WHITE)).pad(10f)
|
||||||
|
|
||||||
group.touchable = Touchable.enabled
|
group.touchable = Touchable.enabled
|
||||||
group.onClick {
|
group.onClick {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user