Added Nuclear Submarines & Missile Cruisers, capable of transporting missiles (#4260)

* Implemented Nuclear Submarine and Missile Cruiser units

* Information Era -> Atomic Era; Future Era -> Information Era, conform G&K

* Fixed deprecated uniques still working

* Implemented requested changes
This commit is contained in:
Xander Lenstra
2021-06-26 21:47:27 +02:00
committed by GitHub
parent 30ac1dae1c
commit 1c079bcef3
13 changed files with 151 additions and 134 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -452,254 +452,268 @@ Minuteman
orig: 100, 100
offset: 0, 0
index: -1
Mobile SAM
Missile Cruiser
rotate: false
xy: 436, 112
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Modern Armor
Mobile SAM
rotate: false
xy: 544, 220
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Mohawk Warrior
Modern Armor
rotate: false
xy: 652, 334
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Musketeer
Mohawk Warrior
rotate: false
xy: 760, 436
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Musketeer
rotate: false
xy: 868, 544
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Musketman
rotate: false
xy: 868, 545
xy: 976, 653
size: 100, 99
orig: 100, 99
offset: 0, 0
index: -1
Naresuan's Elephant
rotate: false
xy: 976, 652
xy: 1084, 760
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Norwegian Ski Infantry
rotate: false
xy: 1084, 760
xy: 1192, 868
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Nuclear Missile
rotate: false
xy: 1192, 868
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Panzer
rotate: false
xy: 436, 4
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Paratrooper
Nuclear Submarine
rotate: false
xy: 544, 112
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Persian Immortal
Panzer
rotate: false
xy: 652, 226
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Pikeman
Paratrooper
rotate: false
xy: 760, 328
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Persian Immortal
rotate: false
xy: 868, 436
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Pikeman
rotate: false
xy: 976, 545
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Rifleman
rotate: false
xy: 868, 437
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Rocket Artillery
rotate: false
xy: 976, 544
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Samurai
rotate: false
xy: 1084, 652
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Scout
Rocket Artillery
rotate: false
xy: 1192, 760
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Settler
Samurai
rotate: false
xy: 1300, 868
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Ship of the Line
Scout
rotate: false
xy: 544, 4
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Sipahi
Settler
rotate: false
xy: 652, 118
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Slinger
Ship of the Line
rotate: false
xy: 760, 220
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Sipahi
rotate: false
xy: 868, 328
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Slinger
rotate: false
xy: 976, 437
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Spearman
rotate: false
xy: 868, 329
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Stealth Bomber
rotate: false
xy: 976, 436
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Submarine
rotate: false
xy: 1084, 544
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Swordsman
Stealth Bomber
rotate: false
xy: 1192, 652
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Tank
Submarine
rotate: false
xy: 1300, 760
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Tercio
Swordsman
rotate: false
xy: 1408, 868
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Trebuchet
Tank
rotate: false
xy: 652, 10
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Triplane
Tercio
rotate: false
xy: 760, 112
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Trireme
Trebuchet
rotate: false
xy: 868, 220
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Triplane
rotate: false
xy: 976, 329
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Trireme
rotate: false
xy: 1084, 435
size: 100, 101
orig: 100, 101
offset: 0, 0
index: -1
Turtle Ship
rotate: false
xy: 976, 328
xy: 1192, 544
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
War Chariot
rotate: false
xy: 1084, 436
xy: 1300, 652
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
War Elephant
rotate: false
xy: 1192, 544
xy: 1408, 760
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Warrior
rotate: false
xy: 1300, 652
xy: 1516, 868
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Work Boats
rotate: false
xy: 1408, 760
xy: 868, 112
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Worker
rotate: false
xy: 1516, 868
xy: 976, 221
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Zero
rotate: false
xy: 868, 112
xy: 1084, 327
size: 100, 100
orig: 100, 100
offset: 0, 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 316 KiB

After

Width:  |  Height:  |  Size: 320 KiB

View File

@ -934,7 +934,7 @@
"quote": "'Come to me, all who labor and are heavy burdened, and I will give you rest.' - New Testament, Matthew 11:28"
},
// Information Era
// Atomic Era
// Column 13
{
@ -998,7 +998,7 @@
"requiredTech": "Rocketry"
},
// Future Era
// Information Era
// Column 15
{

View File

@ -482,7 +482,7 @@
},
{
"columnNumber": 13,
"era": "Information era",
"era": "Atomic era",
"techCost": 5100,
"buildingCost": 500,
"wonderCost": 1250,
@ -515,7 +515,7 @@
},
{
"columnNumber": 14,
"era": "Information era",
"era": "Atomic era",
"techCost": 6400,
"buildingCost": 500,
"wonderCost": 1250,
@ -548,7 +548,7 @@
},
{
"columnNumber": 15,
"era": "Future era",
"era": "Information era",
"techCost": 7700,
"buildingCost": 750,
"wonderCost": 1250,
@ -595,7 +595,7 @@
{
"columnNumber": 16,
"era": "Future era",
"era": "Information era",
"techCost": 8800,
"buildingCost": 750,
"wonderCost": 1250,

View File

@ -165,8 +165,7 @@
{
"name": "Academy",
"science": 8,
"uniques": ["Great Improvement", "[+2 Science] once [Scientific Theory] is discovered"]
// in Gods & Kings academy will also have "[+2 Science] once [Atomic Theory] is discovered"
"uniques": ["Great Improvement", "[+2 Science] once [Scientific Theory] is discovered", "[+2 Science] once [Atomic Theory] is discovered"]
},
{
"name": "Landmark",

View File

@ -250,19 +250,19 @@
},
{
"name": "Flight Deck I",
"effect": "Can carry 1 extra air unit",
"effect": "Can carry [1] extra [Air] units",
"unitTypes": ["WaterAircraftCarrier"]
},
{
"name": "Flight Deck II",
"prerequisites": ["Flight Deck I"],
"effect": "Can carry 1 extra air unit",
"effect": " Can carry [1] extra [Air] units",
"unitTypes": ["WaterAircraftCarrier"]
},
{
"name": "Flight Deck III",
"prerequisites": ["Flight Deck II"],
"effect": "Can carry 1 extra air unit",
"effect": "Can carry [1] extra [Air] units",
"unitTypes": ["WaterAircraftCarrier"]
},

View File

@ -936,7 +936,7 @@
"rangedStrength": 60,
"cost": 325,
"requiredTech": "Refrigeration",
// "upgradesTo": "Nuclear Submarine",
"upgradesTo": "Nuclear Submarine",
"uniques": ["+[75]% Strength when attacking", "Invisible to others", "Can only attack water", "Can attack submarines", "Can enter ice tiles"]
},
{
@ -1013,7 +1013,7 @@
"strength": 40,
"cost": 375,
"requiredTech": "Electronics",
"uniques": ["Cannot attack","Can carry 2 aircraft"]
"uniques": ["Cannot attack", "Can carry [2] [Air] units"]
},
{
"name": "Battleship",
@ -1025,7 +1025,8 @@
"cost": 375,
"requiredResource": "Oil",
"requiredTech": "Electronics",
"uniques": ["Ranged attacks may be performed over obstacles"]
"uniques": ["Ranged attacks may be performed over obstacles"],
// Does not actually upgrade to Missile Cruisers
},
{
"name": "Machine Gun",
@ -1076,6 +1077,9 @@
"uniques": ["Can attack submarines", "[40]% chance to intercept air attacks",
"May withdraw before melee ([80]%)", "+[100]% Strength vs [WaterSubmarine]"]
},
// Atomic Era
{
"name": "Marine",
"unitType": "Melee",
@ -1275,22 +1279,18 @@
},
// Information Era
/*
{
"name": "Nuclear Submarine",
"unitType": "WaterSubmarine",
"movement": 6,
"strength": 30,
"strength": 50,
"range": 3,
"rangedStrength": 70,
"rangedStrength": 85,
"cost": 425,
"requiredTech": "Computers",
"uniques": ["Bonus vs Attacker [75]%", "Invisible to others", "Can only attack water", "Can attack submarines", "Can enter ice tiles","+1 Visibility Range"]
// Can carry 2 Missiles
// 50 strength, 85 rangedStrength, requiredTech "Telecommunications" in expansions
"requiredTech": "Telecommunications",
"uniques": ["+[75]% Strength when attacking", "Invisible to others", "Can only attack water",
"Can attack submarines", "Can enter ice tiles", "+1 Visibility Range", "Can carry [2] [Missile] units"]
},
*/
{
"name": "Mechanized Infantry",
"unitType": "Melee",
@ -1299,23 +1299,20 @@
"cost": 375,
"requiredTech": "Mobile Tactics"
},
/*
{
"name": "Missile Cruiser",
"unitType": "WaterRanged",
"movement": 7,
"strength": 60,
"rangedStrength": 25,
"strength": 80,
"rangedStrength": 100,
"range": 3,
"interceptRange": 2,
"cost": 425,
"requiredTech": "Robotics",
"uniques": ["[100]% chance to intercept air attacks", "Can attack submarines",
"Ranged attacks may be performed over obstacles"]
// Can carry 3 missiles - Guided Missiles and Nuclear Missiles, Attack vs submarines 100
// 100 rangedStrength, 80 strength in expansions
"Ranged attacks may be performed over obstacles", "Can carry [3] [Missile] units",
"+[100]% Strength vs [submarine units]"]
},
*/
{
"name": "Modern Armor",
"unitType": "Armor",

View File

@ -672,7 +672,7 @@ class MapUnit {
// evacuation of transported units before disbanding, if possible. toListed because we're modifying the unit list.
for (unit in currentTile.getUnits().filter { it.isTransported && isTransportTypeOf(it) }
.toList()) {
// we disbanded a carrier in a city, it can still stay in the city
// if we disbanded a unit carrying other units in a city, the carried units can still stay in the city
if (currentTile.isCityCenter() && unit.movement.canMoveTo(currentTile)) continue
// if no "fuel" to escape, should be disbanded as well
if (unit.currentMovement < 0.1)
@ -818,27 +818,24 @@ class MapUnit {
}
fun isTransportTypeOf(mapUnit: MapUnit): Boolean {
val isAircraftCarrier = hasUnique("Can carry 2 aircraft")
val isMissileCarrier = hasUnique("Can carry 2 missiles")
if (!isMissileCarrier && !isAircraftCarrier)
return false
if (!mapUnit.type.isAirUnit()) return false
if (isMissileCarrier && mapUnit.type != UnitType.Missile)
return false
if (isAircraftCarrier && mapUnit.type == UnitType.Missile)
return false
return true
// Currently, only missiles and airplanes can be carried
if (!mapUnit.type.isMissile() && !mapUnit.type.isAirUnit()) return false
return getMatchingUniques("Can carry [] [] units").any { mapUnit.matchesFilter(it.params[1]) }
}
fun canTransport(mapUnit: MapUnit): Boolean {
if (!isTransportTypeOf(mapUnit)) return false
if (owner != mapUnit.owner) return false
var unitCapacity = 2
unitCapacity += getUniques().count { it.text == "Can carry 1 extra air unit" }
if (currentTile.airUnits.count { it.isTransported } >= unitCapacity) return false
fun carryCapacity(unit: MapUnit): Int {
var capacity = getMatchingUniques("Can carry [] [] units").filter { unit.matchesFilter(it.params[1]) }.sumBy { it.params[0].toInt() }
capacity += getMatchingUniques("Can carry [] extra [] units").filter { unit.matchesFilter(it.params[1]) }.sumBy { it.params[0].toInt() }
// Deprecated since 3.15.5
capacity += getMatchingUniques("Can carry 2 air units").filter { unit.matchesFilter("Air") }.sumBy { 2 }
capacity += getMatchingUniques("Can carry 1 extra air units").filter { unit.matchesFilter("Air") }.sumBy { 1 }
return capacity
}
fun canTransport(unit: MapUnit): Boolean {
if (owner != unit.owner) return false
if (!isTransportTypeOf(unit)) return false
if (currentTile.airUnits.count { it.isTransported } >= carryCapacity(unit)) return false
return true
}

View File

@ -249,7 +249,8 @@ class BaseUnit : INamed, IConstruction {
"Water", "water units", "Water units" -> unitType.isWaterUnit()
"Air", "air units" -> unitType.isAirUnit()
"Missile" -> unitType.isMissile()
"non-air" -> !unitType.isAirUnit()
"Submarine", "submarine units" -> unitType == UnitType.WaterSubmarine
"non-air" -> !unitType.isAirUnit() && !unitType.isMissile()
"Military", "military units" -> unitType.isMilitary()
"Nuclear Weapon" -> isNuclearWeapon()
// Deprecated as of 3.15.2

View File

@ -84,33 +84,41 @@ Unless otherwise specified, all the following are from [the Noun Project](https:
* [Artillery](https://thenounproject.com/search/?q=Artillery&i=1165261) By Creative Mania
* [Ship](https://thenounproject.com/term/ship/1594793/) By Aisyah for Ironclad
### Modern, Atomic and Information Eras
### Modern Era
* [Submarine](https://thenounproject.com/search/?q=submarine&i=589519) By Hea Poh Lin, MY
* [Helmet](https://thenounproject.com/term/helmet/25216/) By Daniel Turner for Great War Infantry
* [Cap](https://thenounproject.com/search/?q=kepi&i=950267) By Creative Mania for Foreign Legion
* [Tank](https://thenounproject.com/term/tank/1287510/) By corpus delicti for Landship
* [Warship](https://thenounproject.com/term/warship/1597474/) By zidney for Destroyer
* [Battleship](https://thenounproject.com/search/?q=battleship&i=1986807) By Vitaliy Gorbachev, KZ for Battleship
* [Submarine](https://thenounproject.com/search/?q=submarine&i=589519) By Hea Poh Lin, MY
* [xm8](https://thenounproject.com/term/xm8/172007/) By Xela Ub for Infantry
* Icon for Carrier made by [JackRainy](https://github.com/JackRainy), based on [Aircraft Carrier](https://thenounproject.com/icolabs/collection/flat-icons-transport/?i=2332914) By IcoLabs, BR
* [Battleship](https://thenounproject.com/search/?q=battleship&i=1986807) By Vitaliy Gorbachev, KZ for Battleship
* [machine-gun](https://thenounproject.com/search/?q=machine%20gun&i=591058) By Joana Pereira for Machine Gun
* Icon for Anti-Aircraft made by Yair Morgenstern, based on a free design
[on Vectorstock](https://www.vectorstock.com/royalty-free-vector/flat-icon-design-collection-anti-aircraft-gun-vector-16396060)
* [Anti-Tank Gun](https://thenounproject.com/term/anti-tank-gun/1802450/) By Tom Fricker
* [Tank](https://thenounproject.com/search/?q=tank&i=981914) By jeff
* [Tank](https://thenounproject.com/manueldixken/collection/german-tanks/?i=960769) Manuel Dixken, DE for Panzer
* [APC](https://thenounproject.com/search/?q=apc&i=9965) By Luke Anthony Firth for Mechanized Infantry
* [Missile](https://thenounproject.com/term/missile/2311325/) By Eucalyp for Mobile SAM
* [Military vehicle](https://thenounproject.com/search/?q=Army%20rocket&i=23115) By Luke Anthony Firth For Rocket Artillery
* [Modern Armor](https://thenounproject.com/search/?q=tank&i=218) By Public Domain Nouns for Modern Armor
* [Manhattan Project](https://thenounproject.com/search/?q=Nuclear%20Bomb&i=2041074) By corpus delicti, GR
* [Nuclear Missile](https://thenounproject.com/marialuisa.iborra/collection/missiles-bombs/?i=1022574) By Lluisa Iborra, ES
* Icon for Carrier made by [JackRainy](https://github.com/JackRainy), based on [Aircraft Carrier](https://thenounproject.com/icolabs/collection/flat-icons-transport/?i=2332914) By IcoLabs, BR
* [Tank](https://thenounproject.com/term/tank/1287510/) By corpus delicti for Landship
* [Warship](https://thenounproject.com/term/warship/1597474/) By zidney for Destroyer
### Atomic Era
* [Water Gun](https://thenounproject.com/term/water-gun/2121571) by ProSymbols for Marine
* [Parachute](https://thenounproject.com/term/parachute/2025018) by Nociconist for Paratrooper
* [Tank](https://thenounproject.com/search/?q=tank&i=981914) By jeff for Tank
* [Tank](https://thenounproject.com/manueldixken/collection/german-tanks/?i=960769) Manuel Dixken, DE for Panzer
* [Anti-Tank Gun](https://thenounproject.com/term/anti-tank-gun/1802450/) By Tom Fricker
* [atomic bomb](https://thenounproject.com/search/?q=atomic+bomb&i=3712713) by AmruID for Atomic Bomb
* [Military vehicle](https://thenounproject.com/search/?q=Army%20rocket&i=23115) By Luke Anthony Firth For Rocket Artillery
* [Missile](https://thenounproject.com/term/missile/2311325/) By Eucalyp for Mobile SAM
### Information Era
* [Submarine](https://www.flaticon.com/free-icon/submarine_1534201) by Freepik adapted for Nuclear Submarine
* [APC](https://thenounproject.com/search/?q=apc&i=9965) By Luke Anthony Firth for Mechanized Infantry
* [Battleship](https://thenounproject.com/search/?q=battleship&i=3441862) by Edi Prastyo for Missile Cruiser
* [Modern Armor](https://thenounproject.com/search/?q=tank&i=218) By Public Domain Nouns for Modern Armor
* [Nuclear Missile](https://thenounproject.com/marialuisa.iborra/collection/missiles-bombs/?i=1022574) By Lluisa Iborra, ES
* [Robot](https://thenounproject.com/term/robot/1182459/) by Lluisa Iborra, ES for Giant Death Robot
### Great People
* [Pallet](https://thenounproject.com/search/?q=Pallet&i=6862) By James Keuning for Great Artist
@ -274,6 +282,7 @@ Unless otherwise specified, all the following are from [the Noun Project](https:
* [Water dam](https://thenounproject.com/term/water-dam/1002726/) By Symbolon for Hydro Plant
* [Solar panel](https://thenounproject.com/term/solar-panel/1131/) By Modik for Solar Plant
* [Opera House Sydney](https://thenounproject.com/term/opera-house-sydney/1626283/) By Pham Duy Phuong Hung for Sydney Opera House
* [Manhattan Project](https://thenounproject.com/search/?q=Nuclear%20Bomb&i=2041074) By corpus delicti, GR
* [Spaceship](https://thenounproject.com/term/spaceship/1444621/) By Dinosoft Labs for Apollo Program
* [Build](https://thenounproject.com/term/build/1156478/) By Michael G Brown for Spaceship Factory
* [Nuclear Plant](https://thenounproject.com/term/nuclear-plant/1132340/) By Andrejs Kirma