mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 14:24:43 -04:00
Merge pull request #658 from ninjatao/AI_parameter
Adjust AI parameters.
This commit is contained in:
commit
9dabbb7946
@ -94,7 +94,7 @@ class Automation {
|
|||||||
.minBy{ it.cost }
|
.minBy{ it.cost }
|
||||||
if (foodBuilding!=null) {
|
if (foodBuilding!=null) {
|
||||||
val choice = ConstructionChoice(foodBuilding.name,1f)
|
val choice = ConstructionChoice(foodBuilding.name,1f)
|
||||||
if (cityInfo.population.population < foodBuilding.food + 5) choice.choiceModifier=2f
|
if (cityInfo.population.population < 5) choice.choiceModifier=1.3f
|
||||||
relativeCostEffectiveness.add(choice)
|
relativeCostEffectiveness.add(choice)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,12 +147,12 @@ class Automation {
|
|||||||
//other buildings
|
//other buildings
|
||||||
val other = buildableNotWonders.minBy{it.cost}
|
val other = buildableNotWonders.minBy{it.cost}
|
||||||
if (other!=null) {
|
if (other!=null) {
|
||||||
relativeCostEffectiveness.add(ConstructionChoice(other.name,1.2f))
|
relativeCostEffectiveness.add(ConstructionChoice(other.name,0.8f))
|
||||||
}
|
}
|
||||||
|
|
||||||
//worker
|
//worker
|
||||||
if (workers < cities) {
|
if (workers < cities) {
|
||||||
relativeCostEffectiveness.add(ConstructionChoice(CityConstructions.Worker,workers/(cities+1)))
|
relativeCostEffectiveness.add(ConstructionChoice(CityConstructions.Worker,cities.toFloat()/(workers+0.1f)))
|
||||||
}
|
}
|
||||||
|
|
||||||
//Work boat
|
//Work boat
|
||||||
@ -162,11 +162,11 @@ class Automation {
|
|||||||
|
|
||||||
//Army
|
//Army
|
||||||
val militaryUnit = chooseMilitaryUnit(cityInfo)
|
val militaryUnit = chooseMilitaryUnit(cityInfo)
|
||||||
val unitsToCitiesRatio = militaryUnits / cities.toFloat()
|
val unitsToCitiesRatio = cities.toFloat() / (militaryUnits + 1)
|
||||||
// most buildings and civ units contribute the the civ's growth, military units are anti-growth
|
// most buildings and civ units contribute the the civ's growth, military units are anti-growth
|
||||||
val militaryChoice = ConstructionChoice(militaryUnit,unitsToCitiesRatio/5)
|
val militaryChoice = ConstructionChoice(militaryUnit,unitsToCitiesRatio/2)
|
||||||
if (isAtWar) {
|
if (isAtWar) {
|
||||||
militaryChoice.choiceModifier=unitsToCitiesRatio
|
militaryChoice.choiceModifier=unitsToCitiesRatio*2
|
||||||
}
|
}
|
||||||
relativeCostEffectiveness.add(militaryChoice)
|
relativeCostEffectiveness.add(militaryChoice)
|
||||||
|
|
||||||
|
@ -181,8 +181,8 @@ class NextTurnAutomation{
|
|||||||
private fun declareWar(civInfo: CivilizationInfo) {
|
private fun declareWar(civInfo: CivilizationInfo) {
|
||||||
if (civInfo.cities.isNotEmpty() && civInfo.diplomacy.isNotEmpty()) {
|
if (civInfo.cities.isNotEmpty() && civInfo.diplomacy.isNotEmpty()) {
|
||||||
val ourMilitaryUnits = civInfo.getCivUnits().filter { !it.type.isCivilian() }.size
|
val ourMilitaryUnits = civInfo.getCivUnits().filter { !it.type.isCivilian() }.size
|
||||||
if (!civInfo.isAtWar() && civInfo.happiness > 5
|
if (!civInfo.isAtWar() && civInfo.happiness > 0
|
||||||
&& ourMilitaryUnits >= civInfo.cities.size * 2) { //evaluate war
|
&& ourMilitaryUnits >= civInfo.cities.size) { //evaluate war
|
||||||
val ourCombatStrength = Automation().evaluteCombatStrength(civInfo)
|
val ourCombatStrength = Automation().evaluteCombatStrength(civInfo)
|
||||||
val enemyCivsByDistanceToOurs = civInfo.diplomacy.values.map { it.otherCiv() }
|
val enemyCivsByDistanceToOurs = civInfo.diplomacy.values.map { it.otherCiv() }
|
||||||
.filterNot { it == civInfo || it.cities.isEmpty() || !civInfo.diplomacy[it.civName]!!.canDeclareWar() }
|
.filterNot { it == civInfo || it.cities.isEmpty() || !civInfo.diplomacy[it.civName]!!.canDeclareWar() }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user