Add alteration management for skill
This commit is contained in:
parent
a0251cbeee
commit
2b040afd5c
3 changed files with 39 additions and 2 deletions
|
|
@ -939,6 +939,42 @@ class DiceThrowUseCase @Inject constructor(
|
|||
)
|
||||
allValue.add(result.value)
|
||||
|
||||
// fetch and build a list of dice roll base on alterations.
|
||||
val diceAlterationBonus = alterations[Property.SKILL]?.flatMap { status ->
|
||||
status.dices.map { dice ->
|
||||
val localRoll = roll(
|
||||
amount = if (alterations.isCritical) dice.count * 2 else dice.count,
|
||||
faces = dice.faces,
|
||||
advantage = dice.advantage,
|
||||
disadvantage = dice.disadvantage,
|
||||
fail = dice.fail
|
||||
)
|
||||
allValue.add(localRoll.value)
|
||||
ThrowsCardUio.Detail(
|
||||
title = dice.title,
|
||||
throws = ThrowsCardUio.Throw(
|
||||
dice = dice.faces.icon,
|
||||
advantage = dice.advantage,
|
||||
disadvantage = dice.disadvantage,
|
||||
roll = "${dice.count}d${dice.faces}",
|
||||
result = localRoll.label,
|
||||
),
|
||||
result = "${localRoll.value}",
|
||||
)
|
||||
}
|
||||
} ?: emptyList()
|
||||
|
||||
// fetch and build a list of flat bonus
|
||||
val flatAlterationBonus = alterations[Property.SKILL]?.flatMap { status ->
|
||||
status.bonus.map { bonus ->
|
||||
allValue.add(bonus.value)
|
||||
ThrowsCardUio.Detail(
|
||||
title = bonus.title,
|
||||
result = "${bonus.value}",
|
||||
)
|
||||
}
|
||||
} ?: emptyList()
|
||||
|
||||
// fetch and build the associated characteristic
|
||||
val relatedStatBonus = skill?.effect?.modifier?.mapNotNull { property ->
|
||||
when (property) {
|
||||
|
|
@ -995,7 +1031,7 @@ class DiceThrowUseCase @Inject constructor(
|
|||
),
|
||||
result = "${result.value}",
|
||||
),
|
||||
) + relatedStatBonus,
|
||||
) + diceAlterationBonus + flatAlterationBonus + relatedStatBonus,
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue