More policy conversions

This commit is contained in:
Yair Morgenstern 2020-07-25 23:03:21 +03:00
parent 627283b10b
commit 4758beffa6
8 changed files with 18 additions and 13 deletions

View file

@ -65,12 +65,14 @@
{
"name": "Citizenship",
"effect": "Tile improvement speed +25%, receive a free worker near the capital",
"uniques": ["Tile improvement speed +25%", "Free [Worker] appears"],
"row": 1,
"column": 4
},
{
"name": "Republic",
"effect": "+1 production in every city, +5% production when constructing buildings",
"uniques": ["[+1 Production] in all cities", "+5% production when constructing buildings"],
"requires": ["Collective Rule"],
"row": 2,
"column": 1
@ -78,6 +80,7 @@
{
"name": "Representation",
"effect": "Each city founded increases culture cost of policies 33% less than normal. Starts a golden age.",
"uniques": ["Each city founded increases culture cost of policies 33% less than normal", "Empire enters golden age"],
"requires": ["Citizenship"],
"row": 2,
"column": 3
@ -85,13 +88,15 @@
{
"name": "Meritocracy",
"effect": "+1 happiness for every city connected to capital, -5% unhappiness from citizens",
"uniques": ["+1 happiness for every city connected to capital", "-5% unhappiness from citizens"],
"requires": ["Citizenship"],
"row": 2,
"column": 5
},
{
"name": "Liberty Complete",
"effect": "Free Great Person of choice near capital"
"effect": "Free Great Person of choice near capital",
"uniques": ["Free Great Person"]
}
]
},
@ -99,6 +104,7 @@
"name": "Honor",
"era": "Ancient era",
"effect": "+25% bonus vs Barbarians; gain Culture when you kill a barbarian unit",
"uniques": ["+25% bonus vs Barbarians", "Gain Culture when you kill a barbarian unit", "Notified of new Barbarian encampments"]
"policies": [
{
"name": "Warrior Code",

View file

@ -228,7 +228,7 @@ class GameInfo {
* adopted Honor policy and have explored the [tile] where the Barbarian Encampent has spawned.
*/
fun notifyCivsOfBarbarianEncampment(tile: TileInfo) {
civilizations.filter { it.policies.isAdopted("Honor")
civilizations.filter { it.hasUnique("Notified of new Barbarian encampments")
&& it.exploredTiles.contains(tile.position) }
.forEach { it.addNotification("A new barbarian encampment has spawned!", tile.position, Color.RED) }
}

View file

@ -224,7 +224,7 @@ object Battle {
private fun tryGetCultureFromHonor(civUnit:ICombatant, barbarianUnit:ICombatant){
if(barbarianUnit.isDefeated() && barbarianUnit is MapUnitCombatant
&& barbarianUnit.getCivInfo().isBarbarian()
&& civUnit.getCivInfo().policies.isAdopted("Honor"))
&& civUnit.getCivInfo().hasUnique("Gain Culture when you kill a barbarian unit"))
civUnit.getCivInfo().policies.storedCulture +=
max(barbarianUnit.unit.baseUnit.strength,barbarianUnit.unit.baseUnit.rangedStrength)
}

View file

@ -103,7 +103,7 @@ object BattleDamage {
if (enemy.getCivInfo().isBarbarian()) {
modifiers["Difficulty"] = civInfo.gameInfo.getDifficulty().barbarianBonus
if (civInfo.policies.hasEffect("+25% bonus vs Barbarians; gain Culture when you kill a barbarian unit"))
if (civInfo.policies.hasEffect("+25% bonus vs Barbarians"))
modifiers["vs Barbarians"] = 0.25f
}

View file

@ -199,7 +199,7 @@ class CityStats {
unhappinessFromCitizens *= 2f
if (civInfo.hasUnique("Unhappiness from population decreased by 10%"))
unhappinessFromCitizens *= 0.9f
if (civInfo.policies.hasEffect("+1 happiness for every city connected to capital, -5% unhappiness from citizens"))
if (civInfo.hasUnique("-5% unhappiness from citizens"))
unhappinessFromCitizens *= 0.95f
if (civInfo.nation.unique == UniqueAbility.POPULATION_GROWTH)
unhappinessFromCitizens *= 0.5f //halved for the Indian
@ -212,7 +212,7 @@ class CityStats {
if (civInfo.policies.hasEffect("+1 gold and -1 unhappiness for every 2 citizens in capital")
&& cityInfo.isCapital())
happinessFromPolicies += (cityInfo.population.population / 2).toFloat()
if (civInfo.policies.hasEffect("+1 happiness for every city connected to capital, -5% unhappiness from citizens")
if (civInfo.hasUnique("+1 happiness for every city connected to capital")
&& cityInfo.isConnectedToCapital())
happinessFromPolicies += 1f
if (civInfo.policies.hasEffect("Each city with a garrison increases happiness by 1 and culture by 2"

View file

@ -70,7 +70,7 @@ class PolicyManager {
var policyCultureCost = 25 + (numberOfAdoptedPolicies * 6).toDouble().pow(1.7)
var cityModifier = 0.3f * (civInfo.cities.count { !it.isPuppet } - 1)
if (hasEffect("Each city founded increases culture cost of policies 33% less than normal. Starts a golden age."))
if (civInfo.hasUnique("Each city founded increases culture cost of policies 33% less than normal"))
cityModifier *= (2 / 3f)
if (isAdopted("Piety Complete")) policyCultureCost *= 0.9
if (civInfo.hasUnique("Culture cost of adopting new Policies reduced by 10%"))
@ -138,13 +138,11 @@ class PolicyManager {
if (hasCapital && (unitName != Constants.settler || !civInfo.isOneCityChallenger()))
civInfo.placeUnitNearTile(civInfo.getCapital().location, unitName)
}
"Tile improvement speed +25%, receive a free worker near the capital" ->
if (hasCapital) civInfo.placeUnitNearTile(civInfo.getCapital().location, Constants.worker)
"+1 culture for each monument, temple and monastery. Gain a free policy." -> freePolicies++
"Each city founded increases culture cost of policies 33% less than normal. Starts a golden age.",
"Empire enters golden age",
"+33% culture in all cities with a world wonder, immediately enter a golden age" ->
civInfo.goldenAges.enterGoldenAge()
"Free Great Person of choice near capital" -> {
"Free Great Person" -> {
if (civInfo.isPlayerCivilization()) civInfo.greatPeople.freeGreatPeople++
else {
val preferredVictoryType = civInfo.victoryType()

View file

@ -275,7 +275,7 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
// Unit maintenance changed
if (unit.canGarrison()
&& (origin.isCityCenter() || destination.isCityCenter())
&& unit.civInfo.policies.isAdopted("Oligarchy")
&& unit.civInfo.hasUnique("Units in cities cost no Maintenance")
) unit.civInfo.updateStatsForNextTurn()
// Move through all intermediate tiles to get ancient ruins, barb encampments

View file

@ -27,9 +27,10 @@ class TileImprovement : NamedStats() {
fun getTurnsToBuild(civInfo: CivilizationInfo): Int {
var realTurnsToBuild = turnsToBuild.toFloat() * civInfo.gameInfo.gameParameters.gameSpeed.modifier
// todo UNIFY THESE
if (civInfo.hasUnique("Worker construction increased 25%"))
realTurnsToBuild *= 0.75f
if (civInfo.policies.isAdopted("Citizenship"))
if (civInfo.hasUnique("Tile improvement speed +25%"))
realTurnsToBuild *= 0.75f
return realTurnsToBuild.roundToInt()
}