Remove initiative from the proficiency page, add the proficiency mastery bonus instead.

This commit is contained in:
Thomas Andres Gomez 2023-12-21 13:52:52 +01:00
parent 0e65bd540e
commit 1e3332b447
6 changed files with 13 additions and 19 deletions

View file

@ -17,8 +17,8 @@ import com.pixelized.rplexicon.ui.screens.character.pages.proficiency.CharacterS
fun rememberCharacterSheetStatePreview() = remember { fun rememberCharacterSheetStatePreview() = remember {
mutableStateOf( mutableStateOf(
CharacterSheetUio( CharacterSheetUio(
initiative = LabelPointUio( proficiency = LabelPointUio(
label = R.string.character_sheet_title_initiative, label = R.string.character_sheet_title_proficiency_bonus,
value = "+2", value = "+2",
), ),
stats = listOf( stats = listOf(

View file

@ -22,7 +22,7 @@ class CharacterSheetUioFactory @Inject constructor() {
sheet: CharacterSheet, sheet: CharacterSheet,
status: Map<Property, List<Alteration.Status>>, status: Map<Property, List<Alteration.Status>>,
): CharacterSheetUio { ): CharacterSheetUio {
val proficiency = (sheet.proficiency + status[Property.PROFICIENCY].sum) val proficiency = sheet.proficiency + status[Property.PROFICIENCY].sum
val strength = sheet.strength + status[Property.STRENGTH].sum val strength = sheet.strength + status[Property.STRENGTH].sum
val dexterity = sheet.dexterity + status[Property.DEXTERITY].sum val dexterity = sheet.dexterity + status[Property.DEXTERITY].sum
val constitution = sheet.constitution + status[Property.CONSTITUTION].sum val constitution = sheet.constitution + status[Property.CONSTITUTION].sum
@ -31,9 +31,9 @@ class CharacterSheetUioFactory @Inject constructor() {
val charisma = sheet.charisma + status[Property.CHARISMA].sum val charisma = sheet.charisma + status[Property.CHARISMA].sum
return CharacterSheetUio( return CharacterSheetUio(
initiative = LabelPointUio( proficiency = LabelPointUio(
label = R.string.character_sheet_title_initiative, label = R.string.character_sheet_title_proficiency_bonus,
value = (dexterity.modifier + status[Property.INITIATIVE].sum).toLabel(), value = "$proficiency",
max = null, max = null,
), ),
stats = listOf( stats = listOf(

View file

@ -52,7 +52,7 @@ import com.pixelized.rplexicon.utilitary.extentions.ddBorder
@Stable @Stable
data class CharacterSheetUio( data class CharacterSheetUio(
val initiative: LabelPointUio, val proficiency: LabelPointUio,
val stats: List<StatUio>, val stats: List<StatUio>,
val savingThrows: List<ProficiencyUio>, val savingThrows: List<ProficiencyUio>,
val proficiencies: List<ProficiencyUio>, val proficiencies: List<ProficiencyUio>,
@ -70,10 +70,6 @@ fun ProficiencyPage(
ProficiencyPageContent( ProficiencyPageContent(
modifier = Modifier.fillMaxSize(), modifier = Modifier.fillMaxSize(),
sheet = sheet, sheet = sheet,
onInitiative = {
overlay.prepareRoll(diceThrow = viewModel.initiativeRoll())
overlay.showOverlay()
},
onStats = { stat -> onStats = { stat ->
overlay.prepareRoll(diceThrow = viewModel.statRoll(stat.id)) overlay.prepareRoll(diceThrow = viewModel.statRoll(stat.id))
overlay.showOverlay() overlay.showOverlay()
@ -93,7 +89,6 @@ fun ProficiencyPageContent(
inner: Shape = remember { RoundedCornerShape(size = 8.dp) }, inner: Shape = remember { RoundedCornerShape(size = 8.dp) },
outline: Shape = remember { CutCornerShape(size = 16.dp) }, outline: Shape = remember { CutCornerShape(size = 16.dp) },
sheet: CharacterSheetUio, sheet: CharacterSheetUio,
onInitiative: () -> Unit,
onStats: (StatUio) -> Unit, onStats: (StatUio) -> Unit,
onProficiencies: (ProficiencyUio) -> Unit, onProficiencies: (ProficiencyUio) -> Unit,
) { ) {
@ -110,18 +105,18 @@ fun ProficiencyPageContent(
modifier = Modifier modifier = Modifier
.sizeIn(minWidth = 100.dp, minHeight = 116.dp) .sizeIn(minWidth = 100.dp, minHeight = 116.dp)
.ddBorder(outline = outline, inner = inner) .ddBorder(outline = outline, inner = inner)
.clickable(onClick = onInitiative)
.padding(all = 8.dp), .padding(all = 8.dp),
horizontalAlignment = Alignment.CenterHorizontally, horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(4.dp), verticalArrangement = Arrangement.spacedBy(4.dp),
) { ) {
Text( Text(
style = MaterialTheme.typography.labelSmall, style = MaterialTheme.typography.labelSmall,
text = sheet.initiative.label?.let { stringResource(id = it) } ?: "" textAlign = TextAlign.Center,
text = sheet.proficiency.label?.let { stringResource(id = it) } ?: ""
) )
Text( Text(
style = MaterialTheme.typography.displayMedium, style = MaterialTheme.typography.displaySmall,
text = sheet.initiative.value ?: "" text = sheet.proficiency.value ?: ""
) )
} }
sheet.stats.forEach { sheet.stats.forEach {
@ -301,7 +296,6 @@ fun ProficiencyPreview() {
val sheet by rememberCharacterSheetStatePreview() val sheet by rememberCharacterSheetStatePreview()
ProficiencyPageContent( ProficiencyPageContent(
sheet = sheet, sheet = sheet,
onInitiative = { },
onStats = { }, onStats = { },
onProficiencies = { }, onProficiencies = { },
) )

View file

@ -57,8 +57,6 @@ class ProficiencyViewModel @Inject constructor(
} }
} }
fun initiativeRoll(): DiceThrow.Initiative = DiceThrow.Initiative(character)
fun statRoll(id: StatUio.ID): DiceThrow = when (id) { fun statRoll(id: StatUio.ID): DiceThrow = when (id) {
StatUio.ID.STRENGTH -> DiceThrow.Strength(character) StatUio.ID.STRENGTH -> DiceThrow.Strength(character)
StatUio.ID.DEXTERITY -> DiceThrow.Dexterity(character) StatUio.ID.DEXTERITY -> DiceThrow.Dexterity(character)

View file

@ -101,6 +101,7 @@
<string name="character_sheet_title_inspiration">Inspiration</string> <string name="character_sheet_title_inspiration">Inspiration</string>
<string name="character_sheet_title_conduit">Conduit Divin</string> <string name="character_sheet_title_conduit">Conduit Divin</string>
<string name="character_sheet_title_initiative">Initiative</string> <string name="character_sheet_title_initiative">Initiative</string>
<string name="character_sheet_title_proficiency_bonus">Bonus de maîtrise</string>
<string name="character_sheet_title_characteristic">Caractéristiques</string> <string name="character_sheet_title_characteristic">Caractéristiques</string>
<string name="character_sheet_title_attribute">Attributs</string> <string name="character_sheet_title_attribute">Attributs</string>
<string name="character_sheet_title_passive">Talents passifs</string> <string name="character_sheet_title_passive">Talents passifs</string>

View file

@ -101,6 +101,7 @@
<string name="character_sheet_title_inspiration">Inspiration</string> <string name="character_sheet_title_inspiration">Inspiration</string>
<string name="character_sheet_title_conduit">Divine conduit</string> <string name="character_sheet_title_conduit">Divine conduit</string>
<string name="character_sheet_title_initiative">Initiative</string> <string name="character_sheet_title_initiative">Initiative</string>
<string name="character_sheet_title_proficiency_bonus">Proficiency bonus</string>
<string name="character_sheet_title_saving_throws">Saving Throws</string> <string name="character_sheet_title_saving_throws">Saving Throws</string>
<string name="character_sheet_title_proficiencies">Proficiencies</string> <string name="character_sheet_title_proficiencies">Proficiencies</string>
<string name="character_sheet_title_characteristic">Characteristics</string> <string name="character_sheet_title_characteristic">Characteristics</string>