Changed some border icons to filled icons, which look way better in-game
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 930 B |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 1022 KiB |
@ -353,7 +353,6 @@
|
|||||||
hurryCostModifier:20,
|
hurryCostModifier:20,
|
||||||
attackSound:"metalhit"
|
attackSound:"metalhit"
|
||||||
},
|
},
|
||||||
/*
|
|
||||||
{
|
{
|
||||||
name:"Mohawk Warrior",
|
name:"Mohawk Warrior",
|
||||||
unitType:"Melee",
|
unitType:"Melee",
|
||||||
@ -368,9 +367,7 @@
|
|||||||
hurryCostModifier:20,
|
hurryCostModifier:20,
|
||||||
uniques:["Combat Bonus in Forest/Jungle 33%"],
|
uniques:["Combat Bonus in Forest/Jungle 33%"],
|
||||||
attackSound:"metalhit"
|
attackSound:"metalhit"
|
||||||
//Iroquese unique unit. Bonus when fighting in Jungles and Forests. Doesn't require Iron.
|
|
||||||
},
|
},
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
name:"Horseman",
|
name:"Horseman",
|
||||||
unitType:"Mounted",
|
unitType:"Mounted",
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.unciv.logic.battle
|
package com.unciv.logic.battle
|
||||||
|
|
||||||
|
import com.unciv.Constants
|
||||||
import com.unciv.logic.map.MapUnit
|
import com.unciv.logic.map.MapUnit
|
||||||
import com.unciv.logic.map.TileInfo
|
import com.unciv.logic.map.TileInfo
|
||||||
import com.unciv.models.gamebasics.unit.UnitType
|
import com.unciv.models.gamebasics.unit.UnitType
|
||||||
@ -40,47 +41,46 @@ class BattleDamage{
|
|||||||
for (BDM in getBattleDamageModifiersOfUnit(combatant.unit)) {
|
for (BDM in getBattleDamageModifiersOfUnit(combatant.unit)) {
|
||||||
if (BDM.vs == enemy.getUnitType().toString())
|
if (BDM.vs == enemy.getUnitType().toString())
|
||||||
addToModifiers(BDM)
|
addToModifiers(BDM)
|
||||||
if(BDM.vs == "wounded units" && enemy is MapUnitCombatant && enemy.getHealth()<100)
|
if (BDM.vs == "wounded units" && enemy is MapUnitCombatant && enemy.getHealth() < 100)
|
||||||
addToModifiers(BDM)
|
addToModifiers(BDM)
|
||||||
if(BDM.vs == "land units" && enemy.getUnitType().isLandUnit())
|
if (BDM.vs == "land units" && enemy.getUnitType().isLandUnit())
|
||||||
addToModifiers(BDM)
|
addToModifiers(BDM)
|
||||||
if(BDM.vs == "water units" && enemy.getUnitType().isWaterUnit())
|
if (BDM.vs == "water units" && enemy.getUnitType().isWaterUnit())
|
||||||
addToModifiers(BDM)
|
addToModifiers(BDM)
|
||||||
if(BDM.vs == "air units" && enemy.getUnitType().isAirUnit())
|
if (BDM.vs == "air units" && enemy.getUnitType().isAirUnit())
|
||||||
addToModifiers(BDM)
|
addToModifiers(BDM)
|
||||||
}
|
}
|
||||||
|
|
||||||
//https://www.carlsguides.com/strategy/civilization5/war/combatbonuses.php
|
//https://www.carlsguides.com/strategy/civilization5/war/combatbonuses.php
|
||||||
val civHappiness = combatant.getCivInfo().getHappiness()
|
val civHappiness = combatant.getCivInfo().getHappiness()
|
||||||
if (civHappiness < 0)
|
if (civHappiness < 0)
|
||||||
modifiers["Unhappiness"] = max(0.02f * civHappiness,-0.9f) // otherwise it could exceed -100% and start healing enemy units...
|
modifiers["Unhappiness"] = max(0.02f * civHappiness, -0.9f) // otherwise it could exceed -100% and start healing enemy units...
|
||||||
|
|
||||||
if(combatant.getCivInfo().policies.isAdopted("Populism") && combatant.getHealth() < 100){
|
if (combatant.getCivInfo().policies.isAdopted("Populism") && combatant.getHealth() < 100) {
|
||||||
modifiers["Populism"] = 0.25f
|
modifiers["Populism"] = 0.25f
|
||||||
}
|
}
|
||||||
|
|
||||||
if(combatant.getCivInfo().policies.isAdopted("Discipline") && combatant.isMelee()
|
if (combatant.getCivInfo().policies.isAdopted("Discipline") && combatant.isMelee()
|
||||||
&& combatant.getTile().neighbors.flatMap { it.getUnits() }
|
&& combatant.getTile().neighbors.flatMap { it.getUnits() }
|
||||||
.any { it.civInfo==combatant.getCivInfo() && !it.type.isCivilian() && !it.type.isAirUnit()})
|
.any { it.civInfo == combatant.getCivInfo() && !it.type.isCivilian() && !it.type.isAirUnit() })
|
||||||
modifiers["Discipline"] = 0.15f
|
modifiers["Discipline"] = 0.15f
|
||||||
|
|
||||||
val requiredResource = combatant.unit.baseUnit.requiredResource
|
val requiredResource = combatant.unit.baseUnit.requiredResource
|
||||||
if(requiredResource!=null && combatant.getCivInfo().getCivResourcesByName()[requiredResource]!!<0
|
if (requiredResource != null && combatant.getCivInfo().getCivResourcesByName()[requiredResource]!! < 0
|
||||||
&& !combatant.getCivInfo().isBarbarian()){
|
&& !combatant.getCivInfo().isBarbarian()) {
|
||||||
modifiers["Missing resource"]=-0.25f
|
modifiers["Missing resource"] = -0.25f
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo : performance improvement
|
val nearbyCivUnits = combatant.unit.getTile().getTilesInDistance(2)
|
||||||
if (combatant.getUnitType()!=UnitType.City) {
|
.filter { it.civilianUnit?.civInfo == combatant.unit.civInfo }
|
||||||
val nearbyCivUnits = combatant.unit.getTile().getTilesInDistance(2)
|
.map { it.civilianUnit }
|
||||||
.filter {it.civilianUnit?.civInfo == combatant.unit.civInfo}
|
if (nearbyCivUnits.any { it!!.hasUnique("Bonus for units in 2 tile radius 15%") }) {
|
||||||
.map {it.civilianUnit}
|
val greatGeneralModifier = if (combatant.unit.civInfo.nation.unique ==
|
||||||
if (nearbyCivUnits.any { it!!.hasUnique("Bonus for units in 2 tile radius 15%") }) {
|
"Great general provides double combat bonus, and spawns 50% faster") 0.3f
|
||||||
modifiers["Great General"]= if (combatant.unit.civInfo.nation.unique ==
|
else 0.15f
|
||||||
"Great general provides double combat bonus, and spawns 50% faster") 0.3f
|
modifiers["Great General"] = greatGeneralModifier
|
||||||
else 0.15f
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (combatant.getCivInfo().policies.isAdopted("Honor") && enemy.getCivInfo().isBarbarian())
|
if (combatant.getCivInfo().policies.isAdopted("Honor") && enemy.getCivInfo().isBarbarian())
|
||||||
@ -95,22 +95,6 @@ class BattleDamage{
|
|||||||
if(attacker is MapUnitCombatant) {
|
if(attacker is MapUnitCombatant) {
|
||||||
modifiers.putAll(getTileSpecificModifiers(attacker,defender.getTile()))
|
modifiers.putAll(getTileSpecificModifiers(attacker,defender.getTile()))
|
||||||
|
|
||||||
val defenderTile = defender.getTile()
|
|
||||||
val isDefenderInRoughTerrain = defenderTile.isRoughTerrain()
|
|
||||||
for (BDM in getBattleDamageModifiersOfUnit(attacker.unit)) {
|
|
||||||
val text = BDM.getText()
|
|
||||||
if (BDM.vs == "units in open terrain" && !isDefenderInRoughTerrain) {
|
|
||||||
if(modifiers.containsKey(text))
|
|
||||||
modifiers[text] =modifiers[text]!! + BDM.modificationAmount
|
|
||||||
else modifiers[text] = BDM.modificationAmount
|
|
||||||
}
|
|
||||||
if (BDM.vs == "units in rough terrain" && isDefenderInRoughTerrain) {
|
|
||||||
if (modifiers.containsKey(text))
|
|
||||||
modifiers[text] = modifiers[text]!! + BDM.modificationAmount
|
|
||||||
else modifiers[text] = BDM.modificationAmount
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (ability in attacker.unit.getUniques()) {
|
for (ability in attacker.unit.getUniques()) {
|
||||||
val regexResult = Regex("""Bonus as Attacker [(\d*)]%""").matchEntire(ability) //to do: extend to defender, and penalyy
|
val regexResult = Regex("""Bonus as Attacker [(\d*)]%""").matchEntire(ability) //to do: extend to defender, and penalyy
|
||||||
if (regexResult == null) continue
|
if (regexResult == null) continue
|
||||||
@ -119,6 +103,19 @@ class BattleDamage{
|
|||||||
modifiers["Attacker Bonus"] =modifiers["Attacker Bonus"]!! + bonus
|
modifiers["Attacker Bonus"] =modifiers["Attacker Bonus"]!! + bonus
|
||||||
else modifiers["Attacker Bonus"] = bonus
|
else modifiers["Attacker Bonus"] = bonus
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(attacker.unit.isEmbarked())
|
||||||
|
modifiers["Landing"] = -0.5f
|
||||||
|
|
||||||
|
if (attacker.isMelee()) {
|
||||||
|
val numberOfAttackersSurroundingDefender = defender.getTile().neighbors.count {
|
||||||
|
it.militaryUnit != null
|
||||||
|
&& it.militaryUnit!!.owner == attacker.getCivInfo().civName
|
||||||
|
&& MapUnitCombatant(it.militaryUnit!!).isMelee()
|
||||||
|
}
|
||||||
|
if (numberOfAttackersSurroundingDefender > 1)
|
||||||
|
modifiers["Flanking"] = 0.1f * (numberOfAttackersSurroundingDefender-1) //https://www.carlsguides.com/strategy/civilization5/war/combatbonuses.php
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (attacker is CityCombatant) {
|
else if (attacker is CityCombatant) {
|
||||||
@ -126,18 +123,7 @@ class BattleDamage{
|
|||||||
modifiers["Oligarchy"] = 0.5f
|
modifiers["Oligarchy"] = 0.5f
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attacker.isMelee()) {
|
|
||||||
val numberOfAttackersSurroundingDefender = defender.getTile().neighbors.count {
|
|
||||||
it.militaryUnit != null
|
|
||||||
&& it.militaryUnit!!.owner == attacker.getCivInfo().civName
|
|
||||||
&& MapUnitCombatant(it.militaryUnit!!).isMelee()
|
|
||||||
}
|
|
||||||
if (numberOfAttackersSurroundingDefender > 1)
|
|
||||||
modifiers["Flanking"] = 0.1f * (numberOfAttackersSurroundingDefender-1) //https://www.carlsguides.com/strategy/civilization5/war/combatbonuses.php
|
|
||||||
}
|
|
||||||
|
|
||||||
if(attacker is MapUnitCombatant && attacker.unit.isEmbarked())
|
|
||||||
modifiers["Landing"] = -0.5f
|
|
||||||
|
|
||||||
return modifiers
|
return modifiers
|
||||||
}
|
}
|
||||||
@ -155,26 +141,11 @@ class BattleDamage{
|
|||||||
if (tileDefenceBonus > 0) modifiers["Terrain"] = tileDefenceBonus
|
if (tileDefenceBonus > 0) modifiers["Terrain"] = tileDefenceBonus
|
||||||
}
|
}
|
||||||
|
|
||||||
if(attacker.isRanged()){
|
if(attacker.isRanged()) {
|
||||||
val defenceVsRanged = 0.25f * defender.unit.getUniques().count{it=="+25% Defence against ranged attacks"}
|
val defenceVsRanged = 0.25f * defender.unit.getUniques().count { it == "+25% Defence against ranged attacks" }
|
||||||
if(defenceVsRanged>0) modifiers["defence vs ranged"] = defenceVsRanged
|
if (defenceVsRanged > 0) modifiers["defence vs ranged"] = defenceVsRanged
|
||||||
}
|
}
|
||||||
|
|
||||||
val defenderTile = defender.getTile()
|
|
||||||
val isDefenderInRoughTerrain = defenderTile.isRoughTerrain()
|
|
||||||
for (BDM in getBattleDamageModifiersOfUnit(defender.unit)) {
|
|
||||||
val text = BDM.getText()
|
|
||||||
if (BDM.vs == "units in open terrain" && !isDefenderInRoughTerrain) {
|
|
||||||
if (modifiers.containsKey(text))
|
|
||||||
modifiers[text] = modifiers[text]!! + BDM.modificationAmount
|
|
||||||
else modifiers[text] = BDM.modificationAmount
|
|
||||||
}
|
|
||||||
if (BDM.vs == "units in rough terrain" && isDefenderInRoughTerrain) {
|
|
||||||
if (modifiers.containsKey(text))
|
|
||||||
modifiers[text] = modifiers[text]!! + BDM.modificationAmount
|
|
||||||
else modifiers[text] = BDM.modificationAmount
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (defender.unit.isFortified())
|
if (defender.unit.isFortified())
|
||||||
modifiers["Fortification"] = 0.2f * defender.unit.getFortificationTurns()
|
modifiers["Fortification"] = 0.2f * defender.unit.getFortificationTurns()
|
||||||
@ -190,6 +161,25 @@ class BattleDamage{
|
|||||||
if(!isFriendlyTerritory && unit.unit.hasUnique("+20% bonus outside friendly territory"))
|
if(!isFriendlyTerritory && unit.unit.hasUnique("+20% bonus outside friendly territory"))
|
||||||
modifiers["Foreign Land"] = 0.2f
|
modifiers["Foreign Land"] = 0.2f
|
||||||
|
|
||||||
|
if(unit.unit.hasUnique("+33% combat bonus in Forest/Jungle")
|
||||||
|
&& (tile.terrainFeature== Constants.forest || tile.terrainFeature==Constants.jungle))
|
||||||
|
modifiers[tile.terrainFeature!!]=0.33f
|
||||||
|
|
||||||
|
val isRoughTerrain = tile.isRoughTerrain()
|
||||||
|
for (BDM in getBattleDamageModifiersOfUnit(unit.unit)) {
|
||||||
|
val text = BDM.getText()
|
||||||
|
if (BDM.vs == "units in open terrain" && !isRoughTerrain) {
|
||||||
|
if (modifiers.containsKey(text))
|
||||||
|
modifiers[text] = modifiers[text]!! + BDM.modificationAmount
|
||||||
|
else modifiers[text] = BDM.modificationAmount
|
||||||
|
}
|
||||||
|
if (BDM.vs == "units in rough terrain" && isRoughTerrain) {
|
||||||
|
if (modifiers.containsKey(text))
|
||||||
|
modifiers[text] = modifiers[text]!! + BDM.modificationAmount
|
||||||
|
else modifiers[text] = BDM.modificationAmount
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return modifiers
|
return modifiers
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ import com.unciv.ui.utils.*
|
|||||||
|
|
||||||
class NationTable(val nation: Nation, width:Float, onClick:()->Unit)
|
class NationTable(val nation: Nation, width:Float, onClick:()->Unit)
|
||||||
: Table(CameraStageBaseScreen.skin){
|
: Table(CameraStageBaseScreen.skin){
|
||||||
val innerTable = Table()
|
private val innerTable = Table()
|
||||||
init {
|
init {
|
||||||
background = ImageGetter.getBackground(nation.getInnerColor())
|
background = ImageGetter.getBackground(nation.getInnerColor())
|
||||||
innerTable.pad(10f)
|
innerTable.pad(10f)
|
||||||
@ -26,9 +26,7 @@ class NationTable(val nation: Nation, width:Float, onClick:()->Unit)
|
|||||||
innerTable.add(getUniqueLabel(nation)
|
innerTable.add(getUniqueLabel(nation)
|
||||||
.apply { setWrap(true);setFontColor(nation.getInnerColor()) })
|
.apply { setWrap(true);setFontColor(nation.getInnerColor()) })
|
||||||
.width(width)
|
.width(width)
|
||||||
onClick {
|
onClick { onClick() }
|
||||||
onClick()
|
|
||||||
}
|
|
||||||
touchable = Touchable.enabled
|
touchable = Touchable.enabled
|
||||||
add(innerTable)
|
add(innerTable)
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ Unless otherwise specified, all the following are from [the Noun Project](https:
|
|||||||
* [Ship](https://thenounproject.com/term/ship/1998589/) By Vanisha for Galleass
|
* [Ship](https://thenounproject.com/term/ship/1998589/) By Vanisha for Galleass
|
||||||
* [Crossbow](https://thenounproject.com/term/crossbow/965389/) By Creaticca Creative Agency for Crossbowman
|
* [Crossbow](https://thenounproject.com/term/crossbow/965389/) By Creaticca Creative Agency for Crossbowman
|
||||||
* [Longbow](https://thenounproject.com/search/?q=longbow&i=815991) By Hamish for Longbowman
|
* [Longbow](https://thenounproject.com/search/?q=longbow&i=815991) By Hamish for Longbowman
|
||||||
* [Trebuchet](https://thenounproject.com/search/?q=Trebuchet&i=827987) By Ben Davis
|
* [Trebuchet](https://thenounproject.com/search/?q=trebuchet&i=828475) By Ben Davis
|
||||||
* [Sword](https://thenounproject.com/search/?q=Sword&i=1432662) By uzeir syarief for Longswordsman
|
* [Sword](https://thenounproject.com/search/?q=Sword&i=1432662) By uzeir syarief for Longswordsman
|
||||||
* [Samurai](https://thenounproject.com/search/?q=samurai&i=1683729) By Chanut is Industries
|
* [Samurai](https://thenounproject.com/search/?q=samurai&i=1683729) By Chanut is Industries
|
||||||
* [Spear](https://thenounproject.com/search/?q=Spear&i=1233840) By Alvaro Cabrera for Pikeman
|
* [Spear](https://thenounproject.com/search/?q=Spear&i=1233840) By Alvaro Cabrera for Pikeman
|
||||||
@ -168,7 +168,7 @@ Unless otherwise specified, all the following are from [the Noun Project](https:
|
|||||||
* [Anubis](https://thenounproject.com/term/anubis/1080090/) By Carpe Diem for Burial Tomb
|
* [Anubis](https://thenounproject.com/term/anubis/1080090/) By Carpe Diem for Burial Tomb
|
||||||
* [Parthenon](https://thenounproject.com/term/parthenon/493272/) By Christopher T. Howlett for The Oracle
|
* [Parthenon](https://thenounproject.com/term/parthenon/493272/) By Christopher T. Howlett for The Oracle
|
||||||
* [Stadium](https://thenounproject.com/term/stadium/1500595/) By sandra for Colosseum
|
* [Stadium](https://thenounproject.com/term/stadium/1500595/) By sandra for Colosseum
|
||||||
* [Terracotta Army](https://thenounproject.com/search/?q=terracotta&i=2306346) By Supalerk Laipawat
|
* [Terracotta Army](https://thenounproject.com/search/?q=terracotta&i=2412905) By Phạm Thanh Lộc
|
||||||
* [Stadium](https://thenounproject.com/term/stadium/1152530/) By Creaticca Creative Agency for Circus Maximus
|
* [Stadium](https://thenounproject.com/term/stadium/1152530/) By Creaticca Creative Agency for Circus Maximus
|
||||||
* [Market](https://thenounproject.com/term/market/1723050/) By sofi
|
* [Market](https://thenounproject.com/term/market/1723050/) By sofi
|
||||||
* [Bazaar](https://thenounproject.com/term/bazaar/902288/) By Tokka Elkholy
|
* [Bazaar](https://thenounproject.com/term/bazaar/902288/) By Tokka Elkholy
|
||||||
@ -184,8 +184,8 @@ Unless otherwise specified, all the following are from [the Noun Project](https:
|
|||||||
* [Christian Church](https://thenounproject.com/term/christian-church/1174183/) By Andrejs Kirma for Monastery
|
* [Christian Church](https://thenounproject.com/term/christian-church/1174183/) By Andrejs Kirma for Monastery
|
||||||
* [Castle](https://thenounproject.com/search/?q=castle&i=390189) By Mint Shirt
|
* [Castle](https://thenounproject.com/search/?q=castle&i=390189) By Mint Shirt
|
||||||
* [Red Fort](https://thenounproject.com/arunabh.jain.0fficial/collection/famous-indian-monuments/?i=2092466), [Gateway of India](https://thenounproject.com/arunabh.jain.0fficial/collection/famous-indian-monuments/?i=2092468) By Arunabh Jain, IN for Mughal Fort
|
* [Red Fort](https://thenounproject.com/arunabh.jain.0fficial/collection/famous-indian-monuments/?i=2092466), [Gateway of India](https://thenounproject.com/arunabh.jain.0fficial/collection/famous-indian-monuments/?i=2092468) By Arunabh Jain, IN for Mughal Fort
|
||||||
* [Cambodia](https://thenounproject.com/term/cambodia/1809152/) By Wichai Wi for Angkor Wat
|
* [Angkor Wat](https://thenounproject.com/search/?q=angkor%20wat&i=2412873) By Phạm Thanh Lộc for Angkor Wat
|
||||||
* [Alhambra](https://thenounproject.com/search/?q=alhambra&i=403759) By parkjisun
|
* [Alhambra](https://thenounproject.com/search/?q=alhambra&i=2322217) By Phạm Thanh Lộc
|
||||||
* [Books](https://thenounproject.com/term/books/1140218/) By Abir Alward for Oxford University
|
* [Books](https://thenounproject.com/term/books/1140218/) By Abir Alward for Oxford University
|
||||||
* [Forge](https://thenounproject.com/term/forge/1044767/) By Monjin Friends
|
* [Forge](https://thenounproject.com/term/forge/1044767/) By Monjin Friends
|
||||||
* [Anchor](https://thenounproject.com/term/anchor/1258518/) By Saeful Muslim for Harbor
|
* [Anchor](https://thenounproject.com/term/anchor/1258518/) By Saeful Muslim for Harbor
|
||||||
|