File tree Expand file tree Collapse file tree 1 file changed +24
-32
lines changed
plugin2026/src/main/kotlin/sc/plugin2026 Expand file tree Collapse file tree 1 file changed +24
-32
lines changed Original file line number Diff line number Diff line change @@ -2,43 +2,35 @@ package sc.plugin2026
2
2
3
3
import sc.api.plugins.Team
4
4
5
- // TODO include fish size - maybe a sealed class
6
-
7
- enum class FieldState {
8
- ONE ,
9
- TWO ,
10
- OBSTRUCTED ,
11
- EMPTY ;
5
+ enum class FieldState (val size : Int ) {
6
+ ONE_S (1 ),
7
+ ONE_M (2 ),
8
+ ONE_L (3 ),
9
+ TWO_S (1 ),
10
+ TWO_M (2 ),
11
+ TWO_L (3 ),
12
+ OBSTRUCTED (0 ),
13
+ EMPTY (0 );
12
14
13
- override fun toString () = when ( this ) {
14
- OBSTRUCTED -> " Krake "
15
- ONE -> " Eins "
16
- TWO -> " Zwei "
17
- else -> " empty "
18
- }
15
+ override fun toString () =
16
+ when ( this ) {
17
+ OBSTRUCTED -> " Krake "
18
+ EMPTY -> " Leer "
19
+ else -> team?.color.toString() + size.toString()
20
+ }
19
21
20
- fun asLetter () = when ( this ) {
21
- OBSTRUCTED -> ' O '
22
- ONE -> ' R '
23
- TWO -> ' B '
24
- else -> ' '
25
- }
22
+ fun asLetters () =
23
+ when ( this ) {
24
+ OBSTRUCTED -> " X "
25
+ EMPTY -> " "
26
+ else -> team?.letter.toString() + size.toString()
27
+ }
26
28
27
29
val team: Team ?
28
30
get() = when (this ) {
29
- ONE -> Team .ONE
30
- TWO -> Team .TWO
31
- OBSTRUCTED -> null
32
- EMPTY -> null
31
+ ONE_S , ONE_M , ONE_L -> Team .ONE
32
+ TWO_S , TWO_M , TWO_L -> Team .TWO
33
+ OBSTRUCTED , EMPTY -> null
33
34
}
34
35
35
- companion object {
36
- @JvmStatic
37
- fun from (team : Team ): FieldState {
38
- return when (team) {
39
- Team .ONE -> ONE
40
- Team .TWO -> TWO
41
- }
42
- }
43
- }
44
36
}
You can’t perform that action at this time.
0 commit comments