Player can enter city-state borders.

This commit is contained in:
Duan Tao 2019-05-06 10:44:49 +08:00 committed by Yair Morgenstern
parent ef7b73ad5f
commit 30531316d2
3 changed files with 12 additions and 5 deletions

View File

@ -240,6 +240,9 @@ class DiplomacyManager() {
thirdCiv.getDiplomacyManager(civInfo).addModifier(DiplomaticModifiers.WarMongerer,5f) thirdCiv.getDiplomacyManager(civInfo).addModifier(DiplomaticModifiers.WarMongerer,5f)
else thirdCiv.getDiplomacyManager(civInfo).addModifier(DiplomaticModifiers.WarMongerer,-5f) else thirdCiv.getDiplomacyManager(civInfo).addModifier(DiplomaticModifiers.WarMongerer,-5f)
} }
//Damage diplomatic relationship
otherCivDiplomacy.influence = -50f
} }
fun makePeace(){ fun makePeace(){

View File

@ -150,8 +150,12 @@ class MapUnit {
return false return false
val tileOwner = tile.getOwner() val tileOwner = tile.getOwner()
if(tileOwner!=null && tileOwner.civName!=owner if(tileOwner!=null && tileOwner.civName!=owner) {
&& (tile.isCityCenter() || !civInfo.canEnterTiles(tileOwner))) return false if (tile.isCityCenter()) return false
if (!civInfo.canEnterTiles(tileOwner)
&& !(civInfo.isPlayerCivilization() && tileOwner.isCityState())) return false
// AIs won't enter city-state's border.
}
val unitsInTile = tile.getUnits() val unitsInTile = tile.getUnits()
if(unitsInTile.isNotEmpty()){ if(unitsInTile.isNotEmpty()){

View File

@ -73,8 +73,8 @@ class DiplomacyScreen:CameraStageBaseScreen() {
fun giveGoldGift(otherCiv: CivilizationInfo) { fun giveGoldGift(otherCiv: CivilizationInfo) {
val currentPlayerCiv = UnCivGame.Current.gameInfo.getCurrentPlayerCivilization() val currentPlayerCiv = UnCivGame.Current.gameInfo.getCurrentPlayerCivilization()
currentPlayerCiv.gold -= 50 currentPlayerCiv.gold -= 100
otherCiv.getDiplomacyManager(currentPlayerCiv).influence += 5 otherCiv.getDiplomacyManager(currentPlayerCiv).influence += 10
rightSideTable.clear() rightSideTable.clear()
rightSideTable.add(getDiplomacyTable(otherCiv)) rightSideTable.add(getDiplomacyTable(otherCiv))
} }
@ -101,7 +101,7 @@ class DiplomacyScreen:CameraStageBaseScreen() {
diplomacyTable.addSeparator() diplomacyTable.addSeparator()
if(otherCiv.isCityState()) { if(otherCiv.isCityState()) {
val giftButton = TextButton("Give 50 gold".tr(), skin) val giftButton = TextButton("Give 100 gold".tr(), skin)
giftButton.onClick{ giveGoldGift(otherCiv) } giftButton.onClick{ giveGoldGift(otherCiv) }
diplomacyTable.add(giftButton).row() diplomacyTable.add(giftButton).row()
if (currentPlayerCiv.gold < 1) giftButton.disable() if (currentPlayerCiv.gold < 1) giftButton.disable()