Add Object / Spell alterations.
This commit is contained in:
parent
5db8e516ba
commit
ae6581219b
4 changed files with 32 additions and 8 deletions
|
|
@ -426,8 +426,8 @@ class DiceThrowUseCase @Inject constructor(
|
||||||
action = diceThrow.item,
|
action = diceThrow.item,
|
||||||
diceThrow = action?.effect,
|
diceThrow = action?.effect,
|
||||||
title = { getString(R.string.dice_roll_use_object, it) },
|
title = { getString(R.string.dice_roll_use_object, it) },
|
||||||
alterations = emptyList(),
|
alterations = alterations,
|
||||||
ability = null,
|
ability = Property.OBJECT_EFFECT,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -702,10 +702,10 @@ class DiceThrowUseCase @Inject constructor(
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
diceThrow?.amount
|
diceThrow?.amount
|
||||||
} ?: 1
|
}
|
||||||
// main roll
|
// main roll
|
||||||
val result = roll(
|
val result = roll(
|
||||||
amount = amount,
|
amount = amount ?: 1,
|
||||||
faces = diceThrow?.faces ?: 20,
|
faces = diceThrow?.faces ?: 20,
|
||||||
advantage = advantage,
|
advantage = advantage,
|
||||||
disadvantage = disadvantage,
|
disadvantage = disadvantage,
|
||||||
|
|
@ -785,10 +785,16 @@ class DiceThrowUseCase @Inject constructor(
|
||||||
val spellName = spell?.spell?.name ?: ""
|
val spellName = spell?.spell?.name ?: ""
|
||||||
val titleString = application.getString(R.string.dice_roll_spell_cast, spellName)
|
val titleString = application.getString(R.string.dice_roll_spell_cast, spellName)
|
||||||
|
|
||||||
|
val advantage = status[Property.SPELL_EFFECT].advantage
|
||||||
|
val disadvantage = status[Property.SPELL_EFFECT].disadvantage
|
||||||
// main roll
|
// main roll
|
||||||
val result = roll(
|
val result = roll(
|
||||||
amount = spell?.effect?.amount ?: 1,
|
amount = spell?.effect?.amount ?: 1,
|
||||||
faces = spell?.effect?.faces ?: 4,
|
faces = spell?.effect?.faces ?: 4,
|
||||||
|
advantage = advantage,
|
||||||
|
disadvantage = disadvantage,
|
||||||
|
fail = status[Property.SPELL_EFFECT].fail,
|
||||||
|
critical = status[Property.SPELL_EFFECT].critical,
|
||||||
)
|
)
|
||||||
|
|
||||||
// fetch and build a list of additionnal level effect.
|
// fetch and build a list of additionnal level effect.
|
||||||
|
|
@ -797,12 +803,18 @@ class DiceThrowUseCase @Inject constructor(
|
||||||
val localRoll = roll(
|
val localRoll = roll(
|
||||||
amount = spell.level.amount,
|
amount = spell.level.amount,
|
||||||
faces = spell.level.faces,
|
faces = spell.level.faces,
|
||||||
|
advantage = advantage,
|
||||||
|
disadvantage = disadvantage,
|
||||||
|
fail = status[Property.SPELL_EFFECT].fail,
|
||||||
|
critical = status[Property.SPELL_EFFECT].critical,
|
||||||
)
|
)
|
||||||
ThrowsCardUio.Detail(
|
ThrowsCardUio.Detail(
|
||||||
title = application.getString(R.string.spell_level_chooser_label, "$it"),
|
title = application.getString(R.string.spell_level_chooser_label, "$it"),
|
||||||
throws = ThrowsCardUio.Throw(
|
throws = ThrowsCardUio.Throw(
|
||||||
dice = spell.level.faces.icon,
|
dice = spell.level.faces.icon,
|
||||||
roll = "${spell.level.amount}d${spell.level.faces}",
|
roll = "${spell.level.amount}d${spell.level.faces}",
|
||||||
|
advantage = advantage,
|
||||||
|
disadvantage = disadvantage,
|
||||||
result = localRoll.label,
|
result = localRoll.label,
|
||||||
),
|
),
|
||||||
result = "${localRoll.value}",
|
result = "${localRoll.value}",
|
||||||
|
|
@ -836,6 +848,8 @@ class DiceThrowUseCase @Inject constructor(
|
||||||
throws = ThrowsCardUio.Throw(
|
throws = ThrowsCardUio.Throw(
|
||||||
dice = (spell?.effect?.faces ?: 4).icon,
|
dice = (spell?.effect?.faces ?: 4).icon,
|
||||||
roll = "${spell?.effect?.amount ?: 1}d${spell?.effect?.faces ?: 4}",
|
roll = "${spell?.effect?.amount ?: 1}d${spell?.effect?.faces ?: 4}",
|
||||||
|
advantage = advantage,
|
||||||
|
disadvantage = disadvantage,
|
||||||
result = result.label,
|
result = result.label,
|
||||||
),
|
),
|
||||||
result = "${result.value}",
|
result = "${result.value}",
|
||||||
|
|
@ -856,10 +870,16 @@ class DiceThrowUseCase @Inject constructor(
|
||||||
val spellName = skill?.name
|
val spellName = skill?.name
|
||||||
val titleString = application.getString(R.string.dice_roll_spell_cast, spellName)
|
val titleString = application.getString(R.string.dice_roll_spell_cast, spellName)
|
||||||
|
|
||||||
|
val advantage = status[Property.SKILL].advantage
|
||||||
|
val disadvantage = status[Property.SKILL].disadvantage
|
||||||
// main roll
|
// main roll
|
||||||
val result = roll(
|
val result = roll(
|
||||||
amount = skill?.effect?.amount ?: 1,
|
amount = skill?.effect?.amount ?: 1,
|
||||||
faces = skill?.effect?.faces ?: 4,
|
faces = skill?.effect?.faces ?: 4,
|
||||||
|
advantage = advantage,
|
||||||
|
disadvantage = disadvantage,
|
||||||
|
fail = status[Property.SKILL].fail,
|
||||||
|
critical = status[Property.SKILL].critical,
|
||||||
)
|
)
|
||||||
|
|
||||||
// fetch and build a list of dice roll base on alterations.
|
// fetch and build a list of dice roll base on alterations.
|
||||||
|
|
@ -892,6 +912,8 @@ class DiceThrowUseCase @Inject constructor(
|
||||||
throws = ThrowsCardUio.Throw(
|
throws = ThrowsCardUio.Throw(
|
||||||
dice = (skill?.effect?.faces ?: 4).icon,
|
dice = (skill?.effect?.faces ?: 4).icon,
|
||||||
roll = "${skill?.effect?.amount ?: 1}d${skill?.effect?.faces ?: 4}",
|
roll = "${skill?.effect?.amount ?: 1}d${skill?.effect?.faces ?: 4}",
|
||||||
|
advantage = advantage,
|
||||||
|
disadvantage = disadvantage,
|
||||||
result = result.label,
|
result = result.label,
|
||||||
),
|
),
|
||||||
result = "${result.value}",
|
result = "${result.value}",
|
||||||
|
|
|
||||||
|
|
@ -50,4 +50,6 @@ enum class Property(val key: String) {
|
||||||
PHYSICAL_RANGE_DAMAGE("Dommage physique à distance"),
|
PHYSICAL_RANGE_DAMAGE("Dommage physique à distance"),
|
||||||
SPELL_ATTACK("Attaque sortilège"),
|
SPELL_ATTACK("Attaque sortilège"),
|
||||||
SPELL_DAMAGE("Dommage sortilège"),
|
SPELL_DAMAGE("Dommage sortilège"),
|
||||||
|
SPELL_EFFECT("Effet des objects"),
|
||||||
|
OBJECT_EFFECT("Effet des sortilège")
|
||||||
}
|
}
|
||||||
|
|
@ -225,8 +225,8 @@ private fun ThrowsRollDetail(
|
||||||
.align(alignment = Alignment.Bottom)
|
.align(alignment = Alignment.Bottom)
|
||||||
.padding(bottom = 2.dp),
|
.padding(bottom = 2.dp),
|
||||||
tint = when {
|
tint = when {
|
||||||
it.advantage -> MaterialTheme.colorScheme.primary
|
it.advantage && !it.disadvantage -> MaterialTheme.colorScheme.primary
|
||||||
it.disadvantage -> Color.Red
|
it.disadvantage && !it.advantage -> Color.Red
|
||||||
else -> MaterialTheme.colorScheme.onSurface
|
else -> MaterialTheme.colorScheme.onSurface
|
||||||
},
|
},
|
||||||
painter = painterResource(id = it.dice),
|
painter = painterResource(id = it.dice),
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ class AlterationFactory @Inject constructor(
|
||||||
character = diceThrow.character,
|
character = diceThrow.character,
|
||||||
spell = diceThrow.spell,
|
spell = diceThrow.spell,
|
||||||
)
|
)
|
||||||
spell?.effect?.modifier ?: emptyList()
|
listOf(Property.SPELL_EFFECT) + (spell?.effect?.modifier ?: emptyList())
|
||||||
}
|
}
|
||||||
|
|
||||||
is DiceThrow.Skill -> {
|
is DiceThrow.Skill -> {
|
||||||
|
|
@ -128,7 +128,7 @@ class AlterationFactory @Inject constructor(
|
||||||
listOf(Property.SKILL) + (skill?.effect?.modifier ?: emptyList())
|
listOf(Property.SKILL) + (skill?.effect?.modifier ?: emptyList())
|
||||||
}
|
}
|
||||||
|
|
||||||
is DiceThrow.Object -> emptyList()
|
is DiceThrow.Object -> listOf(Property.OBJECT_EFFECT)
|
||||||
}
|
}
|
||||||
|
|
||||||
return alterationRepository
|
return alterationRepository
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue