Implements the Telecommunications tech (v2) (#4249)

* Added the addPopulation() and setPopulation() functions to add population to cities and automatically reassign them

* Added the Telecommunications tech

* Added the CN tower

* Implemented Bomb Shelter

* Added icons for new buildings

* Implemented requsted changes
This commit is contained in:
Xander Lenstra 2021-06-24 18:07:33 +02:00 committed by GitHub
parent 111d11b9b2
commit af0cd0c9df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 470 additions and 419 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -74,710 +74,717 @@ Big Ben
orig: 100, 100
offset: 0, 0
index: -1
Brandenburg Gate
Bomb Shelter
rotate: false
xy: 4, 436
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Broadcast Tower
Brandenburg Gate
rotate: false
xy: 112, 544
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Burial Tomb
Broadcast Tower
rotate: false
xy: 220, 652
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
CN Tower
Burial Tomb
rotate: false
xy: 328, 760
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Castle
CN Tower
rotate: false
xy: 436, 868
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Chichen Itza
Castle
rotate: false
xy: 4, 328
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Circus
Chichen Itza
rotate: false
xy: 112, 436
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Circus Maximus
Circus
rotate: false
xy: 220, 544
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Colosseum
Circus Maximus
rotate: false
xy: 328, 652
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Colossus
Colosseum
rotate: false
xy: 436, 760
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Courthouse
Colossus
rotate: false
xy: 544, 868
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Cristo Redentor
Courthouse
rotate: false
xy: 4, 220
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Eiffel Tower
Cristo Redentor
rotate: false
xy: 112, 328
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Factory
Eiffel Tower
rotate: false
xy: 220, 436
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Floating Gardens
Factory
rotate: false
xy: 328, 544
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Forbidden Palace
Floating Gardens
rotate: false
xy: 436, 652
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Forge
Forbidden Palace
rotate: false
xy: 544, 760
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Garden
Forge
rotate: false
xy: 652, 868
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Granary
Garden
rotate: false
xy: 4, 112
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Great Wall
Granary
rotate: false
xy: 112, 220
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Hagia Sophia
Great Wall
rotate: false
xy: 220, 328
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Hanging Gardens
Hagia Sophia
rotate: false
xy: 328, 436
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Hanse
Hanging Gardens
rotate: false
xy: 436, 544
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Harbor
Hanse
rotate: false
xy: 544, 652
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Hermitage
Harbor
rotate: false
xy: 652, 760
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Heroic Epic
Hermitage
rotate: false
xy: 760, 868
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Himeji Castle
Heroic Epic
rotate: false
xy: 4, 4
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Hospital
Himeji Castle
rotate: false
xy: 112, 112
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Hubble Space Telescope
Hospital
rotate: false
xy: 220, 220
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Hydro Plant
Hubble Space Telescope
rotate: false
xy: 328, 328
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Ironworks
Hydro Plant
rotate: false
xy: 436, 436
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Kremlin
Ironworks
rotate: false
xy: 544, 544
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Krepost
Kremlin
rotate: false
xy: 652, 652
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Leaning Tower of Pisa
Krepost
rotate: false
xy: 760, 760
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Library
Leaning Tower of Pisa
rotate: false
xy: 868, 868
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Lighthouse
Library
rotate: false
xy: 112, 4
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Longhouse
Lighthouse
rotate: false
xy: 220, 112
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Machu Picchu
Longhouse
rotate: false
xy: 328, 220
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Manhattan Project
Machu Picchu
rotate: false
xy: 436, 328
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Market
Manhattan Project
rotate: false
xy: 544, 436
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Mausoleum of Halicarnassus
Market
rotate: false
xy: 652, 544
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Medical Lab
Mausoleum of Halicarnassus
rotate: false
xy: 760, 652
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Military Academy
Medical Lab
rotate: false
xy: 868, 760
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Military Base
Military Academy
rotate: false
xy: 976, 868
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Mint
Military Base
rotate: false
xy: 220, 4
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Monastery
Mint
rotate: false
xy: 328, 112
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Monument
Monastery
rotate: false
xy: 436, 220
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Mud Pyramid Mosque
Monument
rotate: false
xy: 544, 328
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Mughal Fort
Mud Pyramid Mosque
rotate: false
xy: 652, 436
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Museum
Mughal Fort
rotate: false
xy: 760, 544
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
National College
Museum
rotate: false
xy: 868, 652
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
National Epic
National College
rotate: false
xy: 976, 760
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
National Treasury
National Epic
rotate: false
xy: 1084, 868
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Neuschwanstein
National Treasury
rotate: false
xy: 328, 4
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Notre Dame
Neuschwanstein
rotate: false
xy: 436, 112
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Nuclear Plant
Notre Dame
rotate: false
xy: 544, 220
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Observatory
Nuclear Plant
rotate: false
xy: 652, 328
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Opera House
Observatory
rotate: false
xy: 760, 436
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Oxford University
Opera House
rotate: false
xy: 868, 544
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Palace
Oxford University
rotate: false
xy: 976, 652
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Paper Maker
Palace
rotate: false
xy: 1084, 760
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Pentagon
Paper Maker
rotate: false
xy: 1192, 868
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Petra
Pentagon
rotate: false
xy: 436, 4
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Porcelain Tower
Petra
rotate: false
xy: 544, 112
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Public School
Porcelain Tower
rotate: false
xy: 652, 220
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Research Lab
Public School
rotate: false
xy: 760, 328
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
SS Booster
Research Lab
rotate: false
xy: 868, 436
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
SS Cockpit
SS Booster
rotate: false
xy: 976, 544
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
SS Engine
SS Cockpit
rotate: false
xy: 1084, 652
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
SS Stasis Chamber
SS Engine
rotate: false
xy: 1192, 760
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Satrap's Court
SS Stasis Chamber
rotate: false
xy: 1300, 868
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Seaport
Satrap's Court
rotate: false
xy: 544, 4
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Sistine Chapel
Seaport
rotate: false
xy: 652, 112
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Solar Plant
Sistine Chapel
rotate: false
xy: 760, 220
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Spaceship Factory
Solar Plant
rotate: false
xy: 868, 328
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Stable
Spaceship Factory
rotate: false
xy: 976, 436
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Stadium
Stable
rotate: false
xy: 1084, 544
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Statue of Liberty
Stadium
rotate: false
xy: 1192, 652
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Statue of Zeus
Statue of Liberty
rotate: false
xy: 1300, 760
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Stock Exchange
Statue of Zeus
rotate: false
xy: 1408, 868
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Stone Works
Stock Exchange
rotate: false
xy: 652, 4
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Stonehenge
Stone Works
rotate: false
xy: 760, 112
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Sydney Opera House
Stonehenge
rotate: false
xy: 868, 220
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Taj Mahal
Sydney Opera House
rotate: false
xy: 976, 328
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Temple
Taj Mahal
rotate: false
xy: 1084, 436
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Temple of Artemis
Temple
rotate: false
xy: 1192, 544
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Terracotta Army
Temple of Artemis
rotate: false
xy: 1300, 652
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
The Great Library
Terracotta Army
rotate: false
xy: 1408, 760
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
The Great Lighthouse
The Great Library
rotate: false
xy: 1516, 868
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
The Louvre
The Great Lighthouse
rotate: false
xy: 760, 4
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
The Oracle
The Louvre
rotate: false
xy: 868, 112
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
The Pyramids
The Oracle
rotate: false
xy: 976, 220
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Theatre
The Pyramids
rotate: false
xy: 1084, 328
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
University
Theatre
rotate: false
xy: 1192, 436
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Utopia Project
University
rotate: false
xy: 1300, 544
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Walls
Utopia Project
rotate: false
xy: 1408, 652
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Walls of Babylon
Walls
rotate: false
xy: 1516, 760
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Wat
Walls of Babylon
rotate: false
xy: 1624, 868
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Water Mill
Wat
rotate: false
xy: 868, 4
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Windmill
Water Mill
rotate: false
xy: 976, 112
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Workshop
Windmill
rotate: false
xy: 1084, 220
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Workshop
rotate: false
xy: 1192, 328
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 249 KiB

After

Width:  |  Height:  |  Size: 251 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1005 KiB

After

Width:  |  Height:  |  Size: 1008 KiB

View File

@ -1001,17 +1001,23 @@
// Future Era
// Column 15
/*
{
"name": "CN Tower",
"isWonder": true,
"culture": 1,
"greatPersonPoints": {"production": 1}
"providesFreeBuilding": "Broadcast Tower"
"uniques": ["+1 population in each city","+1 happiness in each city"]
"requiredTech": "Telecommunications" // todo doesn't exist yet!
"greatPersonPoints": {"gold": 1},
"providesFreeBuilding": "Broadcast Tower",
"uniques": ["[+1] population [in all cities]", "[+1 Happiness] [in all cities]"],
"requiredTech": "Telecommunications",
"quote": "'Nothing travels faster than light with the possible exception of bad news, which obeys its own special rules.' Douglas Adams"
},
{
"name": "Bomb Shelter",
"cost": 300,
"maintenance": 1,
"requiredTech": "Telecommunications",
"uniques": ["Population loss from nuclear attacks -[75]%"]
},
*/
{
"name": "SS Cockpit",
"requiredResource": "Aluminum",
@ -1022,7 +1028,7 @@
"name": "Hubble Space Telescope",
"isWonder": true,
"greatPersonPoints": {"science": 1},
"providesFreeBuilding": "Spaceship Factory",
"providesFreeBuilding": "Spaceship Factory",
// If spaceship parts are changed into units, the spaceship part unique should be changed to
// "+[25]% Production when constructing [Spaceship part] units [in this city]"
"uniques": ["[2] free [Great Scientist] units appear",

View File

@ -11,12 +11,12 @@
"quote": "'Where tillage begins, other arts follow. The farmers therefore are the founders of human civilization.' - Daniel Webster",
"uniques": ["Starting tech"]
}
]
]
},
{
"columnNumber": 1,
"era": "Ancient era",
"techCost": 35,
"techCost": 35,
"buildingCost": 60,
"wonderCost": 185,
"techs": [
@ -44,13 +44,13 @@
"prerequisites": ["Agriculture"],
"quote": "'The meek shall inherit the Earth, but not its mineral rights.' - J. Paul Getty"
}
]
]
},
{
"columnNumber": 2,
"era": "Ancient era",
"techCost": 55,
"techCost": 55,
"buildingCost": 75,
"wonderCost": 185,
"techs": [
@ -95,13 +95,13 @@
"row": 10,
"prerequisites": ["Mining"],
"quote": "'Here Hector entered, with a spear eleven cubits long in his hand; the bronze point gleamed in front of him, and was fastened to the shaft of the spear by a ring of gold.' - Homer"
}
]
}
]
},
{
"columnNumber": 3,
"era": "Classical era",
"techCost": 105,
"techCost": 105,
"buildingCost": 100,
"wonderCost": 250,
"techs": [
@ -131,12 +131,12 @@
"prerequisites": ["Masonry","The Wheel"],
"quote": "'Three things are to be looked to in a building: that it stands on the right spot; that it be securely founded; that it be successfully executed.' - Johann Wolfgang von Goethe"
}
]
]
},
{
"columnNumber": 4,
"era": "Classical era",
"techCost": 175,
"techCost": 175,
"buildingCost": 100,
"wonderCost": 250,
"techs": [
@ -165,7 +165,7 @@
"prerequisites": ["Bronze Working"],
"quote": "'Do not wait to strike til the iron is hot, but make it hot by striking.' - William Butler Yeats"
}
]
]
},
{
"columnNumber": 5,
@ -205,7 +205,7 @@
{
"columnNumber": 6,
"era": "Medieval era",
"techCost": 485,
"techCost": 485,
"buildingCost": 160,
"wonderCost": 400,
"techs": [
@ -248,12 +248,12 @@
"prerequisites": ["Metal Casting"],
"quote": "'John Henry said to his Captain, / 'A man ain't nothin' but a man, / And before I'll let your steam drill beat me down, / I'll die with the hammer in my hand.'' - Anonymous: The Ballad of John Henry, the Steel-Drivin' Man"
}
]
]
},
{
"columnNumber": 7,
"era": "Renaissance era",
"techCost": 780,
"techCost": 780,
"buildingCost": 200,
"wonderCost": 500,
"techs": [
@ -288,12 +288,12 @@
"prerequisites": ["Physics","Steel"],
"quote": "'The day when two army corps can annihilate each other in one second, all civilized nations, it is to be hoped, will recoil from war and discharge their troops.' - Alfred Nobel"
}
]
]
},
{
"columnNumber": 8,
"era": "Renaissance era",
"techCost": 1150,
"techCost": 1150,
"buildingCost": 250,
"wonderCost": 625,
"techs": [
@ -327,7 +327,7 @@
"prerequisites": ["Gunpowder"],
"quote": "'Wherever we look, the work of the chemist has raised the level of our civilization and has increased the productive capacity of the nation.' - Calvin Coolidge"
}
]
]
},
{
"columnNumber": 9,
@ -372,7 +372,7 @@
"prerequisites": ["Chemistry"],
"quote": "'The nation that destroys its soil destroys itself.' - Franklin Delano Roosevelt"
}
]
]
},
{
"columnNumber": 10,
@ -406,7 +406,7 @@
"prerequisites": ["Fertilizer","Military Science"],
"quote": "'As soon as men decide that all means are permitted to fight an evil, then their good becomes indistinguishable from the evil that they set out to destroy.' - Christopher Dawson"
}
]
]
},
{
"columnNumber": 11,
@ -445,7 +445,7 @@
"prerequisites": ["Steam Power","Dynamite"],
"quote": "'The introduction of so powerful an agent as steam to a carriage on wheels will make a great change in the situation of man.' - Thomas Jefferson"
}
]
]
},
{
"columnNumber": 12,
@ -478,7 +478,7 @@
"prerequisites": ["Railroad"],
"quote": "'Any man who can drive safely while kissing a pretty girl is simply not giving the kiss the attention it deserves.' - Albert Einstein"
}
]
]
},
{
"columnNumber": 13,
@ -511,7 +511,7 @@
"prerequisites": ["Ballistics","Combustion"],
"quote": "'The root of the evil is not the construction of new, more dreadful weapons. It is the spirit of conquest.' - Ludwig von Mises"
}
]
]
},
{
"columnNumber": 14,
@ -553,6 +553,12 @@
"buildingCost": 750,
"wonderCost": 1250,
"techs": [
{
"name": "Telecommunications",
"row": 2,
"prerequisites": ["Ecology"],
"quote": "'The more we elaborate our means of communication, the less we communicate.' J.B. Priestly"
},
{
"name": "Mobile Tactics",
"row": 3,
@ -569,7 +575,7 @@
"name": "Satellites",
"row": 6,
"prerequisites": ["Rocketry"],
"uniques": ["Reveals the entire map"],
"uniques": ["Reveals the entire map"],
"quote": "'Now, somehow, in some new way, the sky seemed almost alien.' - Lyndon B. Johnson"
},
{
@ -584,9 +590,9 @@
"prerequisites": ["Computers"],
"quote": "'The night is far spent, the day is at hand: let us therefore cast off the works of darkness, and let us put on the armor of light.' - The Holy Bible: Romans, 13:12"
}
]
]
},
{
"columnNumber": 16,
"era": "Future era",
@ -596,8 +602,8 @@
"techs": [
{
"name": "Particle Physics",
"row": 4,
"prerequisites": ["Mobile Tactics", "Advanced Ballistics"],
"row": 3,
"prerequisites": ["Telecommunications","Mobile Tactics","Advanced Ballistics"],
"quote": "'Every particle of matter is attracted by or gravitates to every other particle of matter with a force inversely proportional to the squares of their distances.' - Isaac Newton"
},
{
@ -628,6 +634,6 @@
"uniques": ["Who knows what the future holds?", "Can be continually researched"],
"quote": "'I think we agree, the past is over.' - George W. Bush"
}
]
]
}
]

View File

@ -15,6 +15,7 @@ import com.unciv.models.ruleset.unit.UnitType
import com.unciv.models.stats.Stat
import com.unciv.models.translations.tr
import java.util.*
import kotlin.math.min
import kotlin.math.max
/**
@ -113,7 +114,7 @@ object Battle {
for (unique in bonusUniques) {
if (!defeatedUnit.matchesCategory(unique.params[1])) continue
val yieldPercent = unique.params[0].toFloat() / 100
val defeatedUnitYieldSourceType = unique.params[2]
val yieldTypeSourceAmount =
@ -186,7 +187,7 @@ object Battle {
val locations = LocationAction (
if (attackerTile != null && attackerTile.position != attackedTile.position)
listOf(attackedTile.position, attackerTile.position)
else listOf(attackedTile.position)
else listOf(attackedTile.position)
)
defender.getCivInfo().addNotification(notificationString, locations, attackerIcon, NotificationIcon.War, defenderIcon)
}
@ -319,11 +320,11 @@ object Battle {
for (unique in attackerCiv.getMatchingUniques("Upon capturing a city, receive [] times its [] production as [] immediately")) {
attackerCiv.addStat(
Stat.valueOf(unique.params[2]),
Stat.valueOf(unique.params[2]),
unique.params[0].toInt() * city.cityStats.currentCityStats.get(Stat.valueOf(unique.params[1])).toInt()
)
}
if (attackerCiv.isPlayerCivilization()) {
attackerCiv.popupAlerts.add(PopupAlert(AlertType.CityConquered, city.id))
UncivGame.Current.settings.addCompletedTutorialTask("Conquer a city")
@ -474,11 +475,11 @@ object Battle {
populationLossReduced = true
}
if (city.population.population < 5 && !populationLossReduced) {
city.population.population = 1 // For cities that cannot be destroyed, such as original capitals
city.population.setPopulation(1) // For cities that cannot be destroyed, such as original capitals
city.destroyCity()
} else {
city.population.population -= populationLoss.toInt()
if (city.population.population < 1) city.population.population = 1
city.population.addPopulation(-populationLoss.toInt())
if (city.population.population < 1) city.population.setPopulation(1)
city.population.unassignExtraPopulation()
city.health -= ((0.5 + 0.25 * Random().nextFloat()) * city.health * damageModifierFromMissingResource).toInt()
if (city.health < 1) city.health = 1
@ -531,7 +532,7 @@ object Battle {
val city = tile.getCity()
if (city != null && city.location == tile.position) {
if (city.population.population < 5) {
city.population.population = 1 // For cities that cannot be destroyed, such as original capitals
city.population.setPopulation(1) // For cities that cannot be destroyed, such as original capitals
city.destroyCity()
} else {
var populationLoss = city.population.population * (0.6 + Random().nextFloat() * 0.2);
@ -540,9 +541,9 @@ object Battle {
populationLoss *= 1 - unique.params[0].toFloat() / 100f
populationLossReduced = true
}
city.population.population -= populationLoss.toInt()
if (city.population.population < 5 && populationLossReduced) city.population.population = 5
if (city.population.population < 1) city.population.population = 1
city.population.addPopulation(-populationLoss.toInt())
if (city.population.population < 5 && populationLossReduced) city.population.setPopulation(5)
if (city.population.population < 1) city.population.setPopulation(1)
city.population.unassignExtraPopulation()
city.health -= (0.5 * city.getMaxHealth() * damageModifierFromMissingResource).toInt()
if (city.health < 1) city.health = 1

View File

@ -361,7 +361,7 @@ class CityInfo {
cityConstructions.endTurn(stats)
expansion.nextTurn(stats.culture)
if (isBeingRazed) {
population.population--
population.addPopulation(-1)
if (population.population <= 0) { // there are strange cases where we get to -1
civInfo.addNotification("[$name] has been razed to the ground!", location, "OtherIcons/Fire")
destroyCity()

View File

@ -47,7 +47,7 @@ class CityInfoConquestFunctions(val city: CityInfo){
moveToCiv(conqueringCiv)
Battle.destroyIfDefeated(oldCiv, conqueringCiv)
if (population.population > 1) population.population -= 1 + population.population / 4 // so from 2-4 population, remove 1, from 5-8, remove 2, etc.
if (population.population > 1) population.addPopulation(-1 - population.population / 4) // so from 2-4 population, remove 1, from 5-8, remove 2, etc.
reassignPopulation()
if (reconqueredCityWhileStillInResistance || foundingCiv == conqueringCiv.civName)

View File

@ -14,6 +14,7 @@ class PopulationManager {
lateinit var cityInfo: CityInfo
var population = 1
private set
var foodStored = 0
// In favor of this bad boy
@ -70,6 +71,19 @@ class PopulationManager {
private fun getStatsOfSpecialist(name: String) = cityInfo.cityStats.getStatsOfSpecialist(name)
internal fun addPopulation(count: Int) {
population += count
val freePopulation = getFreePopulation()
if (freePopulation < 0) {
unassignExtraPopulation()
} else {
autoAssignPopulation()
}
}
internal fun setPopulation(count: Int) {
addPopulation(-population + count)
}
internal fun autoAssignPopulation(foodWeight: Float = 1f) {
for (i in 1..getFreePopulation()) {

View File

@ -700,8 +700,7 @@ class MapUnit {
if (civInfo.cities.isNotEmpty()) actions.add {
val city = civInfo.cities.random(tileBasedRandom)
city.population.population++
city.population.autoAssignPopulation()
city.population.addPopulation(1)
val locations = LocationAction(listOf(tile.position, city.location))
civInfo.addNotification(
"We have found survivors in the ruins - population added to [" + city.name + "]",

View File

@ -77,10 +77,17 @@ object UniqueTriggerActivation {
civInfo.addUnit(greatPerson.name, chosenCity)
}
}
"+1 population in each city" ->
// Deprecated since 3.15.4
"+1 population in each city" ->
for (city in civInfo.cities) {
city.population.addPopulation(1)
}
//
"[] population []" ->
for (city in civInfo.cities) {
city.population.population += 1
city.population.autoAssignPopulation()
if (city.matchesFilter(unique.params[1])) {
city.population.addPopulation(unique.params[0].toInt())
}
}
"Free Technology" -> if (!civInfo.isSpectator()) civInfo.tech.freeTechs += 1
"[] Free Technologies" -> if (!civInfo.isSpectator()) civInfo.tech.freeTechs += unique.params[0].toInt()

View File

@ -277,15 +277,18 @@ Unless otherwise specified, all the following are from [the Noun Project](https:
* [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
* [CN Tower Toronto](https://thenounproject.com/search/?q=cn%20tower&i=807678) By mikicon
* [Pentagon](https://thenounproject.com/search/?q=the%20pentagon&i=1788323) By Maxim Kulikov
### Future Era
* [Hubble Telescope](https://thenounproject.com/search/?q=hubble%20space&i=445502) By Scott Lewis for Hubble Space Telescope
* [CN Tower Toronto](https://thenounproject.com/search/?q=cn%20tower&i=807678) By mikicon for CN tower
* [War Shelter](https://www.flaticon.com/free-icon/war-shelter_978661) by [Frepik](www.freepik.com) for Bomb Shelter
* [Missile](https://thenounproject.com/term/missile/799922/) By ProSymbols for SS Booster
* [Rocket](https://thenounproject.com/term/rocket/937173/) By BomSymbols for SS Cockpit
* [Engine](https://thenounproject.com/term/engine/1877958/) By Andre for SS Engine
* [Chamber](https://thenounproject.com/term/chamber/1242689/) By IYIKON for SS Stasis Chamber
### All Era's
* [Illuminati](https://thenounproject.com/term/illuminati/1617812) by emilegraphics for the Utopia Project
## Social Policies
@ -459,6 +462,7 @@ Unless otherwise specified, all the following are from [the Noun Project](https:
* [Electronics](https://thenounproject.com/search/?q=Electronics&i=1565843) By Cuby Design
* [Atom](https://thenounproject.com/term/atom/1586852/) By Kelsey Armstrong for Particle Physics
* [Thermonuclear fusion](https://thenounproject.com/search/?q=fusion&i=3292735) by Olena Panasovska, UA for Nuclear Fusion
* [telecommunications](https://thenounproject.com/search/?q=telecommunications&i=3191260) by Wichai Wi for Telcommunications
* [Information Technology](https://thenounproject.com/term/information-technology/1927668/) By Vectors Markeet for Future Tech
## Terrain