Add mastery and expertise to alteration

This commit is contained in:
Thomas Andres Gomez 2023-12-22 14:07:57 +01:00
parent cc9c0460f0
commit 1a07f5287f
6 changed files with 412 additions and 302 deletions

View file

@ -26,6 +26,7 @@ import com.pixelized.rplexicon.utilitary.extentions.local.fail
import com.pixelized.rplexicon.utilitary.extentions.local.isBrutalCritical
import com.pixelized.rplexicon.utilitary.extentions.local.isCritical
import com.pixelized.rplexicon.utilitary.extentions.local.isSavageAttacks
import com.pixelized.rplexicon.utilitary.extentions.local.mastery
import com.pixelized.rplexicon.utilitary.extentions.local.sum
import com.pixelized.rplexicon.utilitary.extentions.local.toStatus
import com.pixelized.rplexicon.utilitary.extentions.modifier
@ -612,7 +613,8 @@ class DiceThrowUseCase @Inject constructor(
Property.STEALTH -> character.stealth
Property.SURVIVAL -> character.survival
else -> null
}?.let { multiplier ->
}?.let {
val multiplier = max(it, status[ability].mastery)
val mastery = character.proficiency * multiplier
allValue.add(mastery)
listOf(

View file

@ -10,6 +10,8 @@ data class Alteration(
val name: String,
val advantage: Boolean = false,
val disadvantage: Boolean = false,
val mastery: Boolean = false,
val expertise: Boolean = false,
val fail: Boolean = false,
val critical: Boolean = false,
val dices: List<Roll.Dice> = emptyList(),

View file

@ -84,25 +84,12 @@ class AlterationParser @Inject constructor(
private fun parseAlterationStatus(name: String, value: String): Alteration.Status =
when (value) {
ADVANTAGE -> Alteration.Status(
name = name,
advantage = true,
)
DISADVANTAGE -> Alteration.Status(
name = name,
disadvantage = true,
)
FAIL -> Alteration.Status(
name = name,
fail = true,
)
CRITICAL -> Alteration.Status(
name = name,
critical = true,
)
ADVANTAGE -> Alteration.Status(name = name, advantage = true)
DISADVANTAGE -> Alteration.Status(name = name, disadvantage = true)
MASTERY -> Alteration.Status(name = name, mastery = true)
EXPERTISE -> Alteration.Status(name = name, expertise = true)
FAIL -> Alteration.Status(name = name, fail = true)
CRITICAL -> Alteration.Status(name = name, critical = true)
else -> {
Alteration.Status(
@ -117,6 +104,8 @@ class AlterationParser @Inject constructor(
private const val ALL = "Tous"
private const val ADVANTAGE = "adv"
private const val DISADVANTAGE = "dis"
private const val MASTERY = "mas"
private const val EXPERTISE = "exp"
private const val FAIL = "fail"
private const val CRITICAL = "crit"
private const val EFFECT = "Effet"

View file

@ -10,10 +10,12 @@ import com.pixelized.rplexicon.ui.screens.character.composable.character.Passive
import com.pixelized.rplexicon.ui.screens.character.composable.character.ProficiencyUio
import com.pixelized.rplexicon.ui.screens.character.composable.character.StatUio
import com.pixelized.rplexicon.ui.screens.character.pages.proficiency.CharacterSheetUio
import com.pixelized.rplexicon.utilitary.extentions.local.mastery
import com.pixelized.rplexicon.utilitary.extentions.local.passivesBonus
import com.pixelized.rplexicon.utilitary.extentions.local.sum
import com.pixelized.rplexicon.utilitary.extentions.modifier
import javax.inject.Inject
import kotlin.math.max
class CharacterSheetUioFactory @Inject constructor() {
@ -68,138 +70,213 @@ class CharacterSheetUioFactory @Inject constructor() {
),
),
savingThrows = listOf(
ProficiencyUio(
id = ProficiencyUio.ID.STRENGTH_SAVING_THROW,
multiplier = sheet.strengthSavingThrows,
modifier = strength.modifier + status[Property.STRENGTH_SAVING_THROW].sum + sheet.strengthSavingThrows * proficiency,
),
ProficiencyUio(
id = ProficiencyUio.ID.DEXTERITY_SAVING_THROW,
multiplier = sheet.dexteritySavingThrows,
modifier = dexterity.modifier + status[Property.DEXTERITY_SAVING_THROW].sum + sheet.dexteritySavingThrows * proficiency,
),
ProficiencyUio(
id = ProficiencyUio.ID.CONSTITUTION_SAVING_THROW,
multiplier = sheet.constitutionSavingThrows,
modifier = constitution.modifier + status[Property.CONSTITUTION_SAVING_THROW].sum + sheet.constitutionSavingThrows * proficiency,
),
ProficiencyUio(
id = ProficiencyUio.ID.INTELLIGENCE_SAVING_THROW,
multiplier = sheet.intelligenceSavingThrows,
modifier = intelligence.modifier + status[Property.INTELLIGENCE_SAVING_THROW].sum + sheet.intelligenceSavingThrows * proficiency,
),
ProficiencyUio(
id = ProficiencyUio.ID.WISDOM_SAVING_THROW,
multiplier = sheet.wisdomSavingThrows,
modifier = wisdom.modifier + status[Property.WISDOM_SAVING_THROW].sum + sheet.wisdomSavingThrows * proficiency,
),
ProficiencyUio(
id = ProficiencyUio.ID.CHARISMA_SAVING_THROW,
multiplier = sheet.charismaSavingThrows,
modifier = charisma.modifier + status[Property.CHARISMA_SAVING_THROW].sum + sheet.charismaSavingThrows * proficiency,
),
status[Property.STRENGTH_SAVING_THROW].let {
val mastery = max(sheet.strengthSavingThrows, it.mastery)
ProficiencyUio(
id = ProficiencyUio.ID.STRENGTH_SAVING_THROW,
multiplier = mastery,
modifier = strength.modifier + it.sum + mastery * proficiency
)
},
status[Property.DEXTERITY_SAVING_THROW].let {
val mastery = max(sheet.dexteritySavingThrows, it.mastery)
ProficiencyUio(
id = ProficiencyUio.ID.DEXTERITY_SAVING_THROW,
multiplier = mastery,
modifier = dexterity.modifier + it.sum + mastery * proficiency
)
},
status[Property.CONSTITUTION_SAVING_THROW].let {
val mastery = max(sheet.constitutionSavingThrows, it.mastery)
ProficiencyUio(
id = ProficiencyUio.ID.CONSTITUTION_SAVING_THROW,
multiplier = mastery,
modifier = constitution.modifier + it.sum + mastery * proficiency
)
},
status[Property.INTELLIGENCE_SAVING_THROW].let {
val mastery = max(sheet.intelligenceSavingThrows, it.mastery)
ProficiencyUio(
id = ProficiencyUio.ID.INTELLIGENCE_SAVING_THROW,
multiplier = mastery,
modifier = intelligence.modifier + it.sum + mastery * proficiency
)
},
status[Property.WISDOM_SAVING_THROW].let {
val mastery = max(sheet.wisdomSavingThrows, it.mastery)
ProficiencyUio(
id = ProficiencyUio.ID.WISDOM_SAVING_THROW,
multiplier = mastery,
modifier = wisdom.modifier + it.sum + mastery * proficiency
)
},
status[Property.CHARISMA_SAVING_THROW].let {
val mastery = max(sheet.charismaSavingThrows, it.mastery)
ProficiencyUio(
id = ProficiencyUio.ID.CHARISMA_SAVING_THROW,
multiplier = mastery,
modifier = charisma.modifier + it.sum + mastery * proficiency
)
},
),
proficiencies = listOf(
ProficiencyUio(
id = ProficiencyUio.ID.ACROBATICS,
multiplier = sheet.acrobatics,
modifier = dexterity.modifier + status[Property.ACROBATICS].sum + sheet.acrobatics * proficiency,
),
ProficiencyUio(
id = ProficiencyUio.ID.ARCANA,
multiplier = sheet.arcana,
modifier = intelligence.modifier + status[Property.ARCANA].sum + sheet.arcana * proficiency,
),
ProficiencyUio(
id = ProficiencyUio.ID.ATHLETICS,
multiplier = sheet.athletics,
modifier = strength.modifier + status[Property.ATHLETICS].sum + sheet.athletics * proficiency,
),
ProficiencyUio(
id = ProficiencyUio.ID.STEALTH,
multiplier = sheet.stealth,
modifier = dexterity.modifier + status[Property.STEALTH].sum + sheet.stealth * proficiency,
),
ProficiencyUio(
id = ProficiencyUio.ID.ANIMAL_HANDLING,
multiplier = sheet.animalHandling,
modifier = wisdom.modifier + status[Property.ANIMAL_HANDLING].sum + sheet.animalHandling * proficiency,
),
ProficiencyUio(
id = ProficiencyUio.ID.SLEIGHT_OF_HAND,
multiplier = sheet.sleightOfHand,
modifier = dexterity.modifier + status[Property.SLEIGHT_OF_HAND].sum + sheet.sleightOfHand * proficiency,
),
ProficiencyUio(
id = ProficiencyUio.ID.HISTORY,
multiplier = sheet.history,
modifier = intelligence.modifier + status[Property.HISTORY].sum + sheet.history * proficiency,
),
ProficiencyUio(
id = ProficiencyUio.ID.INTIMIDATION,
multiplier = sheet.intimidation,
modifier = charisma.modifier + status[Property.INTIMIDATION].sum + sheet.intimidation * proficiency,
),
ProficiencyUio(
id = ProficiencyUio.ID.INSIGHT,
multiplier = sheet.insight,
modifier = wisdom.modifier + status[Property.INSIGHT].sum + sheet.insight * proficiency,
),
ProficiencyUio(
id = ProficiencyUio.ID.INVESTIGATION,
multiplier = sheet.investigation,
modifier = intelligence.modifier + status[Property.INVESTIGATION].sum + sheet.investigation * proficiency,
),
ProficiencyUio(
id = ProficiencyUio.ID.MEDICINE,
multiplier = sheet.medicine,
modifier = wisdom.modifier + status[Property.MEDICINE].sum + sheet.medicine * proficiency,
),
ProficiencyUio(
id = ProficiencyUio.ID.NATURE,
multiplier = sheet.nature,
modifier = intelligence.modifier + status[Property.NATURE].sum + sheet.nature * proficiency,
),
ProficiencyUio(
id = ProficiencyUio.ID.PERCEPTION,
multiplier = sheet.perception,
modifier = wisdom.modifier + status[Property.PERCEPTION].sum + sheet.perception * proficiency,
),
ProficiencyUio(
id = ProficiencyUio.ID.PERSUASION,
multiplier = sheet.persuasion,
modifier = charisma.modifier + status[Property.PERSUASION].sum + sheet.persuasion * proficiency,
),
ProficiencyUio(
id = ProficiencyUio.ID.RELIGION,
multiplier = sheet.religion,
modifier = intelligence.modifier + status[Property.RELIGION].sum + sheet.religion * proficiency,
),
ProficiencyUio(
id = ProficiencyUio.ID.PERFORMANCE,
multiplier = sheet.performance,
modifier = charisma.modifier + status[Property.PERFORMANCE].sum + sheet.performance * proficiency,
),
ProficiencyUio(
id = ProficiencyUio.ID.SURVIVAL,
multiplier = sheet.survival,
modifier = wisdom.modifier + status[Property.SURVIVAL].sum + sheet.survival * proficiency,
),
ProficiencyUio(
id = ProficiencyUio.ID.DECEPTION,
multiplier = sheet.deception,
modifier = charisma.modifier + status[Property.DECEPTION].sum + sheet.deception * proficiency,
),
status[Property.ACROBATICS].let {
val mastery = max(sheet.acrobatics, it.mastery)
ProficiencyUio(
id = ProficiencyUio.ID.ACROBATICS,
multiplier = mastery,
modifier = dexterity.modifier + it.sum + mastery * proficiency
)
},
status[Property.ARCANA].let {
val mastery = max(sheet.arcana, it.mastery)
ProficiencyUio(
id = ProficiencyUio.ID.ARCANA,
multiplier = mastery,
modifier = intelligence.modifier + it.sum + mastery * proficiency
)
},
status[Property.ATHLETICS].let {
val mastery = max(sheet.athletics, it.mastery)
ProficiencyUio(
id = ProficiencyUio.ID.ATHLETICS,
multiplier = mastery,
modifier = strength.modifier + it.sum + mastery * proficiency
)
},
status[Property.STEALTH].let {
val mastery = max(sheet.stealth, it.mastery)
ProficiencyUio(
id = ProficiencyUio.ID.STEALTH,
multiplier = mastery,
modifier = dexterity.modifier + it.sum + mastery * proficiency
)
},
status[Property.ANIMAL_HANDLING].let {
val mastery = max(sheet.animalHandling, it.mastery)
ProficiencyUio(
id = ProficiencyUio.ID.ANIMAL_HANDLING,
multiplier = mastery,
modifier = wisdom.modifier + it.sum + mastery * proficiency
)
},
status[Property.SLEIGHT_OF_HAND].let {
val mastery = max(sheet.sleightOfHand, it.mastery)
ProficiencyUio(
id = ProficiencyUio.ID.SLEIGHT_OF_HAND,
multiplier = mastery,
modifier = dexterity.modifier + it.sum + mastery * proficiency
)
},
status[Property.HISTORY].let {
val mastery = max(sheet.history, it.mastery)
ProficiencyUio(
id = ProficiencyUio.ID.HISTORY,
multiplier = mastery,
modifier = intelligence.modifier + it.sum + mastery * proficiency
)
},
status[Property.INTIMIDATION].let {
val mastery = max(sheet.intimidation, it.mastery)
ProficiencyUio(
id = ProficiencyUio.ID.INTIMIDATION,
multiplier = mastery,
modifier = charisma.modifier + it.sum + mastery * proficiency
)
},
status[Property.INSIGHT].let {
val mastery = max(sheet.insight, it.mastery)
ProficiencyUio(
id = ProficiencyUio.ID.INSIGHT,
multiplier = mastery,
modifier = wisdom.modifier + it.sum + mastery * proficiency
)
},
status[Property.INVESTIGATION].let {
val mastery = max(sheet.investigation, it.mastery)
ProficiencyUio(
id = ProficiencyUio.ID.INVESTIGATION,
multiplier = mastery,
modifier = intelligence.modifier + it.sum + mastery * proficiency
)
},
status[Property.MEDICINE].let {
val mastery = max(sheet.medicine, it.mastery)
ProficiencyUio(
id = ProficiencyUio.ID.MEDICINE,
multiplier = mastery,
modifier = wisdom.modifier + it.sum + mastery * proficiency
)
},
status[Property.NATURE].let {
val mastery = max(sheet.nature, it.mastery)
ProficiencyUio(
id = ProficiencyUio.ID.NATURE,
multiplier = mastery,
modifier = intelligence.modifier + it.sum + mastery * proficiency
)
},
status[Property.PERCEPTION].let {
val mastery = max(sheet.perception, it.mastery)
ProficiencyUio(
id = ProficiencyUio.ID.PERCEPTION,
multiplier = mastery,
modifier = wisdom.modifier + it.sum + mastery * proficiency
)
},
status[Property.PERSUASION].let {
val mastery = max(sheet.persuasion, it.mastery)
ProficiencyUio(
id = ProficiencyUio.ID.PERSUASION,
multiplier = mastery,
modifier = charisma.modifier + it.sum + mastery * proficiency
)
},
status[Property.RELIGION].let {
val mastery = max(sheet.religion, it.mastery)
ProficiencyUio(
id = ProficiencyUio.ID.RELIGION,
multiplier = mastery,
modifier = intelligence.modifier + it.sum + mastery * proficiency
)
},
status[Property.PERFORMANCE].let {
val mastery = max(sheet.performance, it.mastery)
ProficiencyUio(
id = ProficiencyUio.ID.PERFORMANCE,
multiplier = mastery,
modifier = charisma.modifier + it.sum + mastery * proficiency
)
},
status[Property.SURVIVAL].let {
val mastery = max(sheet.survival, it.mastery)
ProficiencyUio(
id = ProficiencyUio.ID.SURVIVAL,
multiplier = mastery,
modifier = wisdom.modifier + it.sum + mastery * proficiency
)
},
status[Property.DECEPTION].let {
val mastery = max(sheet.deception, it.mastery)
ProficiencyUio(
id = ProficiencyUio.ID.DECEPTION,
multiplier = mastery,
modifier = charisma.modifier + it.sum + mastery * proficiency
)
},
),
passives = PassivesUio(
perception = status[Property.PERCEPTION].let {
10 + wisdom.modifier + it.sum + sheet.perception * proficiency + it.passivesBonus
val mastery = max(sheet.perception, it.mastery)
10 + wisdom.modifier + it.sum + mastery * proficiency + it.passivesBonus
},
investigation = status[Property.INVESTIGATION].let {
10 + intelligence.modifier + it.sum + sheet.investigation * proficiency + it.passivesBonus
val mastery = max(sheet.investigation, it.mastery)
10 + intelligence.modifier + it.sum + mastery * proficiency + it.passivesBonus
},
insight = status[Property.INSIGHT].let {
10 + wisdom.modifier + it.sum + sheet.insight * proficiency + it.passivesBonus
val mastery = max(sheet.insight, it.mastery)
10 + wisdom.modifier + it.sum + mastery * proficiency + it.passivesBonus
},
),
speed = LabelPointUio(

View file

@ -22,6 +22,7 @@ import com.pixelized.rplexicon.ui.screens.summary.composable.common.maxLabel
import com.pixelized.rplexicon.ui.screens.summary.composable.common.none
import com.pixelized.rplexicon.ui.screens.summary.composable.common.proficiency
import com.pixelized.rplexicon.utilitary.extentions.local.highestSpellLevel
import com.pixelized.rplexicon.utilitary.extentions.local.mastery
import com.pixelized.rplexicon.utilitary.extentions.local.passivesBonus
import com.pixelized.rplexicon.utilitary.extentions.local.spell
import com.pixelized.rplexicon.utilitary.extentions.local.sum
@ -34,6 +35,7 @@ import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import javax.inject.Inject
import kotlin.math.max
private const val ENTER_ANIMATION_INITIAL_DELAY = 250L
private const val ENTER_ANIMATION_DELAY = 100L
@ -263,42 +265,50 @@ class SummaryFactory @Inject constructor(
val wisdom = sheet.wisdom + status[Property.WISDOM].sum
val charisma = sheet.charisma + status[Property.CHARISMA].sum
val strengthSavingThrows = proficiency(
multiplier = sheet.strengthSavingThrows,
label = status[Property.STRENGTH_SAVING_THROW].let {
strength.modifier + it.sum + sheet.strengthSavingThrows * proficiency
}.toLabel(),
)
val dexteritySavingThrows = proficiency(
multiplier = sheet.dexteritySavingThrows,
label = status[Property.DEXTERITY_SAVING_THROW].let {
dexterity.modifier + it.sum + sheet.dexteritySavingThrows * proficiency
}.toLabel(),
)
val constitutionSavingThrows = proficiency(
multiplier = sheet.constitutionSavingThrows,
label = status[Property.CONSTITUTION_SAVING_THROW].let {
constitution.modifier + it.sum + sheet.constitutionSavingThrows * proficiency
}.toLabel(),
)
val intelligenceSavingThrows = proficiency(
multiplier = sheet.intelligenceSavingThrows,
label = status[Property.INTELLIGENCE_SAVING_THROW].let {
intelligence.modifier + it.sum + sheet.intelligenceSavingThrows * proficiency
}.toLabel(),
)
val wisdomSavingThrows = proficiency(
multiplier = sheet.wisdomSavingThrows,
label = status[Property.WISDOM_SAVING_THROW].let {
wisdom.modifier + it.sum + sheet.wisdomSavingThrows * proficiency
}.toLabel(),
)
val charismaSavingThrows = proficiency(
multiplier = sheet.charismaSavingThrows,
label = status[Property.CHARISMA_SAVING_THROW].let {
charisma.modifier + it.sum + sheet.charismaSavingThrows * proficiency
}.toLabel(),
)
val strengthSavingThrows = status[Property.STRENGTH_SAVING_THROW].let {
val mastery = max(sheet.strengthSavingThrows, it.mastery)
proficiency(
multiplier = mastery,
label = (strength.modifier + it.sum + mastery * proficiency).toLabel(),
)
}
val dexteritySavingThrows = status[Property.DEXTERITY_SAVING_THROW].let {
val mastery = max(sheet.dexteritySavingThrows, it.mastery)
proficiency(
multiplier = mastery,
label = (dexterity.modifier + it.sum + mastery * proficiency).toLabel(),
)
}
val constitutionSavingThrows =
status[Property.CONSTITUTION_SAVING_THROW].let {
val mastery = max(sheet.constitutionSavingThrows, it.mastery)
proficiency(
multiplier = mastery,
label = (constitution.modifier + it.sum + mastery * proficiency).toLabel(),
)
}
val intelligenceSavingThrows =
status[Property.INTELLIGENCE_SAVING_THROW].let {
val mastery = max(sheet.intelligenceSavingThrows, it.mastery)
proficiency(
multiplier = mastery,
label = (intelligence.modifier + it.sum + mastery * proficiency).toLabel(),
)
}
val wisdomSavingThrows = status[Property.WISDOM_SAVING_THROW].let {
val mastery = max(sheet.wisdomSavingThrows, it.mastery)
proficiency(
multiplier = mastery,
label = (wisdom.modifier + it.sum + mastery * proficiency).toLabel(),
)
}
val charismaSavingThrows = status[Property.CHARISMA_SAVING_THROW].let {
val mastery = max(sheet.charismaSavingThrows, it.mastery)
proficiency(
multiplier = mastery,
label = (charisma.modifier + it.sum + mastery * proficiency).toLabel(),
)
}
withContext(Dispatchers.Main) {
savingThrows.strength.get(sheet)?.value = strengthSavingThrows
savingThrows.dexterity.get(sheet)?.value = dexteritySavingThrows
@ -324,114 +334,132 @@ class SummaryFactory @Inject constructor(
val wisdom = sheet.wisdom + status[Property.WISDOM].sum
val charisma = sheet.charisma + status[Property.CHARISMA].sum
val acrobatics = proficiency(
multiplier = sheet.acrobatics,
label = status[Property.ACROBATICS].let {
dexterity.modifier + it.sum + sheet.acrobatics * proficiency
}.toLabel(),
)
val arcana = proficiency(
multiplier = sheet.arcana,
label = status[Property.ARCANA].let {
intelligence.modifier + it.sum + sheet.arcana * proficiency
}.toLabel(),
)
val athletics = proficiency(
multiplier = sheet.athletics,
label = status[Property.ATHLETICS].let {
strength.modifier + it.sum + sheet.athletics * proficiency
}.toLabel(),
)
val stealth = proficiency(
multiplier = sheet.stealth,
label = status[Property.STEALTH].let {
dexterity.modifier + it.sum + sheet.stealth * proficiency
}.toLabel(),
)
val animalHandling = proficiency(
multiplier = sheet.animalHandling,
label = status[Property.ANIMAL_HANDLING].let {
wisdom.modifier + it.sum + sheet.animalHandling * proficiency
}.toLabel(),
)
val sleightOfHand = proficiency(
multiplier = sheet.sleightOfHand,
label = status[Property.SLEIGHT_OF_HAND].let {
dexterity.modifier + it.sum + sheet.sleightOfHand * proficiency
}.toLabel(),
)
val history = proficiency(
multiplier = sheet.history,
label = status[Property.HISTORY].let {
intelligence.modifier + it.sum + sheet.history * proficiency
}.toLabel(),
)
val intimidation = proficiency(
multiplier = sheet.intimidation,
label = status[Property.INTIMIDATION].let {
charisma.modifier + it.sum + sheet.intimidation * proficiency
}.toLabel(),
)
val insight = proficiency(
multiplier = sheet.insight,
label = status[Property.INSIGHT].let {
wisdom.modifier + it.sum + sheet.insight * proficiency
}.toLabel(),
)
val investigation = proficiency(
multiplier = sheet.investigation,
label = status[Property.INVESTIGATION].let {
intelligence.modifier + it.sum + sheet.investigation * proficiency
}.toLabel(),
)
val medicine = proficiency(
multiplier = sheet.medicine,
label = status[Property.MEDICINE].let {
wisdom.modifier + it.sum + sheet.medicine * proficiency
}.toLabel(),
)
val nature = proficiency(
multiplier = sheet.nature,
label = status[Property.NATURE].let {
intelligence.modifier + it.sum + sheet.nature * proficiency
}.toLabel(),
)
val perception = proficiency(
multiplier = sheet.perception,
label = status[Property.PERCEPTION].let {
wisdom.modifier + it.sum + sheet.perception * proficiency
}.toLabel(),
)
val persuasion = proficiency(
multiplier = sheet.persuasion,
label = status[Property.PERSUASION].let {
charisma.modifier + it.sum + sheet.persuasion * proficiency
}.toLabel(),
)
val religion = proficiency(
multiplier = sheet.religion,
label = status[Property.RELIGION].let {
intelligence.modifier + it.sum + sheet.religion * proficiency
}.toLabel(),
)
val performance = proficiency(
multiplier = sheet.performance,
label = status[Property.PERFORMANCE].let {
charisma.modifier + it.sum + sheet.performance * proficiency
}.toLabel(),
)
val survival = proficiency(
multiplier = sheet.survival,
label = status[Property.SURVIVAL].let {
wisdom.modifier + it.sum + sheet.survival * proficiency
}.toLabel(),
)
val deception = proficiency(
multiplier = sheet.deception,
label = status[Property.DECEPTION].let {
charisma.modifier + it.sum + sheet.deception * proficiency
}.toLabel(),
)
val acrobatics = status[Property.ACROBATICS].let {
val mastery = max(sheet.acrobatics, it.mastery)
proficiency(
multiplier = mastery,
label = (dexterity.modifier + it.sum + mastery * proficiency).toLabel(),
)
}
val arcana = status[Property.ARCANA].let {
val mastery = max(sheet.arcana, it.mastery)
proficiency(
multiplier = mastery,
label = (intelligence.modifier + it.sum + mastery * proficiency).toLabel(),
)
}
val athletics = status[Property.ATHLETICS].let {
val mastery = max(sheet.athletics, it.mastery)
proficiency(
multiplier = mastery,
label = (strength.modifier + it.sum + mastery * proficiency).toLabel(),
)
}
val stealth = status[Property.STEALTH].let {
val mastery = max(sheet.stealth, it.mastery)
proficiency(
multiplier = mastery,
label = (dexterity.modifier + it.sum + mastery * proficiency).toLabel(),
)
}
val animalHandling = status[Property.ANIMAL_HANDLING].let {
val mastery = max(sheet.animalHandling, it.mastery)
proficiency(
multiplier = mastery,
label = (wisdom.modifier + it.sum + mastery * proficiency).toLabel(),
)
}
val sleightOfHand = status[Property.SLEIGHT_OF_HAND].let {
val mastery = max(sheet.sleightOfHand, it.mastery)
proficiency(
multiplier = mastery,
label = (dexterity.modifier + it.sum + mastery * proficiency).toLabel(),
)
}
val history = status[Property.HISTORY].let {
val mastery = max(sheet.history, it.mastery)
proficiency(
multiplier = mastery,
label = (intelligence.modifier + it.sum + mastery * proficiency).toLabel(),
)
}
val intimidation = status[Property.INTIMIDATION].let {
val mastery = max(sheet.intimidation, it.mastery)
proficiency(
multiplier = mastery,
label = (charisma.modifier + it.sum + mastery * proficiency).toLabel(),
)
}
val insight = status[Property.INSIGHT].let {
val mastery = max(sheet.insight, it.mastery)
proficiency(
multiplier = mastery,
label = (wisdom.modifier + it.sum + mastery * proficiency).toLabel(),
)
}
val investigation = status[Property.INVESTIGATION].let {
val mastery = max(sheet.investigation, it.mastery)
proficiency(
multiplier = mastery,
label = (intelligence.modifier + it.sum + mastery * proficiency).toLabel(),
)
}
val medicine = status[Property.MEDICINE].let {
val mastery = max(sheet.medicine, it.mastery)
proficiency(
multiplier = mastery,
label = (wisdom.modifier + it.sum + mastery * proficiency).toLabel(),
)
}
val nature = status[Property.NATURE].let {
val mastery = max(sheet.nature, it.mastery)
proficiency(
multiplier = mastery,
label = (intelligence.modifier + it.sum + mastery * proficiency).toLabel(),
)
}
val perception = status[Property.PERCEPTION].let {
val mastery = max(sheet.perception, it.mastery)
proficiency(
multiplier = mastery,
label = (wisdom.modifier + it.sum + mastery * proficiency).toLabel(),
)
}
val persuasion = status[Property.PERSUASION].let {
val mastery = max(sheet.persuasion, it.mastery)
proficiency(
multiplier = mastery,
label = (charisma.modifier + it.sum + mastery * proficiency).toLabel(),
)
}
val religion = status[Property.RELIGION].let {
val mastery = max(sheet.religion, it.mastery)
proficiency(
multiplier = mastery,
label = (intelligence.modifier + it.sum + mastery * proficiency).toLabel(),
)
}
val performance = status[Property.PERFORMANCE].let {
val mastery = max(sheet.performance, it.mastery)
proficiency(
multiplier = mastery,
label = (charisma.modifier + it.sum + mastery * proficiency).toLabel(),
)
}
val survival = status[Property.SURVIVAL].let {
val mastery = max(sheet.survival, it.mastery)
proficiency(
multiplier = mastery,
label = (wisdom.modifier + it.sum + mastery * proficiency).toLabel(),
)
}
val deception = status[Property.DECEPTION].let {
val mastery = max(sheet.deception, it.mastery)
proficiency(
multiplier = mastery,
label = (charisma.modifier + it.sum + mastery * proficiency).toLabel(),
)
}
withContext(Dispatchers.Main) {
proficiencies.acrobatics.get(sheet)?.value = acrobatics
proficiencies.arcana.get(sheet)?.value = arcana
@ -466,21 +494,24 @@ class SummaryFactory @Inject constructor(
val intelligence = sheet.intelligence + status[Property.INTELLIGENCE].sum
val wisdom = sheet.wisdom + status[Property.WISDOM].sum
val passiveInsight = label(
label = status[Property.INSIGHT].let {
wisdom.modifier + it.sum + sheet.insight * proficiency + it.passivesBonus
}.let { "${10 + it}" },
)
val passiveInvestigation = label(
label = status[Property.INVESTIGATION].let {
intelligence.modifier + it.sum + sheet.investigation * proficiency + it.passivesBonus
}.let { "${10 + it}" },
)
val passivePerception = label(
label = status[Property.PERCEPTION].let {
wisdom.modifier + it.sum + sheet.perception * proficiency + it.passivesBonus
}.let { "${10 + it}" }
)
val passiveInsight = status[Property.INSIGHT].let {
val mastery = max(sheet.insight, it.mastery)
label(
label = "${10 + wisdom.modifier + it.sum + mastery * proficiency + it.passivesBonus}",
)
}
val passiveInvestigation = status[Property.INVESTIGATION].let {
val mastery = max(sheet.investigation, it.mastery)
label(
label = "${10 + intelligence.modifier + it.sum + mastery * proficiency + it.passivesBonus}",
)
}
val passivePerception = status[Property.PERCEPTION].let {
val mastery = max(sheet.perception, it.mastery)
label(
label = "${10 + wisdom.modifier + it.sum + mastery * proficiency + it.passivesBonus}",
)
}
withContext(Dispatchers.Main) {
passives.insight.get(sheet)?.value = passiveInsight
passives.investigation.get(sheet)?.value = passiveInvestigation

View file

@ -22,6 +22,15 @@ val List<Alteration.Status>?.advantage: Boolean
val List<Alteration.Status>?.disadvantage: Boolean
get() = this?.any { it.disadvantage } ?: false
val List<Alteration.Status>?.mastery: Int
get() = this?.maxOf {
when {
it.mastery -> 1
it.expertise -> 2
else -> 0
}
} ?: 0
val List<Alteration.Status>?.fail: Boolean
get() = this?.any { it.fail } ?: false