Removed ALL color-based notifications!

This commit is contained in:
Yair Morgenstern 2021-03-21 00:28:58 +02:00
parent d4b19a7bb3
commit 5a5d0a980f
23 changed files with 699 additions and 731 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 749 B

After

Width:  |  Height:  |  Size: 2.6 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 874 KiB

After

Width:  |  Height:  |  Size: 867 KiB

View File

@ -376,7 +376,6 @@ A [greatPerson] has been born in [cityName]! =
We have encountered [civName]! = We have encountered [civName]! =
Cannot provide unit upkeep for [unitName] - unit has been disbanded! = Cannot provide unit upkeep for [unitName] - unit has been disbanded! =
[cityName] has grown! = [cityName] has grown! =
[cityName] has been founded! =
[cityName] is starving! = [cityName] is starving! =
[construction] has been built in [cityName] = [construction] has been built in [cityName] =
[wonder] has been built in a faraway land = [wonder] has been built in a faraway land =

View File

@ -167,7 +167,7 @@ class GameInfo {
if (tiles.size < 3) { if (tiles.size < 3) {
for (tile in tiles) { for (tile in tiles) {
val unitName = tile.militaryUnit!!.name val unitName = tile.militaryUnit!!.name
thisPlayer.addNotification("An enemy [$unitName] was spotted $inOrNear our territory", tile.position, NotificationIcon.War) thisPlayer.addNotification("An enemy [$unitName] was spotted $inOrNear our territory", tile.position, NotificationIcon.War, unitName)
} }
} else { } else {
val positions = tiles.map { it.position } val positions = tiles.map { it.position }
@ -247,7 +247,7 @@ class GameInfo {
it.hasUnique("Notified of new Barbarian encampments") it.hasUnique("Notified of new Barbarian encampments")
&& it.exploredTiles.contains(tile.position) && it.exploredTiles.contains(tile.position)
} }
.forEach { it.addNotification("A new barbarian encampment has spawned!", tile.position, Color.RED) } .forEach { it.addNotification("A new barbarian encampment has spawned!", tile.position, NotificationIcon.War) }
} }
// All cross-game data which needs to be altered (e.g. when removing or changing a name of a building/tech) // All cross-game data which needs to be altered (e.g. when removing or changing a name of a building/tech)

View File

@ -474,7 +474,7 @@ object UnitAutomation {
if (tryGoToRuinAndEncampment(unit) && unit.currentMovement == 0f) return if (tryGoToRuinAndEncampment(unit) && unit.currentMovement == 0f) return
if (unit.health < 80 && tryHealUnit(unit)) return if (unit.health < 80 && tryHealUnit(unit)) return
if (tryExplore(unit)) return if (tryExplore(unit)) return
unit.civInfo.addNotification("[${unit.displayName()}] finished exploring.", unit.currentTile.position, Color.GRAY) unit.civInfo.addNotification("[${unit.displayName()}] finished exploring.", unit.currentTile.position, unit.name, "OtherIcons/Sleep")
unit.action = null unit.action = null
} }

View File

@ -56,7 +56,7 @@ class WorkerAutomation(val unit: MapUnit) {
return return
} }
unit.civInfo.addNotification("[${unit.displayName()}] has no work to do.", unit.currentTile.position, Color.GRAY) unit.civInfo.addNotification("[${unit.displayName()}] has no work to do.", unit.currentTile.position, unit.name, "OtherIcons/Sleep")
} }

View File

@ -309,12 +309,17 @@ class CityConstructions {
cityInfo.civInfo.popupAlerts.add(PopupAlert(AlertType.WonderBuilt, construction.name)) cityInfo.civInfo.popupAlerts.add(PopupAlert(AlertType.WonderBuilt, construction.name))
for (civ in cityInfo.civInfo.gameInfo.civilizations) { for (civ in cityInfo.civInfo.gameInfo.civilizations) {
if (civ.exploredTiles.contains(cityInfo.location)) if (civ.exploredTiles.contains(cityInfo.location))
civ.addNotification("[${construction.name}] has been built in [${cityInfo.name}]", cityInfo.location, NotificationIcon.Construction, buildingIcon) civ.addNotification("[${construction.name}] has been built in [${cityInfo.name}]",
cityInfo.location, NotificationIcon.Construction, buildingIcon)
else else
civ.addNotification("[${construction.name}] has been built in a faraway land", buildingIcon) civ.addNotification("[${construction.name}] has been built in a faraway land", buildingIcon)
} }
} else } else {
cityInfo.civInfo.addNotification("[${construction.name}] has been built in [" + cityInfo.name + "]", cityInfo.location, NotificationIcon.Construction, buildingIcon) val icon = if (construction is Building) buildingIcon else construction.name // could be a unit, in which case take the unit name.
cityInfo.civInfo.addNotification("[${construction.name}] has been built in [" + cityInfo.name + "]",
cityInfo.location, NotificationIcon.Construction, icon)
}
} }
fun addBuilding(buildingName: String) { fun addBuilding(buildingName: String) {

View File

@ -6,6 +6,7 @@ import com.unciv.Constants
import com.unciv.UncivGame import com.unciv.UncivGame
import com.unciv.logic.battle.Battle import com.unciv.logic.battle.Battle
import com.unciv.logic.civilization.CivilizationInfo import com.unciv.logic.civilization.CivilizationInfo
import com.unciv.logic.civilization.NotificationIcon
import com.unciv.logic.civilization.diplomacy.DiplomacyFlags import com.unciv.logic.civilization.diplomacy.DiplomacyFlags
import com.unciv.logic.civilization.diplomacy.DiplomaticModifiers import com.unciv.logic.civilization.diplomacy.DiplomaticModifiers
import com.unciv.logic.civilization.diplomacy.DiplomaticStatus import com.unciv.logic.civilization.diplomacy.DiplomaticStatus
@ -96,7 +97,6 @@ class CityInfo {
civInfo.citiesCreated++ civInfo.citiesCreated++
civInfo.cities = civInfo.cities.toMutableList().apply { add(this@CityInfo) } civInfo.cities = civInfo.cities.toMutableList().apply { add(this@CityInfo) }
civInfo.addNotification("[$name] has been founded!", cityLocation, Color.PURPLE)
if (civInfo.cities.size == 1) cityConstructions.addBuilding(capitalCityIndicator()) if (civInfo.cities.size == 1) cityConstructions.addBuilding(capitalCityIndicator())
@ -345,7 +345,7 @@ class CityInfo {
if (isInResistance()) { if (isInResistance()) {
resistanceCounter-- resistanceCounter--
if (!isInResistance()) if (!isInResistance())
civInfo.addNotification("The resistance in [$name] has ended!", location, Color.YELLOW) civInfo.addNotification("The resistance in [$name] has ended!", location, "StatIons/Resistance")
} }
if (isPuppet) reassignPopulation() if (isPuppet) reassignPopulation()
@ -374,7 +374,7 @@ class CityInfo {
if (isBeingRazed) { if (isBeingRazed) {
population.population-- population.population--
if (population.population <= 0) { // there are strange cases where we get to -1 if (population.population <= 0) { // there are strange cases where we get to -1
civInfo.addNotification("[$name] has been razed to the ground!", location, Color.RED) civInfo.addNotification("[$name] has been razed to the ground!", location, "OtherIcons/Fire")
destroyCity() destroyCity()
} else { //if not razed yet: } else { //if not razed yet:
if (population.foodStored >= population.getFoodToNextPopulation()) { //if surplus in the granary... if (population.foodStored >= population.getFoodToNextPopulation()) { //if surplus in the granary...
@ -425,7 +425,7 @@ class CityInfo {
// Gain gold for plundering city // Gain gold for plundering city
val goldPlundered = getGoldForCapturingCity(conqueringCiv) val goldPlundered = getGoldForCapturingCity(conqueringCiv)
conqueringCiv.gold += goldPlundered conqueringCiv.gold += goldPlundered
conqueringCiv.addNotification("Received [$goldPlundered] Gold for capturing [$name]", centerTileInfo.position, Color.GOLD) conqueringCiv.addNotification("Received [$goldPlundered] Gold for capturing [$name]", centerTileInfo.position, NotificationIcon.Gold)
val oldCiv = civInfo val oldCiv = civInfo
val reconqueredOurCity = previousOwner == conqueringCiv.civName val reconqueredOurCity = previousOwner == conqueringCiv.civName

View File

@ -129,11 +129,11 @@ class CivInfoTransientUpdater(val civInfo: CivilizationInfo) {
if (!initialSetup) { // In the initial setup we're loading an old game state, so it doesn't really count if (!initialSetup) { // In the initial setup we're loading an old game state, so it doesn't really count
for (city in citiesReachedToMediums.keys) for (city in citiesReachedToMediums.keys)
if (city !in civInfo.citiesConnectedToCapitalToMediums && city.civInfo == civInfo && city != civInfo.getCapital()) if (city !in civInfo.citiesConnectedToCapitalToMediums && city.civInfo == civInfo && city != civInfo.getCapital())
civInfo.addNotification("[${city.name}] has been connected to your capital!", city.location, Color.GOLD) civInfo.addNotification("[${city.name}] has been connected to your capital!", city.location, NotificationIcon.Gold)
for (city in civInfo.citiesConnectedToCapitalToMediums.keys) for (city in civInfo.citiesConnectedToCapitalToMediums.keys)
if (!citiesReachedToMediums.containsKey(city) && city.civInfo == civInfo) if (!citiesReachedToMediums.containsKey(city) && city.civInfo == civInfo)
civInfo.addNotification("[${city.name}] has been disconnected from your capital!", city.location, Color.GOLD) civInfo.addNotification("[${city.name}] has been disconnected from your capital!", city.location, NotificationIcon.Gold)
} }
civInfo.citiesConnectedToCapitalToMediums = citiesReachedToMediums civInfo.citiesConnectedToCapitalToMediums = citiesReachedToMediums

View File

@ -548,11 +548,6 @@ class CivilizationInfo {
return (diplomacyManager.hasOpenBorders || diplomacyManager.diplomaticStatus == DiplomaticStatus.War) return (diplomacyManager.hasOpenBorders || diplomacyManager.diplomaticStatus == DiplomaticStatus.War)
} }
fun addNotification(text: String, location: Vector2?, color: Color) {
val locations = if (location != null) listOf(location) else emptyList()
if (playerType == PlayerType.AI) return // no point in lengthening the saved game info if no one will read it
notifications.add(Notification(text, color, LocationAction(locations)))
}
fun addNotification(text: String, location: Vector2, vararg notificationIcons: String) { fun addNotification(text: String, location: Vector2, vararg notificationIcons: String) {
addNotification(text, LocationAction(listOf(location)), *notificationIcons) addNotification(text, LocationAction(listOf(location)), *notificationIcons)
@ -573,7 +568,7 @@ class CivilizationInfo {
val unit = getEquivalentUnit(unitName) val unit = getEquivalentUnit(unitName)
placeUnitNearTile(cityToAddTo.location, unit.name) placeUnitNearTile(cityToAddTo.location, unit.name)
if (unit.isGreatPerson()) if (unit.isGreatPerson())
addNotification("A [${unit.name}] has been born in [${cityToAddTo.name}]!", cityToAddTo.location, Color.GOLD) addNotification("A [${unit.name}] has been born in [${cityToAddTo.name}]!", cityToAddTo.location, unit.name)
} }
fun placeUnitNearTile(location: Vector2, unitName: String): MapUnit? { fun placeUnitNearTile(location: Vector2, unitName: String): MapUnit? {
@ -590,7 +585,7 @@ class CivilizationInfo {
val destructionText = if (isMajorCiv()) "The civilization of [$civName] has been destroyed!" val destructionText = if (isMajorCiv()) "The civilization of [$civName] has been destroyed!"
else "The City-State of [$civName] has been destroyed!" else "The City-State of [$civName] has been destroyed!"
for (civ in gameInfo.civilizations) for (civ in gameInfo.civilizations)
civ.addNotification(destructionText, null, Color.RED) civ.addNotification(destructionText, civName, NotificationIcon.Death)
getCivUnits().forEach { it.destroy() } getCivUnits().forEach { it.destroy() }
tradeRequests.clear() // if we don't do this then there could be resources taken by "pending" trades forever tradeRequests.clear() // if we don't do this then there could be resources taken by "pending" trades forever
for (diplomacyManager in diplomacy.values) { for (diplomacyManager in diplomacy.values) {
@ -634,7 +629,7 @@ class CivilizationInfo {
.filter { !it.unitType.isCivilian() && it.unitType.isLandUnit() } .filter { !it.unitType.isCivilian() && it.unitType.isLandUnit() }
.toList().random() .toList().random()
placeUnitNearTile(city.location, militaryUnit.name) placeUnitNearTile(city.location, militaryUnit.name)
addNotification("[${otherCiv.civName}] gave us a [${militaryUnit.name}] as gift near [${city.name}]!", null, Color.GREEN) addNotification("[${otherCiv.civName}] gave us a [${militaryUnit.name}] as gift near [${city.name}]!", city.location, otherCiv.civName, militaryUnit.name)
} }
fun getAllyCiv() = allyCivName fun getAllyCiv() = allyCivName
@ -659,13 +654,17 @@ class CivilizationInfo {
if (newAllyName != "") { if (newAllyName != "") {
val newAllyCiv = gameInfo.getCivilization(newAllyName) val newAllyCiv = gameInfo.getCivilization(newAllyName)
newAllyCiv.addNotification("We have allied with [${civName}].", capitalLocation, Color.GREEN) val text = "We have allied with [${civName}]."
if (capitalLocation != null) newAllyCiv.addNotification(text, capitalLocation, civName, NotificationIcon.Diplomacy)
else newAllyCiv.addNotification(text, civName, NotificationIcon.Diplomacy)
newAllyCiv.updateViewableTiles() newAllyCiv.updateViewableTiles()
newAllyCiv.updateDetailedCivResources() newAllyCiv.updateDetailedCivResources()
} }
if (oldAllyName != "") { if (oldAllyName != "") {
val oldAllyCiv = gameInfo.getCivilization(oldAllyName) val oldAllyCiv = gameInfo.getCivilization(oldAllyName)
oldAllyCiv.addNotification("We have lost alliance with [${civName}].", capitalLocation, Color.RED) val text = "We have lost alliance with [${civName}]."
if (capitalLocation != null) oldAllyCiv.addNotification(text, capitalLocation, civName, NotificationIcon.Diplomacy)
else oldAllyCiv.addNotification(text, civName, NotificationIcon.Diplomacy)
oldAllyCiv.updateViewableTiles() oldAllyCiv.updateViewableTiles()
oldAllyCiv.updateDetailedCivResources() oldAllyCiv.updateDetailedCivResources()
} }

View File

@ -30,7 +30,7 @@ class GoldenAgeManager{
turnsToGoldenAge *= (unique.params[0].toFloat()/100 + 1) turnsToGoldenAge *= (unique.params[0].toFloat()/100 + 1)
turnsToGoldenAge *= civInfo.gameInfo.gameParameters.gameSpeed.modifier turnsToGoldenAge *= civInfo.gameInfo.gameParameters.gameSpeed.modifier
turnsLeftForCurrentGoldenAge += turnsToGoldenAge.toInt() turnsLeftForCurrentGoldenAge += turnsToGoldenAge.toInt()
civInfo.addNotification("You have entered a Golden Age!", null, Color.GOLD) civInfo.addNotification("You have entered a Golden Age!", "StatIcons/Happiness")
civInfo.popupAlerts.add(PopupAlert(AlertType.GoldenAge,"")) civInfo.popupAlerts.add(PopupAlert(AlertType.GoldenAge,""))
} }

View File

@ -26,17 +26,11 @@ object NotificationIcon {
open class Notification() { open class Notification() {
var text: String="" var text: String=""
@Deprecated("As of 3.13.10 - replaced with icons")
var color: Color?=null var color: Color?=null
var icons: ArrayList<String> = ArrayList<String>() // Must be ArrayList and not List so it can be deserialized var icons: ArrayList<String> = ArrayList() // Must be ArrayList and not List so it can be deserialized
var action: NotificationAction? = null var action: NotificationAction? = null
// default parameters necessary for json deserialization
constructor(text: String, color: Color, action: NotificationAction?) : this() {
this.text = text
this.color = color
this.action = action
}
constructor(text: String, notificationIcons: ArrayList<String>, action: NotificationAction? = null) : this() { constructor(text: String, notificationIcons: ArrayList<String>, action: NotificationAction? = null) : this() {
this.text = text this.text = text
this.icons = notificationIcons this.icons = notificationIcons

View File

@ -246,14 +246,10 @@ class TechManager {
val currentEra = civInfo.getEra() val currentEra = civInfo.getEra()
if (previousEra != currentEra) { if (previousEra != currentEra) {
civInfo.addNotification("You have entered the [$currentEra]!", null, Color.GOLD) civInfo.addNotification("You have entered the [$currentEra]!", NotificationIcon.Science)
if (civInfo.isMajorCiv()) { if (civInfo.isMajorCiv()) {
for (knownCiv in civInfo.getKnownCivs()) { for (knownCiv in civInfo.getKnownCivs()) {
knownCiv.addNotification( knownCiv.addNotification("[${civInfo.civName}] has entered the [$currentEra]!", civInfo.civName, NotificationIcon.Science)
"[${civInfo.civName}] has entered the [$currentEra]!",
null,
Color.BLUE
)
} }
} }
for (it in getRuleset().policyBranches.values.filter { it.era == currentEra }) { for (it in getRuleset().policyBranches.values.filter { it.era == currentEra }) {
@ -272,7 +268,7 @@ class TechManager {
.firstOrNull { it.isCityCenter() } .firstOrNull { it.isCityCenter() }
if (closestCityTile != null) { if (closestCityTile != null) {
val text = "[${revealedResource.name}] revealed near [${closestCityTile.getCity()!!.name}]" val text = "[${revealedResource.name}] revealed near [${closestCityTile.getCity()!!.name}]"
civInfo.addNotification(text, tileInfo.position, Color.BLUE) civInfo.addNotification(text, tileInfo.position, "ResourceIcons/"+revealedResource.name)
break break
} }
} }
@ -287,7 +283,7 @@ class TechManager {
val newConstructionName = constructionName val newConstructionName = constructionName
if (constructionName in obsoleteUnits) { if (constructionName in obsoleteUnits) {
val text = "[$constructionName] has been obsolete and will be removed from construction queue in [${city.name}]!" val text = "[$constructionName] has been obsolete and will be removed from construction queue in [${city.name}]!"
civInfo.addNotification(text, city.location, Color.BROWN) civInfo.addNotification(text, city.location, NotificationIcon.Construction)
} else city.cityConstructions.constructionQueue.add(newConstructionName) } else city.cityConstructions.constructionQueue.add(newConstructionName)
} }
} }

View File

@ -365,11 +365,17 @@ class DiplomacyManager() {
if (!civInfo.isDefeated()) { // don't display city state relationship notifications when the city state is currently defeated if (!civInfo.isDefeated()) { // don't display city state relationship notifications when the city state is currently defeated
val civCapitalLocation = if (civInfo.cities.isNotEmpty()) civInfo.getCapital().location else null val civCapitalLocation = if (civInfo.cities.isNotEmpty()) civInfo.getCapital().location else null
if (getTurnsToRelationshipChange() == 1) if (getTurnsToRelationshipChange() == 1){
otherCiv().addNotification("Your relationship with [${civInfo.civName}] is about to degrade", civCapitalLocation, Color.GOLD) val text = "Your relationship with [${civInfo.civName}] is about to degrade"
if(civCapitalLocation!=null) otherCiv().addNotification(text, civCapitalLocation, civInfo.civName, NotificationIcon.Diplomacy)
else otherCiv().addNotification(text, civInfo.civName, NotificationIcon.Diplomacy)
}
if (initialRelationshipLevel >= RelationshipLevel.Friend && initialRelationshipLevel != relationshipLevel()) if (initialRelationshipLevel >= RelationshipLevel.Friend && initialRelationshipLevel != relationshipLevel()){
otherCiv().addNotification("Your relationship with [${civInfo.civName}] degraded", civCapitalLocation, Color.GOLD) val text = "Your relationship with [${civInfo.civName}] degraded"
if(civCapitalLocation!=null) otherCiv().addNotification(text, civCapitalLocation, civInfo.civName, NotificationIcon.Diplomacy)
else otherCiv().addNotification(text, civInfo.civName, NotificationIcon.Diplomacy)
}
} }
} }
@ -417,8 +423,8 @@ class DiplomacyManager() {
trades.remove(trade) trades.remove(trade)
for (offer in trade.ourOffers.union(trade.theirOffers).filter { it.duration == 0 }) { // this was a timed trade for (offer in trade.ourOffers.union(trade.theirOffers).filter { it.duration == 0 }) { // this was a timed trade
if (offer in trade.theirOffers) if (offer in trade.theirOffers)
civInfo.addNotification("[${offer.name}] from [$otherCivName] has ended", NotificationIcon.Trade) civInfo.addNotification("[${offer.name}] from [$otherCivName] has ended", otherCivName, NotificationIcon.Trade)
else civInfo.addNotification("[${offer.name}] to [$otherCivName] has ended", NotificationIcon.Trade) else civInfo.addNotification("[${offer.name}] to [$otherCivName] has ended", otherCivName, NotificationIcon.Trade)
civInfo.updateStatsForNextTurn() // if they were bringing us gold per turn civInfo.updateStatsForNextTurn() // if they were bringing us gold per turn
civInfo.updateDetailedCivResources() // if they were giving us resources civInfo.updateDetailedCivResources() // if they were giving us resources
@ -471,7 +477,7 @@ class DiplomacyManager() {
// Cancel all trades. // Cancel all trades.
for (trade in trades) for (trade in trades)
for (offer in trade.theirOffers.filter { it.duration > 0 }) for (offer in trade.theirOffers.filter { it.duration > 0 })
civInfo.addNotification("[" + offer.name + "] from [$otherCivName] has ended", NotificationIcon.Trade) civInfo.addNotification("[" + offer.name + "] from [$otherCivName] has ended", otherCivName, NotificationIcon.Trade)
trades.clear() trades.clear()
updateHasOpenBorders() updateHasOpenBorders()
@ -568,9 +574,8 @@ class DiplomacyManager() {
for (civ in getCommonKnownCivs()) { for (civ in getCommonKnownCivs()) {
civ.addNotification( civ.addNotification(
"[${civInfo.civName}] and [${otherCiv().civName}] have signed a Peace Treaty!", "[${civInfo.civName}] and [$otherCivName] have signed a Peace Treaty!",
null, civInfo.civName, NotificationIcon.Diplomacy, otherCivName
Color.WHITE
) )
} }
} }
@ -618,10 +623,12 @@ class DiplomacyManager() {
setFlag(DiplomacyFlags.DeclarationOfFriendship, 30) setFlag(DiplomacyFlags.DeclarationOfFriendship, 30)
otherCivDiplomacy().setFlag(DiplomacyFlags.DeclarationOfFriendship, 30) otherCivDiplomacy().setFlag(DiplomacyFlags.DeclarationOfFriendship, 30)
if (otherCiv().playerType == PlayerType.Human) if (otherCiv().playerType == PlayerType.Human)
otherCiv().addNotification("[${civInfo.civName}] and [$otherCivName] have signed the Declaration of Friendship!", null, Color.WHITE) otherCiv().addNotification("[${civInfo.civName}] and [$otherCivName] have signed the Declaration of Friendship!",
civInfo.civName, NotificationIcon.Diplomacy, otherCivName)
for (thirdCiv in getCommonKnownCivs().filter { it.isMajorCiv() }) { for (thirdCiv in getCommonKnownCivs().filter { it.isMajorCiv() }) {
thirdCiv.addNotification("[${civInfo.civName}] and [$otherCivName] have signed the Declaration of Friendship!", null, Color.WHITE) thirdCiv.addNotification("[${civInfo.civName}] and [$otherCivName] have signed the Declaration of Friendship!",
civInfo.civName, NotificationIcon.Diplomacy, otherCivName)
thirdCiv.getDiplomacyManager(civInfo).setFriendshipBasedModifier() thirdCiv.getDiplomacyManager(civInfo).setFriendshipBasedModifier()
} }
} }

View File

@ -435,7 +435,8 @@ class MapUnit {
if (tile.owningCity == null || tile.owningCity!!.civInfo != civInfo) productionPointsToAdd = productionPointsToAdd * 2 / 3 if (tile.owningCity == null || tile.owningCity!!.civInfo != civInfo) productionPointsToAdd = productionPointsToAdd * 2 / 3
if (productionPointsToAdd > 0) { if (productionPointsToAdd > 0) {
closestCity.cityConstructions.addProductionPoints(productionPointsToAdd) closestCity.cityConstructions.addProductionPoints(productionPointsToAdd)
civInfo.addNotification("Clearing a [$removedTerrainFeature] has created [$productionPointsToAdd] Production for [${closestCity.name}]", closestCity.location, Color.BROWN) civInfo.addNotification("Clearing a [$removedTerrainFeature] has created [$productionPointsToAdd] Production for [${closestCity.name}]",
closestCity.location, NotificationIcon.Construction)
} }
} }
@ -581,7 +582,7 @@ class MapUnit {
goldGained *= 3f goldGained *= 3f
civInfo.gold += goldGained.toInt() civInfo.gold += goldGained.toInt()
civInfo.addNotification("We have captured a barbarian encampment and recovered [${goldGained.toInt()}] gold!", tile.position, Color.RED) civInfo.addNotification("We have captured a barbarian encampment and recovered [${goldGained.toInt()}] gold!", tile.position, NotificationIcon.Gold)
} }
fun disband() { fun disband() {
@ -639,20 +640,20 @@ class MapUnit {
val chosenUnit = possibleUnits.random(tileBasedRandom) val chosenUnit = possibleUnits.random(tileBasedRandom)
if (!(civInfo.isCityState() || civInfo.isOneCityChallenger()) || chosenUnit != Constants.settler) { //City-States and OCC don't get settler from ruins if (!(civInfo.isCityState() || civInfo.isOneCityChallenger()) || chosenUnit != Constants.settler) { //City-States and OCC don't get settler from ruins
civInfo.placeUnitNearTile(tile.position, chosenUnit) civInfo.placeUnitNearTile(tile.position, chosenUnit)
civInfo.addNotification("A [$chosenUnit] has joined us!", tile.position, Color.BROWN) civInfo.addNotification("A [$chosenUnit] has joined us!", tile.position, chosenUnit)
} }
} }
if (!type.isCivilian()) if (!type.isCivilian())
actions.add { actions.add {
promotions.XP += 10 promotions.XP += 10
civInfo.addNotification("An ancient tribe trains our [$name] in their ways of combat!", tile.position, Color.RED) civInfo.addNotification("An ancient tribe trains our [$name] in their ways of combat!", tile.position, name)
} }
actions.add { actions.add {
val amount = listOf(25, 60, 100).random(tileBasedRandom) val amount = listOf(25, 60, 100).random(tileBasedRandom)
civInfo.gold += amount civInfo.gold += amount
civInfo.addNotification("We have found a stash of [$amount] gold in the ruins!", tile.position, Color.GOLD) civInfo.addNotification("We have found a stash of [$amount] gold in the ruins!", tile.position, NotificationIcon.Gold)
} }
actions.add { actions.add {
@ -669,7 +670,7 @@ class MapUnit {
.map { it.position } .map { it.position }
civInfo.exploredTiles.addAll(tilesToReveal) civInfo.exploredTiles.addAll(tilesToReveal)
civInfo.updateViewableTiles() civInfo.updateViewableTiles()
civInfo.addNotification("We have found a crudely-drawn map in the ruins!", tile.position, Color.RED) civInfo.addNotification("We have found a crudely-drawn map in the ruins!", tile.position, "ImprovementIcons/Ancient ruins")
} }
(actions.random(tileBasedRandom))() (actions.random(tileBasedRandom))()
@ -730,9 +731,9 @@ class MapUnit {
health -= tileDamage health -= tileDamage
if (health <= 0) { if (health <= 0) {
civInfo.addNotification("Our [$name] took [$tileDamage] tile damage and was destroyed", currentTile.position, Color.RED) civInfo.addNotification("Our [$name] took [$tileDamage] tile damage and was destroyed", currentTile.position, name, NotificationIcon.Death)
destroy() destroy()
} else civInfo.addNotification("Our [$name] took [$tileDamage] tile damage", currentTile.position, Color.RED) } else civInfo.addNotification("Our [$name] took [$tileDamage] tile damage", currentTile.position, name)
} }
} }
@ -749,10 +750,10 @@ class MapUnit {
health -= 30 health -= 30
if (health <= 0) { if (health <= 0) {
civInfo.addNotification("An enemy [Citadel] has destroyed our [$name]", currentTile.position, Color.RED) civInfo.addNotification("An enemy [Citadel] has destroyed our [$name]", currentTile.position, name, NotificationIcon.Death)
// todo - add notification for attacking civ // todo - add notification for attacking civ
destroy() destroy()
} else civInfo.addNotification("An enemy [Citadel] has attacked our [$name]", currentTile.position, Color.RED) } else civInfo.addNotification("An enemy [Citadel] has attacked our [$name]", currentTile.position, name)
} }
} }

View File

@ -6,6 +6,7 @@ import com.unciv.UncivGame
import com.unciv.logic.automation.UnitAutomation import com.unciv.logic.automation.UnitAutomation
import com.unciv.logic.automation.WorkerAutomation import com.unciv.logic.automation.WorkerAutomation
import com.unciv.logic.civilization.CivilizationInfo import com.unciv.logic.civilization.CivilizationInfo
import com.unciv.logic.civilization.NotificationIcon
import com.unciv.logic.civilization.diplomacy.DiplomaticModifiers import com.unciv.logic.civilization.diplomacy.DiplomaticModifiers
import com.unciv.logic.map.MapUnit import com.unciv.logic.map.MapUnit
import com.unciv.logic.map.RoadStatus import com.unciv.logic.map.RoadStatus
@ -346,7 +347,8 @@ object UnitActions {
goldEarned *= 2 goldEarned *= 2
unit.civInfo.gold += goldEarned unit.civInfo.gold += goldEarned
tile.owningCity!!.civInfo.getDiplomacyManager(unit.civInfo).influence += influenceEarned tile.owningCity!!.civInfo.getDiplomacyManager(unit.civInfo).influence += influenceEarned
unit.civInfo.addNotification("Your trade mission to [${tile.owningCity!!.civInfo}] has earned you [${goldEarned}] gold and [$influenceEarned] influence!", null, Color.GOLD) unit.civInfo.addNotification("Your trade mission to [${tile.owningCity!!.civInfo}] has earned you [${goldEarned}] gold and [$influenceEarned] influence!",
tile.owningCity!!.civInfo.civName, NotificationIcon.Gold, NotificationIcon.Culture)
addGoldPerGreatPersonUsage(unit.civInfo) addGoldPerGreatPersonUsage(unit.civInfo)
unit.destroy() unit.destroy()
}.takeIf { canConductTradeMission }) }.takeIf { canConductTradeMission })
@ -413,7 +415,7 @@ object UnitActions {
nearestCity!!.expansion.takeOwnership(tile) nearestCity!!.expansion.takeOwnership(tile)
} }
for (otherCiv in notifications) for (otherCiv in notifications)
otherCiv.addNotification("[${unit.civInfo}] has stolen your territory!", unit.currentTile.position, Color.RED) otherCiv.addNotification("[${unit.civInfo}] has stolen your territory!", unit.currentTile.position, unit.civInfo.civName, NotificationIcon.War)
} }
private fun addGoldPerGreatPersonUsage(civInfo: CivilizationInfo) { private fun addGoldPerGreatPersonUsage(civInfo: CivilizationInfo) {
@ -424,7 +426,7 @@ object UnitActions {
civInfo.gold += goldEarned civInfo.gold += goldEarned
val mausoleum = cityWithMausoleum.cityConstructions.getBuiltBuildings().first { it.uniques.contains(uniqueText) } val mausoleum = cityWithMausoleum.cityConstructions.getBuiltBuildings().first { it.uniques.contains(uniqueText) }
civInfo.addNotification("[${mausoleum.name}] has provided [$goldEarned] Gold!", cityWithMausoleum.location, Color.GOLD) civInfo.addNotification("[${mausoleum.name}] has provided [$goldEarned] Gold!", cityWithMausoleum.location, NotificationIcon.Gold)
} }
private fun addFortifyActions(actionList: ArrayList<UnitAction>, unit: MapUnit, unitTable: UnitTable) { private fun addFortifyActions(actionList: ArrayList<UnitAction>, unit: MapUnit, unitTable: UnitTable) {