great scienstist does the job like original game (#1453)

This commit is contained in:
lishaoxia1985 2019-12-16 02:41:39 +08:00 committed by Yair Morgenstern
parent e937ea0af1
commit 418a4968a4
8 changed files with 65 additions and 43 deletions

View File

@ -2127,29 +2127,32 @@
"Songhai":{
Italian:"Songhai"
French:"Songhaï"
Traditional_Chinese:"桑海帝國"
Portuguese:"Songhai" //not sure but will do
Czech:"Songhajská říše"
// same in German
Polish:"Songhaj"
Simplified_Chinese:"桑海"
Traditional_Chinese:"桑海"
Korean:"송가이"
}
"Askia":{
Traditional_Chinese:"阿斯基亞"
Italian:"Askia"
Simplified_Chinese:"阿斯基亚"
Traditional_Chinese:"阿斯基亞"
Korean:"아스키아"
French:"Askia"
}
"Receive triple Gold from Barbarian encampments and pillaging Cities. Embarked units can defend themselves.":{
Traditional_Chinese:"能從蠻族營地與掠奪城市中獲得三倍金錢。單位船運時有自衛能力。"
Italian:"Saccheggiare città o conquistare accampamenti barbari frutta una quantità tripla di Oro. Le unità imbarcate possono difendersi da sole."
Portuguese:"Receba 3x mais ouro de campos bárbaros e ao pilhar cidades. Unidades embarcadas podem se defender."
French:"Reçoit 3 fois plus d'or lors des pillages de campement barbare et de villes. Les unités embarquées peuvent se défendre."
Czech:"Získává trojnásobek zlata z Barbarských táborů a drancování měst. Jednotky při naloďování se můžou bránit."
German:"Erhalte dreimal soviel Gold von Barbaren-Camps und plündern von Städten. Eingeschiffte Einheiten können sich selbst verteidigen."
Polish:"Odtrymaj potrojone Złoto od Barbażyńskich obozowisk i plądrowanych Miast. Zaokrętowane jednostki mogą same się bronić"
Simplified_Chinese:"摧毁蛮族营地及劫掠城市时获得三倍金钱,单位船运时拥有攻击能力"
Traditional_Chinese:"摧毀蠻族營地及劫掠城市時獲得三倍金錢,單位船運时擁有攻擊能力"
Korean:"야만인 주둔지나 도시 약탈에서 얻는 금이 세 배가 됩니다. 승선한 유닛들이 스스로를 방어할 수 있습니다."
}

View File

@ -65,8 +65,8 @@
French:"[cityName] - Un [greatPerson] est né!",
Romanian:"[cityName] - S-a născut un [greatPerson]!",
Spanish:"¡[cityName] - Un [greatPerson] ha nacido!",
Simplified_Chinese:"[cityName] - 一个[greatPerson]已经出现",
Traditional_Chinese:"[cityName] - 一個[greatPerson]已經出現!",
Simplified_Chinese:"一个[greatPerson]在[cityName]诞生了",
Traditional_Chinese:"一個[greatPerson]在[cityName]誕生了!",
Portuguese:"[cityName] - Um [greatPerson] nasceu!",
German:"[cityName] - Ein [greatPerson] wurde geboren!",
Dutch:"[cityName] - Een [greatPerson] is geboren!",

View File

@ -1975,19 +1975,9 @@
// for unit action button
"Discover Technology":{
Romanian:"Descoperă tehnologie"
Spanish:"Descubrir Tecnologia"
Simplified_Chinese:"发现科技"
Traditional_Chinese:"發現科技"
Italian:"Scopri tecnologia"
German:"Entdecke Technologie"
Portuguese:"Descobrir uma tecnologia" //do you mean discover "a" tecnology?
Russian:"Откройте для себя технологию"
French:"Découvrir une technologie"
Czech:"Objevit technologii"
Ukrainian:"Відкрийте для себе технологію"
Korean:"무료 기술 발견"
"Hurry Research":{
Simplified_Chinese:"加速科技研究"
Traditional_Chinese:"加速科技研究"
}
// for unit action button

View File

@ -1996,7 +1996,9 @@
Czech:"Atomová bomba"
German:"Atombombe"
French:"Bombardier Atomique"
Polish:"Bomba atomowa"
Simplified_Chinese:"原子弹"
Traditional_Chinese:"原子彈"
Polish:"Bomba atomowa"
Ukrainian:"Ядерна бомба"
Korean:"원자폭탄"
}
@ -2145,20 +2147,9 @@
}
"Can discover a technology":{
Spanish:"Puede descubrir una tecnologia"
Italian:"Può scoprire una tecnologia"
French:"Peut découvrir une technologie"
Romanian:"Poate descoperi o tehnologie"
Simplified_Chinese:"可以发现1项科技",
Traditional_Chinese:"可以發現1項科技",
Portuguese:"Pode descobrir uma tecnologia"
German:"Kann eine Technologie entdecken"
Russian:"Может открыть технологию"
Czech:"Může vyzkoumat technologii"
Polish:"Może odkryć technologię"
Ukrainian:"Може відкрити технологію"
Korean:"기술 하나를 무료로 발견 가능"
"Can gain a large sum of science immediately to hurry technology research":{
Simplified_Chinese:"可以立即获得大量科研以加速科技研究",
Traditional_Chinese:"可以立即獲得大量科研以加速科技研究",
}
"Can build improvement: Academy":{

View File

@ -1268,7 +1268,7 @@
name:"Great Scientist",
unbuildable:true,
unitType:"Civilian",
uniques:["Can discover a technology","Can build improvement: Academy"]
uniques:["Can gain a large sum of science immediately to hurry technology research","Can build improvement: Academy"]
movement:2
},
{

View File

@ -13,6 +13,7 @@ import kotlin.collections.ArrayList
import kotlin.collections.HashSet
import kotlin.math.ceil
import kotlin.math.max
import kotlin.math.min
class TechManager {
@Transient lateinit var civInfo: CivilizationInfo
@ -27,6 +28,7 @@ class TechManager {
@Transient var movementSpeedOnRoadsImproved=false
var freeTechs = 0
var recently8turnsScience = IntArray(8){0}
var techsResearched = HashSet<String>()
/* When moving towards a certain tech, the user doesn't have to manually pick every one. */
var techsToResearch = ArrayList<String>()
@ -40,6 +42,8 @@ class TechManager {
toReturn.freeTechs=freeTechs
toReturn.techsInProgress.putAll(techsInProgress)
toReturn.techsToResearch.addAll(techsToResearch)
toReturn.recently8turnsScience=recently8turnsScience.clone()
toReturn.overflowScience=overflowScience
return toReturn
}
@ -117,7 +121,43 @@ class TechManager {
return prerequisites.sortedBy { it.column!!.columnNumber }.map { it.name }
}
fun greatscientistgetScience(): Int {
// https://civilization.fandom.com/wiki/Great_Scientist_(Civ5)
return (recently8turnsScience.sum() * civInfo.gameInfo.gameParameters.gameSpeed.getModifier()).toInt()
}
fun recently8turnsScience() {
// Science greatscientist gets does not include Science from Polocies, Trade routes and City States.
var allcitiesScience = 0f
civInfo.cities.forEach{
val m= it.cityStats.baseStatList.values.map { it.science }.sum()
val n= it.cityStats.statPercentBonusList.filter { it.key!="Policies" }.values.map { it.science }.sum()
allcitiesScience += m*(1+n/100)
}
recently8turnsScience[civInfo.gameInfo.turns%8] = allcitiesScience.toInt()
}
fun hurryResearch() {
val currentTechnology = currentTechnologyName()
if (currentTechnology == null) return
techsInProgress[currentTechnology] = researchOfTech(currentTechnology) + greatscientistgetScience()
if (techsInProgress[currentTechnology]!! < costOfTech(currentTechnology))
return
// We finished it!
// http://www.civclub.net/bbs/forum.php?mod=viewthread&tid=123976
var overflowscience = techsInProgress[currentTechnology]!! - costOfTech(currentTechnology)
overflowScience += overflowScience(overflowscience)
addTechnology(currentTechnology)
}
fun overflowScience(overflowscience: Int): Int {
// http://www.civclub.net/bbs/forum.php?mod=viewthread&tid=123976
return min(overflowscience, max(civInfo.statsForNextTurn.science.toInt() * 5, getRuleset().Technologies[currentTechnologyName()]!!.cost))
}
fun nextTurn(scienceForNewTurn: Int) {
recently8turnsScience()
val currentTechnology = currentTechnologyName()
if (currentTechnology == null) return
techsInProgress[currentTechnology] = researchOfTech(currentTechnology) + scienceForNewTurn
@ -125,15 +165,14 @@ class TechManager {
val techsResearchedKnownCivs = civInfo.getKnownCivs().count { it.isMajorCiv() && it.tech.isResearched(currentTechnologyName()!!) }
val undefeatedCivs = UncivGame.Current.gameInfo.civilizations.count { it.isMajorCiv() && !it.isDefeated() }
techsInProgress[currentTechnology] = techsInProgress[currentTechnology]!! + ((1 + techsResearchedKnownCivs / undefeatedCivs.toFloat() * 0.3f)* overflowScience).toInt()
overflowScience = 0
}
if (techsInProgress[currentTechnology]!! < costOfTech(currentTechnology))
return
// We finished it!
// http://www.civclub.net/bbs/forum.php?mod=viewthread&tid=123976
overflowScience = techsInProgress[currentTechnology]!! - costOfTech(currentTechnology)
if(overflowScience > max(scienceForNewTurn * 5, getRuleset().Technologies[currentTechnology]!!.cost))
overflowScience = max(scienceForNewTurn * 5, getRuleset().Technologies[currentTechnology]!!.cost)
val overflowscience = techsInProgress[currentTechnology]!! - costOfTech(currentTechnology)
overflowScience = overflowScience(overflowscience)
addTechnology(currentTechnology)
}

View File

@ -12,7 +12,6 @@ import com.unciv.models.ruleset.Building
import com.unciv.models.ruleset.tr
import com.unciv.ui.pickerscreens.ImprovementPickerScreen
import com.unciv.ui.pickerscreens.PromotionPickerScreen
import com.unciv.ui.pickerscreens.TechPickerScreen
import com.unciv.ui.worldscreen.WorldScreen
import com.unciv.ui.worldscreen.optionstable.YesNoPopupTable
import java.util.*
@ -196,11 +195,11 @@ class UnitActions {
if (unit.name == "Great Scientist" && !unit.isEmbarked()) {
actionList += UnitAction("Discover Technology", unit.currentMovement >0
actionList += UnitAction("Hurry Research", unit.civInfo.tech.currentTechnologyName() != null
&& unit.currentMovement >0
) {
unit.civInfo.tech.freeTechs += 1
unit.civInfo.tech.hurryResearch()
unit.destroy()
worldScreen.game.setScreen(TechPickerScreen(true, unit.civInfo))
}.sound("chimes")
}

View File

@ -33,7 +33,7 @@ class UnitActionsTable(val worldScreen: WorldScreen) : Table(){
"Automate" -> return ImageGetter.getUnitIcon("Great Engineer")
"Stop automation" -> return ImageGetter.getImage("OtherIcons/Stop")
"Found city" -> return ImageGetter.getUnitIcon(Constants.settler)
"Discover Technology" -> return ImageGetter.getUnitIcon("Great Scientist")
"Hurry Research" -> return ImageGetter.getUnitIcon("Great Scientist")
"Construct Academy" -> return ImageGetter.getImprovementIcon("Academy")
"Start Golden Age" -> return ImageGetter.getUnitIcon("Great Artist")
"Construct Landmark" -> return ImageGetter.getImprovementIcon("Landmark")