Add DC saving throw in the character sheets.
This commit is contained in:
parent
1b5dfe8552
commit
c5874fcc8c
8 changed files with 28 additions and 7 deletions
|
|
@ -17,6 +17,7 @@ data class CharacterSheet(
|
|||
val spell7: Counter?,
|
||||
val spell8: Counter?,
|
||||
val spell9: Counter?,
|
||||
val dC: Int?,
|
||||
val criticalModifier: Int, // Critical Dice Multiplier
|
||||
val armorClass: Int, // Classe d'armure
|
||||
val speed: Int, // Vitesse
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ class CharacterSheetParser @Inject constructor(
|
|||
spell9 = counterParser.parseCounter(
|
||||
value = item.parseString(SPELL_LEVEL_9)
|
||||
),
|
||||
dC = item.parseInt(DD_SAVE_THROW),
|
||||
criticalModifier = item.parseInt(CRITICAL_MODIFIER) ?: 2,
|
||||
armorClass = item.parseInt(ARMOR_CLASS) ?: 10,
|
||||
speed = item.parseInt(SPEED) ?: 10,
|
||||
|
|
@ -140,6 +141,7 @@ class CharacterSheetParser @Inject constructor(
|
|||
private const val SPELL_LEVEL_7 = "Sort de niveau 7"
|
||||
private const val SPELL_LEVEL_8 = "Sort de niveau 8"
|
||||
private const val SPELL_LEVEL_9 = "Sort de niveau 9"
|
||||
private const val DD_SAVE_THROW = "DD sauvergarde des sorts"
|
||||
private const val CRITICAL_MODIFIER = "Dé de critique"
|
||||
private const val ARMOR_CLASS = "Classe d'armure"
|
||||
private const val SPEED = "Vitesse"
|
||||
|
|
@ -192,6 +194,7 @@ class CharacterSheetParser @Inject constructor(
|
|||
SPELL_LEVEL_7,
|
||||
SPELL_LEVEL_8,
|
||||
SPELL_LEVEL_9,
|
||||
DD_SAVE_THROW,
|
||||
CRITICAL_MODIFIER,
|
||||
ARMOR_CLASS,
|
||||
SPEED,
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
|||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.pager.PagerState
|
||||
import androidx.compose.foundation.pager.rememberPagerState
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.Stable
|
||||
|
|
@ -27,6 +28,7 @@ data class CharacterSheetHeaderUio(
|
|||
val armorClass: LabelPointUio,
|
||||
val hitPoint: LabelPointUio,
|
||||
val speed: LabelPointUio,
|
||||
val dC: LabelPointUio?,
|
||||
)
|
||||
|
||||
@OptIn(ExperimentalFoundationApi::class)
|
||||
|
|
@ -55,7 +57,8 @@ fun CharacterSheetHeader(
|
|||
) {
|
||||
header.value?.armorClass?.let { LabelPoint(label = it) }
|
||||
header.value?.hitPoint?.let { LabelPoint(label = it) }
|
||||
header.value?.speed?.let { LabelPoint(label = it) }
|
||||
header.value?.dC?.let { LabelPoint(label = it) }
|
||||
header.value?.speed?.let { LabelPoint(label = it,) }
|
||||
}
|
||||
|
||||
IndicatorStep(
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.Arrangement
|
|||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
|
|
@ -16,6 +15,7 @@ import androidx.compose.ui.Alignment
|
|||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.pixelized.rplexicon.R
|
||||
|
|
@ -31,18 +31,19 @@ class LabelPointUio(
|
|||
@Composable
|
||||
fun LabelPoint(
|
||||
modifier: Modifier = Modifier,
|
||||
titleStyle: TextStyle = MaterialTheme.typography.labelSmall,
|
||||
labelStyle: TextStyle = MaterialTheme.typography.labelSmall,
|
||||
valueStyle: TextStyle = MaterialTheme.typography.headlineMedium,
|
||||
labelStyle: TextStyle = MaterialTheme.typography.titleMedium,
|
||||
maxStyle: TextStyle = MaterialTheme.typography.titleMedium,
|
||||
label: LabelPointUio,
|
||||
) {
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(4.dp),
|
||||
modifier = modifier,
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
label.label?.let {
|
||||
Text(
|
||||
style = titleStyle,
|
||||
style = labelStyle,
|
||||
fontWeight = FontWeight.Light,
|
||||
text = stringResource(id = it)
|
||||
)
|
||||
}
|
||||
|
|
@ -52,12 +53,13 @@ fun LabelPoint(
|
|||
Text(
|
||||
modifier = Modifier.alignByBaseline(),
|
||||
style = valueStyle,
|
||||
fontWeight = FontWeight.Bold,
|
||||
text = label.value ?: "0"
|
||||
)
|
||||
label.max?.let {
|
||||
Text(
|
||||
modifier = Modifier.alignByBaseline(),
|
||||
style = labelStyle,
|
||||
style = maxStyle,
|
||||
text = it,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,10 @@ fun rememberCharacterHeaderStatePreview() = remember {
|
|||
value = "30",
|
||||
max = "m",
|
||||
),
|
||||
dC = LabelPointUio(
|
||||
label = R.string.character_sheet_title_dc,
|
||||
value = "13",
|
||||
),
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
@ -36,6 +36,12 @@ class CharacterSheetHeaderUioFactory @Inject constructor() {
|
|||
value = model.hitPoint,
|
||||
max = "/ ${model.maxHitPoint}",
|
||||
),
|
||||
dC = model.dC?.let {
|
||||
LabelPointUio(
|
||||
label = R.string.character_sheet_title_dc,
|
||||
value = "$it",
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -74,6 +74,7 @@
|
|||
<string name="character_sheet_title">Feuille de personnage</string>
|
||||
<string name="character_sheet_title_hp">Point de vie</string>
|
||||
<string name="character_sheet_title_ca">CA</string>
|
||||
<string name="character_sheet_title_dc">DD</string>
|
||||
<string name="character_sheet_title_speed">Vitesse</string>
|
||||
<string name="character_sheet_title_initiative">Initiative</string>
|
||||
<string name="character_sheet_title_saving_throws">Jet de sauvegarde</string>
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@
|
|||
<string name="character_sheet_title">Character sheet</string>
|
||||
<string name="character_sheet_title_hp">HP</string>
|
||||
<string name="character_sheet_title_ca">CA</string>
|
||||
<string name="character_sheet_title_dc">DC</string>
|
||||
<string name="character_sheet_title_speed">Speed</string>
|
||||
<string name="character_sheet_title_initiative">Initiative</string>
|
||||
<string name="character_sheet_title_saving_throws">Saving Throws</string>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue