Added promotion jsons, icons and organized unit types (scout is now its own!)
BIN
android/assets/UnitPromotionIcons/Accuracy_III_(Civ5).png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
android/assets/UnitPromotionIcons/Accuracy_II_(Civ5).png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
android/assets/UnitPromotionIcons/Accuracy_I_(Civ5).png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
android/assets/UnitPromotionIcons/Barrage_III_(Civ5).png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
android/assets/UnitPromotionIcons/Barrage_II_(Civ5).png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
android/assets/UnitPromotionIcons/Barrage_I_(Civ5).png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
android/assets/UnitPromotionIcons/Drill_III_(Civ5).png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
android/assets/UnitPromotionIcons/Drill_II_(Civ5).png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
android/assets/UnitPromotionIcons/Drill_I_(Civ5).png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
android/assets/UnitPromotionIcons/Scouting_III_(Civ5).png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
android/assets/UnitPromotionIcons/Scouting_II_(Civ5).png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
android/assets/UnitPromotionIcons/Scouting_I_(Civ5).png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
android/assets/UnitPromotionIcons/Shock_III_(Civ5).png
Normal file
After Width: | Height: | Size: 2 KiB |
BIN
android/assets/UnitPromotionIcons/Shock_II_(Civ5).png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
android/assets/UnitPromotionIcons/Shock_I_(Civ5).png
Normal file
After Width: | Height: | Size: 1.8 KiB |
88
android/assets/jsons/UnitPromotions.json
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
[
|
||||||
|
|
||||||
|
{
|
||||||
|
name:"Accuracy I",
|
||||||
|
effect:"Bonus vs units in open terrain +15%",
|
||||||
|
unitTypes:["Siege","Ranged"]
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name:"Accuracy II",
|
||||||
|
prerequisites:["Accuracy I"],
|
||||||
|
effect:"Bonus vs units in open terrain +15%",
|
||||||
|
unitTypes:["Siege","Ranged"]
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name:"Accuracy III",
|
||||||
|
prerequisites:["Accuracy II"],
|
||||||
|
effect:"Bonus vs units in open terrain +15%",
|
||||||
|
unitTypes:["Siege","Ranged"]
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name:"Barrage I",
|
||||||
|
effect:"Bonus vs units in rough terrain +15%",
|
||||||
|
unitTypes:["Siege","Ranged"]
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name:"Barrage II",
|
||||||
|
prerequisites:["Barrage I"],
|
||||||
|
effect:"Bonus vs units in rough terrain +15%",
|
||||||
|
unitTypes:["Siege","Ranged"]
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name:"Barrage III",
|
||||||
|
prerequisites:["Barrage II"],
|
||||||
|
effect:"Bonus vs units in rough terrain +15%",
|
||||||
|
unitTypes:["Siege","Ranged"]
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name:"Shock I",
|
||||||
|
effect:"Bonus vs units in open terrain +15%",
|
||||||
|
unitTypes:["Melee","Mounted"]
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name:"Shock II",
|
||||||
|
prerequisites:["Shock I"],
|
||||||
|
effect:"Bonus vs units in open terrain +15%",
|
||||||
|
unitTypes:["Melee","Mounted"]
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name:"Shock III",
|
||||||
|
prerequisites:["Shock II"],
|
||||||
|
effect:"Bonus vs units in open terrain +15%",
|
||||||
|
unitTypes:["Melee","Mounted"]
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name:"Drill I",
|
||||||
|
effect:"Bonus vs units in rough terrain +15%",
|
||||||
|
unitTypes:["Melee","Mounted"]
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name:"Drill II",
|
||||||
|
prerequisites:["Drill I"],
|
||||||
|
effect:"Bonus vs units in rough terrain +15%",
|
||||||
|
unitTypes:["Melee","Mounted"]
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name:"Drill III",
|
||||||
|
prerequisites:["Drill II"],
|
||||||
|
effect:"Bonus vs units in rough terrain +15%",
|
||||||
|
unitTypes:["Melee","Mounted"]
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name:"Scouting I",
|
||||||
|
effect:"+1 Visibility Range",
|
||||||
|
unitTypes:["Melee","Mounted"]
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name:"Scouting II",
|
||||||
|
prerequisites:["Scouting I"],
|
||||||
|
effect:"+1 Visibility Range",
|
||||||
|
unitTypes:["Melee","Mounted"]
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name:"Scouting III",
|
||||||
|
prerequisites:["Scouting II"],
|
||||||
|
effect:"+1 Visibility Range",
|
||||||
|
unitTypes:["Melee","Mounted"]
|
||||||
|
}
|
||||||
|
]
|
|
@ -22,7 +22,7 @@
|
||||||
{
|
{
|
||||||
name:"Scout",
|
name:"Scout",
|
||||||
cost:25,
|
cost:25,
|
||||||
unitType:"Melee",
|
unitType:"Scout",
|
||||||
strength:5,
|
strength:5,
|
||||||
uniques:["Ignores terrain cost"]
|
uniques:["Ignores terrain cost"]
|
||||||
movement:2
|
movement:2
|
||||||
|
|
|
@ -16,9 +16,9 @@ interface ICombatant{
|
||||||
fun getTile(): TileInfo
|
fun getTile(): TileInfo
|
||||||
|
|
||||||
fun isMelee(): Boolean {
|
fun isMelee(): Boolean {
|
||||||
return this.getUnitType() in listOf(UnitType.Melee, UnitType.Mounted)
|
return this.getUnitType().isMelee()
|
||||||
}
|
}
|
||||||
fun isRanged(): Boolean {
|
fun isRanged(): Boolean {
|
||||||
return this.getUnitType() in listOf(UnitType.Ranged, UnitType.Siege)
|
return this.getUnitType().isRanged()
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,6 +6,7 @@ import com.unciv.models.gamebasics.tile.Terrain
|
||||||
import com.unciv.models.gamebasics.tile.TileImprovement
|
import com.unciv.models.gamebasics.tile.TileImprovement
|
||||||
import com.unciv.models.gamebasics.tile.TileResource
|
import com.unciv.models.gamebasics.tile.TileResource
|
||||||
import com.unciv.models.gamebasics.unit.Unit
|
import com.unciv.models.gamebasics.unit.Unit
|
||||||
|
import com.unciv.models.gamebasics.unit.UnitPromotion
|
||||||
import com.unciv.models.stats.INamed
|
import com.unciv.models.stats.INamed
|
||||||
import kotlin.collections.set
|
import kotlin.collections.set
|
||||||
|
|
||||||
|
@ -17,6 +18,7 @@ object GameBasics {
|
||||||
val Technologies = LinkedHashMap<String, Technology>()
|
val Technologies = LinkedHashMap<String, Technology>()
|
||||||
val Helps = LinkedHashMap<String, BasicHelp>()
|
val Helps = LinkedHashMap<String, BasicHelp>()
|
||||||
val Units = LinkedHashMap<String, Unit>()
|
val Units = LinkedHashMap<String, Unit>()
|
||||||
|
val UnitPromotions = LinkedHashMap<String, UnitPromotion>()
|
||||||
val Civilizations = LinkedHashMap<String, Civilization>()
|
val Civilizations = LinkedHashMap<String, Civilization>()
|
||||||
val PolicyBranches = LinkedHashMap<String, PolicyBranch>()
|
val PolicyBranches = LinkedHashMap<String, PolicyBranch>()
|
||||||
val Tutorials = LinkedHashMap<String, List<String>>()
|
val Tutorials = LinkedHashMap<String, List<String>>()
|
||||||
|
@ -41,6 +43,7 @@ object GameBasics {
|
||||||
TileImprovements += createHashmap(getFromJson(Array<TileImprovement>::class.java, "TileImprovements"))
|
TileImprovements += createHashmap(getFromJson(Array<TileImprovement>::class.java, "TileImprovements"))
|
||||||
Helps += createHashmap(getFromJson(Array<BasicHelp>::class.java, "BasicHelp"))
|
Helps += createHashmap(getFromJson(Array<BasicHelp>::class.java, "BasicHelp"))
|
||||||
Units += createHashmap(getFromJson(Array<Unit>::class.java, "Units"))
|
Units += createHashmap(getFromJson(Array<Unit>::class.java, "Units"))
|
||||||
|
UnitPromotions += createHashmap(getFromJson(Array<UnitPromotion>::class.java, "UnitPromotions"))
|
||||||
PolicyBranches += createHashmap(getFromJson(Array<PolicyBranch>::class.java, "Policies"))
|
PolicyBranches += createHashmap(getFromJson(Array<PolicyBranch>::class.java, "Policies"))
|
||||||
Civilizations += createHashmap(getFromJson(Array<Civilization>::class.java, "Civilizations"))
|
Civilizations += createHashmap(getFromJson(Array<Civilization>::class.java, "Civilizations"))
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,11 @@ import java.util.*
|
||||||
|
|
||||||
class TileImprovement : NamedStats(), ICivilopedia {
|
class TileImprovement : NamedStats(), ICivilopedia {
|
||||||
|
|
||||||
@JvmField var terrainsCanBeBuiltOn: Collection<String> = ArrayList()
|
var terrainsCanBeBuiltOn: Collection<String> = ArrayList()
|
||||||
@JvmField var techRequired: String? = null
|
var techRequired: String? = null
|
||||||
|
|
||||||
@JvmField var improvingTech: String? = null
|
var improvingTech: String? = null
|
||||||
@JvmField var improvingTechStats: Stats? = null
|
var improvingTechStats: Stats? = null
|
||||||
|
|
||||||
private val turnsToBuild: Int = 0 // This is the base cost.
|
private val turnsToBuild: Int = 0 // This is the base cost.
|
||||||
fun getTurnsToBuild(civInfo: CivilizationInfo): Int {
|
fun getTurnsToBuild(civInfo: CivilizationInfo): Int {
|
||||||
|
@ -47,3 +47,4 @@ class TileImprovement : NamedStats(), ICivilopedia {
|
||||||
return stringBuilder.toString()
|
return stringBuilder.toString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
15
core/src/com/unciv/models/gamebasics/unit/UnitPromotion.kt
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
package com.unciv.models.gamebasics.unit
|
||||||
|
|
||||||
|
import com.unciv.models.gamebasics.ICivilopedia
|
||||||
|
import com.unciv.models.stats.INamed
|
||||||
|
|
||||||
|
class UnitPromotion : ICivilopedia, INamed{
|
||||||
|
override lateinit var name: String
|
||||||
|
override val description: String
|
||||||
|
get(){
|
||||||
|
return effect
|
||||||
|
}
|
||||||
|
var prerequisites = listOf<String>()
|
||||||
|
lateinit var effect:String;
|
||||||
|
var unitTypes = listOf<UnitType>()
|
||||||
|
}
|
|
@ -5,6 +5,14 @@ enum class UnitType{
|
||||||
Civilian,
|
Civilian,
|
||||||
Melee,
|
Melee,
|
||||||
Ranged,
|
Ranged,
|
||||||
|
Scout,
|
||||||
Mounted,
|
Mounted,
|
||||||
Siege
|
Siege;
|
||||||
|
|
||||||
|
fun isMelee(): Boolean {
|
||||||
|
return this in listOf(Melee, Mounted, Scout)
|
||||||
|
}
|
||||||
|
fun isRanged(): Boolean {
|
||||||
|
return this in listOf(Ranged, Siege)
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -48,3 +48,4 @@ class ImprovementPickerScreen(tileInfo: TileInfo) : PickerScreen() {
|
||||||
topTable.add(regularImprovements)
|
topTable.add(regularImprovements)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
45
core/src/com/unciv/ui/pickerscreens/PromotionPickerScreen.kt
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
package com.unciv.ui.pickerscreens
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.Button
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.Label
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup
|
||||||
|
import com.unciv.logic.map.MapUnit
|
||||||
|
import com.unciv.models.gamebasics.GameBasics
|
||||||
|
import com.unciv.models.gamebasics.unit.UnitPromotion
|
||||||
|
import com.unciv.ui.utils.ImageGetter
|
||||||
|
import com.unciv.ui.utils.addClickListener
|
||||||
|
import com.unciv.ui.utils.setFontColor
|
||||||
|
|
||||||
|
class PromotionPickerScreen(mapUnit: MapUnit) : PickerScreen() {
|
||||||
|
private var selectedPromotion: UnitPromotion? = null
|
||||||
|
|
||||||
|
init {
|
||||||
|
rightSideButton.setText("Pick promotion")
|
||||||
|
rightSideButton.addClickListener {
|
||||||
|
// todo add promotion to unit and decrease XP
|
||||||
|
game.setWorldScreen()
|
||||||
|
dispose()
|
||||||
|
}
|
||||||
|
|
||||||
|
val availablePromotions = VerticalGroup()
|
||||||
|
availablePromotions.space(10f)
|
||||||
|
for (promotion in GameBasics.UnitPromotions.values) {
|
||||||
|
if (!promotion.unitTypes.contains(mapUnit.getBaseUnit().unitType)) continue
|
||||||
|
val promotionButton = Button(skin)
|
||||||
|
|
||||||
|
promotionButton.add(ImageGetter.getPromotionIcon(promotion.name)).size(30f).pad(10f)
|
||||||
|
|
||||||
|
promotionButton.add(Label(promotion.name, skin)
|
||||||
|
.setFontColor(Color.WHITE)).pad(10f)
|
||||||
|
|
||||||
|
promotionButton.addClickListener {
|
||||||
|
selectedPromotion = promotion
|
||||||
|
pick(promotion.name)
|
||||||
|
descriptionLabel.setText(promotion.effect)
|
||||||
|
}
|
||||||
|
availablePromotions.addActor(promotionButton)
|
||||||
|
}
|
||||||
|
topTable.add(availablePromotions)
|
||||||
|
}
|
||||||
|
}
|
|
@ -50,5 +50,9 @@ object ImageGetter {
|
||||||
return getImage("ImprovementIcons/" + improvementName.replace(' ', '_') + "_(Civ5).png")
|
return getImage("ImprovementIcons/" + improvementName.replace(' ', '_') + "_(Civ5).png")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getPromotionIcon(promotionName:String):Image{
|
||||||
|
return getImage("UnitPromotionIcons/" + promotionName.replace(' ', '_') + "_(Civ5).png")
|
||||||
|
}
|
||||||
|
|
||||||
fun getBlue() = Color(0x004085bf)
|
fun getBlue() = Color(0x004085bf)
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,11 +99,12 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap:
|
||||||
for(tile: TileInfo in unit.getDistanceToTiles().keys)
|
for(tile: TileInfo in unit.getDistanceToTiles().keys)
|
||||||
tileGroups[tile]!!.showCircle(colorFromRGB(0, 120, 215))
|
tileGroups[tile]!!.showCircle(colorFromRGB(0, 120, 215))
|
||||||
|
|
||||||
val attackableTiles: List<TileInfo> = when(unit.getBaseUnit().unitType){
|
val unitType = unit.getBaseUnit().unitType
|
||||||
UnitType.Civilian -> unit.getDistanceToTiles().keys.toList()
|
val attackableTiles: List<TileInfo> = when{
|
||||||
UnitType.Melee, UnitType.Mounted -> unit.getDistanceToTiles().keys.toList()
|
unitType==UnitType.Civilian -> unit.getDistanceToTiles().keys.toList()
|
||||||
UnitType.Ranged, UnitType.Siege -> unit.getTile().getTilesInDistance(2)
|
unit.getBaseUnit().unitType.isMelee() -> unit.getDistanceToTiles().keys.toList()
|
||||||
UnitType.City -> throw Exception("A unit shouldn't have a City unittype!")
|
unitType.isRanged() -> unit.getTile().getTilesInDistance(2)
|
||||||
|
else -> throw Exception("UnitType isn't Civilian, Melee or Ranged???")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|