horsegen: generate keyed struct literals
This commit is contained in:
@@ -13,7 +13,7 @@ const (
|
||||
|
||||
var Characters = map[CharacterID]Character{
|
||||
{{- range $c := $.Characters }}
|
||||
Character{{ goenum $c.Name }}: { {{- $c.ID }}, {{ printf "%q" $c.Name -}} },
|
||||
Character{{ goenum $c.Name }}: {ID: {{ $c.ID }}, Name: {{ printf "%q" $c.Name -}} },
|
||||
{{- end }}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 }}
|
||||
|
||||
Reference in New Issue
Block a user