mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-06 16:28:40 +07:00
Trading gold now works as well!
This commit is contained in:
@ -21,8 +21,8 @@ android {
|
|||||||
applicationId "com.unciv.game"
|
applicationId "com.unciv.game"
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 26
|
targetSdkVersion 26
|
||||||
versionCode 96
|
versionCode 97
|
||||||
versionName "2.5.10"
|
versionName "2.6.0"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
|
@ -89,6 +89,21 @@ class TradeScreen(val otherCivilization: CivilizationInfo) : CameraStageBaseScre
|
|||||||
else if(offerButton.text.toString() == "Accept"){
|
else if(offerButton.text.toString() == "Accept"){
|
||||||
civInfo.diplomacy[otherCivilization.civName]!!.trades.add(currentTrade)
|
civInfo.diplomacy[otherCivilization.civName]!!.trades.add(currentTrade)
|
||||||
otherCivilization.diplomacy[civInfo.civName]!!.trades.add(currentTrade.reverse())
|
otherCivilization.diplomacy[civInfo.civName]!!.trades.add(currentTrade.reverse())
|
||||||
|
|
||||||
|
// instant transfers
|
||||||
|
for(offer in currentTrade.theirOffers){
|
||||||
|
if(offer.type==TradeType.Gold){
|
||||||
|
civInfo.gold += offer.amount
|
||||||
|
otherCivilization.gold -= offer.amount
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(offer in currentTrade.ourOffers){
|
||||||
|
if(offer.type==TradeType.Gold){
|
||||||
|
civInfo.gold -= offer.amount
|
||||||
|
otherCivilization.gold += offer.amount
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val newTradeScreen = TradeScreen(otherCivilization)
|
val newTradeScreen = TradeScreen(otherCivilization)
|
||||||
UnCivGame.Current.screen = newTradeScreen
|
UnCivGame.Current.screen = newTradeScreen
|
||||||
newTradeScreen.tradeText.setText("Pleasure doing business with you!")
|
newTradeScreen.tradeText.setText("Pleasure doing business with you!")
|
||||||
@ -164,7 +179,7 @@ class TradeScreen(val otherCivilization: CivilizationInfo) : CameraStageBaseScre
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun evaluateOffer(offer:TradeOffer, otherCivIsRecieving:Boolean): Int {
|
fun evaluateOffer(offer:TradeOffer, otherCivIsRecieving:Boolean): Int {
|
||||||
if(offer.type==TradeType.Gold) return 1
|
if(offer.type==TradeType.Gold) return offer.amount
|
||||||
if(offer.type == TradeType.Luxury_Resource){
|
if(offer.type == TradeType.Luxury_Resource){
|
||||||
var value = 100*offer.amount
|
var value = 100*offer.amount
|
||||||
if(!theirAvailableOffers.any { it.name==offer.name }) // We want to take away their last luxury or give them one they don't have
|
if(!theirAvailableOffers.any { it.name==offer.name }) // We want to take away their last luxury or give them one they don't have
|
||||||
|
Reference in New Issue
Block a user