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 MiB After Width: | Height: | Size: 1,022 KiB |
|
@ -353,7 +353,6 @@
|
|||
hurryCostModifier:20,
|
||||
attackSound:"metalhit"
|
||||
},
|
||||
/*
|
||||
{
|
||||
name:"Mohawk Warrior",
|
||||
unitType:"Melee",
|
||||
|
@ -368,9 +367,7 @@
|
|||
hurryCostModifier:20,
|
||||
uniques:["Combat Bonus in Forest/Jungle 33%"],
|
||||
attackSound:"metalhit"
|
||||
//Iroquese unique unit. Bonus when fighting in Jungles and Forests. Doesn't require Iron.
|
||||
},
|
||||
*/
|
||||
{
|
||||
name:"Horseman",
|
||||
unitType:"Mounted",
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.unciv.logic.battle
|
||||
|
||||
import com.unciv.Constants
|
||||
import com.unciv.logic.map.MapUnit
|
||||
import com.unciv.logic.map.TileInfo
|
||||
import com.unciv.models.gamebasics.unit.UnitType
|
||||
|
@ -40,47 +41,46 @@ class BattleDamage{
|
|||
for (BDM in getBattleDamageModifiersOfUnit(combatant.unit)) {
|
||||
if (BDM.vs == enemy.getUnitType().toString())
|
||||
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)
|
||||
if(BDM.vs == "land units" && enemy.getUnitType().isLandUnit())
|
||||
if (BDM.vs == "land units" && enemy.getUnitType().isLandUnit())
|
||||
addToModifiers(BDM)
|
||||
if(BDM.vs == "water units" && enemy.getUnitType().isWaterUnit())
|
||||
if (BDM.vs == "water units" && enemy.getUnitType().isWaterUnit())
|
||||
addToModifiers(BDM)
|
||||
if(BDM.vs == "air units" && enemy.getUnitType().isAirUnit())
|
||||
if (BDM.vs == "air units" && enemy.getUnitType().isAirUnit())
|
||||
addToModifiers(BDM)
|
||||
}
|
||||
|
||||
//https://www.carlsguides.com/strategy/civilization5/war/combatbonuses.php
|
||||
val civHappiness = combatant.getCivInfo().getHappiness()
|
||||
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
|
||||
}
|
||||
|
||||
if(combatant.getCivInfo().policies.isAdopted("Discipline") && combatant.isMelee()
|
||||
&& combatant.getTile().neighbors.flatMap { it.getUnits() }
|
||||
.any { it.civInfo==combatant.getCivInfo() && !it.type.isCivilian() && !it.type.isAirUnit()})
|
||||
if (combatant.getCivInfo().policies.isAdopted("Discipline") && combatant.isMelee()
|
||||
&& combatant.getTile().neighbors.flatMap { it.getUnits() }
|
||||
.any { it.civInfo == combatant.getCivInfo() && !it.type.isCivilian() && !it.type.isAirUnit() })
|
||||
modifiers["Discipline"] = 0.15f
|
||||
|
||||
val requiredResource = combatant.unit.baseUnit.requiredResource
|
||||
if(requiredResource!=null && combatant.getCivInfo().getCivResourcesByName()[requiredResource]!!<0
|
||||
&& !combatant.getCivInfo().isBarbarian()){
|
||||
modifiers["Missing resource"]=-0.25f
|
||||
if (requiredResource != null && combatant.getCivInfo().getCivResourcesByName()[requiredResource]!! < 0
|
||||
&& !combatant.getCivInfo().isBarbarian()) {
|
||||
modifiers["Missing resource"] = -0.25f
|
||||
}
|
||||
|
||||
//todo : performance improvement
|
||||
if (combatant.getUnitType()!=UnitType.City) {
|
||||
val nearbyCivUnits = combatant.unit.getTile().getTilesInDistance(2)
|
||||
.filter {it.civilianUnit?.civInfo == combatant.unit.civInfo}
|
||||
.map {it.civilianUnit}
|
||||
if (nearbyCivUnits.any { it!!.hasUnique("Bonus for units in 2 tile radius 15%") }) {
|
||||
modifiers["Great General"]= if (combatant.unit.civInfo.nation.unique ==
|
||||
"Great general provides double combat bonus, and spawns 50% faster") 0.3f
|
||||
else 0.15f
|
||||
}
|
||||
val nearbyCivUnits = combatant.unit.getTile().getTilesInDistance(2)
|
||||
.filter { it.civilianUnit?.civInfo == combatant.unit.civInfo }
|
||||
.map { it.civilianUnit }
|
||||
if (nearbyCivUnits.any { it!!.hasUnique("Bonus for units in 2 tile radius 15%") }) {
|
||||
val greatGeneralModifier = if (combatant.unit.civInfo.nation.unique ==
|
||||
"Great general provides double combat bonus, and spawns 50% faster") 0.3f
|
||||
else 0.15f
|
||||
modifiers["Great General"] = greatGeneralModifier
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (combatant.getCivInfo().policies.isAdopted("Honor") && enemy.getCivInfo().isBarbarian())
|
||||
|
@ -95,22 +95,6 @@ class BattleDamage{
|
|||
if(attacker is MapUnitCombatant) {
|
||||
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()) {
|
||||
val regexResult = Regex("""Bonus as Attacker [(\d*)]%""").matchEntire(ability) //to do: extend to defender, and penalyy
|
||||
if (regexResult == null) continue
|
||||
|
@ -119,6 +103,19 @@ class BattleDamage{
|
|||
modifiers["Attacker Bonus"] =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) {
|
||||
|
@ -126,18 +123,7 @@ class BattleDamage{
|
|||
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
|
||||
}
|
||||
|
@ -155,26 +141,11 @@ class BattleDamage{
|
|||
if (tileDefenceBonus > 0) modifiers["Terrain"] = tileDefenceBonus
|
||||
}
|
||||
|
||||
if(attacker.isRanged()){
|
||||
val defenceVsRanged = 0.25f * defender.unit.getUniques().count{it=="+25% Defence against ranged attacks"}
|
||||
if(defenceVsRanged>0) modifiers["defence vs ranged"] = defenceVsRanged
|
||||
if(attacker.isRanged()) {
|
||||
val defenceVsRanged = 0.25f * defender.unit.getUniques().count { it == "+25% Defence against ranged attacks" }
|
||||
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())
|
||||
modifiers["Fortification"] = 0.2f * defender.unit.getFortificationTurns()
|
||||
|
@ -190,6 +161,25 @@ class BattleDamage{
|
|||
if(!isFriendlyTerritory && unit.unit.hasUnique("+20% bonus outside friendly territory"))
|
||||
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
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import com.unciv.ui.utils.*
|
|||
|
||||
class NationTable(val nation: Nation, width:Float, onClick:()->Unit)
|
||||
: Table(CameraStageBaseScreen.skin){
|
||||
val innerTable = Table()
|
||||
private val innerTable = Table()
|
||||
init {
|
||||
background = ImageGetter.getBackground(nation.getInnerColor())
|
||||
innerTable.pad(10f)
|
||||
|
@ -26,9 +26,7 @@ class NationTable(val nation: Nation, width:Float, onClick:()->Unit)
|
|||
innerTable.add(getUniqueLabel(nation)
|
||||
.apply { setWrap(true);setFontColor(nation.getInnerColor()) })
|
||||
.width(width)
|
||||
onClick {
|
||||
onClick()
|
||||
}
|
||||
onClick { onClick() }
|
||||
touchable = Touchable.enabled
|
||||
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
|
||||
* [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
|
||||
* [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
|
||||
* [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
|
||||
|
@ -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
|
||||
* [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
|
||||
* [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
|
||||
* [Market](https://thenounproject.com/term/market/1723050/) By sofi
|
||||
* [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
|
||||
* [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
|
||||
* [Cambodia](https://thenounproject.com/term/cambodia/1809152/) By Wichai Wi for Angkor Wat
|
||||
* [Alhambra](https://thenounproject.com/search/?q=alhambra&i=403759) By parkjisun
|
||||
* [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=2322217) By Phạm Thanh Lộc
|
||||
* [Books](https://thenounproject.com/term/books/1140218/) By Abir Alward for Oxford University
|
||||
* [Forge](https://thenounproject.com/term/forge/1044767/) By Monjin Friends
|
||||
* [Anchor](https://thenounproject.com/term/anchor/1258518/) By Saeful Muslim for Harbor
|
||||
|
|