Add level modifier to throws and refactor usecase.

This commit is contained in:
Thomas Andres Gomez 2023-11-28 16:30:11 +01:00
parent 601e1b086b
commit cbb0460bbf
6 changed files with 427 additions and 515 deletions

View file

@ -2,6 +2,7 @@ package com.pixelized.rplexicon.data.model
enum class Property(val key: String) {
PROFICIENCY("Maîtrise"),
LEVEL("Niveau"),
HIT_POINT("Point de vie"),
ARMOR_CLASS("Classe d'armure"),
INITIATIVE("Initiative"),

View file

@ -10,6 +10,7 @@ class ModifierParser @Inject constructor(
companion object {
private val MODIFIER_REGEX = Regex(
pattern = Property.PROFICIENCY.key +
"|${Property.LEVEL.key}" +
"|${Property.STRENGTH.key}" +
"|${Property.DEXTERITY.key}" +
"|${Property.CONSTITUTION.key}" +

View file

@ -64,6 +64,7 @@ class SkillsViewModel @Inject constructor(
val description = descriptionRepository.find(name = skill.name)
val modifier = skill.effect?.modifier?.sumOf {
when (it) {
Property.LEVEL -> character?.level ?: 0
Property.PROFICIENCY -> character?.proficiency ?: 0
Property.STRENGTH -> character?.strength?.modifier ?: 0
Property.DEXTERITY -> character?.dexterity?.modifier ?: 0