Updated Honor branch to G&K (#4118)

* Updated Honor policies to G&K

* Simplified another unique

* Implemented requested changes
This commit is contained in:
Xander Lenstra
2021-06-13 07:11:14 +02:00
committed by GitHub
parent 60809db065
commit da991b5f66
3 changed files with 42 additions and 17 deletions

View File

@ -89,19 +89,19 @@
{
"name": "Honor",
"era": "Ancient era",
"uniques": ["+25% bonus vs Barbarians", "Earn [100]% of killed [Barbarian] unit's [Strength] as [Culture]",
"uniques": ["+[33]% Strength vs [Barbarians]", "Earn [100]% of killed [Barbarian] unit's [Strength] as [Culture]",
"Notified of new Barbarian encampments"],
"policies": [
{
"name": "Warrior Code",
"uniques":["+[20]% Production when constructing [Melee] units [in all cities]"],
"uniques":["+[15]% Production when constructing [Melee] units [in all cities]", "Free [Great General] appears"],
"row": 1,
"column": 2
},
{
"name": "Discipline",
"uniques":["+15% combat strength for melee units which have another military unit in an adjacent tile"],
"row": 1,
"uniques":["+[15]% Strength for [Melee] units which have another [military] unit in an adjacent tile"],
"row": 1,
"column": 4
},
{
@ -120,7 +120,9 @@
},
{
"name": "Professional Army",
"uniques": ["Gold cost of upgrading military units reduced by 33%"],
"uniques": ["Gold cost of upgrading [military] units reduced by [33]%", "[+1 Happiness] from every [Walls]",
"[+1 Happiness] from every [Castle]", "[+1 Happiness] from every [Arsenal]", "[+1 Happiness] from every [Military Base]"
],
"requires": ["Military Caste"],
"row": 3,
"column": 4

View File

@ -75,12 +75,17 @@ object BattleDamage {
}
}
if (civInfo.hasUnique("+15% combat strength for melee units which have another military unit in an adjacent tile")
&& combatant.isMelee()
&& combatant.getTile().neighbors.flatMap { it.getUnits() }
.any { it.civInfo == civInfo && !it.type.isCivilian() && !it.type.isAirUnit() }
)
modifiers["Discipline"] = 15
var adjacentUnitBonus = 0;
for (unique in civInfo.getMatchingUniques("+[]% Strength for [] units which have another [] unit in an adjacent tile")) {
if (combatant.matchesCategory(unique.params[1])
&& combatant.getTile().neighbors.flatMap { it.getUnits() }
.any { it.civInfo == civInfo && it.matchesFilter(unique.params[2]) }
) {
adjacentUnitBonus += unique.params[0].toInt()
}
}
if (adjacentUnitBonus != 0)
modifiers["Adjacent unit"] = adjacentUnitBonus
val civResources = civInfo.getCivResourcesByName()
for (resource in combatant.unit.baseUnit.getResourceRequirements().keys)
@ -103,14 +108,24 @@ object BattleDamage {
.isCityState() && civInfo.hasUnique("+30% Strength when fighting City-State units and cities")
)
modifiers["vs [City-States]"] = 30
// Deprecated since 3.14.17
if (civInfo.hasUnique("+15% combat strength for melee units which have another military unit in an adjacent tile")
&& combatant.isMelee()
&& combatant.getTile().neighbors.flatMap { it.getUnits() }
.any { it.civInfo == civInfo && !it.type.isCivilian() && !it.type.isAirUnit() }
)
modifiers["Discipline"] = 15
}
if (enemy.getCivInfo().isBarbarian()) {
modifiers["Difficulty"] =
(civInfo.gameInfo.getDifficulty().barbarianBonus * 100).toInt()
if (civInfo.hasUnique("+25% bonus vs Barbarians"))
modifiers["vs Barbarians"] = 25
// Deprecated since 3.14.17
if (civInfo.hasUnique("+25% bonus vs Barbarians")) {
modifiers["vs Barbarians (deprecated)"] = 25
}
}
return modifiers

View File

@ -319,11 +319,19 @@ class MapUnit {
fun getCostOfUpgrade(): Int {
val unitToUpgradeTo = getUnitToUpgradeTo()
var goldCostOfUpgrade = (unitToUpgradeTo.cost - baseUnit().cost) * 2 + 10
for (unique in civInfo.getMatchingUniques("Gold cost of upgrading military units reduced by 33%"))
goldCostOfUpgrade = (goldCostOfUpgrade * 0.66f).toInt()
var goldCostOfUpgrade = (unitToUpgradeTo.cost - baseUnit().cost) * 2f + 10f
for (unique in civInfo.getMatchingUniques("Gold cost of upgrading [] units reduced by []%")) {
if (matchesFilter(unique.params[0]))
goldCostOfUpgrade *= (1 - unique.params[1].toFloat() / 100f)
}
// Deprecated since 3.14.17
if (civInfo.hasUnique("Gold cost of upgrading military units reduced by 33%")) {
goldCostOfUpgrade *= 0.67f
}
//
if (goldCostOfUpgrade < 0) return 0 // For instance, Landsknecht costs less than Spearman, so upgrading would cost negative gold
return goldCostOfUpgrade
return goldCostOfUpgrade.toInt()
}