Ice is impassible for all except submarines (#2158)
* Ice is impassible for all except submarines * Using "unique" property + simplified call of functions
This commit is contained in:
parent
feb786c9ee
commit
2cbc0e93e0
6 changed files with 31 additions and 40 deletions
|
@ -1098,7 +1098,7 @@
|
|||
"rangedStrength": 60,
|
||||
"cost": 325,
|
||||
"requiredTech": "Refrigeration",
|
||||
"uniques": ["Bonus as Attacker [75]%", "Invisible to others", "Can only attack water", "Can attack submarines"],
|
||||
"uniques": ["Bonus as Attacker [75]%", "Invisible to others", "Can only attack water", "Can attack submarines", "Can enter ice tiles"],
|
||||
"hurryCostModifier": 20
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1586,6 +1586,7 @@ Submarine = Подводная лодка
|
|||
Bonus as Attacker [amount]% = Бонус при атаке +[amount]%
|
||||
Invisible to others = Невидим остальным
|
||||
Can only attack water = Может атаковать только морские юниты
|
||||
Can enter ice tiles = Может проходить через лёд
|
||||
Carrier = Авианосец
|
||||
Triplane = Триплан
|
||||
[percent]% chance to intercept air attacks = [percent]% шанс перехвата воздушных атак
|
||||
|
|
|
@ -1566,6 +1566,7 @@ Submarine = Субмарина
|
|||
Bonus as Attacker [amount]% = Перевага у нападі +[amount]%
|
||||
Invisible to others = Інші не бачать
|
||||
Can only attack water = Може атакувати тільки на воді
|
||||
Can enter ice tiles = Може проходити крізь лід
|
||||
Carrier = Авіаносець
|
||||
Triplane = Триплан
|
||||
[percent]% chance to intercept air attacks = Можливе перехоплення повітряних атак [percent]%
|
||||
|
|
|
@ -1564,6 +1564,7 @@ Submarine =
|
|||
Bonus as Attacker [amount]% =
|
||||
Invisible to others =
|
||||
Can only attack water =
|
||||
Can enter ice tiles =
|
||||
Carrier =
|
||||
Triplane =
|
||||
[percent]% chance to intercept air attacks =
|
||||
|
|
|
@ -318,6 +318,10 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
|
|||
&& !(tile.isCityCenter() && tile.isCoastalTile()))
|
||||
return false
|
||||
|
||||
if (tile.terrainFeature == Constants.ice
|
||||
&& !unit.baseUnit.uniques.contains("Can enter ice tiles"))
|
||||
return false
|
||||
|
||||
if (tile.isWater && unit.type.isLandUnit()) {
|
||||
if (!unit.civInfo.tech.unitsCanEmbark) return false
|
||||
if (tile.isOcean && !unit.civInfo.tech.embarkedUnitsCanEnterOcean)
|
||||
|
|
|
@ -21,66 +21,50 @@ enum class UnitType{
|
|||
Bomber,
|
||||
Missile;
|
||||
|
||||
fun isMelee(): Boolean {
|
||||
return this == Melee
|
||||
fun isMelee() =
|
||||
this == Melee
|
||||
|| this == Mounted
|
||||
|| this == Armor
|
||||
|| this == Scout
|
||||
|| this == WaterMelee
|
||||
}
|
||||
fun isRanged(): Boolean {
|
||||
return this == Ranged
|
||||
|
||||
fun isRanged() =
|
||||
this == Ranged
|
||||
|| this == Siege
|
||||
|| this == WaterRanged
|
||||
|| this == WaterSubmarine
|
||||
|| this == City
|
||||
|| this.isAirUnit()
|
||||
}
|
||||
|
||||
fun isLandUnit(): Boolean {
|
||||
return this == Civilian
|
||||
fun isLandUnit() =
|
||||
this == Civilian
|
||||
|| this == Melee
|
||||
|| this == Mounted
|
||||
|| this == Armor
|
||||
|| this == Scout
|
||||
|| this == Ranged
|
||||
|| this == Siege
|
||||
}
|
||||
|
||||
fun isCivilian(): Boolean {
|
||||
return this == Civilian
|
||||
|| this == WaterCivilian
|
||||
}
|
||||
fun isCivilian() = this == Civilian || this == WaterCivilian
|
||||
|
||||
fun isMilitary(): Boolean {
|
||||
return this != Civilian
|
||||
&& this != WaterCivilian
|
||||
}
|
||||
fun isMilitary() = this != Civilian && this != WaterCivilian
|
||||
|
||||
fun isWaterUnit(): Boolean {
|
||||
return this==WaterSubmarine
|
||||
|| this==WaterRanged
|
||||
|| this==WaterMelee
|
||||
|| this==WaterCivilian
|
||||
|| this==WaterAircraftCarrier
|
||||
|| this==WaterMissileCarrier
|
||||
}
|
||||
fun isWaterUnit() =
|
||||
this == WaterSubmarine
|
||||
|| this == WaterRanged
|
||||
|| this == WaterMelee
|
||||
|| this == WaterCivilian
|
||||
|| this == WaterAircraftCarrier
|
||||
|| this == WaterMissileCarrier
|
||||
|
||||
fun isAirUnit():Boolean{
|
||||
return this==Bomber
|
||||
|| this==Fighter
|
||||
|| this==Missile
|
||||
}
|
||||
fun isAirUnit() =
|
||||
this == Bomber
|
||||
|| this == Fighter
|
||||
|| this == Missile
|
||||
|
||||
fun isMissile():Boolean{
|
||||
return this == Missile
|
||||
}
|
||||
fun isMissile() = this == Missile
|
||||
|
||||
fun isAircraftCarrierUnit():Boolean{
|
||||
return this == WaterAircraftCarrier
|
||||
}
|
||||
fun isAircraftCarrierUnit() = this == WaterAircraftCarrier
|
||||
|
||||
fun isMissileCarrierUnit():Boolean{
|
||||
return this == WaterMissileCarrier
|
||||
}
|
||||
fun isMissileCarrierUnit() = this == WaterMissileCarrier
|
||||
}
|
Loading…
Reference in a new issue