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,18 +89,18 @@
{ {
"name": "Honor", "name": "Honor",
"era": "Ancient era", "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"], "Notified of new Barbarian encampments"],
"policies": [ "policies": [
{ {
"name": "Warrior Code", "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, "row": 1,
"column": 2 "column": 2
}, },
{ {
"name": "Discipline", "name": "Discipline",
"uniques":["+15% combat strength for melee units which have another military unit in an adjacent tile"], "uniques":["+[15]% Strength for [Melee] units which have another [military] unit in an adjacent tile"],
"row": 1, "row": 1,
"column": 4 "column": 4
}, },
@ -120,7 +120,9 @@
}, },
{ {
"name": "Professional Army", "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"], "requires": ["Military Caste"],
"row": 3, "row": 3,
"column": 4 "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") var adjacentUnitBonus = 0;
&& combatant.isMelee() for (unique in civInfo.getMatchingUniques("+[]% Strength for [] units which have another [] unit in an adjacent tile")) {
&& combatant.getTile().neighbors.flatMap { it.getUnits() } if (combatant.matchesCategory(unique.params[1])
.any { it.civInfo == civInfo && !it.type.isCivilian() && !it.type.isAirUnit() } && combatant.getTile().neighbors.flatMap { it.getUnits() }
) .any { it.civInfo == civInfo && it.matchesFilter(unique.params[2]) }
modifiers["Discipline"] = 15 ) {
adjacentUnitBonus += unique.params[0].toInt()
}
}
if (adjacentUnitBonus != 0)
modifiers["Adjacent unit"] = adjacentUnitBonus
val civResources = civInfo.getCivResourcesByName() val civResources = civInfo.getCivResourcesByName()
for (resource in combatant.unit.baseUnit.getResourceRequirements().keys) for (resource in combatant.unit.baseUnit.getResourceRequirements().keys)
@ -104,13 +109,23 @@ object BattleDamage {
) )
modifiers["vs [City-States]"] = 30 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()) { if (enemy.getCivInfo().isBarbarian()) {
modifiers["Difficulty"] = modifiers["Difficulty"] =
(civInfo.gameInfo.getDifficulty().barbarianBonus * 100).toInt() (civInfo.gameInfo.getDifficulty().barbarianBonus * 100).toInt()
if (civInfo.hasUnique("+25% bonus vs Barbarians")) // Deprecated since 3.14.17
modifiers["vs Barbarians"] = 25 if (civInfo.hasUnique("+25% bonus vs Barbarians")) {
modifiers["vs Barbarians (deprecated)"] = 25
}
} }
return modifiers return modifiers

View File

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