Resolved #491 - Once Honor has been adopted, gain Culture when you kill a barbarian unit

This commit is contained in:
Yair Morgenstern 2019-03-03 23:05:12 +02:00
parent c4e686f514
commit 0ef11e12cd
5 changed files with 18 additions and 5 deletions

View File

@ -89,7 +89,7 @@
{
name:"Honor",
era:"Ancient",
description:"+25% bonus vs Barbarians",
description:"+25% bonus vs Barbarians; gain Culture when you kill a barbarian unit",
policies:[
{
name:"Warrior Code",

View File

@ -6620,7 +6620,7 @@
German:"Ehre"
French:"Honneur"
}
"+25% bonus vs Barbarians":{ //it's 33% in the original game
"+25% bonus vs Barbarians; gain Culture when you kill a barbarian unit":{ //25% in Vanilla, 33% in G&K
Spanish:"+25% bonus al luchar contra Barbaros"
Italian:"+25% forza contro Barbari"
Romanian:"+25% bonus contra Barbarilor"

View File

@ -21,8 +21,8 @@ android {
applicationId "com.unciv.app"
minSdkVersion 14
targetSdkVersion 28
versionCode 209
versionName "2.13.9"
versionCode 211
versionName "2.13.10"
}
// Had to add this crap for Travis to build, it wanted to sign the app

View File

@ -17,7 +17,7 @@ class UnCivGame : Game() {
* This exists so that when debugging we can see the entire map.
* Remember to turn this to false before commit and upload!
*/
val viewEntireMapForDebug = true
val viewEntireMapForDebug = false
// For when you need to test something in an advanced game and don't have time to faff around
val superchargedForDebug = false

View File

@ -8,6 +8,7 @@ import com.unciv.logic.civilization.diplomacy.DiplomaticIncidentType
import com.unciv.logic.map.TileInfo
import com.unciv.models.gamebasics.unit.UnitType
import java.util.*
import kotlin.math.max
/**
* Damage calculations according to civ v wiki and https://steamcommunity.com/sharedfiles/filedetails/?id=170194443
@ -125,6 +126,18 @@ class Battle(val gameInfo:GameInfo) {
addXp(defender,2,attacker)
}
// Add culture when defeating a barbarian when Honor policy is adopted (can be either attacker or defender!)
fun tryGetCultureFromHonor(civUnit:ICombatant, barbarianUnit:ICombatant){
if(barbarianUnit.isDefeated() && barbarianUnit is MapUnitCombatant
&& barbarianUnit.getCivInfo().isBarbarianCivilization()
&& civUnit.getCivInfo().policies.isAdopted("Honor"))
civUnit.getCivInfo().policies.storedCulture +=
max(barbarianUnit.unit.baseUnit.strength,barbarianUnit.unit.baseUnit.rangedStrength)
}
tryGetCultureFromHonor(attacker,defender)
tryGetCultureFromHonor(defender,attacker)
if(defender.isDefeated() && defender is MapUnitCombatant && !defender.getUnitType().isCivilian()
&& attacker.getCivInfo().policies.isAdopted("Honor Complete"))
attacker.getCivInfo().gold += defender.unit.baseUnit.getGoldCost(hashSetOf()) / 10