Added combat penalty when attacking across a river
This commit is contained in:
parent
69dc3cc5f1
commit
e81e048169
2 changed files with 13 additions and 4 deletions
|
@ -137,6 +137,14 @@ object BattleDamage {
|
|||
}
|
||||
if (numberOfAttackersSurroundingDefender > 1)
|
||||
modifiers["Flanking"] = 0.1f * (numberOfAttackersSurroundingDefender-1) //https://www.carlsguides.com/strategy/civilization5/war/combatbonuses.php
|
||||
|
||||
if (attacker.getTile().isConnectedByRiver(defender.getTile())){
|
||||
if (!attacker.getTile().hasConnection(attacker.getCivInfo()) // meaning, the tiles are not road-connected for this civ
|
||||
|| !defender.getTile().hasConnection(attacker.getCivInfo())
|
||||
|| !attacker.getCivInfo().tech.roadsConnectAcrossRivers){
|
||||
modifiers["Across river"] = -0.2f
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (policies.autocracyCompletedTurns > 0 && policies.hasEffect("+20% attack bonus to all Military Units for 30 turns"))
|
||||
|
@ -153,8 +161,6 @@ object BattleDamage {
|
|||
modifiers["Oligarchy"] = 0.5f
|
||||
}
|
||||
|
||||
|
||||
|
||||
return modifiers
|
||||
}
|
||||
|
||||
|
@ -217,7 +223,8 @@ object BattleDamage {
|
|||
|| tile.terrainFeature != Constants.jungle))
|
||||
modifiers[tile.baseTerrain] = 0.25f
|
||||
|
||||
if(unit.getCivInfo().nation.unique == UniqueAbility.WAYFINDING && tile.getTilesInDistance(2).any { it.improvement=="Moai" })
|
||||
if(unit.getCivInfo().nation.unique == UniqueAbility.WAYFINDING
|
||||
&& tile.getTilesInDistance(2).any { it.improvement=="Moai" })
|
||||
modifiers["Moai"] = 0.1f
|
||||
|
||||
if(tile.neighbors.flatMap { it.getUnits() }
|
||||
|
|
|
@ -341,12 +341,14 @@ open class TileInfo {
|
|||
return toString(null)
|
||||
}
|
||||
|
||||
/** The two tiles have a river between them */
|
||||
fun isConnectedByRiver(otherTile:TileInfo): Boolean {
|
||||
if(otherTile !in neighbors) throw Exception("Should never call this function on a non-neighbor!")
|
||||
val xDifference = this.position.x - otherTile.position.x
|
||||
val yDifference = this.position.y - otherTile.position.y
|
||||
|
||||
return when {
|
||||
yDifference < -1f || xDifference < -1f || yDifference > 1f || xDifference > 1f ->
|
||||
throw Exception("Should never call this function on a non-neighbor!")
|
||||
xDifference == 1f && yDifference == 1f -> hasBottomRiver // we're directly above it
|
||||
xDifference == 1f -> hasBottomRightRiver // we're to the top-left of it
|
||||
yDifference == 1f -> hasBottomLeftRiver // we're to the top-right of it
|
||||
|
|
Loading…
Reference in a new issue