Change the behavior of the dice
This commit is contained in:
parent
bb0e10c1ad
commit
2c6fc19a2c
6 changed files with 61 additions and 35 deletions
|
|
@ -613,25 +613,25 @@ class DiceThrowUseCase @Inject constructor(
|
|||
)
|
||||
} ?: emptyList()
|
||||
|
||||
// compute the final roll result
|
||||
val rollResult = when (result.value) {
|
||||
1, 20 -> "${result.value}"
|
||||
else -> "${allValue.sum()}"
|
||||
}
|
||||
|
||||
// build the result.
|
||||
return DiceThrowResult(
|
||||
dice = RollDiceUio(
|
||||
isCriticalSuccess = result.value == 20,
|
||||
isCriticalFailure = result.value == 1,
|
||||
result = "${result.value}",
|
||||
result = rollResult,
|
||||
),
|
||||
card = ThrowsCardUio(
|
||||
title = abilityTitleString.uppercase(),
|
||||
highlight = abilityLabelString.uppercase(),
|
||||
dice = R.drawable.ic_d20_24,
|
||||
roll = allValue.toLabel(),
|
||||
result = "${
|
||||
when (result.value) {
|
||||
20 -> 20
|
||||
1 -> 1
|
||||
else -> allValue.sum()
|
||||
}
|
||||
}",
|
||||
result = rollResult,
|
||||
isCriticalSuccess = result.value == 20,
|
||||
isCriticalFailure = result.value == 1,
|
||||
details = listOf(
|
||||
|
|
@ -718,13 +718,20 @@ class DiceThrowUseCase @Inject constructor(
|
|||
)
|
||||
} ?: emptyList()
|
||||
|
||||
// compute the final roll result
|
||||
val rollResult = when {
|
||||
canMakeCriticalRoll && result.value == 20 -> "20"
|
||||
canMakeCriticalRoll && result.value == 1 -> "1"
|
||||
else -> "${allValue.sum()}"
|
||||
}
|
||||
|
||||
// build the result.
|
||||
return DiceThrowResult(
|
||||
dice = RollDiceUio(
|
||||
icon = diceThrow?.faces?.icon ?: R.drawable.ic_d20_24,
|
||||
isCriticalSuccess = canMakeCriticalRoll && result.value == 20,
|
||||
isCriticalFailure = canMakeCriticalRoll && result.value == 1,
|
||||
result = "${result.value}",
|
||||
result = rollResult,
|
||||
),
|
||||
card = ThrowsCardUio(
|
||||
title = titleString.uppercase(),
|
||||
|
|
@ -733,13 +740,7 @@ class DiceThrowUseCase @Inject constructor(
|
|||
isCriticalSuccess = canMakeCriticalRoll && result.value == 20,
|
||||
isCriticalFailure = canMakeCriticalRoll && result.value == 1,
|
||||
roll = allValue.toLabel(),
|
||||
result = "${
|
||||
when {
|
||||
canMakeCriticalRoll && result.value == 20 -> 20
|
||||
canMakeCriticalRoll && result.value == 1 -> 1
|
||||
else -> allValue.sum()
|
||||
}
|
||||
}",
|
||||
result = rollResult,
|
||||
details = listOf(
|
||||
ThrowsCardUio.Detail(
|
||||
title = action,
|
||||
|
|
@ -799,18 +800,21 @@ class DiceThrowUseCase @Inject constructor(
|
|||
// fetch and build the associated characteristic
|
||||
val relatedStatBonus = spell?.effect.statBonus(name = spellName)
|
||||
|
||||
// compute the final roll result
|
||||
val rollResult = "${allValue.sum()}"
|
||||
|
||||
// build the result.
|
||||
return DiceThrowResult(
|
||||
dice = RollDiceUio(
|
||||
icon = (spell?.effect?.faces ?: 4).icon,
|
||||
result = "${result.value}",
|
||||
result = rollResult,
|
||||
),
|
||||
card = ThrowsCardUio(
|
||||
title = titleString.uppercase(),
|
||||
highlight = spellName,
|
||||
dice = (spell?.effect?.faces ?: 4).icon,
|
||||
roll = allValue.toLabel(),
|
||||
result = "${allValue.sum()}",
|
||||
result = rollResult,
|
||||
details = listOf(
|
||||
ThrowsCardUio.Detail(
|
||||
title = spellName,
|
||||
|
|
@ -852,18 +856,21 @@ class DiceThrowUseCase @Inject constructor(
|
|||
// fetch and build the associated characteristic, proficiency or level
|
||||
val relatedStatBonus = skill?.effect.statBonus(name = skill?.name)
|
||||
|
||||
// compute the final roll result
|
||||
val rollResult = "${allValue.sum()}"
|
||||
|
||||
// build the result.
|
||||
return DiceThrowResult(
|
||||
dice = RollDiceUio(
|
||||
icon = (skill?.effect?.faces ?: 4).icon,
|
||||
result = "${result.value}",
|
||||
result = rollResult,
|
||||
),
|
||||
card = ThrowsCardUio(
|
||||
title = titleString.uppercase(),
|
||||
highlight = spellName,
|
||||
dice = (skill?.effect?.faces ?: 4).icon,
|
||||
roll = allValue.toLabel(),
|
||||
result = "${allValue.sum()}",
|
||||
result = rollResult,
|
||||
details = listOf(
|
||||
ThrowsCardUio.Detail(
|
||||
title = spellName,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue