Changed how great unit recognition works

This commit is contained in:
Yair Morgenstern 2020-08-02 13:53:27 +03:00
parent 0626755a4e
commit ebb8432dcb
7 changed files with 26 additions and 12 deletions

View file

@ -30,7 +30,7 @@
"outerColor": [27,53,63],
"innerColor": [213,249,255],
"unique": "INGENUITY",
"uniques": ["Receive free [Great Scientist] when you discover [Writing]", "Earn Great Scientists 50% faster"]
"uniques": ["Receive free [Great Scientist] when you discover [Writing]", "[Great Scientist] is earned [50]% faster"]
"cities": ["Babylon","Akkad","Dur-Kurigalzu","Nippur","Borsippa","Sippar","Opis","Mari","Shushan","Eshnunna",
"Ellasar","Erech","Kutha","Sirpurla","Neribtum","Ashur","Ninveh","Nimrud","Arbela","Nuzi",
"Arrapkha","Tutub","Shaduppum","Rapiqum","Mashkan Shapir","Tuttul","Ramad","Ana","Haradum","Agrab",

View file

@ -269,7 +269,7 @@
{
"name": "Entrepreneurship",
"effect": "Great Merchants are earned 25% faster, +1 Science from every Mint, Market, Bank and Stock Exchange.",
"uniques": ["Great Merchants are earned 25% faster", "[+1 Science] from every [Mint]", "[+1 Science] from every [Market]",
"uniques": ["[Great Merchant] is earned [25]% faster", "[+1 Science] from every [Mint]", "[+1 Science] from every [Market]",
"[+1 Science] from every [Bank]", "[+1 Science] from every [Stock Exchange]" ],
"requires": ["Trade Unions"],
"row": 2,

View file

@ -1290,33 +1290,33 @@
{
"name": "Great Artist",
"unitType": "Civilian",
"uniques": ["Can start an 8-turn golden age", "Can construct [Landmark]", "Great Person", "Unbuildable"],
"uniques": ["Can start an 8-turn golden age", "Can construct [Landmark]", "Great Person - [Culture]", "Unbuildable"],
"movement": 2
},
{
"name": "Great Scientist",
"unitType": "Civilian",
"uniques": ["Can hurry technology research", "Can construct [Academy]", "Great Person", "Unbuildable"],
"uniques": ["Can hurry technology research", "Can construct [Academy]", "Great Person - [Science]", "Unbuildable"],
"movement": 2
},
{
"name": "Great Merchant",
"unitType": "Civilian",
"uniques": ["Can undertake a trade mission with City-State, giving a large sum of gold and [30] Influence",
"Can construct [Customs house]", "Great Person", "Unbuildable"],
"Can construct [Customs house]", "Great Person - [Gold]", "Unbuildable"],
"movement": 2
},
{
"name": "Great Engineer",
"unitType": "Civilian",
"uniques": ["Can speed up construction of a wonder", "Can construct [Manufactory]", "Great Person", "Unbuildable"],
"uniques": ["Can speed up construction of a wonder", "Can construct [Manufactory]", "Great Person - [Production]", "Unbuildable"],
"movement": 2
},
{
"name": "Great General",
"unitType": "Civilian",
"uniques": ["Can start an 8-turn golden age", "Bonus for units in 2 tile radius 15%", "Can construct [Citadel]",
"Great Person", "Unbuildable"],
"Great Person - [War]", "Unbuildable"],
"movement": 2
},
{
@ -1325,7 +1325,7 @@
"uniqueTo": "Mongolia",
"replaces": "Great General",
"uniques": ["Can start an 8-turn golden age","Bonus for units in 2 tile radius 15%",
"Heal adjacent units for an additional 15 HP per turn", "Can construct [Citadel]", "Great Person", "Unbuildable"],
"Heal adjacent units for an additional 15 HP per turn", "Can construct [Citadel]", "Great Person - [War]", "Unbuildable"],
"movement": 5
}
]

View file

@ -3,8 +3,8 @@ package com.unciv.build
object BuildConfig {
const val kotlinVersion = "1.3.71"
const val appName = "Unciv"
const val appCodeNumber = 454
const val appVersion = "3.9.17"
const val appCodeNumber = 455
const val appVersion = "3.9.17-patch1"
const val gdxVersion = "1.9.10"
const val roboVMVersion = "2.3.1"

View file

@ -19,7 +19,9 @@ import com.unciv.logic.trade.TradeType
import com.unciv.models.ruleset.tile.ResourceSupplyList
import com.unciv.models.ruleset.tile.ResourceType
import com.unciv.models.ruleset.unit.BaseUnit
import com.unciv.models.stats.Stat
import com.unciv.models.stats.Stats
import com.unciv.models.translations.equalsPlaceholderText
import com.unciv.models.translations.getPlaceholderParameters
import com.unciv.ui.utils.withoutItem
import java.util.*
@ -259,6 +261,18 @@ class CityInfo {
stats["Buildings"] = buildingStats
for (entry in stats) {
for (unique in civInfo.getMatchingUniques("[] is earned []% faster")) {
val params = unique.getPlaceholderParameters()
val unit = civInfo.gameInfo.ruleSet.units[params[0]]
if (unit == null) continue
val greatUnitUnique = unit.uniques.firstOrNull { it.equalsPlaceholderText("Great Person - []") }
if (greatUnitUnique == null) continue
val statName = greatUnitUnique.getPlaceholderParameters()[0]
val stat = Stat.values().firstOrNull { it.name == statName }
// this is not very efficient, and if it causes problems we can try and think of a way of improving it
if (stat != null) entry.value.add(stat, entry.value.get(stat) * params[1].toInt())
}
if (civInfo.nation.unique == UniqueAbility.INGENUITY)
entry.value.science *= 1.5f
if (civInfo.hasUnique("Great Merchants are earned 25% faster"))

View file

@ -497,7 +497,7 @@ class CivilizationInfo {
val cityToAddTo = city ?: cities.random()
val unit = getEquivalentUnit(unitName)
placeUnitNearTile(cityToAddTo.location, unit.name)
if ("Great Person" in unit.uniques)
if (unit.uniques.any { it.equalsPlaceholderText("Great Person - []") })
addNotification("A [${unit.name}] has been born in [${cityToAddTo.name}]!", cityToAddTo.location, Color.GOLD)
}