horsegen: generate keyed struct literals

This commit is contained in:
2026-01-16 22:01:10 -05:00
parent 5576dd8d3f
commit cb1c51db05
4 changed files with 7646 additions and 8486 deletions

View File

@@ -14,26 +14,32 @@ const (
var AllSkills = map[SkillID]Skill{
{{- range $s := $.Skills }}
Skill{{ goenum $s.Name }}{{ if ne $s.InheritID 0 }}Inherit{{ end }}: {
{{ $s.ID }},
{{ printf "%q" $s.Name }}{{ if ne $s.InheritID 0 }} + " (Inherited)"{{ end }},
{{ printf "%q" $s.Description }},
{{ $s.GroupID }},
{{ $s.Rarity }},
{{ $s.GroupRate }},
{{ $s.GradeValue }},
{{ $s.WitCheck }},
[]Activation{
ID: {{ $s.ID }},
Name: {{ printf "%q" $s.Name }}{{ if ne $s.InheritID 0 }} + " (Inherited)"{{ end }},
Description: {{ printf "%q" $s.Description }},
Group: {{ $s.GroupID }},
Rarity: {{ $s.Rarity }},
GroupRate: {{ $s.GroupRate }},
GradeValue: {{ $s.GradeValue }},
{{- if $s.WitCheck }}
WitCheck: {{ $s.WitCheck }},
{{- end }}
Activations: []Activation{
{{- range $a := $s.Activations }}
{{- if ne $a.Condition "" }}
{
{{ printf "%q" $a.Precondition }},
{{ printf "%q" $a.Condition }},
{{ $a.Duration }},
{{ $a.Cooldown }},
[]Ability{
{{- if $a.Precondition }}
Precondition: {{ printf "%q" $a.Precondition }},
{{- end }}
Condition: {{ printf "%q" $a.Condition }},
Duration: {{ $a.Duration }},
{{- if $a.Cooldown }}
Cooldown: {{ $a.Cooldown }},
{{- end }}
Abilities: []Ability{
{{- range $abil := $a.Abilities }}
{{- if ne $abil.Type 0 }}
{ {{- $abil.Type }}, {{ $abil.ValueUsage }}, {{ $abil.Value }}, {{ $abil.Target }}, {{ $abil.TargetValue -}} },
{Type: {{ $abil.Type }}, ValueUsage: {{ $abil.ValueUsage }}, Value: {{ $abil.Value }}, Target: {{ $abil.Target }}, TargetValue: {{ $abil.TargetValue -}} },
{{- end }}
{{- end }}
},
@@ -41,8 +47,10 @@ var AllSkills = map[SkillID]Skill{
{{- end }}
{{- end }}
},
{{ $s.SPCost }},
{{ $s.IconID }},
{{- if $s.SPCost }}
SPCost: {{ $s.SPCost }},
{{- end }}
IconID: {{ $s.IconID }},
},
{{- end }}
}
@@ -58,4 +66,4 @@ var SkillGroups = map[int32][4]SkillID{
{{ $g.ID }}: { {{- range $s := index $.Related $g.ID }}Skill{{ goenum $s.Name }}{{ if ne $s.InheritID 0 }}Inherit{{ end }}, {{ end -}} },
{{- end }}
}
{{ end }}
{{ end }}