diff --git a/android/assets/jsons/Tutorials/Tutorials_English.json b/android/assets/jsons/Tutorials/Tutorials_English.json index 7350224d0c..5fc914dd84 100644 --- a/android/assets/jsons/Tutorials/Tutorials_English.json +++ b/android/assets/jsons/Tutorials/Tutorials_English.json @@ -226,13 +226,12 @@ ], [ "There are three ways to win in Unciv. They are:", - "Cultural Victory: Complete 4 Social Policy Trees", - "Domination Victory: Survive as the last civilization", - "Science Victory: Be the first to construct a spaceship to Alpha Centauri" + " - Cultural Victory: Complete 4 Social Policy Trees", + " - Domination Victory: Survive as the last civilization", + " - Science Victory: Be the first to construct a spaceship to Alpha Centauri" ], [ - "So to sum it up, these are the basics of Unciv – ", - "Found a prosperous first city, expand slowly to manage happiness,", + "So to sum it up, these are the basics of Unciv – Found a prosperous first city, expand slowly to manage happiness,", " 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.", ] @@ -249,6 +248,7 @@ 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,", " but extra resources of the same type don't add anything, ", " so use them for trading with other civilizations!" @@ -257,6 +257,7 @@ 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", " 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 ", diff --git a/core/src/com/unciv/Constants.kt b/core/src/com/unciv/Constants.kt index aa43202f7b..a12b2f9426 100644 --- a/core/src/com/unciv/Constants.kt +++ b/core/src/com/unciv/Constants.kt @@ -17,6 +17,7 @@ class Constants{ const val ancientRuins = "Ancient ruins" const val peaceTreaty = "Peace Treaty" + const val openBorders = "Open Borders" const val random = "Random" val greatImprovements = listOf("Academy", "Landmark", "Manufactory", "Customs house") diff --git a/core/src/com/unciv/logic/civilization/diplomacy/DiplomacyManager.kt b/core/src/com/unciv/logic/civilization/diplomacy/DiplomacyManager.kt index 4c96f0974a..60f8242fd7 100644 --- a/core/src/com/unciv/logic/civilization/diplomacy/DiplomacyManager.kt +++ b/core/src/com/unciv/logic/civilization/diplomacy/DiplomacyManager.kt @@ -10,7 +10,6 @@ import com.unciv.logic.trade.Trade import com.unciv.logic.trade.TradeType import com.unciv.models.gamebasics.GameBasics import com.unciv.models.gamebasics.tile.ResourceSupplyList -import com.unciv.models.gamebasics.tr enum class RelationshipLevel{ 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 fun updateHasOpenBorders(){ 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 hasOpenBorders=newHasOpenBorders @@ -209,10 +208,46 @@ class DiplomacyManager() { } fun nextTurn(){ - for(trade in trades.toList()){ - for(offer in trade.ourOffers.union(trade.theirOffers).filter { it.duration>0 }) { + nextTurnTrades() + 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-- - if(offer.duration==0) { + if (offer.duration == 0) { civInfo.addNotification("[" + offer.name + "] from [$otherCivName] has ended", null, Color.GOLD) 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) } } - removeUntenebleTrades() - updateHasOpenBorders() + } - if(diplomaticStatus==DiplomaticStatus.Peace) { - if(getModifier(DiplomaticModifiers.YearsOfPeace)< 30) + private fun nextTurnDiplomaticModifiers() { + if (diplomaticStatus == DiplomaticStatus.Peace) { + if (getModifier(DiplomaticModifiers.YearsOfPeace) < 30) 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 - if(hasOpenBorders) openBorders+=1 + if (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 - else revertToZero(DiplomaticModifiers.OpenBorders, 1/8f) + 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 + 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.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.BetrayedDeclarationOfFriendship,1/8f) // That's a bastardly thing to do - revertToZero(DiplomaticModifiers.RefusedToNotSettleCitiesNearUs,1/4f) - revertToZero(DiplomaticModifiers.BetrayedPromiseToNotSettleCitiesNearUs,1/8f) // That's a bastardly thing to do - revertToZero(DiplomaticModifiers.UnacceptableDemands,1/4f) + 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.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.RefusedToNotSettleCitiesNearUs, 1 / 4f) + revertToZero(DiplomaticModifiers.BetrayedPromiseToNotSettleCitiesNearUs, 1 / 8f) // That's a bastardly thing to do + revertToZero(DiplomaticModifiers.UnacceptableDemands, 1 / 4f) - if(!hasFlag(DiplomacyFlags.DeclarationOfFriendship)) - revertToZero(DiplomaticModifiers.DeclarationOfFriendship, 1/2f) //decreases slowly and will revert to full if it is declared later + if (!hasFlag(DiplomacyFlags.DeclarationOfFriendship)) + 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 (hasFlag(DiplomacyFlags.ProvideMilitaryUnit)) removeFlag(DiplomacyFlags.ProvideMilitaryUnit) - } - else { + } else { 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 */ @@ -401,6 +409,9 @@ class DiplomacyManager() { 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() }){ if(thirdCiv==otherCiv() || !thirdCiv.knows(otherCivName)) continue val thirdCivRelationshipWithOtherCiv = thirdCiv.getDiplomacyManager(otherCiv()).relationshipLevel() @@ -411,7 +422,6 @@ class DiplomacyManager() { RelationshipLevel.Ally -> addModifier(DiplomaticModifiers.DenouncedOurAllies,-15f) } } - otherCiv().addNotification("[${civInfo.civName}] has denounced us!", Color.RED) } fun agreeNotToSettleNear(){ diff --git a/core/src/com/unciv/logic/trade/TradeEvaluation.kt b/core/src/com/unciv/logic/trade/TradeEvaluation.kt index d99702c92f..41e9b52832 100644 --- a/core/src/com/unciv/logic/trade/TradeEvaluation.kt +++ b/core/src/com/unciv/logic/trade/TradeEvaluation.kt @@ -145,7 +145,7 @@ class TradeEvaluation{ return sumOfStats.toInt() * 100 } TradeType.Agreement -> { - if(offer.name=="Open Borders") return 100 + if(offer.name==Constants.openBorders) return 100 throw Exception("Invalid agreement type!") } } @@ -211,7 +211,7 @@ class TradeEvaluation{ return sumOfStats.toInt() * 100 } TradeType.Agreement -> { - if(offer.name == "Open Borders"){ + if(offer.name == Constants.openBorders){ when(civInfo.getDiplomacyManager(tradePartner).relationshipLevel()){ RelationshipLevel.Unforgivable -> return 10000 RelationshipLevel.Enemy -> return 2000 diff --git a/core/src/com/unciv/logic/trade/TradeLogic.kt b/core/src/com/unciv/logic/trade/TradeLogic.kt index 64ebeae9a1..dd7092a94a 100644 --- a/core/src/com/unciv/logic/trade/TradeLogic.kt +++ b/core/src/com/unciv/logic/trade/TradeLogic.kt @@ -25,7 +25,7 @@ class TradeLogic(val ourCivilization:CivilizationInfo, val otherCivilization: Ci && otherCivilization.tech.getTechUniques().contains("Enables Open Borders agreements")) { 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() diff --git a/core/src/com/unciv/ui/pickerscreens/ImprovementPickerScreen.kt b/core/src/com/unciv/ui/pickerscreens/ImprovementPickerScreen.kt index 706cb29164..6c247fc204 100644 --- a/core/src/com/unciv/ui/pickerscreens/ImprovementPickerScreen.kt +++ b/core/src/com/unciv/ui/pickerscreens/ImprovementPickerScreen.kt @@ -3,7 +3,6 @@ package com.unciv.ui.pickerscreens import com.badlogic.gdx.graphics.Color import com.badlogic.gdx.scenes.scene2d.Touchable 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.VerticalGroup 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(Label(improvement.name.tr() + " - " + improvement.getTurnsToBuild(currentPlayerCiv) + " {turns}".tr(),skin) - .setFontColor(Color.WHITE)).pad(10f) + var labelText = improvement.name.tr() + " - " + improvement.getTurnsToBuild(currentPlayerCiv) + " {turns}" + 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.onClick {