Add an hide feature to a throw.

This commit is contained in:
Andres Gomez, Thomas (ITDV RL) 2024-05-31 10:51:39 +02:00
parent 550522d792
commit 4b34446697
3 changed files with 23 additions and 7 deletions

View file

@ -655,6 +655,7 @@ class DiceThrowUseCase @Inject constructor(
timestamp = System.currentTimeMillis(),
title = abilityTitleString.uppercase(),
highlight = abilityLabelString.uppercase(),
hidden = ability == Property.DEATH_SAVING_THROW,
face = 20,
roll = allValue.toLabel(),
result = rollResult,

View file

@ -42,6 +42,10 @@ data class NetworkThrow(
@get:PropertyName(DETAILS)
@set:PropertyName(DETAILS)
var details: List<Detail> = emptyList(),
@get:PropertyName(HIDDEN)
@set:PropertyName(HIDDEN)
var hidden: Boolean = false,
) {
@Keep
@IgnoreExtraProperties
@ -112,5 +116,6 @@ data class NetworkThrow(
const val CRITICAL = "crit"
const val FAIL = "fail"
const val DETAILS = "details"
const val HIDDEN = "hidden"
}
}

View file

@ -652,13 +652,23 @@ class SummaryFactory @Inject constructor(
dices.getOrNull(index = characters.indexOf(name))
throws.forEach { entry ->
header.getDice(name = entry.key)?.value = ClassHeaderSummaryUio.Dice(
characterName = entry.key,
timestamp = entry.value.timestamp,
result = entry.value.result,
isCriticalSuccess = entry.value.isCriticalSuccess ?: false,
isCriticalFailure = entry.value.isCriticalFailure ?: false,
)
header.getDice(name = entry.key)?.value = if (entry.value.hidden) {
ClassHeaderSummaryUio.Dice(
characterName = entry.key,
timestamp = entry.value.timestamp,
result = "?",
isCriticalSuccess = false,
isCriticalFailure = false,
)
} else {
ClassHeaderSummaryUio.Dice(
characterName = entry.key,
timestamp = entry.value.timestamp,
result = entry.value.result,
isCriticalSuccess = entry.value.isCriticalSuccess ?: false,
isCriticalFailure = entry.value.isCriticalFailure ?: false,
)
}
}
}
}