From 49c45610d326eca0ae840a00c786afc61357b9f4 Mon Sep 17 00:00:00 2001
From: Oskar Marquardt <oskar.marquardt@student.uni-halle.de>
Date: Sun, 16 Jun 2024 19:13:18 +0200
Subject: [PATCH] Added arete - Added remaining spheres - Forced sphere dots to
 be at most at arete level

---
 public/main.js    | 38 +++++++++++++++++++++++++++++++++++++-
 src/Character.elm | 39 ++++++++++++++++++++++++++++++++++-----
 2 files changed, 71 insertions(+), 6 deletions(-)

diff --git a/public/main.js b/public/main.js
index 037adbf..e52c120 100644
--- a/public/main.js
+++ b/public/main.js
@@ -5167,6 +5167,7 @@ var $author$project$Sphere$dots = function (value) {
 	return A3($author$project$BoundedInt$new, value, 0, 5);
 };
 var $author$project$Character$new = {
+	arete: A3($author$project$BoundedInt$new, 1, 0, 10),
 	creationPoints: {freebie: 15, spheres: 6},
 	name: 'Default Name',
 	spheres: _List_fromArray(
@@ -5180,6 +5181,41 @@ var $author$project$Character$new = {
 			affinity: false,
 			dots: $author$project$Sphere$dots(0),
 			name: 'Entropy'
+		},
+			{
+			affinity: false,
+			dots: $author$project$Sphere$dots(0),
+			name: 'Forces'
+		},
+			{
+			affinity: false,
+			dots: $author$project$Sphere$dots(0),
+			name: 'Life'
+		},
+			{
+			affinity: false,
+			dots: $author$project$Sphere$dots(0),
+			name: 'Matter'
+		},
+			{
+			affinity: false,
+			dots: $author$project$Sphere$dots(0),
+			name: 'Mind'
+		},
+			{
+			affinity: false,
+			dots: $author$project$Sphere$dots(0),
+			name: 'Prime'
+		},
+			{
+			affinity: false,
+			dots: $author$project$Sphere$dots(0),
+			name: 'Spirit'
+		},
+			{
+			affinity: false,
+			dots: $author$project$Sphere$dots(0),
+			name: 'Time'
 		}
 		])
 };
@@ -5277,7 +5313,7 @@ var $author$project$Character$changeSphere = F2(
 				return 0;
 			} else {
 				var oldDots = maybeOldDots.a;
-				return sphere.dots.value - oldDots.value;
+				return (_Utils_cmp(sphere.dots.value, character.arete.value) > 0) ? character.arete.value : (sphere.dots.value - oldDots.value);
 			}
 		}();
 		if (maybeOldDots.$ === 'Nothing') {
diff --git a/src/Character.elm b/src/Character.elm
index 9ad4726..849a3db 100644
--- a/src/Character.elm
+++ b/src/Character.elm
@@ -1,15 +1,14 @@
 module Character exposing (..)
 
 import Sphere exposing (Sphere)
-import Json.Decode exposing (int)
 import Sphere exposing (getDotsOfSphereInList)
-import BoundedInt
-import Html exposing (s)
+import BoundedInt exposing (BoundedInt)
 
 type alias Character =
     { name : String
     , creationPoints : CreationPoints
     , spheres : List Sphere
+    , arete : BoundedInt
     }
 
 type alias CreationPoints =
@@ -32,7 +31,9 @@ changeSphere character sphere =
         difference = case maybeOldDots of
             Nothing -> 0
             Just oldDots ->
-                sphere.dots.value - oldDots.value
+                if sphere.dots.value > character.arete.value
+                then character.arete.value
+                else sphere.dots.value - oldDots.value
     in
         case maybeOldDots of
             Nothing -> character
@@ -70,7 +71,6 @@ changeSphere character sphere =
                             , spheres = character.creationPoints.spheres - difference
                             }
                         }
-        -- this currently works incorrectly
 
 new : Character
 new =
@@ -88,5 +88,34 @@ new =
             , dots = Sphere.dots 0
             , affinity = False
             }
+        ,   { name = "Forces"
+            , dots = Sphere.dots 0
+            , affinity = False
+            }
+        ,   { name = "Life"
+            , dots = Sphere.dots 0
+            , affinity = False
+            }
+        ,   { name = "Matter"
+            , dots = Sphere.dots 0
+            , affinity = False
+            }
+        ,   { name = "Mind"
+            , dots = Sphere.dots 0
+            , affinity = False
+            }
+        ,   { name = "Prime"
+            , dots = Sphere.dots 0
+            , affinity = False
+            }
+        ,   { name = "Spirit"
+            , dots = Sphere.dots 0
+            , affinity = False
+            }
+        ,   { name = "Time"
+            , dots = Sphere.dots 0
+            , affinity = False
+            }
         ]
+    , arete = BoundedInt.new 1 0 10
     }
\ No newline at end of file
-- 
GitLab