mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 22:37:02 -04:00
Started implementing Patronage branch. Parametrized some uniques, city-states can handle different resting points for different civs.
This commit is contained in:
parent
9c725d74ae
commit
4e2aaa76dc
@ -59,7 +59,7 @@
|
|||||||
"outerColor": [181, 232, 232],
|
"outerColor": [181, 232, 232],
|
||||||
"innerColor": [68,142,249],
|
"innerColor": [68,142,249],
|
||||||
"uniqueName": "Hellenic League",
|
"uniqueName": "Hellenic League",
|
||||||
"uniques": ["City-State Influence degrades at half rate", "City-State Influence recovers at twice the normal rate"],
|
"uniques": ["City-State Influence degrades [50]% slower", "City-State Influence recovers at twice the normal rate"],
|
||||||
"cities": ["Athens","Sparta","Corinth","Argos","Knossos","Mycenae","Pharsalos","Ephesus","Halicarnassus","Rhodes",
|
"cities": ["Athens","Sparta","Corinth","Argos","Knossos","Mycenae","Pharsalos","Ephesus","Halicarnassus","Rhodes",
|
||||||
"Eretria","Pergamon","Miletos","Megara","Phocaea","Sicyon","Tiryns","Samos","Mytilene","Chios",
|
"Eretria","Pergamon","Miletos","Megara","Phocaea","Sicyon","Tiryns","Samos","Mytilene","Chios",
|
||||||
"Paros","Elis","Syracuse","Herakleia","Gortyn","Chalkis","Pylos","Pella","Naxos","Sicyon",
|
"Paros","Elis","Syracuse","Herakleia","Gortyn","Chalkis","Pylos","Pella","Naxos","Sicyon",
|
||||||
|
@ -177,14 +177,17 @@
|
|||||||
},/*{
|
},/*{
|
||||||
"name": "Patronage",
|
"name": "Patronage",
|
||||||
"era": "Classical era",
|
"era": "Classical era",
|
||||||
|
"uniques": ["City-State Influence degrades [25]% slower"],
|
||||||
"policies": [
|
"policies": [
|
||||||
{
|
{
|
||||||
"name": "Philantropy",
|
"name": "Philantropy",
|
||||||
|
"uniques":["Gifts of Gold to City-States generate [25]% more Influence"],
|
||||||
"row": 1,
|
"row": 1,
|
||||||
"column": 2
|
"column": 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Aesthetics",
|
"name": "Aesthetics",
|
||||||
|
"uniques":["Resting point for Influence with City-States is increased by [20]"],
|
||||||
"row": 1,
|
"row": 1,
|
||||||
"column": 4
|
"column": 4
|
||||||
},
|
},
|
||||||
|
@ -21,7 +21,6 @@ import com.unciv.models.ruleset.tile.ResourceType
|
|||||||
import com.unciv.models.ruleset.tile.TileResource
|
import com.unciv.models.ruleset.tile.TileResource
|
||||||
import com.unciv.models.ruleset.unit.BaseUnit
|
import com.unciv.models.ruleset.unit.BaseUnit
|
||||||
import com.unciv.models.stats.Stats
|
import com.unciv.models.stats.Stats
|
||||||
import com.unciv.models.translations.equalsPlaceholderText
|
|
||||||
import com.unciv.models.translations.tr
|
import com.unciv.models.translations.tr
|
||||||
import com.unciv.ui.victoryscreen.RankingType
|
import com.unciv.ui.victoryscreen.RankingType
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@ -597,11 +596,18 @@ class CivilizationInfo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun giveGoldGift(otherCiv: CivilizationInfo, giftAmount: Int) {
|
fun influenceGainedByGift(cityState: CivilizationInfo, giftAmount: Int): Int {
|
||||||
if (!otherCiv.isCityState()) throw Exception("You can only gain influence with City-States!")
|
var influenceGained = giftAmount / 10f
|
||||||
|
for (unique in cityState.getMatchingUniques("Gifts of Gold to City-States generate []% more Influence"))
|
||||||
|
influenceGained *= (100f + unique.params[0].toInt()) / 100
|
||||||
|
return influenceGained.toInt()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun giveGoldGift(cityState: CivilizationInfo, giftAmount: Int) {
|
||||||
|
if (!cityState.isCityState()) throw Exception("You can only gain influence with City-States!")
|
||||||
gold -= giftAmount
|
gold -= giftAmount
|
||||||
otherCiv.getDiplomacyManager(this).influence += giftAmount / 10
|
cityState.getDiplomacyManager(this).influence += influenceGainedByGift(cityState, giftAmount)
|
||||||
otherCiv.updateAllyCivForCityState()
|
cityState.updateAllyCivForCityState()
|
||||||
updateStatsForNextTurn()
|
updateStatsForNextTurn()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,8 +91,6 @@ class DiplomacyManager() {
|
|||||||
var influence = 0f
|
var influence = 0f
|
||||||
set(value) { field = max(value, MINIMUM_INFLUENCE) }
|
set(value) { field = max(value, MINIMUM_INFLUENCE) }
|
||||||
get() = if(civInfo.isAtWarWith(otherCiv())) MINIMUM_INFLUENCE else field
|
get() = if(civInfo.isAtWarWith(otherCiv())) MINIMUM_INFLUENCE else field
|
||||||
/** For city-states. Resting point is the value of Influence at which it ceases changing by itself */
|
|
||||||
var restingPoint = 0f
|
|
||||||
|
|
||||||
/** Total of each turn Science during Research Agreement */
|
/** Total of each turn Science during Research Agreement */
|
||||||
var totalOfScienceDuringRA = 0
|
var totalOfScienceDuringRA = 0
|
||||||
@ -103,7 +101,6 @@ class DiplomacyManager() {
|
|||||||
toReturn.diplomaticStatus=diplomaticStatus
|
toReturn.diplomaticStatus=diplomaticStatus
|
||||||
toReturn.trades.addAll(trades.map { it.clone() })
|
toReturn.trades.addAll(trades.map { it.clone() })
|
||||||
toReturn.influence = influence
|
toReturn.influence = influence
|
||||||
toReturn.restingPoint = restingPoint
|
|
||||||
toReturn.flagsCountdown.putAll(flagsCountdown)
|
toReturn.flagsCountdown.putAll(flagsCountdown)
|
||||||
toReturn.diplomaticModifiers.putAll(diplomaticModifiers)
|
toReturn.diplomaticModifiers.putAll(diplomaticModifiers)
|
||||||
toReturn.totalOfScienceDuringRA=totalOfScienceDuringRA
|
toReturn.totalOfScienceDuringRA=totalOfScienceDuringRA
|
||||||
@ -176,11 +173,19 @@ class DiplomacyManager() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// To be run from City-State DiplomacyManager, which holds the influence. Resting point for every major civ can be different.
|
||||||
|
fun getCityStateInfluenceRestingPoint(): Float {
|
||||||
|
var restingPoint = 0f
|
||||||
|
for(unique in otherCiv().getMatchingUniques("Resting point for Influence with City-States is increased by []"))
|
||||||
|
restingPoint += unique.params[0].toInt()
|
||||||
|
return restingPoint
|
||||||
|
}
|
||||||
|
|
||||||
private fun getCityStateInfluenceDegrade(): Float {
|
private fun getCityStateInfluenceDegrade(): Float {
|
||||||
if (influence < restingPoint)
|
if (influence < getCityStateInfluenceRestingPoint())
|
||||||
return 0f
|
return 0f
|
||||||
|
|
||||||
var decrement = when (civInfo.cityStatePersonality) {
|
val decrement = when (civInfo.cityStatePersonality) {
|
||||||
CityStatePersonality.Hostile -> 1.5f
|
CityStatePersonality.Hostile -> 1.5f
|
||||||
else -> 1f
|
else -> 1f
|
||||||
}
|
}
|
||||||
@ -192,17 +197,21 @@ class DiplomacyManager() {
|
|||||||
else -> 1f
|
else -> 1f
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Deprecated at 3.12.11 in favor of "City-State Influence degrades [50]% slower"
|
||||||
if (otherCiv().hasUnique("City-State Influence degrades at half rate"))
|
if (otherCiv().hasUnique("City-State Influence degrades at half rate"))
|
||||||
modifier *= .5f
|
modifier *= .5f
|
||||||
|
|
||||||
|
for (unique in otherCiv().getMatchingUniques("City-State Influence degrades []% slower"))
|
||||||
|
modifier *= (100f - unique.params[0].toInt()) / 100
|
||||||
|
|
||||||
return max(0f, decrement) * max(0f, modifier)
|
return max(0f, decrement) * max(0f, modifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getCityStateInfluenceRecovery(): Float {
|
private fun getCityStateInfluenceRecovery(): Float {
|
||||||
if (influence > restingPoint)
|
if (influence > getCityStateInfluenceRestingPoint())
|
||||||
return 0f
|
return 0f
|
||||||
|
|
||||||
var increment = 1f
|
val increment = 1f
|
||||||
|
|
||||||
var modifier = when (civInfo.cityStatePersonality) {
|
var modifier = when (civInfo.cityStatePersonality) {
|
||||||
CityStatePersonality.Friendly -> 2f
|
CityStatePersonality.Friendly -> 2f
|
||||||
@ -335,6 +344,7 @@ class DiplomacyManager() {
|
|||||||
private fun nextTurnCityStateInfluence() {
|
private fun nextTurnCityStateInfluence() {
|
||||||
val initialRelationshipLevel = relationshipLevel()
|
val initialRelationshipLevel = relationshipLevel()
|
||||||
|
|
||||||
|
val restingPoint = getCityStateInfluenceRestingPoint()
|
||||||
if (influence > restingPoint) {
|
if (influence > restingPoint) {
|
||||||
val decrement = getCityStateInfluenceDegrade()
|
val decrement = getCityStateInfluenceDegrade()
|
||||||
influence = max(restingPoint, influence - decrement)
|
influence = max(restingPoint, influence - decrement)
|
||||||
|
@ -147,7 +147,7 @@ class DiplomacyScreen(val viewingCiv:CivilizationInfo):CameraStageBaseScreen() {
|
|||||||
diplomacyTable.addSeparator()
|
diplomacyTable.addSeparator()
|
||||||
|
|
||||||
val giftAmount = 250
|
val giftAmount = 250
|
||||||
val influenceAmount = giftAmount / 10
|
val influenceAmount = viewingCiv.influenceGainedByGift(otherCiv, giftAmount)
|
||||||
val giftButton = "Gift [$giftAmount] gold (+[$influenceAmount] influence)".toTextButton()
|
val giftButton = "Gift [$giftAmount] gold (+[$influenceAmount] influence)".toTextButton()
|
||||||
giftButton.onClick {
|
giftButton.onClick {
|
||||||
viewingCiv.giveGoldGift(otherCiv, giftAmount)
|
viewingCiv.giveGoldGift(otherCiv, giftAmount)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user