Add Speed alteration management.

This commit is contained in:
Thomas Andres Gomez 2024-01-05 16:47:08 +01:00
parent c8e7fee2c2
commit a73a352004
4 changed files with 3 additions and 4 deletions

View file

@ -5,6 +5,7 @@ enum class Property(val key: String) {
LEVEL("Niveau"),
HIT_POINT("Point de vie"),
ARMOR_CLASS("Classe d'armure"),
SPEED("Vitesse"),
INITIATIVE("Initiative"),
STRENGTH("Force"),
DEXTERITY("Dextérité"),

View file

@ -281,7 +281,7 @@ class CharacterSheetUioFactory @Inject constructor() {
),
speed = LabelPointUio(
label = R.string.character_sheet_title_speed,
value = "${sheet.speed}m",
value = "${max(sheet.speed + status[Property.SPEED].sum, 0)}m",
),
masteries = MasteriesUio(
martial = sheet.martial,

View file

@ -72,7 +72,6 @@ class HeaderViewModel @Inject constructor(
hpMax = sheet.hitPoint + status[Property.HIT_POINT].sum,
characterClass = sheet.characterClass.firstOrNull(),
initiative = (sheet.dexterity + status[Property.DEXTERITY].sum).modifier + status[Property.INITIATIVE].sum,
speed = sheet.speed,
ca = sheet.armorClass + status[Property.ARMOR_CLASS].sum,
dc = sheet.dC,
)
@ -178,7 +177,6 @@ class HeaderViewModel @Inject constructor(
val hpMax: Int,
val characterClass: CharacterSheet.Class?,
val initiative: Int,
val speed: Int,
val ca: Int,
val dc: Int?,
)

View file

@ -208,7 +208,7 @@ class SummaryFactory @Inject constructor(
label = (dexterity.modifier + status[Property.INITIATIVE].sum).toLabel()
)
val speed = label(
label = "${sheet.speed}m",
label = "${max(sheet.speed + status[Property.SPEED].sum, 0)}m",
)
withContext(Dispatchers.Main) {
attributes.hp.get(sheet)?.value = hitPoint