mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-11 11:28:03 +07:00
parent
d6a99a7848
commit
45ee382fba
@ -14,18 +14,18 @@ import kotlin.math.min
|
|||||||
import kotlin.math.pow
|
import kotlin.math.pow
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
class BattleDamageModifier(val vs:String, val modificationAmount:Float){
|
|
||||||
fun getText(): String = "vs $vs"
|
|
||||||
}
|
|
||||||
|
|
||||||
object BattleDamage {
|
object BattleDamage {
|
||||||
|
|
||||||
private fun getModifierStringFromUnique(unique: Unique): String {
|
private fun getModifierStringFromUnique(unique: Unique): String {
|
||||||
return when (unique.sourceObjectType) {
|
val source = when (unique.sourceObjectType) {
|
||||||
UniqueTarget.Unit -> "Unit ability"
|
UniqueTarget.Unit -> "Unit ability"
|
||||||
UniqueTarget.Nation -> "National ability"
|
UniqueTarget.Nation -> "National ability"
|
||||||
else -> "[${unique.sourceObjectName}] ([${unique.sourceObjectType?.name}])"
|
else -> "[${unique.sourceObjectName}] ([${unique.sourceObjectType?.name}])"
|
||||||
}
|
}
|
||||||
|
if (unique.conditionals.isEmpty()) return source
|
||||||
|
|
||||||
|
val conditionalsText = unique.conditionals.joinToString { it.text }
|
||||||
|
return "$source - $conditionalsText"
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getGeneralModifiers(combatant: ICombatant, enemy: ICombatant, combatAction: CombatAction): Counter<String> {
|
private fun getGeneralModifiers(combatant: ICombatant, enemy: ICombatant, combatAction: CombatAction): Counter<String> {
|
||||||
|
@ -24,7 +24,7 @@ class BattleTable(val worldScreen: WorldScreen): Table() {
|
|||||||
init {
|
init {
|
||||||
isVisible = false
|
isVisible = false
|
||||||
skin = BaseScreen.skin
|
skin = BaseScreen.skin
|
||||||
background = ImageGetter.getBackground(ImageGetter.getBlue())
|
background = ImageGetter.getBackground(ImageGetter.getBlue().apply { a=0.8f })
|
||||||
|
|
||||||
defaults().pad(5f)
|
defaults().pad(5f)
|
||||||
pad(5f)
|
pad(5f)
|
||||||
@ -130,9 +130,16 @@ class BattleTable(val worldScreen: WorldScreen): Table() {
|
|||||||
}
|
}
|
||||||
else listOf()
|
else listOf()
|
||||||
|
|
||||||
for(i in 0..max(attackerModifiers.size,defenderModifiers.size)){
|
val quarterScreen = worldScreen.stage.width/4
|
||||||
if (attackerModifiers.size > i) add(attackerModifiers[i].toLabel(fontSize = 14)) else add()
|
for (i in 0..max(attackerModifiers.size,defenderModifiers.size)) {
|
||||||
if (defenderModifiers.size > i) add(defenderModifiers[i].toLabel(fontSize = 14)) else add()
|
if (attackerModifiers.size > i)
|
||||||
|
add(attackerModifiers[i].toLabel(fontSize = 14)
|
||||||
|
.apply { wrap = true }).width(quarterScreen)
|
||||||
|
else add().width(quarterScreen)
|
||||||
|
if (defenderModifiers.size > i)
|
||||||
|
add(defenderModifiers[i].toLabel(fontSize = 14)
|
||||||
|
.apply { wrap = true }).width(quarterScreen)
|
||||||
|
else add().width(quarterScreen)
|
||||||
row().pad(2f)
|
row().pad(2f)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user