mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-10 15:59:33 +07:00
Dev: Removed baseDescription from units, all old baseDescriptions moved to Uniques
This commit is contained in:
@ -6,17 +6,17 @@
|
|||||||
{
|
{
|
||||||
name:"Worker",
|
name:"Worker",
|
||||||
unitType:"Civilian",
|
unitType:"Civilian",
|
||||||
baseDescription: "Can build improvements on tiles",
|
|
||||||
movement:2,
|
movement:2,
|
||||||
hurryCostModifier:20,
|
hurryCostModifier:20,
|
||||||
|
uniques:["Can build improvements on tiles"]
|
||||||
cost:70
|
cost:70
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name:"Settler",
|
name:"Settler",
|
||||||
unitType:"Civilian",
|
unitType:"Civilian",
|
||||||
baseDescription: "Founds a new city",
|
|
||||||
movement:2,
|
movement:2,
|
||||||
cost:106,
|
cost:106,
|
||||||
|
uniques:["Founds a new city"]
|
||||||
hurryCostModifier:20
|
hurryCostModifier:20
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -66,11 +66,10 @@
|
|||||||
{
|
{
|
||||||
name:"Work Boats",
|
name:"Work Boats",
|
||||||
unitType:"WaterCivilian",
|
unitType:"WaterCivilian",
|
||||||
baseDescription: "May create improvements on water resources",
|
|
||||||
movement:4,
|
movement:4,
|
||||||
cost: 30,
|
cost: 30,
|
||||||
requiredTech:"Sailing",
|
requiredTech:"Sailing",
|
||||||
uniques:["Cannot enter ocean tiles until Astronomy"]
|
uniques:["Cannot enter ocean tiles until Astronomy","May create improvements on water resources"]
|
||||||
hurryCostModifier:20
|
hurryCostModifier:20
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -379,30 +378,30 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
name:"Great Artist",
|
name:"Great Artist",
|
||||||
baseDescription: "Can start an 8-turn golden age or construct a Landmark (+6 culture)",
|
|
||||||
unbuildable:true,
|
unbuildable:true,
|
||||||
unitType:"Civilian",
|
unitType:"Civilian",
|
||||||
|
uniques:["Can start an 8-turn golden age","Can build improvement: Landmark"]
|
||||||
movement:2
|
movement:2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name:"Great Scientist",
|
name:"Great Scientist",
|
||||||
baseDescription: "Can discover a technology, or construct an Academy (+4 science)",
|
|
||||||
unbuildable:true,
|
unbuildable:true,
|
||||||
unitType:"Civilian",
|
unitType:"Civilian",
|
||||||
|
uniques:["Can discover a technology","Can build improvement: Academy"]
|
||||||
movement:2
|
movement:2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name:"Great Merchant",
|
name:"Great Merchant",
|
||||||
baseDescription: "Can undertake a trade mission, giving a large sum of gold, or construct a Customs House (+4 gold)",
|
|
||||||
unbuildable:true,
|
unbuildable:true,
|
||||||
unitType:"Civilian",
|
unitType:"Civilian",
|
||||||
|
uniques:["Can undertake a trade mission, giving a large sum of gold","Can build improvement: Customs House"]
|
||||||
movement:2
|
movement:2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name:"Great Engineer",
|
name:"Great Engineer",
|
||||||
baseDescription: "Can speed up construction of a wonder, or construct a Manufactory (+4 production)",
|
|
||||||
unbuildable:true,
|
unbuildable:true,
|
||||||
unitType:"Civilian",
|
unitType:"Civilian",
|
||||||
|
uniques:["Can speed up construction of a wonder","Can build improvement: Manufactory"]
|
||||||
movement:2
|
movement:2
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ import com.unciv.logic.GameInfo
|
|||||||
import com.unciv.logic.civilization.CivilizationInfo
|
import com.unciv.logic.civilization.CivilizationInfo
|
||||||
import com.unciv.logic.map.TileMap
|
import com.unciv.logic.map.TileMap
|
||||||
import com.unciv.models.gamebasics.GameBasics
|
import com.unciv.models.gamebasics.GameBasics
|
||||||
import com.unciv.models.gamebasics.tile.TerrainType
|
|
||||||
import com.unciv.ui.NewGameScreen
|
import com.unciv.ui.NewGameScreen
|
||||||
import com.unciv.ui.utils.getRandom
|
import com.unciv.ui.utils.getRandom
|
||||||
|
|
||||||
@ -29,7 +28,7 @@ class GameStarter(){
|
|||||||
.filter { it.isLand() && vectorIsWithinNTilesOfEdge(it.position,3)}
|
.filter { it.isLand() && vectorIsWithinNTilesOfEdge(it.position,3)}
|
||||||
.toMutableList()
|
.toMutableList()
|
||||||
val playerPosition = freeTiles.getRandom().position
|
val playerPosition = freeTiles.getRandom().position
|
||||||
val playerCiv = CivilizationInfo(newGameParameters.nation, gameInfo)
|
val playerCiv = CivilizationInfo(newGameParameters.nation)
|
||||||
playerCiv.difficulty=newGameParameters.difficulty
|
playerCiv.difficulty=newGameParameters.difficulty
|
||||||
gameInfo.civilizations.add(playerCiv) // first one is player civ
|
gameInfo.civilizations.add(playerCiv) // first one is player civ
|
||||||
|
|
||||||
@ -40,7 +39,7 @@ class GameStarter(){
|
|||||||
|
|
||||||
for (nationName in GameBasics.Nations.keys.filterNot { it=="Barbarians" || it==newGameParameters.nation }.shuffled()
|
for (nationName in GameBasics.Nations.keys.filterNot { it=="Barbarians" || it==newGameParameters.nation }.shuffled()
|
||||||
.take(newGameParameters.numberOfEnemies)) {
|
.take(newGameParameters.numberOfEnemies)) {
|
||||||
val civ = CivilizationInfo(nationName, gameInfo)
|
val civ = CivilizationInfo(nationName)
|
||||||
civ.tech.techsResearched.addAll(playerCiv.getDifficulty().aiFreeTechs)
|
civ.tech.techsResearched.addAll(playerCiv.getDifficulty().aiFreeTechs)
|
||||||
gameInfo.civilizations.add(civ)
|
gameInfo.civilizations.add(civ)
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ class CivilizationInfo {
|
|||||||
|
|
||||||
constructor()
|
constructor()
|
||||||
|
|
||||||
constructor(civName: String, gameInfo: GameInfo) {
|
constructor(civName: String) {
|
||||||
this.civName = civName
|
this.civName = civName
|
||||||
tech.techsResearched.add("Agriculture")
|
tech.techsResearched.add("Agriculture")
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ class TileMap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun placeUnitNearTile(position: Vector2, unitName: String, civInfo: CivilizationInfo): MapUnit {
|
fun placeUnitNearTile(position: Vector2, unitName: String, civInfo: CivilizationInfo): MapUnit {
|
||||||
val unit = GameBasics.Units[unitName]!!.getMapUnit(civInfo)
|
val unit = GameBasics.Units[unitName]!!.getMapUnit()
|
||||||
val tilesInDistance = getTilesInDistance(position, 2)
|
val tilesInDistance = getTilesInDistance(position, 2)
|
||||||
|
|
||||||
unit.assignOwner(civInfo) // both the civ name and actual civ need to be in here in order to calculate the canMoveTo...Darn
|
unit.assignOwner(civInfo) // both the civ name and actual civ need to be in here in order to calculate the canMoveTo...Darn
|
||||||
|
@ -13,7 +13,6 @@ import com.unciv.ui.utils.tr
|
|||||||
class BaseUnit : INamed, IConstruction, ICivilopedia {
|
class BaseUnit : INamed, IConstruction, ICivilopedia {
|
||||||
|
|
||||||
override lateinit var name: String
|
override lateinit var name: String
|
||||||
var baseDescription: String? = null
|
|
||||||
var cost: Int = 0
|
var cost: Int = 0
|
||||||
var hurryCostModifier: Int = 0
|
var hurryCostModifier: Int = 0
|
||||||
var movement: Int = 0
|
var movement: Int = 0
|
||||||
@ -38,7 +37,7 @@ class BaseUnit : INamed, IConstruction, ICivilopedia {
|
|||||||
|
|
||||||
fun getShortDescription(): String {
|
fun getShortDescription(): String {
|
||||||
val infoList= mutableListOf<String>()
|
val infoList= mutableListOf<String>()
|
||||||
if(baseDescription!=null) infoList+=baseDescription!!
|
infoList += uniques.map { it.tr() }
|
||||||
if(strength!=0) infoList += "{Strength}: $strength".tr()
|
if(strength!=0) infoList += "{Strength}: $strength".tr()
|
||||||
if(rangedStrength!=0) infoList += "{Ranged strength}: $rangedStrength".tr()
|
if(rangedStrength!=0) infoList += "{Ranged strength}: $rangedStrength".tr()
|
||||||
if(movement!=2) infoList+="{Movement}: $movement".tr()
|
if(movement!=2) infoList+="{Movement}: $movement".tr()
|
||||||
@ -47,7 +46,6 @@ class BaseUnit : INamed, IConstruction, ICivilopedia {
|
|||||||
|
|
||||||
fun getDescription(forPickerScreen:Boolean): String {
|
fun getDescription(forPickerScreen:Boolean): String {
|
||||||
val sb = StringBuilder()
|
val sb = StringBuilder()
|
||||||
if(baseDescription!=null) sb.appendln(baseDescription!!.tr())
|
|
||||||
if(requiredResource!=null) sb.appendln("Requires {$requiredResource}".tr())
|
if(requiredResource!=null) sb.appendln("Requires {$requiredResource}".tr())
|
||||||
if(!forPickerScreen) {
|
if(!forPickerScreen) {
|
||||||
if(uniqueTo!=null) sb.appendln("Unique to $uniqueTo, replaces $replaces")
|
if(uniqueTo!=null) sb.appendln("Unique to $uniqueTo, replaces $replaces")
|
||||||
@ -71,7 +69,7 @@ class BaseUnit : INamed, IConstruction, ICivilopedia {
|
|||||||
return sb.toString()
|
return sb.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getMapUnit(civInfo: CivilizationInfo): MapUnit {
|
fun getMapUnit(): MapUnit {
|
||||||
val unit = MapUnit()
|
val unit = MapUnit()
|
||||||
unit.name = name
|
unit.name = name
|
||||||
unit.setTransients() // must be after setting name because it sets the baseUnit according to the name
|
unit.setTransients() // must be after setting name because it sets the baseUnit according to the name
|
||||||
|
@ -25,7 +25,7 @@ class GreatPersonPickerScreen : PickerScreen() {
|
|||||||
button.onClick {
|
button.onClick {
|
||||||
theChosenOne = unit
|
theChosenOne = unit
|
||||||
pick("Get " +unit.name)
|
pick("Get " +unit.name)
|
||||||
descriptionLabel.setText(unit.baseDescription)
|
descriptionLabel.setText(unit.uniques.joinToString())
|
||||||
}
|
}
|
||||||
topTable.add(button).pad(10f)
|
topTable.add(button).pad(10f)
|
||||||
}
|
}
|
||||||
|
@ -52,8 +52,9 @@ class TechButton(techName:String, val techManager: TechManager) : Table(CameraSt
|
|||||||
techEnabledIcons.add(ImageGetter.getResourceImage(resource.name, 30f))
|
techEnabledIcons.add(ImageGetter.getResourceImage(resource.name, 30f))
|
||||||
|
|
||||||
val tech = GameBasics.Technologies[techName]!!
|
val tech = GameBasics.Technologies[techName]!!
|
||||||
if(tech.baseDescription!=null)
|
for(unique in tech.uniques)
|
||||||
techEnabledIcons.add(ImageGetter.getImage("OtherIcons/Star").apply { color= Color.BLACK }.surroundWithCircle(30f))
|
techEnabledIcons.add(ImageGetter.getImage("OtherIcons/Star")
|
||||||
|
.apply { color= Color.BLACK }.surroundWithCircle(30f))
|
||||||
|
|
||||||
rightSide.add(techEnabledIcons)
|
rightSide.add(techEnabledIcons)
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ class UnitActions {
|
|||||||
{unit.action="Set Up"; unit.currentMovement = max(0f, unit.currentMovement-1)},
|
{unit.action="Set Up"; unit.currentMovement = max(0f, unit.currentMovement-1)},
|
||||||
unit.currentMovement != 0f)
|
unit.currentMovement != 0f)
|
||||||
|
|
||||||
if (unit.name == "Settler" && !unit.isEmbarked()) {
|
if (unit.hasUnique("Founds a new city") && !unit.isEmbarked()) {
|
||||||
actionList += UnitAction("Found city",
|
actionList += UnitAction("Found city",
|
||||||
{
|
{
|
||||||
worldScreen.displayTutorials("CityFounded")
|
worldScreen.displayTutorials("CityFounded")
|
||||||
@ -109,7 +109,7 @@ class UnitActions {
|
|||||||
!tile.getTilesInDistance(3).any { it.isCityCenter() })
|
!tile.getTilesInDistance(3).any { it.isCityCenter() })
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unit.name == "Worker" && !unit.isEmbarked()) {
|
if (unit.hasUnique("Can build improvements on tiles") && !unit.isEmbarked()) {
|
||||||
actionList += UnitAction("Construct improvement",
|
actionList += UnitAction("Construct improvement",
|
||||||
{ worldScreen.game.screen = ImprovementPickerScreen(tile) },
|
{ worldScreen.game.screen = ImprovementPickerScreen(tile) },
|
||||||
unit.currentMovement != 0f
|
unit.currentMovement != 0f
|
||||||
@ -131,7 +131,7 @@ class UnitActions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(improvement in listOf("Fishing Boats","Oil well")) {
|
for(improvement in listOf("Fishing Boats","Oil well")) {
|
||||||
if (unit.name == "Work Boats" && tile.resource != null
|
if (unit.hasUnique("May create improvements on water resources") && tile.resource != null
|
||||||
&& tile.getTileResource().improvement == improvement
|
&& tile.getTileResource().improvement == improvement
|
||||||
&& unit.civInfo.tech.isResearched(GameBasics.TileImprovements[improvement]!!.techRequired!!)
|
&& unit.civInfo.tech.isResearched(GameBasics.TileImprovements[improvement]!!.techRequired!!)
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user