Duantao/ai bonus (#1117)
* Ai bonus. * AI modifiers apply correctly. * AI initial units. * Use gameInfo.getDifficulty() instead of civInfo.getDifficulty(). * Minor fix.
This commit is contained in:
parent
ad07db9334
commit
38a28888ef
10 changed files with 120 additions and 37 deletions
|
@ -2,96 +2,160 @@
|
|||
{
|
||||
name:"Settler",
|
||||
baseHappiness:15,
|
||||
extraHappinessPerLuxury:1,
|
||||
researchCostModifier:0.9,
|
||||
unitCostModifier:0.5,
|
||||
buildingCostModifier:0.5,
|
||||
policyCostModifier:0.5,
|
||||
unhappinessModifier:0.4,
|
||||
aiCityGrowthModifier:1.6, // that is to say it'll take them 1.6 times as long to grow the city
|
||||
aiUnitCostModifier:1.75,
|
||||
aiBuildingCostModifier:1.6,
|
||||
aiWonderCostModifier:1.6,
|
||||
aiBuildingMaintenanceModifier:1,
|
||||
aiUnitMaintenanceModifier:1,
|
||||
aiYieldModifier:0.6, // Replaces "Construction rate" and "Create rate" in original config
|
||||
aiFreeTechs:[],
|
||||
aiFreeUnits:[],
|
||||
aiUnhappinessModifier:1,
|
||||
aisExchangeTechs:false
|
||||
},
|
||||
{
|
||||
name:"Chieftain",
|
||||
baseHappiness:12,
|
||||
extraHappinessPerLuxury:1,
|
||||
researchCostModifier:0.95,
|
||||
unitCostModifier:0.67,
|
||||
buildingCostModifier:0.67,
|
||||
policyCostModifier:0.67,
|
||||
unhappinessModifier:0.6,
|
||||
aiCityGrowthModifier:1.3,
|
||||
aiUnitCostModifier:1.3,
|
||||
aiBuildingCostModifier:1.3,
|
||||
aiWonderCostModifier:1.3,
|
||||
aiBuildingMaintenanceModifier:1,
|
||||
aiUnitMaintenanceModifier:1,
|
||||
aiYieldModifier:0.75,
|
||||
aiFreeTechs:[],
|
||||
aiFreeUnits:[],
|
||||
aiUnhappinessModifier:1,
|
||||
aisExchangeTechs:false
|
||||
},
|
||||
{
|
||||
name:"Warlord",
|
||||
baseHappiness:12,
|
||||
extraHappinessPerLuxury:0,
|
||||
researchCostModifier:1,
|
||||
unitCostModifier:0.85,
|
||||
buildingCostModifier:0.85,
|
||||
policyCostModifier:0.85,
|
||||
unhappinessModifier:0.75,
|
||||
aiCityGrowthModifier:1.1,
|
||||
aiUnitCostModifier:1.1,
|
||||
aiBuildingCostModifier:1.1,
|
||||
aiWonderCostModifier:1.1,
|
||||
aiBuildingMaintenanceModifier:1,
|
||||
aiUnitMaintenanceModifier:1,
|
||||
aiYieldModifier:0.9,
|
||||
aiFreeTechs:[],
|
||||
aiFreeUnits:[],
|
||||
aiUnhappinessModifier:1,
|
||||
aisExchangeTechs:false
|
||||
},
|
||||
{
|
||||
name:"Prince",
|
||||
baseHappiness:9,
|
||||
extraHappinessPerLuxury:0,
|
||||
researchCostModifier:1,
|
||||
unitCostModifier:1,
|
||||
buildingCostModifier:1,
|
||||
policyCostModifier:1,
|
||||
unhappinessModifier:1,
|
||||
aiCityGrowthModifier:1,
|
||||
aiUnitCostModifier:1,
|
||||
aiBuildingCostModifier:1,
|
||||
aiWonderCostModifier:1,
|
||||
aiBuildingMaintenanceModifier:1,
|
||||
aiUnitMaintenanceModifier:0.85,
|
||||
aiYieldModifier:1,
|
||||
aiFreeTechs:[],
|
||||
aiFreeUnits:[],
|
||||
aiUnhappinessModifier:1,
|
||||
aisExchangeTechs:true
|
||||
},
|
||||
{
|
||||
name:"King",
|
||||
baseHappiness:9,
|
||||
researchCostModifier:1.1,
|
||||
extraHappinessPerLuxury:0,
|
||||
researchCostModifier:1,
|
||||
unitCostModifier:1,
|
||||
buildingCostModifier:1,
|
||||
policyCostModifier:1,
|
||||
unhappinessModifier:1,
|
||||
aiCityGrowthModifier:0.9,
|
||||
aiUnitCostModifier:0.85,
|
||||
aiBuildingCostModifier:0.85,
|
||||
aiWonderCostModifier:1,
|
||||
aiBuildingMaintenanceModifier:0.85,
|
||||
aiUnitMaintenanceModifier:0.8,
|
||||
aiYieldModifier:1.15,
|
||||
aiFreeTechs:["Pottery"],
|
||||
aiFreeUnits:["Warrior"],
|
||||
aiUnhappinessModifier:0.9,
|
||||
aisExchangeTechs:true
|
||||
},
|
||||
{
|
||||
name:"Emperor",
|
||||
baseHappiness:9,
|
||||
researchCostModifier:1.2,
|
||||
extraHappinessPerLuxury:0,
|
||||
researchCostModifier:1,
|
||||
unitCostModifier:1,
|
||||
buildingCostModifier:1,
|
||||
policyCostModifier:1,
|
||||
unhappinessModifier:1,
|
||||
aiCityGrowthModifier:0.85,
|
||||
aiUnitCostModifier:0.8,
|
||||
aiBuildingCostModifier:0.8,
|
||||
aiWonderCostModifier:1,
|
||||
aiBuildingMaintenanceModifier:0.8,
|
||||
aiUnitMaintenanceModifier:0.75,
|
||||
aiYieldModifier:1.25,
|
||||
aiFreeTechs:["Pottery","Animal Husbandry"],
|
||||
aiFreeUnits:["Warrior", "Scout"],
|
||||
aiUnhappinessModifier:0.85,
|
||||
aisExchangeTechs:true
|
||||
},
|
||||
{
|
||||
name:"Immortal",
|
||||
baseHappiness:9,
|
||||
researchCostModifier:1.3,
|
||||
extraHappinessPerLuxury:0,
|
||||
researchCostModifier:1,
|
||||
unitCostModifier:1,
|
||||
buildingCostModifier:1,
|
||||
policyCostModifier:1,
|
||||
unhappinessModifier:1,
|
||||
aiCityGrowthModifier:0.75,
|
||||
aiUnitCostModifier:0.65,
|
||||
aiBuildingCostModifier:0.65,
|
||||
aiWonderCostModifier:1,
|
||||
aiBuildingMaintenanceModifier:0.65,
|
||||
aiUnitMaintenanceModifier:0.65,
|
||||
aiYieldModifier:1.5,
|
||||
aiFreeTechs:["Pottery","Animal Husbandry","Mining"],
|
||||
aiFreeUnits:["Warrior", "Warrior", "Worker", "Scout"],
|
||||
aiUnhappinessModifier:0.75,
|
||||
aisExchangeTechs:true
|
||||
},
|
||||
{
|
||||
name:"Deity",
|
||||
baseHappiness:9,
|
||||
researchCostModifier:1.5,
|
||||
extraHappinessPerLuxury:0,
|
||||
researchCostModifier:1,
|
||||
unitCostModifier:1,
|
||||
buildingCostModifier:1,
|
||||
policyCostModifier:1,
|
||||
unhappinessModifier:1,
|
||||
aiCityGrowthModifier:0.6,
|
||||
aiUnitCostModifier:0.5,
|
||||
aiBuildingCostModifier:0.5,
|
||||
aiWonderCostModifier:1,
|
||||
aiBuildingMaintenanceModifier:0.5,
|
||||
aiUnitMaintenanceModifier:0.5,
|
||||
aiYieldModifier:2,
|
||||
aiFreeTechs:["Pottery","Animal Husbandry","Mining","The Wheel"],
|
||||
aiFreeUnits:["Settler", "Warrior", "Warrior", "Worker", "Worker", "Scout"],
|
||||
aiUnhappinessModifier:0.6,
|
||||
aisExchangeTechs:true
|
||||
}
|
||||
|
|
|
@ -76,6 +76,12 @@ class GameStarter{
|
|||
civ.placeUnitNearTile(startingLocation.position, Constants.settler)
|
||||
civ.placeUnitNearTile(startingLocation.position, "Warrior")
|
||||
civ.placeUnitNearTile(startingLocation.position, "Scout")
|
||||
|
||||
if (!civ.isPlayerCivilization()) {
|
||||
for (unit in gameInfo.getDifficulty().aiFreeUnits) {
|
||||
civ.placeUnitNearTile(startingLocation.position, unit)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return gameInfo
|
||||
|
|
|
@ -59,9 +59,10 @@ class CityConstructions {
|
|||
|
||||
fun getCityProductionTextForCityButton(): String {
|
||||
val currentConstructionSnapshot = currentConstruction // See below
|
||||
var result = currentConstructionSnapshot .tr()
|
||||
var result = currentConstructionSnapshot.tr()
|
||||
if (currentConstructionSnapshot!=""
|
||||
&& SpecialConstruction.getSpecialConstructions().none { it.name==currentConstructionSnapshot })
|
||||
result += ("\r\nCost " + getConstruction(currentConstruction).getProductionCost(cityInfo.civInfo).toString()).tr()
|
||||
result += "\r\n" + turnsToConstruction(currentConstructionSnapshot ) + " {turns}".tr()
|
||||
return result
|
||||
}
|
||||
|
|
|
@ -107,22 +107,6 @@ class CityStats {
|
|||
return stats
|
||||
}
|
||||
|
||||
private fun getStatPercentBonusesFromDifficulty(): Stats {
|
||||
val stats = Stats()
|
||||
|
||||
val civ = cityInfo.civInfo
|
||||
if (!civ.isPlayerCivilization()) {
|
||||
val modifier = civ.gameInfo.getCurrentPlayerCivilization().getDifficulty().aiYieldModifier
|
||||
stats.production += modifier
|
||||
stats.science += modifier
|
||||
stats.food += modifier
|
||||
stats.gold += modifier
|
||||
stats.culture += modifier
|
||||
}
|
||||
|
||||
return stats
|
||||
}
|
||||
|
||||
private fun getStatsFromNationUnique(): Stats {
|
||||
val stats = Stats()
|
||||
|
||||
|
@ -392,7 +376,6 @@ class CityStats {
|
|||
newStatPercentBonusList["Railroad"]=getStatPercentBonusesFromRailroad()
|
||||
newStatPercentBonusList["Marble"]=getStatPercentBonusesFromMarble()
|
||||
newStatPercentBonusList["Computers"]=getStatPercentBonusesFromComputers()
|
||||
newStatPercentBonusList["Difficulty"]=getStatPercentBonusesFromDifficulty()
|
||||
newStatPercentBonusList["National ability"]=getStatPercentBonusesFromNationUnique()
|
||||
newStatPercentBonusList["Puppet City"]=getStatPercentBonusesFromPuppetCity()
|
||||
|
||||
|
@ -470,8 +453,11 @@ class CityStats {
|
|||
newFinalStatList["Policies"]!!.food += foodFromGrowthBonuses
|
||||
|
||||
// Same here - will have a different UI display.
|
||||
val buildingsMaintenance = cityInfo.cityConstructions.getMaintenanceCosts() // this is AFTER the bonus calculation!
|
||||
newFinalStatList["Maintenance"] = Stats().apply { gold -= buildingsMaintenance }
|
||||
var buildingsMaintenance = cityInfo.cityConstructions.getMaintenanceCosts().toFloat() // this is AFTER the bonus calculation!
|
||||
if (!cityInfo.civInfo.isPlayerCivilization()) {
|
||||
buildingsMaintenance *= cityInfo.civInfo.gameInfo.getDifficulty().aiBuildingMaintenanceModifier
|
||||
}
|
||||
newFinalStatList["Maintenance"] = Stats().apply { gold -= buildingsMaintenance.toInt() }
|
||||
|
||||
if (cityInfo.resistanceCounter > 0)
|
||||
newFinalStatList.clear() // NOPE
|
||||
|
|
|
@ -101,7 +101,7 @@ class CivInfoStats(val civInfo: CivilizationInfo){
|
|||
val statMap = HashMap<String, Float>()
|
||||
statMap["Base happiness"] = civInfo.getDifficulty().baseHappiness.toFloat()
|
||||
|
||||
var happinessPerUniqueLuxury = 5f
|
||||
var happinessPerUniqueLuxury = 5f + civInfo.getDifficulty().extraHappinessPerLuxury
|
||||
if (civInfo.policies.isAdopted("Protectionism")) happinessPerUniqueLuxury += 1
|
||||
statMap["Luxury resources"]= civInfo.getCivResources().map { it.resource }
|
||||
.count { it.resourceType === ResourceType.Luxury } * happinessPerUniqueLuxury
|
||||
|
|
|
@ -31,6 +31,8 @@ class PolicyManager {
|
|||
if (isAdopted("Piety Complete")) policyCultureCost *= 0.9
|
||||
if (civInfo.containsBuildingUnique("Culture cost of adopting new Policies reduced by 10%"))
|
||||
policyCultureCost *= 0.9
|
||||
if (civInfo.isPlayerCivilization())
|
||||
policyCultureCost *= civInfo.getDifficulty().policyCostModifier
|
||||
policyCultureCost *= civInfo.gameInfo.gameParameters.gameSpeed.getModifier()
|
||||
val cost: Int = (policyCultureCost * (1 + cityModifier)).roundToInt()
|
||||
return cost - (cost % 5)
|
||||
|
|
|
@ -42,7 +42,8 @@ class TechManager {
|
|||
|
||||
fun costOfTech(techName: String): Int {
|
||||
var techCost = GameBasics.Technologies[techName]!!.cost.toFloat()
|
||||
techCost *= civInfo.getDifficulty().researchCostModifier
|
||||
if (civInfo.isPlayerCivilization())
|
||||
techCost *= civInfo.getDifficulty().researchCostModifier
|
||||
techCost *= civInfo.gameInfo.gameParameters.gameSpeed.getModifier()
|
||||
techCost *= 1 + (civInfo.cities.size -1 ) * 0.02f // each city increases tech cost by 2%, as per https://civilization.fandom.com/wiki/Science_(Civ5)
|
||||
return techCost.toInt()
|
||||
|
|
|
@ -192,6 +192,17 @@ class Building : NamedStats(), IConstruction{
|
|||
var productionCost = cost.toFloat()
|
||||
if (!isWonder && culture != 0f && civInfo.policies.isAdopted("Piety"))
|
||||
productionCost *= 0.85f
|
||||
if (civInfo.isPlayerCivilization()) {
|
||||
if(!isWonder) {
|
||||
productionCost *= civInfo.getDifficulty().buildingCostModifier
|
||||
}
|
||||
} else {
|
||||
if(isWonder) {
|
||||
productionCost *= civInfo.gameInfo.getDifficulty().aiWonderCostModifier
|
||||
} else {
|
||||
productionCost *= civInfo.gameInfo.getDifficulty().aiBuildingCostModifier
|
||||
}
|
||||
}
|
||||
productionCost *= civInfo.gameInfo.gameParameters.gameSpeed.getModifier()
|
||||
return productionCost.toInt()
|
||||
}
|
||||
|
|
|
@ -6,12 +6,20 @@ import java.util.*
|
|||
class Difficulty: INamed {
|
||||
override lateinit var name: String
|
||||
var baseHappiness: Int = 0
|
||||
var extraHappinessPerLuxury: Float = 0f
|
||||
var researchCostModifier:Float = 1f
|
||||
var unhappinessModifier = 1f
|
||||
var aiCityGrowthModifier = 1f
|
||||
var unitCostModifier:Float = 1f
|
||||
var buildingCostModifier:Float = 1f
|
||||
var policyCostModifier:Float = 1f
|
||||
var unhappinessModifier:Float = 1f
|
||||
var aiCityGrowthModifier:Float = 1f
|
||||
var aiUnitCostModifier:Float = 1f
|
||||
var aiBuildingCostModifier:Float = 1f
|
||||
var aiWonderCostModifier:Float = 1f
|
||||
var aiBuildingMaintenanceModifier:Float = 1f
|
||||
var aiUnitMaintenanceModifier = 1f
|
||||
var aiYieldModifier = 1f
|
||||
var aiFreeTechs = ArrayList<String>()
|
||||
var aiFreeUnits = ArrayList<String>()
|
||||
var aiUnhappinessModifier = 1f
|
||||
var aisExchangeTechs = false
|
||||
}
|
|
@ -99,6 +99,10 @@ class BaseUnit : INamed, IConstruction, ICivilopedia {
|
|||
|
||||
override fun getProductionCost(civInfo: CivilizationInfo): Int {
|
||||
var productionCost = cost.toFloat()
|
||||
if (civInfo.isPlayerCivilization())
|
||||
productionCost *= civInfo.getDifficulty().unitCostModifier
|
||||
else
|
||||
productionCost *= civInfo.gameInfo.getDifficulty().aiUnitCostModifier
|
||||
productionCost *= civInfo.gameInfo.gameParameters.gameSpeed.getModifier()
|
||||
return productionCost.toInt()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue