From df62372b76b041e4298552b447fbd047c9e5b066 Mon Sep 17 00:00:00 2001 From: Austin Lee Date: Mon, 10 Aug 2026 01:31:24 +0900 Subject: [PATCH] fix(schaledb): accept fractional skill effect values --- internal/types/schaledb_students.go | 2 +- internal/types/schaledb_students_test.go | 30 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 internal/types/schaledb_students_test.go diff --git a/internal/types/schaledb_students.go b/internal/types/schaledb_students.go index 756c74b..e6e4bf8 100644 --- a/internal/types/schaledb_students.go +++ b/internal/types/schaledb_students.go @@ -130,7 +130,7 @@ type SkillEffect struct { Restrictions []SkillRestriction `json:"Restrictions,omitempty"` Target []string `json:"Target,omitempty"` Scale []int `json:"Scale,omitempty"` - Value [][]int `json:"Value,omitempty"` + Value [][]float64 `json:"Value,omitempty"` AdditionalValue any `json:"AdditionalValue,omitempty"` Stat string `json:"Stat,omitempty"` Duration int `json:"Duration,omitempty"` diff --git a/internal/types/schaledb_students_test.go b/internal/types/schaledb_students_test.go new file mode 100644 index 0000000..c920196 --- /dev/null +++ b/internal/types/schaledb_students_test.go @@ -0,0 +1,30 @@ +package types + +import ( + "encoding/json" + "testing" +) + +func TestStudentDataUnmarshalsFractionalSkillEffectValue(t *testing.T) { + const data = `{ + "Skills": { + "Ex": { + "Desc": "", + "Effects": [{ + "Type": "Buff", + "Value": [[3197, 3676], [3836.3999999999996, 4411.2]] + }] + } + } + }` + + var student StudentData + if err := json.Unmarshal([]byte(data), &student); err != nil { + t.Fatalf("unmarshal student data: %v", err) + } + + got := student.Skills.Ex.Effects[0].Value[1][0] + if got != 3836.3999999999996 { + t.Fatalf("fractional effect value = %v, want 3836.3999999999996", got) + } +}