Skip to content

Commit 858e1f5

Browse files
committed
Use UInt for CN instead of Int
1 parent a359f51 commit 858e1f5

File tree

6 files changed

+12
-10
lines changed

6 files changed

+12
-10
lines changed

common/src/commonMain/kotlin/cz/frantisekmasa/wfrp_master/common/character/spells/dialog/NonCompendiumSpellForm.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ private class NonCompendiumSpellFormData(
135135
range = range.value,
136136
target = target.value,
137137
duration = duration.value,
138-
castingNumber = castingNumber.value.toInt(),
138+
castingNumber = castingNumber.value.toUInt(),
139139
effect = effect.value,
140140
)
141141

common/src/commonMain/kotlin/cz/frantisekmasa/wfrp_master/common/compendium/domain/Spell.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ data class Spell(
1717
val range: String,
1818
val target: String,
1919
val duration: String,
20-
val castingNumber: Int,
20+
val castingNumber: UInt,
2121
val effect: String,
2222
val lore: String,
2323
) : CompendiumItem<Spell>() {

common/src/commonMain/kotlin/cz/frantisekmasa/wfrp_master/common/compendium/domain/importer/grammars/SpellListGrammar.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class SpellListGrammar(private val loreName: String) : Grammar<List<Spell>>() {
3333
Spell(
3434
id = UUID.randomUUID(),
3535
name = cleanupName(parts[0]),
36-
castingNumber = parts[1].toInt(),
36+
castingNumber = parts[1].toUInt(),
3737
range = extractTextValue(range),
3838
target = extractTextValue(target),
3939
duration = extractTextValue(duration),

common/src/commonMain/kotlin/cz/frantisekmasa/wfrp_master/common/compendium/tabs/SpellCompendiumTab.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ private data class SpellFormData(
9494
range = range.value,
9595
target = target.value,
9696
duration = duration.value,
97-
castingNumber = castingNumber.value.toInt(),
97+
castingNumber = castingNumber.value.toUInt(),
9898
effect = effect.value,
9999
)
100100

common/src/commonMain/kotlin/cz/frantisekmasa/wfrp_master/common/core/domain/spells/Spell.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@ data class Spell(
2020
val range: String,
2121
val target: String,
2222
val duration: String,
23-
val castingNumber: Int,
23+
val castingNumber: UInt,
2424
val effect: String,
2525
val memorized: Boolean = true, // TODO: Remove default value and migrate stored data
2626
) : CharacterItem {
2727

2828

29-
val effectiveCastingNumber: Int get() = if (memorized) castingNumber else castingNumber * 2
29+
val effectiveCastingNumber: UInt get() = if (memorized)
30+
castingNumber
31+
else castingNumber * 2.toUInt()
3032

3133
init {
3234
require(name.isNotBlank()) { "Name must not be blank" }

common/src/commonTest/kotlin/cz/frantisekmasa/wfrp_master/common/compendium/domain/importer/grammars/SpellListGrammarTest.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class SpellListGrammarTest {
5656
Spell(
5757
id = result[0].id,
5858
name = "Push ’em",
59-
castingNumber = 6,
59+
castingNumber = 6.toUInt(),
6060
range = "You",
6161
target = "You",
6262
duration = "Instant",
@@ -73,7 +73,7 @@ class SpellListGrammarTest {
7373
Spell(
7474
id = result[1].id,
7575
name = "Teleport",
76-
castingNumber = 5,
76+
castingNumber = 5.toUInt(),
7777
range = "You",
7878
target = "You",
7979
duration = "Instant",
@@ -88,7 +88,7 @@ class SpellListGrammarTest {
8888
Spell(
8989
id = result[2].id,
9090
name = "Terrifying",
91-
castingNumber = 7,
91+
castingNumber = 7.toUInt(),
9292
range = "You",
9393
target = "You",
9494
duration = "Willpower Bonus Rounds",
@@ -98,7 +98,7 @@ class SpellListGrammarTest {
9898
Spell(
9999
id = result[3].id,
100100
name = "Ward",
101-
castingNumber = 5,
101+
castingNumber = 5.toUInt(),
102102
range = "You",
103103
target = "You",
104104
duration = "Willpower Bonus Rounds",

0 commit comments

Comments
 (0)