relationshipLevel() clean-up (#2627)

* Diplomacy Clean-up

* Better formatting

* Quickfix

* Fix

counterpoint
This commit is contained in:
AcridBrimistic 2020-05-19 21:28:32 +03:00 committed by GitHub
parent b3a7528818
commit 39e5d0df0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -136,15 +136,12 @@ class DiplomacyManager() {
if(civInfo.isPlayerCivilization())
return otherCiv().getDiplomacyManager(civInfo).relationshipLevel()
if(civInfo.isCityState()){
if (influence<=-60) return RelationshipLevel.Unforgivable
if (influence<=-30) return RelationshipLevel.Enemy
if(civInfo.isCityState()) {
if(influence <= -60) return RelationshipLevel.Unforgivable
if(influence <= -30 || civInfo.isAtWarWith(otherCiv())) return RelationshipLevel.Enemy
if(civInfo.isAtWarWith(otherCiv()))
return RelationshipLevel.Enemy // See below, same with major civs
if(influence>=60) return RelationshipLevel.Ally
if(influence>=30) return RelationshipLevel.Friend
if(influence >= 60) return RelationshipLevel.Ally
if(influence >= 30) return RelationshipLevel.Friend
return RelationshipLevel.Neutral
}
@ -152,19 +149,16 @@ class DiplomacyManager() {
// maybe we need to average their views of each other? That makes sense to me.
val opinion = opinionOfOtherCiv()
if(opinion<=-80) return RelationshipLevel.Unforgivable
if(opinion<=-40) return RelationshipLevel.Enemy
// This is here because when you're at war you can either be enemy OR unforgivable,
// depending on the opinion
if(civInfo.isAtWarWith(otherCiv()))
return RelationshipLevel.Enemy
if(opinion<=-15) return RelationshipLevel.Competitor
if(opinion>=80) return RelationshipLevel.Ally
if(opinion>=40) return RelationshipLevel.Friend
if(opinion>=15) return RelationshipLevel.Favorable
return RelationshipLevel.Neutral
return when {
opinion <= -80 -> RelationshipLevel.Unforgivable
opinion <= -40 || civInfo.isAtWarWith(otherCiv()) -> RelationshipLevel.Enemy /* During wartime, the estimation in which you are held may be enemy OR unforgivable */
opinion <= -15 -> RelationshipLevel.Competitor
opinion >= 80 -> RelationshipLevel.Ally
opinion >= 40 -> RelationshipLevel.Friend
opinion >= 15 -> RelationshipLevel.Favorable
else -> RelationshipLevel.Neutral
}
}
/** Returns the number of turns to degrade from Ally or from Friend */
@ -233,7 +227,6 @@ class DiplomacyManager() {
fun getCommonKnownCivs(): Set<CivilizationInfo> = civInfo.getKnownCivs().intersect(otherCiv().getKnownCivs())
/** Returns true when the [civInfo]'s territory is considered allied for [otherCiv].
*
* This includes friendly and allied city-states and the open border treaties.
*/
fun isConsideredFriendlyTerritory(): Boolean {