mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 22:06:05 -04:00
Demands now work between human players!
This commit is contained in:
parent
6dc471850e
commit
2799205884
@ -491,6 +491,9 @@
|
||||
French:"[civName] nous offre un(e) [untiName] prêt de [cityName]!"
|
||||
}
|
||||
|
||||
"[civName] has denounced us!":{
|
||||
}
|
||||
|
||||
// Trade
|
||||
"[civName] has accepted your trade request":{
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ class NextTurnAutomation{
|
||||
|
||||
private fun respondToDemands(civInfo: CivilizationInfo) {
|
||||
for(popupAlert in civInfo.popupAlerts){
|
||||
if(popupAlert.type==AlertType.CitySettledNearOtherCiv){ // we're called upon to make a decision
|
||||
if(popupAlert.type==AlertType.DemandToStopSettlingCitiesNear){ // we're called upon to make a decision
|
||||
val demandingCiv = civInfo.gameInfo.getCivilization(popupAlert.value)
|
||||
val diploManager = civInfo.getDiplomacyManager(demandingCiv)
|
||||
if(Automation().threatAssessment(civInfo,demandingCiv) >= ThreatLevel.High)
|
||||
@ -472,7 +472,7 @@ class NextTurnAutomation{
|
||||
else -> {
|
||||
val threatLevel = Automation().threatAssessment(civInfo,otherCiv)
|
||||
if(threatLevel<ThreatLevel.High) // don't piss them off for no reason please.
|
||||
otherCiv.popupAlerts.add(PopupAlert(AlertType.CitySettledNearOtherCiv, civInfo.civName))
|
||||
otherCiv.popupAlerts.add(PopupAlert(AlertType.DemandToStopSettlingCitiesNear, civInfo.civName))
|
||||
}
|
||||
}
|
||||
diplomacyManager.removeFlag(DiplomacyFlags.SettledCitiesNearUs)
|
||||
|
@ -316,7 +316,7 @@ class CityInfo {
|
||||
When someone settles a city within 6 tiles of another civ,
|
||||
this makes the AI unhappy and it starts a rolling event.
|
||||
The SettledCitiesNearUs flag gets added to the AI so it knows this happened,
|
||||
and on its turn it asks the player to stop (with a CitySettledNearOtherCiv alert type)
|
||||
and on its turn it asks the player to stop (with a DemandToStopSettlingCitiesNear alert type)
|
||||
If the player says "whatever, I'm not promising to stop", they get a -10 modifier which gradually disappears in 40 turns
|
||||
If they DO agree, then if they keep their promise for ~100 turns they get a +10 modifier for keeping the promise,
|
||||
But if they don't keep their promise they get a -20 that will only fully disappear in 160 turns.
|
||||
|
@ -6,7 +6,9 @@ enum class AlertType{
|
||||
FirstContact,
|
||||
CityConquered,
|
||||
BorderConflict,
|
||||
CitySettledNearOtherCiv,
|
||||
@Deprecated("As of 2.19.0 - replaced with DemandToStopSettlingCitiesNear")
|
||||
CitiesSettledNearOtherCiv,
|
||||
DemandToStopSettlingCitiesNear,
|
||||
CitySettledNearOtherCivDespiteOurPromise,
|
||||
}
|
||||
|
||||
|
@ -415,18 +415,20 @@ class DiplomacyManager() {
|
||||
RelationshipLevel.Ally -> addModifier(DiplomaticModifiers.DenouncedOurAllies,-15f)
|
||||
}
|
||||
}
|
||||
otherCiv().addNotification("[${civInfo.civName}] has denounced us!", Color.RED) // todo translation
|
||||
otherCiv().addNotification("[${civInfo.civName}] has denounced us!", Color.RED)
|
||||
}
|
||||
|
||||
fun agreeNotToSettleNear(){
|
||||
otherCivDiplomacy().setFlag(DiplomacyFlags.AgreedToNotSettleNearUs,100)
|
||||
addModifier(DiplomaticModifiers.UnacceptableDemands,-10f)
|
||||
otherCiv().addNotification("[${civInfo.civName}] agreed to stop settling cities near us!", Color.MAROON)
|
||||
}
|
||||
|
||||
fun refuseDemandNotToSettleNear(){
|
||||
addModifier(DiplomaticModifiers.UnacceptableDemands,-20f)
|
||||
otherCivDiplomacy().setFlag(DiplomacyFlags.IgnoreThemSettlingNearUs,100)
|
||||
otherCivDiplomacy().addModifier(DiplomaticModifiers.RefusedToNotSettleCitiesNearUs,-15f)
|
||||
otherCiv().addNotification("[${civInfo.civName}] refused to stop settling cities near us!", Color.MAROON)
|
||||
}
|
||||
|
||||
//endregion
|
||||
|
@ -7,10 +7,10 @@ import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
|
||||
import com.unciv.Constants
|
||||
import com.unciv.UnCivGame
|
||||
import com.unciv.logic.automation.Automation
|
||||
import com.unciv.logic.automation.ThreatLevel
|
||||
import com.unciv.logic.civilization.AlertType
|
||||
import com.unciv.logic.civilization.CityStateType
|
||||
import com.unciv.logic.civilization.CivilizationInfo
|
||||
import com.unciv.logic.civilization.PopupAlert
|
||||
import com.unciv.logic.civilization.diplomacy.DiplomacyFlags
|
||||
import com.unciv.logic.civilization.diplomacy.DiplomacyManager
|
||||
import com.unciv.logic.civilization.diplomacy.DiplomaticModifiers.*
|
||||
@ -268,19 +268,16 @@ class DiplomacyScreen:CameraStageBaseScreen() {
|
||||
private fun getDemandsTable(currentPlayerCiv: CivilizationInfo, otherCiv: CivilizationInfo): Table {
|
||||
val demandsTable = Table()
|
||||
demandsTable.defaults().pad(10f)
|
||||
|
||||
val dontSettleCitiesButton = TextButton("Please don't settle new cities near us.".tr(),skin)
|
||||
if(otherCiv.popupAlerts.any { it.type==AlertType.DemandToStopSettlingCitiesNear && it.value==currentPlayerCiv.civName })
|
||||
dontSettleCitiesButton.disable()
|
||||
dontSettleCitiesButton.onClick {
|
||||
val threatLevel = Automation().threatAssessment(otherCiv,currentPlayerCiv)
|
||||
if(threatLevel>ThreatLevel.Medium){
|
||||
otherCiv.getDiplomacyManager(currentPlayerCiv).agreeNotToSettleNear()
|
||||
setRightSideFlavorText(otherCiv,"Very well, we shall look for new lands to settle.","Excellent!")
|
||||
}
|
||||
else {
|
||||
otherCiv.getDiplomacyManager(currentPlayerCiv).refuseDemandNotToSettleNear()
|
||||
setRightSideFlavorText(otherCiv,"We shall do as we please.","Very well.")
|
||||
}
|
||||
otherCiv.popupAlerts.add(PopupAlert(AlertType.DemandToStopSettlingCitiesNear, currentPlayerCiv.civName))
|
||||
dontSettleCitiesButton.disable()
|
||||
}
|
||||
demandsTable.add(dontSettleCitiesButton).row()
|
||||
|
||||
demandsTable.add(TextButton("Close".tr(),skin).onClick { updateRightSide(otherCiv) })
|
||||
return demandsTable
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ class AlertPopup(val worldScreen: WorldScreen, val popupAlert: PopupAlert): Popu
|
||||
responseTable.add(getCloseButton("Never!"))
|
||||
add(responseTable)
|
||||
}
|
||||
AlertType.CitySettledNearOtherCiv -> {
|
||||
AlertType.DemandToStopSettlingCitiesNear -> {
|
||||
val otherciv= worldScreen.gameInfo.getCivilization(popupAlert.value)
|
||||
val playerDiploManager = worldScreen.currentPlayerCiv.getDiplomacyManager(otherciv)
|
||||
val translatedNation = otherciv.getTranslatedNation()
|
||||
|
@ -95,12 +95,7 @@ class WorldScreen : CameraStageBaseScreen() {
|
||||
}
|
||||
tileMapHolder.setCenterPosition(tileToCenterOn,true)
|
||||
|
||||
|
||||
// On the one hand, all updates to e.g. TileGroups need to happen on the main rendering thread.
|
||||
// On the other hand, the initial setup requires setting up a lot of items on the map,
|
||||
// and we would sometimes get an "Input dispatching timed out" ANR when doing so.
|
||||
// Putting it in a postRunnnable is our way of attempting to avoid this.
|
||||
Gdx.app.postRunnable { render(0f) }
|
||||
update()
|
||||
}
|
||||
|
||||
// This is private so that we will set the shouldUpdate to true instead.
|
||||
|
Loading…
x
Reference in New Issue
Block a user