Added Persian civilization

This commit is contained in:
Yair Morgenstern
2019-09-15 15:17:56 +03:00
parent 9665c59782
commit 3084a5bc33
13 changed files with 606 additions and 569 deletions

View File

@ -81,6 +81,9 @@ class BattleDamage{
modifiers["Great General"] = greatGeneralModifier
}
if(combatant.getCivInfo().nation.unique=="Golden Ages last 50% longer. During a Golden Age, units receive +1 Movement and +10% Strength")
modifiers["Golden Age"] = 0.1f
}
if (combatant.getCivInfo().policies.isAdopted("Honor") && enemy.getCivInfo().isBarbarian())

View File

@ -27,6 +27,8 @@ class GoldenAgeManager{
fun enterGoldenAge() {
var turnsToGoldenAge = 10.0
if (civInfo.containsBuildingUnique("Golden Age length increases +50%")) turnsToGoldenAge *= 1.5
if(civInfo.nation.unique=="Golden Ages last 50% longer. During a Golden Age, units receive +1 Movement and +10% Strength")
turnsToGoldenAge*=1.5
if (civInfo.policies.isAdopted("Freedom Complete")) turnsToGoldenAge *= 1.5
turnsToGoldenAge *= civInfo.gameInfo.gameParameters.gameSpeed.getModifier()
turnsLeftForCurrentGoldenAge += turnsToGoldenAge.toInt()

View File

@ -82,18 +82,21 @@ class MapUnit {
fun getMovementString(): String = DecimalFormat("0.#").format(currentMovement.toDouble()) + "/" + getMaxMovement()
fun getTile(): TileInfo = currentTile
fun getMaxMovement(): Int {
if(isEmbarked()) return getEmbarkedMovement()
if (isEmbarked()) return getEmbarkedMovement()
var movement = baseUnit.movement
movement += getUniques().count{it=="+1 Movement"}
movement += getUniques().count { it == "+1 Movement" }
if(type.isWaterUnit() && !type.isCivilian()
if (type.isWaterUnit() && !type.isCivilian()
&& civInfo.containsBuildingUnique("All military naval units receive +1 movement and +1 sight"))
movement += 1
if(type.isWaterUnit() && civInfo.nation.unique=="+2 movement for all naval units")
movement+=2
if (type.isWaterUnit() && civInfo.nation.unique == "+2 movement for all naval units")
movement += 2
if(civInfo.nation.unique=="Golden Ages last 50% longer. During a Golden Age, units receive +1 Movement and +10% Strength")
movement+=1
return movement
}
@ -336,11 +339,14 @@ class MapUnit {
tile.improvementInProgress = null
}
private fun heal(){
if(isEmbarked()) return // embarked units can't heal
private fun heal() {
if (isEmbarked()) return // embarked units can't heal
var amountToHealBy = rankTileForHealing(getTile())
if (amountToHealBy == 0) return
if (hasUnique("+10 HP when healing")) amountToHealBy += 10
val adjacentUnits = currentTile.getTilesInDistance(1).flatMap { it.getUnits() }
if(adjacentUnits.isNotEmpty())
if (adjacentUnits.isNotEmpty())
amountToHealBy += adjacentUnits.map { it.adjacentHealingBonus() }.max()!!
healBy(amountToHealBy)
}