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