mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-16 02:40:41 +07:00
Added Minuteman, American unique, and England special ability
This commit is contained in:
@ -20,6 +20,9 @@ class UnCivGame : Game() {
|
||||
*/
|
||||
val viewEntireMapForDebug = false
|
||||
|
||||
// For when you need to test something in an advanced game and don't have time to faff around
|
||||
val SuperchagedForDebug = false
|
||||
|
||||
lateinit var worldScreen: WorldScreen
|
||||
|
||||
override fun create() {
|
||||
|
@ -62,7 +62,7 @@ class Automation {
|
||||
|
||||
val goldBuildings = buildableNotWonders.filter { it.gold>0 }
|
||||
val wartimeBuildings = buildableNotWonders.filter { it.xpForNewUnits>0 || it.cityStrength>0 }.sortedBy { it.maintenance }
|
||||
val zeroMaintainanceBuildings = buildableNotWonders.filter { it.maintenance == 0 && it !in wartimeBuildings }
|
||||
val zeroMaintenanceBuildings = buildableNotWonders.filter { it.maintenance == 0 && it !in wartimeBuildings }
|
||||
val isAtWar = cityInfo.civInfo.isAtWar()
|
||||
|
||||
when {
|
||||
@ -77,7 +77,7 @@ class Automation {
|
||||
buildableNotWonders.any { it.name=="Market"} -> currentConstruction = "Market"
|
||||
militaryUnits==0 -> trainCombatUnit(cityInfo)
|
||||
workers==0 -> currentConstruction = CityConstructions.Worker
|
||||
zeroMaintainanceBuildings.isNotEmpty() -> currentConstruction = zeroMaintainanceBuildings.getRandom().name
|
||||
zeroMaintenanceBuildings.isNotEmpty() -> currentConstruction = zeroMaintenanceBuildings.getRandom().name
|
||||
isAtWar && militaryUnits<cities -> trainCombatUnit(cityInfo)
|
||||
isAtWar && wartimeBuildings.isNotEmpty() -> currentConstruction = wartimeBuildings.getRandom().name
|
||||
workers<cities/2 -> currentConstruction = CityConstructions.Worker
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.unciv.logic.city
|
||||
|
||||
import com.unciv.UnCivGame
|
||||
import com.unciv.logic.map.BFS
|
||||
import com.unciv.logic.map.RoadStatus
|
||||
import com.unciv.models.gamebasics.Building
|
||||
@ -275,7 +276,14 @@ class CityStats {
|
||||
newStatPercentBonusList["Railroad"]=getStatPercentBonusesFromRailroad()
|
||||
newStatPercentBonusList["Marble"]=getStatPercentBonusesFromMarble()
|
||||
newStatPercentBonusList["Computers"]=getStatPercentBonusesFromComputers()
|
||||
newStatPercentBonusList["Difficutly"]=getStatPercentBonusesFromDifficulty()
|
||||
newStatPercentBonusList["Difficulty"]=getStatPercentBonusesFromDifficulty()
|
||||
|
||||
if(UnCivGame.Current.SuperchagedForDebug) {
|
||||
val stats = Stats()
|
||||
for(stat in Stat.values()) stats.add(stat,10000f)
|
||||
newStatPercentBonusList["Supercharged"] = stats
|
||||
}
|
||||
|
||||
statPercentBonusList=newStatPercentBonusList
|
||||
|
||||
val statPercentBonuses = Stats()
|
||||
@ -310,8 +318,8 @@ class CityStats {
|
||||
if (!newBaseStatList.containsKey("Policies")) newBaseStatList["Policies"] = Stats()
|
||||
newBaseStatList["Policies"]!!.food += getGrowthBonusFromPolicies() * excessFood
|
||||
|
||||
val buildingsMaintainance = cityInfo.cityConstructions.getMaintenanceCosts().toFloat() // this is AFTER the bonus calculation!
|
||||
newBaseStatList["Maintenance"] = Stats().apply { gold = -buildingsMaintainance }
|
||||
val buildingsMaintenance = cityInfo.cityConstructions.getMaintenanceCosts().toFloat() // this is AFTER the bonus calculation!
|
||||
newBaseStatList["Maintenance"] = Stats().apply { gold = -buildingsMaintenance }
|
||||
|
||||
baseStatList = newBaseStatList
|
||||
|
||||
|
@ -134,7 +134,7 @@ class CivilizationInfo {
|
||||
var unitsToPayFor = getCivUnits()
|
||||
if(policies.isAdopted("Oligarchy")) unitsToPayFor = unitsToPayFor.filterNot { it.getTile().isCityCenter() }
|
||||
val totalPaidUnits = max(0,unitsToPayFor.count()-freeUnits)
|
||||
val gameProgress = gameInfo.turns/400f // as game progresses maintainance cost rises
|
||||
val gameProgress = gameInfo.turns/400f // as game progresses Maintenance cost rises
|
||||
var cost = baseUnitCost*totalPaidUnits*(1+gameProgress)
|
||||
cost = cost.pow(1+gameProgress/3) // Why 3? To spread 1 to 1.33
|
||||
if(!isPlayerCivilization())
|
||||
|
@ -57,6 +57,9 @@ class MapUnit {
|
||||
&& civInfo.getBuildingUniques().contains("All military naval units receive +1 movement and +1 sight"))
|
||||
movement += 1
|
||||
|
||||
if(type.isWaterUnit() && civInfo.getNation().unique=="+2 movement for all naval units")
|
||||
movement+=2
|
||||
|
||||
return movement
|
||||
}
|
||||
|
||||
|
@ -42,40 +42,51 @@ class NewGameScreen: PickerScreen(){
|
||||
update()
|
||||
}
|
||||
|
||||
private fun getUniqueLabel(nation: Nation): CharSequence? {
|
||||
private fun getUniqueLabel(nation: Nation): String {
|
||||
val textList = ArrayList<String>()
|
||||
|
||||
if(nation.unique!=null) {
|
||||
textList += nation.unique!!
|
||||
textList += ""
|
||||
}
|
||||
|
||||
for (building in GameBasics.Buildings.values)
|
||||
if (building.uniqueTo == nation.name) {
|
||||
var text = building.name.tr() + " - {replaces} " + building.replaces!!.tr() + "\n"
|
||||
val originalBuilding = GameBasics.Buildings[building.replaces!!]!!
|
||||
|
||||
textList += building.name.tr() + " - {replaces} " + originalBuilding.name.tr()
|
||||
val originalBuildingStatMap = originalBuilding.toHashMap()
|
||||
for (stat in building.toHashMap())
|
||||
if (stat.value != originalBuildingStatMap[stat.key])
|
||||
text += stat.value.toInt().toString() + " " + stat.key + " vs " + originalBuildingStatMap[stat.key]!!.toInt() + "\n"
|
||||
textList += " "+stat.value.toInt() + " " + stat.key + " vs " + originalBuildingStatMap[stat.key]!!.toInt()
|
||||
for(unique in building.uniques.filter { it !in originalBuilding.uniques })
|
||||
text += unique.tr()+"\n"
|
||||
textList += " "+unique.tr()
|
||||
if (building.maintenance != originalBuilding.maintenance)
|
||||
text += "{Maintainance} " + building.maintenance + " vs " + originalBuilding.maintenance + "\n"
|
||||
return text.tr()
|
||||
textList += " {Maintenance} " + building.maintenance + " vs " + originalBuilding.maintenance
|
||||
textList+=""
|
||||
}
|
||||
|
||||
for (unit in GameBasics.Units.values)
|
||||
if (unit.uniqueTo == nation.name) {
|
||||
var text = unit.name.tr() + " - {replaces} " + unit.replaces!!.tr() + "\n"
|
||||
val originalUnit = GameBasics.Units[unit.replaces!!]!!
|
||||
|
||||
textList += unit.name.tr() + " - {replaces} " + originalUnit.name.tr()
|
||||
if (unit.strength != originalUnit.strength)
|
||||
text += "{Combat strength} " + unit.strength + " vs " + originalUnit.strength + "\n"
|
||||
textList += " {Combat strength} " + unit.strength + " vs " + originalUnit.strength
|
||||
if (unit.rangedStrength!= originalUnit.rangedStrength)
|
||||
text += "{Ranged strength} " + unit.rangedStrength+ " vs " + originalUnit.rangedStrength + "\n"
|
||||
textList+= " {Ranged strength} " + unit.rangedStrength+ " vs " + originalUnit.rangedStrength
|
||||
if (unit.range!= originalUnit.range)
|
||||
text += "{Range} " + unit.range+ " vs " + originalUnit.range + "\n"
|
||||
textList+= " {Range} " + unit.range+ " vs " + originalUnit.range
|
||||
if (unit.movement!= originalUnit.movement)
|
||||
text += "{Movement} " + unit.movement+ " vs " + originalUnit.movement + "\n"
|
||||
return text.tr()
|
||||
textList+= " {Movement} " + unit.movement+ " vs " + originalUnit.movement
|
||||
val newUniques = unit.uniques.filterNot { it in originalUnit.uniques }
|
||||
if(newUniques.isNotEmpty())
|
||||
textList+=" {Uniques}: "+newUniques.joinToString()
|
||||
textList+=""
|
||||
}
|
||||
|
||||
if(nation.unique!=null) return nation.unique
|
||||
|
||||
return ""
|
||||
return textList.joinToString("\n").tr().trim()
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user