Added unique civ text for attacking, being attacked, and being defeated

This commit is contained in:
Yair Morgenstern 2019-02-10 19:50:42 +02:00
parent 07663bfc54
commit 796284c7e2
10 changed files with 90 additions and 17 deletions

View File

@ -2,6 +2,9 @@
{
name:"Babylon",
leaderName:"Nebuchadnezzar II",
declaringWar:"The demon wants the blood of soldiers!"
attacked:"Oh well, I presume you know what you're doing."
defeated:"It is over. Perhaps now I shall have peace, at last."
mainColor:[27,53,63],
secondaryColor:[213,249,255],
unique:"Receive free Great Scientist when you discover Writing, Earn Great Scientists 50% faster",
@ -11,6 +14,9 @@
},
{
name:"Greece",
declaringWar:"You are in my way, you must be destroyed."
attacked:"As a matter of fact I too grow weary of peace."
defeated:"You have somehow become my undoing! What kind of beast are you?"
leaderName:"Alexander",
mainColor:[181, 232, 232],
secondaryColor:[68,142,249],
@ -21,6 +27,9 @@
{
name:"China",
leaderName:"Wu Zetian",
declaringWar:"You won't ever be able to bother me again. Go meet Yama."
attacked:"Fool! I will disembowel you all!"
defeated:"You have proven to be a cunning and competent adversary. I congratulate you on your victory."
mainColor:[9, 112, 84],
secondaryColor:[255,255,255],
unique:"Great general provides double combat bonus, and spawns 50% faster"
@ -31,6 +40,9 @@
{
name:"Egypt",
leaderName:"Ramesses II",
declaringWar:"You are but a pest on this Earth, prepare to be eliminated!",
attacked:"You are a fool who evokes pity. You have brought my hostility upon yourself and your repulsive civilization!"
defeated:"Strike me down and my soul will torment yours forever you have won nothing."
mainColor:[ 231, 213, 0],
secondaryColor:[98,10,210],
unique:"+20% production towards Wonder construction"
@ -41,6 +53,9 @@
{
name:"England",
leaderName:"Elizabeth",
declaringWar:"By the grace of God, your days are numbered."
attacked:"We shall never surrender."
defeated:"You have triumphed over us. The day is yours."
mainColor:[ 114, 0, 0],
secondaryColor:[255,255,255],
unique:"+2 movement for all naval units"
@ -51,6 +66,9 @@
{
name:"France",
leaderName:"Napoleon",
declaringWar:"You're disturbing us, prepare for war.",
attacked:"You've fallen into my trap. I'll bury you.",
defeated:"I congratulate you for your victory."
mainColor:[ 38, 98, 255],
secondaryColor:[239,236,148],
unique:"+2 Culture per turn from cities before discovering Steam Power",
@ -61,6 +79,9 @@
{
name:"Russia",
leaderName:"Catherine",
declaringWar:"You've behaved yourself very badly, you know it. Now it's payback time.",
attacked:"You've mistaken my passion for a weakness, you'll regret about this."
defeated:"We were defeated, so this makes me your prisoner. I suppose there are worse fates."
mainColor:[ 236, 178, 0],
secondaryColor:[0,0,0],
unique:"Strategic Resources provide +1 Production, and Horses, Iron and Uranium Resources provide double quantity",
@ -71,6 +92,9 @@
{
name:"Rome",
leaderName:"Augustus Caesar",
declaringWar:"My treasury contains little and my soldiers are getting impatient... <sigh> ...therefore you must die."
attacked:"So brave, yet so stupid! If only you had a brain similar to your courage."
defeated:"The gods have deprived Rome of their favour. We have been defeated."
mainColor:[ 53,0,87],
secondaryColor:[238,201,9],
unique:"+25% Production towards any buildings that already exist in the Capital",
@ -81,6 +105,9 @@
{
name:"Arabia",
leaderName:"Harun al-Rashid",
declaringWar:"The world will be more beautiful without you. Prepare for war."
attacked:"Fool! You will soon regret dearly! I swear it!"
defeated:"You have won, congratulations. My palace is now in your possession, and I beg that you care well for the peacock."
mainColor:[ 41,83,42],
secondaryColor:[146,221,9],
cities:["Mecca","Medina","Damascus","Baghdad","Najran","Kufah","Basra","Khurasan","Anjar","Fustat",
@ -90,6 +117,9 @@
{
name:"America",
leaderName:"Washington",
declaringWar:"Your wanton aggression leaves us no choice. Prepare for war!"
attacked:"You have mistaken our love of peace for weakness. You shall regret this!"
defeated:"The day...is yours. I hope you will be merciful in your triumph."
mainColor:[ 28,51,119],
secondaryColor:[255,255,255],
unique:"All land military units have +1 sight, 50% discount when purchasing tiles",

View File

@ -4019,6 +4019,8 @@
German:"Schwierigkeitsgrad"
}
// Diplomacy!
"Diplomacy":{
Italian:"Diplomazia"
Russian:"Дипломатия"
@ -4074,6 +4076,10 @@
German:"[civName] hat uns den Krieg erklärt!"
}
"You'll pay for this!":{}
"Very well.":{}
"Farewell.":{}
// Overview screen
"Overview":{
Italian:"Panoramica"
@ -4275,6 +4281,8 @@
German:"Nächstgelegene Stadt"
}
"Defeated":{}
// Buildings!
"Palace":{
@ -7363,4 +7371,5 @@
French:"Détruiser [civName]"
}
}

View File

@ -25,6 +25,7 @@ class NextTurnAutomation{
automateUnits(civInfo)
reassignWorkedTiles(civInfo)
trainSettler(civInfo)
civInfo.diplomaticIncidents.clear()
}
private fun buyBuildingOrUnit(civInfo: CivilizationInfo) {

View File

@ -3,6 +3,8 @@ package com.unciv.logic.battle
import com.badlogic.gdx.graphics.Color
import com.unciv.logic.GameInfo
import com.unciv.logic.city.CityInfo
import com.unciv.logic.civilization.diplomacy.DiplomaticIncident
import com.unciv.logic.civilization.diplomacy.DiplomaticIncidentType
import com.unciv.logic.map.TileInfo
import com.unciv.models.gamebasics.unit.UnitType
import java.util.*
@ -163,6 +165,7 @@ class Battle(val gameInfo:GameInfo) {
for(civ in gameInfo.civilizations)
civ.addNotification("The civilization of [${enemyCiv.civName}] has been destroyed!", null, Color.RED)
enemyCiv.getCivUnits().forEach { it.destroy() }
attacker.getCivInfo().diplomaticIncidents.add(DiplomaticIncident(enemyCiv.civName,DiplomaticIncidentType.Defeated))
}
else if(enemyCiv.cities.isNotEmpty()){
enemyCiv.cities.first().cityConstructions.addBuilding("Palace") // relocate palace

View File

@ -2,5 +2,5 @@ package com.unciv.logic.civilization.diplomacy
enum class DiplomaticIncidentType{
WarDeclaration,
TradeOffer
Defeated
}

View File

@ -7,6 +7,11 @@ import com.unciv.ui.utils.colorFromRGB
class Nation : INamed {
override lateinit var name: String
lateinit var leaderName: String
lateinit var declaringWar:String
lateinit var attacked:String
lateinit var defeated:String
lateinit var mainColor: List<Int>
var unique:String?=null
var secondaryColor: List<Int>?=null

View File

@ -296,10 +296,14 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){
val civGroup = Table()
val civGroupBackground = ImageGetter.getDrawable("OtherIcons/civTableBackground.png")
val label = Label(civ.civName.tr(), CameraStageBaseScreen.skin)
var civNameText = civ.civName.tr()
if(civ.isDefeated()) civNameText += "\n({Defeated})".tr()
val label = Label(civNameText, CameraStageBaseScreen.skin)
label.setAlignment(Align.center)
if (civ.isDefeated()) {
civGroup.background = civGroupBackground.tint(Color.LIGHT_GRAY)
label.setFontColor(Color.BLACK)
} else if (playerKnows(civ)) {
civGroup.background = civGroupBackground.tint(civ.getNation().getColor())
label.setFontColor(civ.getNation().getSecondaryColor())

View File

@ -5,6 +5,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.*
import com.unciv.UnCivGame
import com.unciv.models.gamebasics.tr
import com.unciv.ui.utils.*
import com.unciv.ui.worldscreen.optionstable.PopupTable
import com.unciv.ui.worldscreen.optionstable.YesNoPopupTable
class DiplomacyScreen:CameraStageBaseScreen(){
@ -62,9 +63,19 @@ class DiplomacyScreen:CameraStageBaseScreen(){
declareWarButton.setText(declareWarButton.text.toString() + " ($turnsToPeaceTreaty)")
}
declareWarButton.onClick {
YesNoPopupTable("Declare war on [${civ.civName}]?".tr(),{
YesNoPopupTable("Declare war on [${civ.civName}]?".tr(), {
civDiplomacy.declareWar()
updateLeftSideTable()}, this@DiplomacyScreen)
val responsePopup = PopupTable(this)
val otherCivLeaderName = civ.getNation().leaderName + " of " + civ.civName
responsePopup.add(Label(otherCivLeaderName, skin))
responsePopup.addSeparator()
responsePopup.addGoodSizedLabel(civ.getNation().attacked).row()
responsePopup.addButton("Very well.".tr()) { responsePopup.remove() }
responsePopup.open()
updateLeftSideTable()
}, this)
}
civTable.add(declareWarButton).row()
}

View File

@ -311,27 +311,30 @@ class WorldScreen : CameraStageBaseScreen() {
}
class DiplomaticIncidentPopup(val worldScreen: WorldScreen, val diplomaticIncident: DiplomaticIncident):PopupTable(worldScreen){
init{
fun getCloseButton(text:String): TextButton {
val button = TextButton(text.tr(), skin)
button.onClick { close() }
return button
}
init {
val otherCiv = worldScreen.gameInfo.getCivilization(diplomaticIncident.civName)
val otherCivLeaderName = otherCiv.getNation().leaderName+" of "+otherCiv.civName
add(Label(otherCivLeaderName,skin))
addSeparator()
when(diplomaticIncident.type){
DiplomaticIncidentType.WarDeclaration -> {
add(Label("We've decided to declare war on you, k?",skin)).row()
addGoodSizedLabel(otherCiv.getNation().declaringWar).row()
val responseTable = Table()
val angryResponse = TextButton("You'll pay for this",skin)
angryResponse.onClick { close() }
val acceptingResponse= TextButton("This is fine",skin)
acceptingResponse.onClick { close() }
responseTable.add(angryResponse)
responseTable.add(acceptingResponse)
responseTable.add(getCloseButton("You'll pay for this!"))
responseTable.add(getCloseButton("Very well."))
add(responseTable)
}
DiplomaticIncidentType.TradeOffer -> TODO()
DiplomaticIncidentType.Defeated -> {
addGoodSizedLabel(otherCiv.getNation().defeated).row()
add(getCloseButton("Farewell."))
}
}
open()
isOpen = true

View File

@ -1,6 +1,7 @@
package com.unciv.ui.worldscreen.optionstable
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.scenes.scene2d.ui.Cell
import com.badlogic.gdx.scenes.scene2d.ui.Label
import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
@ -26,6 +27,12 @@ open class PopupTable(val screen: CameraStageBaseScreen): Table(CameraStageBaseS
screen.stage.addActor(this)
}
fun addGoodSizedLabel(text: String): Cell<Label> {
val label = Label(text,CameraStageBaseScreen.skin)
label.setWrap(true)
return add(label).width(screen.stage.width/2)
}
fun addButton(text:String, action:()->Unit){
val button = TextButton(text.tr(), skin).apply { color= ImageGetter.getBlue() }
button.onClick(action)