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",
|
||||
era:"Ancient",
|
||||
description:"+3 culture in capital and increased rate of border expansion",
|
||||
policies:[
|
||||
{
|
||||
@ -42,6 +43,7 @@
|
||||
]
|
||||
},{
|
||||
name:"Liberty",
|
||||
era:"Ancient",
|
||||
description:"+1 culture in evey city",
|
||||
policies:[
|
||||
{
|
||||
@ -84,6 +86,7 @@
|
||||
]
|
||||
},{
|
||||
name:"Piety",
|
||||
era:"Classical",
|
||||
description:"Building time of culture buildings reduced by 15%",
|
||||
policies:[
|
||||
{
|
||||
@ -127,6 +130,7 @@
|
||||
},{
|
||||
name:"Commerce",
|
||||
description:"+25% gold in capital",
|
||||
era:"Medieval",
|
||||
policies:[
|
||||
{
|
||||
name:"Trade Unions",
|
||||
@ -168,6 +172,7 @@
|
||||
]
|
||||
},{
|
||||
name:"Rationalism",
|
||||
era:"Renaissance",
|
||||
description:"Production to science conversion in cities increased by 33%",
|
||||
policies:[
|
||||
{
|
||||
@ -210,6 +215,7 @@
|
||||
]
|
||||
},{
|
||||
name:"Freedom",
|
||||
era:"Renaissance",
|
||||
description:"+25% great people rate",
|
||||
policies:[
|
||||
{
|
||||
|
@ -247,6 +247,8 @@
|
||||
hurryCostModifier:20
|
||||
uniques:["Can move after attacking","No defensive terrain bonus","Penalty vs City 33%","Bonus vs Mounted 50%" ],
|
||||
},
|
||||
|
||||
// UNITS FROM HERE NEED IMAGES
|
||||
{
|
||||
name:"Rifleman",
|
||||
unitType:"Melee",
|
||||
|
@ -9,6 +9,7 @@ import com.unciv.logic.map.RoadStatus
|
||||
import com.unciv.logic.map.TileInfo
|
||||
import com.unciv.models.gamebasics.Civilization
|
||||
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.TileResource
|
||||
import com.unciv.models.linq.Counter
|
||||
@ -208,4 +209,19 @@ class CivilizationInfo {
|
||||
override fun toString(): String {return civName} // for debug
|
||||
|
||||
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")
|
||||
&& getAdoptedPolicies().containsAll(policy.requires!!)
|
||||
&& policy.getBranch().era <= civInfo.getEra()
|
||||
|
||||
fun canAdoptPolicy(): Boolean = freePolicies > 0 || storedCulture >= getCultureNeededForNextPolicy()
|
||||
|
||||
@ -48,7 +49,7 @@ class PolicyManager {
|
||||
adoptedPolicies.add(policy.name)
|
||||
|
||||
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
|
||||
adopt(branch.policies.last(), true) // add branch completion!
|
||||
}
|
||||
|
@ -9,5 +9,9 @@ open class Policy : INamed {
|
||||
var row: Int = 0
|
||||
var column: Int = 0
|
||||
var requires: ArrayList<String>? = null
|
||||
|
||||
fun getBranch():PolicyBranch{
|
||||
return GameBasics.PolicyBranches[branch]!!
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,4 +2,5 @@ package com.unciv.models.gamebasics
|
||||
|
||||
class PolicyBranch : Policy() {
|
||||
var policies: ArrayList<Policy> = arrayListOf()
|
||||
lateinit var era:TechEra
|
||||
}
|
||||
|
@ -1,12 +1,24 @@
|
||||
package com.unciv.models.gamebasics
|
||||
|
||||
import java.util.ArrayList
|
||||
import java.util.*
|
||||
|
||||
class TechColumn {
|
||||
@JvmField var columnNumber: Int = 0
|
||||
@JvmField var era: String? = null
|
||||
@JvmField var techs = ArrayList<Technology>()
|
||||
@JvmField var techCost: Int = 0
|
||||
@JvmField var buildingCost: Int = 0
|
||||
@JvmField var wonderCost: Int = 0
|
||||
var columnNumber: Int = 0
|
||||
lateinit var era: TechEra
|
||||
var techs = ArrayList<Technology>()
|
||||
var techCost: Int = 0
|
||||
var buildingCost: 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 {
|
||||
return name
|
||||
}
|
||||
}
|
||||
|
||||
fun era() = column!!.era
|
||||
}
|
||||
|
@ -89,8 +89,12 @@ class PolicyPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen(
|
||||
}
|
||||
pickedPolicy = policy
|
||||
var policyText = policy.name + "\r\n" + policy.description + "\r\n"
|
||||
if (!policy.name.endsWith("Complete") && policy.requires!!.isNotEmpty())
|
||||
policyText += "Requires " + policy.requires!!.joinToString()
|
||||
if (!policy.name.endsWith("Complete")){
|
||||
if(policy.requires!!.isNotEmpty())
|
||||
policyText += "Requires " + policy.requires!!.joinToString()
|
||||
else
|
||||
policyText += "Unlocked at "+policy.getBranch().era+" era"
|
||||
}
|
||||
descriptionLabel.setText(policyText)
|
||||
}
|
||||
|
||||
@ -99,8 +103,9 @@ class PolicyPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen(
|
||||
if (image) {
|
||||
val policyImage = ImageGetter.getImage("PolicyIcons/" + policy.name.replace(" ", "_") + "_(Civ5).png")
|
||||
policyButton.add(policyImage).size(30f)
|
||||
} else
|
||||
} else {
|
||||
policyButton = TextButton(policy.name, CameraStageBaseScreen.skin)
|
||||
}
|
||||
|
||||
if (civInfo.policies.isAdopted(policy.name)) { // existing
|
||||
policyButton.color = Color.GREEN
|
||||
|
Loading…
Reference in New Issue
Block a user