mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-30 09:31:25 +07:00
Rename isPlayerCivilization -> isHuman
This commit is contained in:
parent
7bc924f76f
commit
ba7a9708e2
@ -259,7 +259,7 @@ class GameInfo : IsPartOfGameInfoSerialization, HasGameInfoSerializationVersion
|
||||
//check is important or else switchTurn
|
||||
//would skip a turn if an AI civ calls nextTurn
|
||||
//this happens when resigning a multiplayer game
|
||||
if (thisPlayer.isPlayerCivilization()) {
|
||||
if (thisPlayer.isHuman()) {
|
||||
endTurn()
|
||||
}
|
||||
|
||||
@ -483,7 +483,7 @@ class GameInfo : IsPartOfGameInfoSerialization, HasGameInfoSerializationVersion
|
||||
|
||||
tileMap.setTransients(ruleSet)
|
||||
|
||||
if (currentPlayer == "") currentPlayer = civilizations.first { it.isPlayerCivilization() }.civName
|
||||
if (currentPlayer == "") currentPlayer = civilizations.first { it.isHuman() }.civName
|
||||
currentPlayerCiv = getCivilization(currentPlayer)
|
||||
|
||||
difficultyObject = ruleSet.difficulties[difficulty]!!
|
||||
|
@ -157,7 +157,7 @@ object GameStarter {
|
||||
private fun addCivTechs(gameInfo: GameInfo, ruleset: Ruleset, gameSetupInfo: GameSetupInfo) {
|
||||
for (civInfo in gameInfo.civilizations.filter { !it.isBarbarian() }) {
|
||||
|
||||
if (!civInfo.isPlayerCivilization())
|
||||
if (!civInfo.isHuman())
|
||||
for (tech in gameInfo.getDifficulty().aiFreeTechs)
|
||||
civInfo.tech.addTechnology(tech)
|
||||
|
||||
@ -330,7 +330,7 @@ object GameStarter {
|
||||
|
||||
// Add extra units granted by difficulty
|
||||
startingUnits.addAll(when {
|
||||
civ.isPlayerCivilization() -> gameInfo.getDifficulty().playerBonusStartingUnits
|
||||
civ.isHuman() -> gameInfo.getDifficulty().playerBonusStartingUnits
|
||||
civ.isMajorCiv() -> gameInfo.getDifficulty().aiMajorCivBonusStartingUnits
|
||||
else -> gameInfo.getDifficulty().aiCityStateBonusStartingUnits
|
||||
})
|
||||
|
@ -48,7 +48,7 @@ class WorkerAutomation(
|
||||
private val bestRoadAvailable: RoadStatus =
|
||||
cloningSource?.bestRoadAvailable ?:
|
||||
//Player can choose not to auto-build roads & railroads.
|
||||
if (civInfo.isPlayerCivilization() && !UncivGame.Current.settings.autoBuildingRoads)
|
||||
if (civInfo.isHuman() && !UncivGame.Current.settings.autoBuildingRoads)
|
||||
RoadStatus.None
|
||||
else civInfo.tech.getBestRoadAvailable()
|
||||
|
||||
@ -320,7 +320,7 @@ class WorkerAutomation(
|
||||
val junkImprovement = tile.getTileImprovement()?.hasUnique(UniqueType.AutomatedWorkersWillReplace)
|
||||
if (tile.improvement != null && junkImprovement == false
|
||||
&& !UncivGame.Current.settings.automatedWorkersReplaceImprovements
|
||||
&& unit.civInfo.isPlayerCivilization())
|
||||
&& unit.civInfo.isHuman())
|
||||
return false
|
||||
|
||||
|
||||
@ -399,7 +399,7 @@ class WorkerAutomation(
|
||||
|
||||
// Defence is more important that civilian improvements
|
||||
// While AI sucks in strategical placement of forts, allow a human does it manually
|
||||
!civInfo.isPlayerCivilization() && evaluateFortPlacement(tile, civInfo,false) -> Constants.fort
|
||||
!civInfo.isHuman() && evaluateFortPlacement(tile, civInfo,false) -> Constants.fort
|
||||
// I think we can assume that the unique improvement is better
|
||||
uniqueImprovement != null && tile.canBuildImprovement(uniqueImprovement, civInfo)
|
||||
-> uniqueImprovement.name
|
||||
|
@ -548,7 +548,7 @@ object Battle {
|
||||
// retaking old capital
|
||||
city.puppetCity(attackerCiv)
|
||||
city.annexCity()
|
||||
} else if (attackerCiv.isPlayerCivilization()) {
|
||||
} else if (attackerCiv.isHuman()) {
|
||||
// we're not taking our former capital
|
||||
attackerCiv.popupAlerts.add(PopupAlert(AlertType.CityConquered, city.id))
|
||||
} else {
|
||||
|
@ -588,7 +588,7 @@ class CityConstructions : IsPartOfGameInfoSerialization {
|
||||
val isCurrentPlayersTurn = cityInfo.civInfo.gameInfo.isUsersTurn()
|
||||
|| !cityInfo.civInfo.gameInfo.gameParameters.isOnlineMultiplayer
|
||||
if ((UncivGame.Current.settings.autoAssignCityProduction && isCurrentPlayersTurn) // only automate if the active human player has the setting to automate production
|
||||
|| !cityInfo.civInfo.isPlayerCivilization() || cityInfo.isPuppet) {
|
||||
|| !cityInfo.civInfo.isHuman() || cityInfo.isPuppet) {
|
||||
ConstructionAutomation(this).chooseNextConstruction()
|
||||
}
|
||||
|
||||
|
@ -337,7 +337,7 @@ class CityStats(val cityInfo: CityInfo) {
|
||||
private fun getBuildingMaintenanceCosts(): Float {
|
||||
// Same here - will have a different UI display.
|
||||
var buildingsMaintenance = cityInfo.cityConstructions.getMaintenanceCosts().toFloat() // this is AFTER the bonus calculation!
|
||||
if (!cityInfo.civInfo.isPlayerCivilization()) {
|
||||
if (!cityInfo.civInfo.isHuman()) {
|
||||
buildingsMaintenance *= cityInfo.civInfo.gameInfo.getDifficulty().aiBuildingMaintenanceModifier
|
||||
}
|
||||
|
||||
@ -376,7 +376,7 @@ class CityStats(val cityInfo: CityInfo) {
|
||||
val civInfo = cityInfo.civInfo
|
||||
val newHappinessList = LinkedHashMap<String, Float>()
|
||||
var unhappinessModifier = civInfo.getDifficulty().unhappinessModifier
|
||||
if (!civInfo.isPlayerCivilization())
|
||||
if (!civInfo.isHuman())
|
||||
unhappinessModifier *= civInfo.gameInfo.getDifficulty().aiUnhappinessModifier
|
||||
|
||||
var unhappinessFromCity = -3f // -3 happiness per city
|
||||
|
@ -48,7 +48,7 @@ class PopulationManager : IsPartOfGameInfoSerialization {
|
||||
var foodRequired = 15 + 6 * (population - 1) + floor((population - 1).toDouble().pow(1.8))
|
||||
if (cityInfo.civInfo.isCityState())
|
||||
foodRequired *= 1.5f
|
||||
if (!cityInfo.civInfo.isPlayerCivilization())
|
||||
if (!cityInfo.civInfo.isHuman())
|
||||
foodRequired *= cityInfo.civInfo.gameInfo.getDifficulty().aiCityGrowthModifier
|
||||
return foodRequired.toInt()
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ class CivInfoStats(val civInfo: CivilizationInfo) {
|
||||
var cost = baseUnitCost * numberOfUnitsToPayFor * (1 + gameProgress)
|
||||
cost = cost.pow(1 + gameProgress / 3) // Why 3? To spread 1 to 1.33
|
||||
|
||||
if (!civInfo.isPlayerCivilization())
|
||||
if (!civInfo.isHuman())
|
||||
cost *= civInfo.gameInfo.getDifficulty().aiUnitMaintenanceModifier
|
||||
|
||||
return cost.toInt()
|
||||
|
@ -313,7 +313,7 @@ class CivilizationInfo : IsPartOfGameInfoSerialization {
|
||||
|
||||
//region pure functions
|
||||
fun getDifficulty(): Difficulty {
|
||||
if (isPlayerCivilization()) return gameInfo.getDifficulty()
|
||||
if (isHuman()) return gameInfo.getDifficulty()
|
||||
// TODO We should be able to mark a difficulty as 'default AI difficulty' somehow
|
||||
val chieftainDifficulty = gameInfo.ruleSet.difficulties["Chieftain"]
|
||||
if (chieftainDifficulty != null) return chieftainDifficulty
|
||||
@ -347,7 +347,7 @@ class CivilizationInfo : IsPartOfGameInfoSerialization {
|
||||
.thenBy (UncivGame.Current.settings.getCollatorFromLocale()) { it.civName.tr() }
|
||||
)
|
||||
fun getCapital() = cities.firstOrNull { it.isCapital() }
|
||||
fun isPlayerCivilization() = playerType == PlayerType.Human
|
||||
fun isHuman() = playerType == PlayerType.Human
|
||||
fun isOneCityChallenger() = (
|
||||
playerType == PlayerType.Human &&
|
||||
gameInfo.gameParameters.oneCityChallenge)
|
||||
@ -1234,7 +1234,7 @@ class CivilizationInfo : IsPartOfGameInfoSerialization {
|
||||
if (diplomacyManager != null && (diplomacyManager.hasOpenBorders || diplomacyManager.diplomaticStatus == DiplomaticStatus.War))
|
||||
return true
|
||||
// Players can always pass through city-state tiles
|
||||
if (isPlayerCivilization() && otherCiv.isCityState()) return true
|
||||
if (isHuman() && otherCiv.isCityState()) return true
|
||||
return false
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ class PolicyManager : IsPartOfGameInfoSerialization {
|
||||
|
||||
for (unique in civInfo.getMatchingUniques(UniqueType.LessPolicyCostFromCities)) cityModifier *= 1 - unique.params[0].toFloat() / 100
|
||||
for (unique in civInfo.getMatchingUniques(UniqueType.LessPolicyCost)) policyCultureCost *= unique.params[0].toPercent()
|
||||
if (civInfo.isPlayerCivilization()) policyCultureCost *= civInfo.getDifficulty().policyCostModifier
|
||||
if (civInfo.isHuman()) policyCultureCost *= civInfo.getDifficulty().policyCostModifier
|
||||
policyCultureCost *= civInfo.gameInfo.speed.cultureCostModifier
|
||||
val cost: Int = (policyCultureCost * (1 + cityModifier)).roundToInt()
|
||||
return cost - (cost % 5)
|
||||
|
@ -85,7 +85,7 @@ class TechManager : IsPartOfGameInfoSerialization {
|
||||
|
||||
fun costOfTech(techName: String): Int {
|
||||
var techCost = getRuleset().technologies[techName]!!.cost.toFloat()
|
||||
if (civInfo.isPlayerCivilization())
|
||||
if (civInfo.isHuman())
|
||||
techCost *= civInfo.getDifficulty().researchCostModifier
|
||||
techCost *= civInfo.gameInfo.speed.scienceCostModifier
|
||||
val techsResearchedKnownCivs = civInfo.getKnownCivs()
|
||||
@ -332,7 +332,7 @@ class TechManager : IsPartOfGameInfoSerialization {
|
||||
for (policyBranch in getRuleset().policyBranches.values.filter { it.era == currentEra.name && civInfo.policies.isAdoptable(it) }) {
|
||||
civInfo.addNotification("[" + policyBranch.name + "] policy branch unlocked!", NotificationIcon.Culture)
|
||||
}
|
||||
|
||||
|
||||
val erasPassed = getRuleset().eras.values
|
||||
.filter { it.eraNumber > previousEra.eraNumber && it.eraNumber <= currentEra.eraNumber }
|
||||
.sortedBy { it.eraNumber }
|
||||
|
@ -165,10 +165,10 @@ class DiplomacyManager() : IsPartOfGameInfoSerialization {
|
||||
}
|
||||
|
||||
fun relationshipLevel(): RelationshipLevel {
|
||||
if (civInfo.isPlayerCivilization() && otherCiv().isPlayerCivilization())
|
||||
if (civInfo.isHuman() && otherCiv().isHuman())
|
||||
return RelationshipLevel.Neutral // People make their own choices.
|
||||
|
||||
if (civInfo.isPlayerCivilization())
|
||||
if (civInfo.isHuman())
|
||||
return otherCiv().getDiplomacyManager(civInfo).relationshipLevel()
|
||||
|
||||
if (civInfo.isCityState()) return when {
|
||||
|
@ -809,7 +809,7 @@ class PathfindingCache(private val unit: MapUnit) {
|
||||
private fun isValid(): Boolean = (movement == unit.currentMovement) && (unit.getTile() == currentTile)
|
||||
|
||||
fun getShortestPathCache(destination: TileInfo): List<TileInfo> {
|
||||
if (unit.civInfo.isPlayerCivilization()) return listOf()
|
||||
if (unit.civInfo.isHuman()) return listOf()
|
||||
if (isValid() && this.destination == destination) {
|
||||
return shortestPathCache
|
||||
}
|
||||
@ -817,7 +817,7 @@ class PathfindingCache(private val unit: MapUnit) {
|
||||
}
|
||||
|
||||
fun setShortestPathCache(destination: TileInfo, newShortestPath: List<TileInfo>) {
|
||||
if (unit.civInfo.isPlayerCivilization()) return
|
||||
if (unit.civInfo.isHuman()) return
|
||||
if (isValid()) {
|
||||
shortestPathCache = newShortestPath
|
||||
this.destination = destination
|
||||
@ -825,14 +825,14 @@ class PathfindingCache(private val unit: MapUnit) {
|
||||
}
|
||||
|
||||
fun getDistanceToTiles(zoneOfControl: Boolean): PathsToTilesWithinTurn? {
|
||||
if (unit.civInfo.isPlayerCivilization()) return null
|
||||
if (unit.civInfo.isHuman()) return null
|
||||
if (isValid())
|
||||
return distanceToTilesCache[zoneOfControl]
|
||||
return null
|
||||
}
|
||||
|
||||
fun setDistanceToTiles(zoneOfControl: Boolean, paths: PathsToTilesWithinTurn) {
|
||||
if (unit.civInfo.isPlayerCivilization()) return
|
||||
if (unit.civInfo.isHuman()) return
|
||||
if (!isValid()) {
|
||||
clear() // we want to reset the entire cache at this point
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ class TradeLogic(val ourCivilization:CivilizationInfo, val otherCivilization: Ci
|
||||
city.getCenterTile().getUnits().toList().forEach { it.movement.teleportToClosestMoveableTile() }
|
||||
for (tile in city.getTiles()) {
|
||||
for (unit in tile.getUnits().toList()) {
|
||||
if (!unit.civInfo.canPassThroughTiles(to) && !unit.canEnterForeignTerrain)
|
||||
if (!unit.civInfo.canPassThroughTiles(to) && !unit.canEnterForeignTerrain)
|
||||
unit.movement.teleportToClosestMoveableTile()
|
||||
}
|
||||
}
|
||||
@ -106,7 +106,7 @@ class TradeLogic(val ourCivilization:CivilizationInfo, val otherCivilization: Ci
|
||||
from.updateViewableTiles()
|
||||
|
||||
// suggest an option to liberate the city
|
||||
if (to.isPlayerCivilization()
|
||||
if (to.isHuman()
|
||||
&& city.foundingCiv != ""
|
||||
&& from.civName != city.foundingCiv // can't liberate if the city actually belongs to those guys
|
||||
&& to.civName != city.foundingCiv) // can't liberate if it's our city
|
||||
@ -133,4 +133,4 @@ class TradeLogic(val ourCivilization:CivilizationInfo, val otherCivilization: Ci
|
||||
transferTrade(ourCivilization, otherCivilization, currentTrade)
|
||||
transferTrade(otherCivilization, ourCivilization, currentTrade.reverse())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -340,7 +340,7 @@ class Building : RulesetStatsObject(), INonPerpetualConstruction {
|
||||
|
||||
if (civInfo.isCityState())
|
||||
productionCost *= 1.5f
|
||||
if (civInfo.isPlayerCivilization()) {
|
||||
if (civInfo.isHuman()) {
|
||||
if (!isWonder)
|
||||
productionCost *= civInfo.getDifficulty().buildingCostModifier
|
||||
} else {
|
||||
|
@ -174,7 +174,7 @@ object UniqueTriggerActivation {
|
||||
val greatPeople = civInfo.getGreatPeople()
|
||||
if (unique.type == MayanGainGreatPerson && civInfo.greatPeople.longCountGPPool.isEmpty())
|
||||
civInfo.greatPeople.longCountGPPool = greatPeople.map { it.name }.toHashSet()
|
||||
if (civInfo.isPlayerCivilization()) {
|
||||
if (civInfo.isHuman()) {
|
||||
civInfo.greatPeople.freeGreatPeople++
|
||||
// Anyone an idea for a good icon?
|
||||
if (unique.type == MayanGainGreatPerson) {
|
||||
|
@ -251,7 +251,7 @@ class BaseUnit : RulesetObject(), INonPerpetualConstruction {
|
||||
var productionCost = cost.toFloat()
|
||||
if (civInfo.isCityState())
|
||||
productionCost *= 1.5f
|
||||
productionCost *= if (civInfo.isPlayerCivilization())
|
||||
productionCost *= if (civInfo.isHuman())
|
||||
civInfo.getDifficulty().unitCostModifier
|
||||
else
|
||||
civInfo.gameInfo.getDifficulty().aiUnitCostModifier
|
||||
|
@ -694,7 +694,7 @@ class DiplomacyScreen(
|
||||
if (otherCiv.cities.isNotEmpty() && otherCiv.getCapital() != null && viewingCiv.hasExplored(otherCiv.getCapital()!!.location))
|
||||
diplomacyTable.add(getGoToOnMapButton(otherCiv)).row()
|
||||
|
||||
if (!otherCiv.isPlayerCivilization()) { // human players make their own choices
|
||||
if (!otherCiv.isHuman()) { // human players make their own choices
|
||||
diplomacyTable.add(getRelationshipTable(otherCivDiplomacyManager)).row()
|
||||
diplomacyTable.add(getDiplomacyModifiersTable(otherCivDiplomacyManager)).row()
|
||||
val promisesTable = getPromisesTable(diplomacyManager, otherCivDiplomacyManager)
|
||||
|
Loading…
Reference in New Issue
Block a user