horsegen: generate map of skill names to ids
This commit is contained in:
111
character.go
111
character.go
File diff suppressed because one or more lines are too long
@@ -10,7 +10,7 @@ This file is my notes from exploring the database.
|
||||
- 47 is skill names, 48 is skill descriptions
|
||||
- 75 is support card names incl. variant, 76 is support card variant, 77 is support card character
|
||||
- 147 is spark names, 172 is spark descriptions
|
||||
- 33 is race names
|
||||
- 33 is race names by race id, 28 is race names by race instance id, 31 is race courses
|
||||
- 65 is player titles, 66 is title descriptions - ties with honor_data?
|
||||
|
||||
# succession factor (sparks)
|
||||
@@ -189,7 +189,8 @@ seems to be activate_lot = 1 means wit check, 0 means guaranteed
|
||||
|
||||
- group 1, grade: g1 100, g2 200, g3 300, op 400, pre-op 700
|
||||
- group 61 is ....?? don't match anything
|
||||
- takarazuka kinen, kikuka sho, and tenno sho spring are defined twice???
|
||||
- several races are defined twice for "weird" races that appear in certain careers (maruzensky's 5 opponent spring stakes, mcqueen/ryan/rice's kyoto takarazuka kinen, &c.); these **do not** count as the same race as the normal versions for shared saddle bonus
|
||||
|
||||
single_mode_wins_saddle defines titles (classic triple crown, tenno sweep, &c.) using win_saddle_type = 0
|
||||
|
||||
# trainee definitions
|
||||
@@ -198,7 +199,7 @@ single_mode_wins_saddle defines titles (classic triple crown, tenno sweep, &c.)
|
||||
- card_rarity_data has per-star-level stats: initial numbers, stat caps (!!), aptitudes (!!)
|
||||
- card_talent_upgrade has costs to increase potential level, but it doesn't seem to have skill sets
|
||||
- card_talent_hint_upgrade has costs to raise hint levels, but it's actually universal, only six rows
|
||||
|
||||
- single_mode_route_race is career goals (not only races)
|
||||
|
||||
# unrelated to everything
|
||||
|
||||
|
||||
@@ -32,29 +32,7 @@ var AllSkills = map[SkillID]Skill{
|
||||
[]Ability{
|
||||
{{- range $abil := $a.Abilities }}
|
||||
{{- if ne $abil.Type 0 }}
|
||||
{
|
||||
{{ if eq $abil.Type 1 -}}AbilityPassiveSpeed,
|
||||
{{ else if eq $abil.Type 2 -}}AbilityPassiveStamina,
|
||||
{{ else if eq $abil.Type 3 -}}AbilityPassivePower,
|
||||
{{ else if eq $abil.Type 4 -}}AbilityPassiveGuts,
|
||||
{{ else if eq $abil.Type 5 -}}AbilityPassiveWit,
|
||||
{{ else if eq $abil.Type 6 -}}AbilityGreatEscape,
|
||||
{{ else if eq $abil.Type 8 -}}AbilityVision,
|
||||
{{ else if eq $abil.Type 9 -}}AbilityHP,
|
||||
{{ else if eq $abil.Type 10 -}}AbilityGateDelay,
|
||||
{{ else if eq $abil.Type 13 -}}AbilityFrenzy,
|
||||
{{ else if eq $abil.Type 21 -}}AbilityCurrentSpeed,
|
||||
{{ else if eq $abil.Type 27 -}}AbilityTargetSpeed,
|
||||
{{ else if eq $abil.Type 28 -}}AbilityLaneSpeed,
|
||||
{{ else if eq $abil.Type 31 -}}AbilityAccel,
|
||||
{{ else if eq $abil.Type 35 -}}AbilityLaneChange,
|
||||
{{ else }}??? $abil.Type={{$abil.Type}}
|
||||
{{ end -}}
|
||||
{{ $abil.ValueUsage }},
|
||||
{{ $abil.Value }},
|
||||
{{ $abil.Target }},
|
||||
{{ $abil.TargetValue }},
|
||||
},
|
||||
{ {{- $abil.Type }}, {{ $abil.ValueUsage }}, {{ $abil.Value }}, {{ $abil.Target }}, {{ $abil.TargetValue -}} },
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
},
|
||||
@@ -67,4 +45,10 @@ var AllSkills = map[SkillID]Skill{
|
||||
},
|
||||
{{- end }}
|
||||
}
|
||||
|
||||
var SkillNameToID = map[string]SkillID{
|
||||
{{- range $s := $.Skills }}
|
||||
{{ printf "%q" $s.Name }}{{ if ne $s.InheritID 0 }} + " (Inherited)"{{ end }}: {{ $s.ID }},
|
||||
{{- end }}
|
||||
}
|
||||
{{ end }}
|
||||
19
skill.go
19
skill.go
@@ -1,7 +1,22 @@
|
||||
package horse
|
||||
|
||||
import "strconv"
|
||||
|
||||
type SkillID int32
|
||||
|
||||
type TenThousandths int32
|
||||
|
||||
func (x TenThousandths) String() string {
|
||||
b := make([]byte, 0, 12)
|
||||
b = strconv.AppendInt(b, int64(x/1e4), 10)
|
||||
b = append(b, '.')
|
||||
if x < 0 {
|
||||
x = -x
|
||||
}
|
||||
b = strconv.AppendInt(b, int64(x%1e4), 10)
|
||||
return string(b)
|
||||
}
|
||||
|
||||
// Skill is the internal data about a skill.
|
||||
type Skill struct {
|
||||
ID SkillID
|
||||
@@ -21,8 +36,8 @@ type Skill struct {
|
||||
type Activation struct {
|
||||
Precondition string
|
||||
Condition string
|
||||
Duration int // 1e4 scale
|
||||
Cooldown int // 1e4 scale
|
||||
Duration TenThousandths
|
||||
Cooldown TenThousandths
|
||||
Abilities []Ability
|
||||
}
|
||||
|
||||
|
||||
6027
skill_data.go
6027
skill_data.go
File diff suppressed because it is too large
Load Diff
38
skill_test.go
Normal file
38
skill_test.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package horse_test
|
||||
|
||||
import (
|
||||
"cmp"
|
||||
"slices"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"git.sunturtle.xyz/zephyr/horse"
|
||||
)
|
||||
|
||||
var SortedSkills = sync.OnceValue(func() []horse.Skill {
|
||||
skills := make([]horse.Skill, 0, len(horse.AllSkills))
|
||||
for _, v := range horse.AllSkills {
|
||||
skills = append(skills, v)
|
||||
}
|
||||
slices.SortFunc(skills, func(a, b horse.Skill) int { return cmp.Compare(a.ID, b.ID) })
|
||||
return skills
|
||||
})
|
||||
|
||||
func TestSkillStrings(t *testing.T) {
|
||||
t.Parallel()
|
||||
for _, s := range SortedSkills() {
|
||||
if n := s.ID.String(); strings.HasPrefix(n, "SkillID(") {
|
||||
t.Error(n)
|
||||
}
|
||||
// We could check that s.ID.String() matches s.Name,
|
||||
// but that may be awkward for inherited skills.
|
||||
for _, a := range s.Activations {
|
||||
for _, abil := range a.Abilities {
|
||||
if n := abil.Type.String(); strings.HasPrefix(n, "AbilityType(") {
|
||||
t.Errorf("%v %s: %s", s.ID, s.Name, n)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user