mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-19 03:05:59 +07:00
Minor improvements from GPC
This commit is contained in:
parent
6bbab8a394
commit
8a6b4de84f
@ -212,7 +212,8 @@ class WorkerAutomation(
|
|||||||
}
|
}
|
||||||
while (true) {
|
while (true) {
|
||||||
for (cityTile in cityTilesToSeek) {
|
for (cityTile in cityTilesToSeek) {
|
||||||
if (bfs.hasReachedTile(cityTile)) { // we have a winner!
|
if (!bfs.hasReachedTile(cityTile)) continue
|
||||||
|
// we have a winner!
|
||||||
val pathToCity = bfs.getPathTo(cityTile)
|
val pathToCity = bfs.getPathTo(cityTile)
|
||||||
val roadableTiles = pathToCity.filter { it.roadStatus < bestRoadAvailable }
|
val roadableTiles = pathToCity.filter { it.roadStatus < bestRoadAvailable }
|
||||||
val tileToConstructRoadOn: TileInfo
|
val tileToConstructRoadOn: TileInfo
|
||||||
@ -239,7 +240,6 @@ class WorkerAutomation(
|
|||||||
println("WorkerAutomation: ${unit.label()} -> connect city ${bfs.startingPoint.getCity()?.name} to ${cityTile.getCity()!!.name} on $tileToConstructRoadOn")
|
println("WorkerAutomation: ${unit.label()} -> connect city ${bfs.startingPoint.getCity()?.name} to ${cityTile.getCity()!!.name} on $tileToConstructRoadOn")
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (bfs.hasEnded()) break
|
if (bfs.hasEnded()) break
|
||||||
bfs.nextStep()
|
bfs.nextStep()
|
||||||
}
|
}
|
||||||
|
@ -349,7 +349,7 @@ class CityStateFunctions(val civInfo: CivilizationInfo) {
|
|||||||
if (!requireWholeList && modifiers.values.sum() < -100)
|
if (!requireWholeList && modifiers.values.sum() < -100)
|
||||||
return modifiers
|
return modifiers
|
||||||
|
|
||||||
val bullyRange = max(5, civInfo.gameInfo.tileMap.tileMatrix.size / 10) // Longer range for larger maps
|
val bullyRange = (civInfo.gameInfo.tileMap.tileMatrix.size / 10).coerceIn(5, 10) // Longer range for larger maps
|
||||||
val inRangeTiles = civInfo.getCapital().getCenterTile().getTilesInDistanceRange(1..bullyRange)
|
val inRangeTiles = civInfo.getCapital().getCenterTile().getTilesInDistanceRange(1..bullyRange)
|
||||||
val forceNearCity = inRangeTiles
|
val forceNearCity = inRangeTiles
|
||||||
.sumOf { if (it.militaryUnit?.civInfo == demandingCiv)
|
.sumOf { if (it.militaryUnit?.civInfo == demandingCiv)
|
||||||
|
@ -168,11 +168,11 @@ class DiplomacyManager() {
|
|||||||
return otherCiv().getDiplomacyManager(civInfo).relationshipLevel()
|
return otherCiv().getDiplomacyManager(civInfo).relationshipLevel()
|
||||||
|
|
||||||
if (civInfo.isCityState()) return when {
|
if (civInfo.isCityState()) return when {
|
||||||
|
influence >= 60 && civInfo.getAllyCiv() == otherCivName -> RelationshipLevel.Ally
|
||||||
|
influence >= 30 -> RelationshipLevel.Friend
|
||||||
influence <= -30 || civInfo.isAtWarWith(otherCiv()) -> RelationshipLevel.Unforgivable
|
influence <= -30 || civInfo.isAtWarWith(otherCiv()) -> RelationshipLevel.Unforgivable
|
||||||
influence < 30 && civInfo.getTributeWillingness(otherCiv()) > 0 -> RelationshipLevel.Afraid
|
influence < 30 && civInfo.getTributeWillingness(otherCiv()) > 0 -> RelationshipLevel.Afraid
|
||||||
influence < 0 -> RelationshipLevel.Enemy
|
influence < 0 -> RelationshipLevel.Enemy
|
||||||
influence >= 60 && civInfo.getAllyCiv() == otherCivName -> RelationshipLevel.Ally
|
|
||||||
influence >= 30 -> RelationshipLevel.Friend
|
|
||||||
else -> RelationshipLevel.Neutral
|
else -> RelationshipLevel.Neutral
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user