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:
Jack Rainy 2020-03-15 18:24:52 +02:00 committed by GitHub
parent feb786c9ee
commit 2cbc0e93e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 31 additions and 40 deletions

View file

@ -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
},
{

View file

@ -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]% шанс перехвата воздушных атак

View file

@ -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]%

View file

@ -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 =

View file

@ -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)

View file

@ -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
}