mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-22 04:29:17 +07:00
Added "relationship" dependant on the modifiers - this will be the main way we apply user actions to AI consequences
This commit is contained in:
parent
5952056518
commit
b4fc129a9b
@ -11,6 +11,16 @@ import com.unciv.models.gamebasics.GameBasics
|
||||
import com.unciv.models.gamebasics.tile.TileResource
|
||||
import com.unciv.models.gamebasics.tr
|
||||
|
||||
enum class RelationshipLevel{
|
||||
Unforgivable,
|
||||
Enemy,
|
||||
Competitor,
|
||||
Neutral,
|
||||
Favorable,
|
||||
Friend,
|
||||
Ally
|
||||
}
|
||||
|
||||
enum class DiplomacyFlags{
|
||||
DeclinedLuxExchange,
|
||||
DeclinedPeace
|
||||
@ -75,6 +85,17 @@ class DiplomacyManager() {
|
||||
|
||||
fun opinionOfOtherCiv() = diplomaticModifiers.values.sum()
|
||||
|
||||
fun relationshipLevel(): RelationshipLevel {
|
||||
val opinion = opinionOfOtherCiv()
|
||||
if(opinion>80) return RelationshipLevel.Ally
|
||||
if(opinion>40) return RelationshipLevel.Friend
|
||||
if(opinion>15) return RelationshipLevel.Favorable
|
||||
if(opinion<-80) return RelationshipLevel.Unforgivable
|
||||
if(opinion<-40) return RelationshipLevel.Enemy
|
||||
if(opinion<-15) return RelationshipLevel.Competitor
|
||||
return RelationshipLevel.Neutral
|
||||
}
|
||||
|
||||
fun canDeclareWar() = (turnsToPeaceTreaty()==0 && diplomaticStatus != DiplomaticStatus.War)
|
||||
|
||||
|
||||
|
@ -116,7 +116,8 @@ class DiplomacyScreen:CameraStageBaseScreen() {
|
||||
if(!otherCiv.isCityState()){
|
||||
val diplomacyModifiersTable = Table()
|
||||
val otherCivDiplomacyManager = otherCiv.getDiplomacyManager(currentPlayerCiv)
|
||||
diplomacyModifiersTable.add(("Current opinion: "+otherCivDiplomacyManager.opinionOfOtherCiv()).toLabel()).row()
|
||||
val relationshipText = "Our relationship: "+otherCivDiplomacyManager.relationshipLevel()+" ("+otherCivDiplomacyManager.opinionOfOtherCiv()+")"
|
||||
diplomacyModifiersTable.add(relationshipText.toLabel()).row()
|
||||
for(modifier in otherCivDiplomacyManager.diplomaticModifiers){
|
||||
diplomacyModifiersTable.add((modifier.key+" "+modifier.value).toLabel()).row()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user