Add alteration support for diminished status.
This commit is contained in:
parent
17b7b06ec8
commit
51a477bb58
5 changed files with 66 additions and 29 deletions
|
|
@ -21,11 +21,11 @@ import com.pixelized.shared.lwa.model.characterSheet.CharacterSheet.Characterist
|
|||
import com.pixelized.shared.lwa.model.characterSheet.CharacterSheet.CharacteristicId.REFLEX
|
||||
import com.pixelized.shared.lwa.model.characterSheet.CharacterSheet.CharacteristicId.STR
|
||||
import com.pixelized.shared.lwa.model.characterSheet.CharacterSheet.CharacteristicId.THUMBNAIL
|
||||
import com.pixelized.shared.lwa.model.inventory.Inventory
|
||||
import com.pixelized.shared.lwa.model.inventory.Inventory.Item
|
||||
import com.pixelized.shared.lwa.model.characterSheet.CharacterSheet.StatusId.DIMINISHED
|
||||
import com.pixelized.shared.lwa.parser.expression.Expression
|
||||
import com.pixelized.shared.lwa.usecase.CharacterSheetUseCase
|
||||
import com.pixelized.shared.lwa.usecase.ExpressionUseCase
|
||||
import kotlin.math.max
|
||||
|
||||
class AlteredCharacterSheetFactory(
|
||||
private val sheetUseCase: CharacterSheetUseCase,
|
||||
|
|
@ -109,7 +109,10 @@ class AlteredCharacterSheet(
|
|||
get() = sheet.fatigue
|
||||
|
||||
val diminished: Int
|
||||
get() = sheet.diminished
|
||||
get() = max(0, sheet.diminished + diminishedAlterations)
|
||||
|
||||
val diminishedAlterations: Int
|
||||
get() = fieldAlterations[DIMINISHED].sum()
|
||||
|
||||
val alterations: List<String>
|
||||
get() = sheet.alterations
|
||||
|
|
|
|||
|
|
@ -56,6 +56,10 @@ data class CharacterSheet(
|
|||
val critical: String?,
|
||||
)
|
||||
|
||||
object StatusId {
|
||||
const val DIMINISHED = "DIMINISHED"
|
||||
}
|
||||
|
||||
object CharacteristicId {
|
||||
const val PORTRAIT = "PORTRAIT"
|
||||
const val THUMBNAIL = "THUMBNAIL"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
package com.pixelized.shared.lwa.utils
|
||||
|
||||
import kotlin.math.sign
|
||||
|
||||
val Int.signLabel: Char
|
||||
get() = when (this.sign) {
|
||||
1 -> '+'
|
||||
-1 -> '-'
|
||||
else -> ' '
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue