mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-20 09:17:47 +07:00
Policy branches are unlocked by era
This commit is contained in:
parent
85a8e68a0a
commit
c5f127e555
@ -1,6 +1,7 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
name:"Tradition",
|
name:"Tradition",
|
||||||
|
era:"Ancient",
|
||||||
description:"+3 culture in capital and increased rate of border expansion",
|
description:"+3 culture in capital and increased rate of border expansion",
|
||||||
policies:[
|
policies:[
|
||||||
{
|
{
|
||||||
@ -42,6 +43,7 @@
|
|||||||
]
|
]
|
||||||
},{
|
},{
|
||||||
name:"Liberty",
|
name:"Liberty",
|
||||||
|
era:"Ancient",
|
||||||
description:"+1 culture in evey city",
|
description:"+1 culture in evey city",
|
||||||
policies:[
|
policies:[
|
||||||
{
|
{
|
||||||
@ -84,6 +86,7 @@
|
|||||||
]
|
]
|
||||||
},{
|
},{
|
||||||
name:"Piety",
|
name:"Piety",
|
||||||
|
era:"Classical",
|
||||||
description:"Building time of culture buildings reduced by 15%",
|
description:"Building time of culture buildings reduced by 15%",
|
||||||
policies:[
|
policies:[
|
||||||
{
|
{
|
||||||
@ -127,6 +130,7 @@
|
|||||||
},{
|
},{
|
||||||
name:"Commerce",
|
name:"Commerce",
|
||||||
description:"+25% gold in capital",
|
description:"+25% gold in capital",
|
||||||
|
era:"Medieval",
|
||||||
policies:[
|
policies:[
|
||||||
{
|
{
|
||||||
name:"Trade Unions",
|
name:"Trade Unions",
|
||||||
@ -168,6 +172,7 @@
|
|||||||
]
|
]
|
||||||
},{
|
},{
|
||||||
name:"Rationalism",
|
name:"Rationalism",
|
||||||
|
era:"Renaissance",
|
||||||
description:"Production to science conversion in cities increased by 33%",
|
description:"Production to science conversion in cities increased by 33%",
|
||||||
policies:[
|
policies:[
|
||||||
{
|
{
|
||||||
@ -210,6 +215,7 @@
|
|||||||
]
|
]
|
||||||
},{
|
},{
|
||||||
name:"Freedom",
|
name:"Freedom",
|
||||||
|
era:"Renaissance",
|
||||||
description:"+25% great people rate",
|
description:"+25% great people rate",
|
||||||
policies:[
|
policies:[
|
||||||
{
|
{
|
||||||
|
@ -247,6 +247,8 @@
|
|||||||
hurryCostModifier:20
|
hurryCostModifier:20
|
||||||
uniques:["Can move after attacking","No defensive terrain bonus","Penalty vs City 33%","Bonus vs Mounted 50%" ],
|
uniques:["Can move after attacking","No defensive terrain bonus","Penalty vs City 33%","Bonus vs Mounted 50%" ],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// UNITS FROM HERE NEED IMAGES
|
||||||
{
|
{
|
||||||
name:"Rifleman",
|
name:"Rifleman",
|
||||||
unitType:"Melee",
|
unitType:"Melee",
|
||||||
|
@ -9,6 +9,7 @@ import com.unciv.logic.map.RoadStatus
|
|||||||
import com.unciv.logic.map.TileInfo
|
import com.unciv.logic.map.TileInfo
|
||||||
import com.unciv.models.gamebasics.Civilization
|
import com.unciv.models.gamebasics.Civilization
|
||||||
import com.unciv.models.gamebasics.GameBasics
|
import com.unciv.models.gamebasics.GameBasics
|
||||||
|
import com.unciv.models.gamebasics.TechEra
|
||||||
import com.unciv.models.gamebasics.tile.ResourceType
|
import com.unciv.models.gamebasics.tile.ResourceType
|
||||||
import com.unciv.models.gamebasics.tile.TileResource
|
import com.unciv.models.gamebasics.tile.TileResource
|
||||||
import com.unciv.models.linq.Counter
|
import com.unciv.models.linq.Counter
|
||||||
@ -208,4 +209,19 @@ class CivilizationInfo {
|
|||||||
override fun toString(): String {return civName} // for debug
|
override fun toString(): String {return civName} // for debug
|
||||||
|
|
||||||
fun isDefeated()= cities.isEmpty() && !getCivUnits().any{it.name=="Settler"}
|
fun isDefeated()= cities.isEmpty() && !getCivUnits().any{it.name=="Settler"}
|
||||||
}
|
fun getEra(): TechEra {
|
||||||
|
return tech.techsResearched.map { GameBasics.Technologies[it]!! }
|
||||||
|
.map { it.era() }
|
||||||
|
.max()!!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//enum class DiplomaticStatus{
|
||||||
|
// Peace,
|
||||||
|
// War
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//class DiplomacyManager {
|
||||||
|
// lateinit var otherCivName:String
|
||||||
|
// var status:DiplomaticStatus = DiplomaticStatus.Peace
|
||||||
|
//}
|
@ -35,6 +35,7 @@ class PolicyManager {
|
|||||||
|
|
||||||
fun isAdoptable(policy: Policy) = !policy.name.endsWith("Complete")
|
fun isAdoptable(policy: Policy) = !policy.name.endsWith("Complete")
|
||||||
&& getAdoptedPolicies().containsAll(policy.requires!!)
|
&& getAdoptedPolicies().containsAll(policy.requires!!)
|
||||||
|
&& policy.getBranch().era <= civInfo.getEra()
|
||||||
|
|
||||||
fun canAdoptPolicy(): Boolean = freePolicies > 0 || storedCulture >= getCultureNeededForNextPolicy()
|
fun canAdoptPolicy(): Boolean = freePolicies > 0 || storedCulture >= getCultureNeededForNextPolicy()
|
||||||
|
|
||||||
@ -48,7 +49,7 @@ class PolicyManager {
|
|||||||
adoptedPolicies.add(policy.name)
|
adoptedPolicies.add(policy.name)
|
||||||
|
|
||||||
if (!branchCompletion) {
|
if (!branchCompletion) {
|
||||||
val branch = GameBasics.PolicyBranches[policy.branch]!!
|
val branch = policy.getBranch()
|
||||||
if (branch.policies.count { isAdopted(it.name) } == branch.policies.size - 1) { // All done apart from branch completion
|
if (branch.policies.count { isAdopted(it.name) } == branch.policies.size - 1) { // All done apart from branch completion
|
||||||
adopt(branch.policies.last(), true) // add branch completion!
|
adopt(branch.policies.last(), true) // add branch completion!
|
||||||
}
|
}
|
||||||
|
@ -9,5 +9,9 @@ open class Policy : INamed {
|
|||||||
var row: Int = 0
|
var row: Int = 0
|
||||||
var column: Int = 0
|
var column: Int = 0
|
||||||
var requires: ArrayList<String>? = null
|
var requires: ArrayList<String>? = null
|
||||||
|
|
||||||
|
fun getBranch():PolicyBranch{
|
||||||
|
return GameBasics.PolicyBranches[branch]!!
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,4 +2,5 @@ package com.unciv.models.gamebasics
|
|||||||
|
|
||||||
class PolicyBranch : Policy() {
|
class PolicyBranch : Policy() {
|
||||||
var policies: ArrayList<Policy> = arrayListOf()
|
var policies: ArrayList<Policy> = arrayListOf()
|
||||||
|
lateinit var era:TechEra
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,24 @@
|
|||||||
package com.unciv.models.gamebasics
|
package com.unciv.models.gamebasics
|
||||||
|
|
||||||
import java.util.ArrayList
|
import java.util.*
|
||||||
|
|
||||||
class TechColumn {
|
class TechColumn {
|
||||||
@JvmField var columnNumber: Int = 0
|
var columnNumber: Int = 0
|
||||||
@JvmField var era: String? = null
|
lateinit var era: TechEra
|
||||||
@JvmField var techs = ArrayList<Technology>()
|
var techs = ArrayList<Technology>()
|
||||||
@JvmField var techCost: Int = 0
|
var techCost: Int = 0
|
||||||
@JvmField var buildingCost: Int = 0
|
var buildingCost: Int = 0
|
||||||
@JvmField var wonderCost: Int = 0
|
var wonderCost: Int = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
enum class TechEra{
|
||||||
|
Ancient,
|
||||||
|
Classical,
|
||||||
|
Medieval,
|
||||||
|
Renaissance,
|
||||||
|
Industrial,
|
||||||
|
Modern,
|
||||||
|
Information,
|
||||||
|
Future
|
||||||
|
}
|
@ -49,4 +49,6 @@ class Technology : ICivilopedia {
|
|||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return name
|
return name
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
fun era() = column!!.era
|
||||||
|
}
|
||||||
|
@ -89,8 +89,12 @@ class PolicyPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen(
|
|||||||
}
|
}
|
||||||
pickedPolicy = policy
|
pickedPolicy = policy
|
||||||
var policyText = policy.name + "\r\n" + policy.description + "\r\n"
|
var policyText = policy.name + "\r\n" + policy.description + "\r\n"
|
||||||
if (!policy.name.endsWith("Complete") && policy.requires!!.isNotEmpty())
|
if (!policy.name.endsWith("Complete")){
|
||||||
policyText += "Requires " + policy.requires!!.joinToString()
|
if(policy.requires!!.isNotEmpty())
|
||||||
|
policyText += "Requires " + policy.requires!!.joinToString()
|
||||||
|
else
|
||||||
|
policyText += "Unlocked at "+policy.getBranch().era+" era"
|
||||||
|
}
|
||||||
descriptionLabel.setText(policyText)
|
descriptionLabel.setText(policyText)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,8 +103,9 @@ class PolicyPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen(
|
|||||||
if (image) {
|
if (image) {
|
||||||
val policyImage = ImageGetter.getImage("PolicyIcons/" + policy.name.replace(" ", "_") + "_(Civ5).png")
|
val policyImage = ImageGetter.getImage("PolicyIcons/" + policy.name.replace(" ", "_") + "_(Civ5).png")
|
||||||
policyButton.add(policyImage).size(30f)
|
policyButton.add(policyImage).size(30f)
|
||||||
} else
|
} else {
|
||||||
policyButton = TextButton(policy.name, CameraStageBaseScreen.skin)
|
policyButton = TextButton(policy.name, CameraStageBaseScreen.skin)
|
||||||
|
}
|
||||||
|
|
||||||
if (civInfo.policies.isAdopted(policy.name)) { // existing
|
if (civInfo.policies.isAdopted(policy.name)) { // existing
|
||||||
policyButton.color = Color.GREEN
|
policyButton.color = Color.GREEN
|
||||||
|
Loading…
Reference in New Issue
Block a user