mirror of
https://github.com/yairm210/Unciv.git
synced 2025-03-13 11:30:31 +07:00
Helicopter Gunship uniques (#3294)
* Preparation for Helicopter unit
-"All tiles costs 1" unique makes every tile cost 1. Used by Helicopter in CIV 5.
-"Can pass through impassable tiles" unique allows unit to pass through any tile. Used by Helicopter in CIV 5. Does not let units cross ocean if they couldn't already, just terrain that is considered "impassable"
-Mountains now do 50 damage to units that end turn on it. In civ 5 and its expansion this is what happens to any unit that is able to pass mountains.
This is "hard coded" for now. Also added the notification text to template.properties
* mountains do not give sight bonus when on them
* Revert "mountains do not give sight bonus when on them"
This reverts commit 83ad3df5d4
.
This commit is contained in:
parent
3713923caf
commit
64fc57e6d2
@ -448,6 +448,8 @@ Clearing a [forest] has created [amount] Production for [cityName] =
|
||||
[civName] assigned you a new quest: [questName]. =
|
||||
[civName] rewarded you with [influence] influence for completing the [questName] quest. =
|
||||
The resistance in [cityName] has ended! =
|
||||
Our [name] took [tileDamage] tile damage and was destroyed =
|
||||
Our [name] took [tileDamage] tile damage =
|
||||
|
||||
# World Screen UI
|
||||
|
||||
|
@ -31,6 +31,8 @@ class MapUnit {
|
||||
// a major component of getDistanceToTilesWithinTurn,
|
||||
// which in turn is a component of getShortestPath and canReach
|
||||
@Transient var ignoresTerrainCost = false
|
||||
@Transient var allTilesCosts1 = false
|
||||
@Transient var canPassThroughImpassableTiles = false
|
||||
@Transient var roughTerrainPenalty = false
|
||||
@Transient var doubleMovementInCoast = false
|
||||
@Transient var doubleMovementInForestAndJungle = false
|
||||
@ -121,6 +123,8 @@ class MapUnit {
|
||||
|
||||
tempUniques = uniques
|
||||
|
||||
allTilesCosts1 = hasUnique("All tiles costs 1")
|
||||
canPassThroughImpassableTiles = hasUnique("Can pass through impassable tiles")
|
||||
ignoresTerrainCost = hasUnique("Ignores terrain cost")
|
||||
roughTerrainPenalty = hasUnique("Rough terrain penalty")
|
||||
doubleMovementInCoast = hasUnique("Double movement in coast")
|
||||
@ -439,6 +443,7 @@ class MapUnit {
|
||||
}
|
||||
|
||||
getCitadelDamage()
|
||||
getTerrainDamage()
|
||||
}
|
||||
|
||||
fun startTurn() {
|
||||
@ -657,6 +662,20 @@ class MapUnit {
|
||||
.sumBy { it.params[0].toInt() }
|
||||
}
|
||||
|
||||
private fun getTerrainDamage() {
|
||||
// hard coded mountain damage for now
|
||||
if (getTile().baseTerrain == Constants.mountain) {
|
||||
val tileDamage = 50
|
||||
health -= tileDamage
|
||||
|
||||
if (health <= 0) {
|
||||
civInfo.addNotification("Our [$name] took [$tileDamage] tile damage and was destroyed", currentTile.position, Color.RED)
|
||||
destroy()
|
||||
} else civInfo.addNotification("Our [$name] took [$tileDamage] tile damage", currentTile.position, Color.RED)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun getCitadelDamage() {
|
||||
// Check for Citadel damage
|
||||
val applyCitadelDamage = currentTile.neighbors
|
||||
|
@ -8,6 +8,8 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
|
||||
|
||||
// This function is called ALL THE TIME and should be as time-optimal as possible!
|
||||
fun getMovementCostBetweenAdjacentTiles(from: TileInfo, to: TileInfo, civInfo: CivilizationInfo): Float {
|
||||
if (unit.allTilesCosts1)
|
||||
return 1f
|
||||
|
||||
if ((from.isLand != to.isLand) && !unit.civInfo.nation.embarkDisembarkCosts1 && unit.type.isLandUnit())
|
||||
return 100f // this is embarkment or disembarkment, and will take the entire turn
|
||||
@ -330,8 +332,9 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
|
||||
// because optimization on this function results in massive benefits!
|
||||
fun canPassThrough(tile: TileInfo): Boolean {
|
||||
if (tile.isImpassible()){
|
||||
// special exception - ice tiles are technically impassible, but somme units can move through them anyway
|
||||
if (!(tile.terrainFeature == Constants.ice && unit.canEnterIceTiles))
|
||||
// special exception - ice tiles are technically impassible, but some units can move through them anyway
|
||||
// helicopters can pass through impassable tiles like mountains
|
||||
if (!(tile.terrainFeature == Constants.ice && unit.canEnterIceTiles) && !unit.canPassThroughImpassableTiles)
|
||||
return false
|
||||
}
|
||||
if (tile.isLand
|
||||
|
Loading…
Reference in New Issue
Block a user