mirror of
https://github.com/yairm210/Unciv.git
synced 2025-08-03 08:39:37 +07:00
Resolved #3967 - City-states can no longer 'gift' you your unique units
This commit is contained in:
@ -637,11 +637,11 @@ class CivilizationInfo {
|
|||||||
return (basicGoldCostOfSignResearchAgreement * gameInfo.gameParameters.gameSpeed.modifier).toInt()
|
return (basicGoldCostOfSignResearchAgreement * gameInfo.gameParameters.gameSpeed.modifier).toInt()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun giftMilitaryUnitTo(otherCiv: CivilizationInfo) {
|
fun gainMilitaryUnitFromCityState(otherCiv: CivilizationInfo) {
|
||||||
val cities = NextTurnAutomation.getClosestCities(this, otherCiv)
|
val cities = NextTurnAutomation.getClosestCities(this, otherCiv)
|
||||||
val city = cities.city1
|
val city = cities.city1
|
||||||
val militaryUnit = city.cityConstructions.getConstructableUnits()
|
val militaryUnit = city.cityConstructions.getConstructableUnits()
|
||||||
.filter { !it.unitType.isCivilian() && it.unitType.isLandUnit() }
|
.filter { !it.unitType.isCivilian() && it.unitType.isLandUnit() && it.uniqueTo==null }
|
||||||
.toList().random()
|
.toList().random()
|
||||||
// placing the unit may fail - in that case stay quiet
|
// placing the unit may fail - in that case stay quiet
|
||||||
val placedUnit = placeUnitNearTile(city.location, militaryUnit.name) ?: return
|
val placedUnit = placeUnitNearTile(city.location, militaryUnit.name) ?: return
|
||||||
|
@ -392,12 +392,13 @@ class DiplomacyManager() {
|
|||||||
if (!otherCivDiplomacy().hasFlag(DiplomacyFlags.ResearchAgreement))
|
if (!otherCivDiplomacy().hasFlag(DiplomacyFlags.ResearchAgreement))
|
||||||
sciencefromResearchAgreement()
|
sciencefromResearchAgreement()
|
||||||
}
|
}
|
||||||
|
// This is confusingly named - in fact, the civ that has the flag set is the MAJOR civ
|
||||||
DiplomacyFlags.ProvideMilitaryUnit.name -> {
|
DiplomacyFlags.ProvideMilitaryUnit.name -> {
|
||||||
// Do not unset the flag
|
// Do not unset the flag - they may return soon, and we'll continue from that point on
|
||||||
if (civInfo.cities.isEmpty() || otherCiv().cities.isEmpty())
|
if (civInfo.cities.isEmpty() || otherCiv().cities.isEmpty())
|
||||||
continue@loop
|
continue@loop
|
||||||
else
|
else
|
||||||
civInfo.giftMilitaryUnitTo(otherCiv())
|
civInfo.gainMilitaryUnitFromCityState(otherCiv())
|
||||||
}
|
}
|
||||||
DiplomacyFlags.AgreedToNotSettleNearUs.name -> {
|
DiplomacyFlags.AgreedToNotSettleNearUs.name -> {
|
||||||
addModifier(DiplomaticModifiers.FulfilledPromiseToNotSettleCitiesNearUs, 10f)
|
addModifier(DiplomaticModifiers.FulfilledPromiseToNotSettleCitiesNearUs, 10f)
|
||||||
|
Reference in New Issue
Block a user