mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-26 13:27:22 -04:00
Deprecation of old uniques
This commit is contained in:
parent
30e5722c24
commit
2cac1622c9
@ -170,13 +170,6 @@ class CityStats {
|
||||
|
||||
fun getGrowthBonusFromPoliciesAndWonders(): Float {
|
||||
var bonus = 0f
|
||||
|
||||
// This is to be deprecated and converted to "+[]% growth in all cities" and "+[]% growth in capital" - keeping it here to that mods with this can still work for now
|
||||
if (cityInfo.civInfo.hasUnique("+10% food growth in capital") && cityInfo.isCapital())
|
||||
bonus += 10f
|
||||
if (cityInfo.civInfo.hasUnique("+15% growth in all cities"))
|
||||
bonus += 15f
|
||||
|
||||
for (unique in cityInfo.civInfo.getMatchingUniques("+[]% growth in all cities"))
|
||||
bonus += unique.params[0].toFloat()
|
||||
if (cityInfo.isCapital()) for (unique in cityInfo.civInfo.getMatchingUniques("+[]% growth in capital"))
|
||||
@ -296,19 +289,6 @@ class CityStats {
|
||||
private fun getStatPercentBonusesFromBuildings(currentConstruction: IConstruction): Stats {
|
||||
val stats = cityInfo.cityConstructions.getStatPercentBonuses()
|
||||
|
||||
// This is to be deprecated and converted to "+[]% production when building [] in this city" - keeping it here to that mods with this can still work for now
|
||||
if (currentConstruction is BaseUnit) {
|
||||
if (currentConstruction.unitType == UnitType.Mounted
|
||||
&& cityInfo.containsBuildingUnique("+15% Production when building Mounted Units in this city"))
|
||||
stats.production += 15
|
||||
if (currentConstruction.unitType.isLandUnit()
|
||||
&& cityInfo.containsBuildingUnique("+15% production of land units"))
|
||||
stats.production += 15
|
||||
if (currentConstruction.unitType.isWaterUnit()
|
||||
&& cityInfo.containsBuildingUnique("+15% production of naval units"))
|
||||
stats.production += 15
|
||||
}
|
||||
|
||||
for (unique in cityInfo.cityConstructions.builtBuildingUniqueMap.getUniques("+[]% production when building [] in this city")) {
|
||||
if (constructionMatchesFilter(currentConstruction, unique.params[1]))
|
||||
stats.production += unique.params[0].toInt()
|
||||
|
@ -27,11 +27,6 @@ class CivInfoStats(val civInfo: CivilizationInfo){
|
||||
|
||||
var numberOfUnitsToPayFor = max(0f, unitsToPayFor.count().toFloat() - freeUnits)
|
||||
|
||||
// Deprecated and generalized as of 3.11.20 - here for mod transition period
|
||||
if (civInfo.hasUnique("-25% land units maintenance")) {
|
||||
val numberOfUnitsWithDiscount = min(numberOfUnitsToPayFor, unitsToPayFor.count { it.type.isLandUnit() }.toFloat())
|
||||
numberOfUnitsToPayFor -= 0.25f * numberOfUnitsWithDiscount
|
||||
}
|
||||
|
||||
for (unique in civInfo.getMatchingUniques("-[]% [] unit maintenance costs")) {
|
||||
val numberOfUnitsWithDiscount = min(numberOfUnitsToPayFor, unitsToPayFor.count { it.matchesFilter(unique.params[1]) }.toFloat())
|
||||
|
@ -58,11 +58,11 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
|
||||
|
||||
class ParentTileAndTotalDistance(val parentTile: TileInfo, val totalDistance: Float)
|
||||
|
||||
val MOVEMENT_TESTING = UncivGame.Current.settings.unitMovementIncludesImpassibles
|
||||
fun isUnknownTileWeShouldAssumeToBePassable(tileInfo: TileInfo) = MOVEMENT_TESTING && !unit.civInfo.exploredTiles.contains(tileInfo.position)
|
||||
fun isUnknownTileWeShouldAssumeToBePassable(tileInfo: TileInfo) = UncivGame.Current.settings.unitMovementIncludesImpassibles
|
||||
&& !unit.civInfo.exploredTiles.contains(tileInfo.position)
|
||||
|
||||
fun getDistanceToTilesWithinTurn(origin: Vector2, unitMovement: Float): PathsToTilesWithinTurn {
|
||||
if(MOVEMENT_TESTING) return getDistanceToTilesWithinTurnIncludingUnknownImpassibles(origin, unitMovement)
|
||||
if (UncivGame.Current.settings.unitMovementIncludesImpassibles) return getDistanceToTilesWithinTurnIncludingUnknownImpassibles(origin, unitMovement)
|
||||
|
||||
val distanceToTiles = PathsToTilesWithinTurn()
|
||||
if (unitMovement == 0f) return distanceToTiles
|
||||
|
@ -170,25 +170,24 @@ class BaseUnit : INamed, IConstruction {
|
||||
if (unit == null) return false // couldn't place the unit, so there's actually no unit =(
|
||||
|
||||
//movement penalty
|
||||
if (wasBought && !unit.hasUnique("Can move immediately once bought") && !civInfo.gameInfo.gameParameters.godMode)
|
||||
if (wasBought && !civInfo.gameInfo.gameParameters.godMode && !unit.hasUnique("Can move immediately once bought"))
|
||||
unit.currentMovement = 0f
|
||||
|
||||
if (this.unitType.isCivilian()) return true // tiny optimization makes save files a few bytes smaller
|
||||
|
||||
var XP = construction.getBuiltBuildings().sumBy { it.xpForNewUnits }
|
||||
|
||||
// As of 3.11.2 This is to be deprecated and converted to "New [] units start with [] Experience" - keeping it here to that mods with this can still work for now
|
||||
for (unique in civInfo.getMatchingUniques("New military units start with [] Experience"))
|
||||
XP += unique.params[0].toInt()
|
||||
|
||||
for (unique in construction.cityInfo.cityConstructions.builtBuildingUniqueMap.getUniques("New [] units start with [] Experience in this city")
|
||||
for (unique in construction.cityInfo.cityConstructions.builtBuildingUniqueMap
|
||||
.getUniques("New [] units start with [] Experience in this city")
|
||||
+ civInfo.getMatchingUniques("New [] units start with [] Experience")) {
|
||||
if (unit.matchesFilter(unique.params[0]))
|
||||
XP += unique.params[1].toInt()
|
||||
}
|
||||
unit.promotions.XP = XP
|
||||
|
||||
for (unique in construction.cityInfo.cityConstructions.builtBuildingUniqueMap.getUniques("All newly-trained [] units in this city receive the [] promotion")) {
|
||||
for (unique in construction.cityInfo.cityConstructions.builtBuildingUniqueMap
|
||||
.getUniques("All newly-trained [] units in this city receive the [] promotion")) {
|
||||
val filter = unique.params[0]
|
||||
val promotion = unique.params[1]
|
||||
|
||||
@ -196,11 +195,6 @@ class BaseUnit : INamed, IConstruction {
|
||||
unit.promotions.addPromotion(promotion, isFree = true)
|
||||
}
|
||||
|
||||
// This is to be deprecated and converted to "All newly-trained [] in this city receive the [] promotion" - keeping it here to that mods with this can still work for now
|
||||
if (unit.type in listOf(UnitType.Melee, UnitType.Mounted, UnitType.Armor)
|
||||
&& construction.cityInfo.containsBuildingUnique("All newly-trained melee, mounted, and armored units in this city receive the Drill I promotion"))
|
||||
unit.promotions.addPromotion("Drill I", isFree = true)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user