214 lines
9.0 KiB
Plaintext
214 lines
9.0 KiB
Plaintext
{{- define "koka-skill" -}}
|
|
module horse/{{ $.Region }}/skill
|
|
|
|
// Automatically generated with horsegen; DO NOT EDIT
|
|
|
|
import std/data/rb-map
|
|
import std/num/decimal
|
|
import horse/game-id
|
|
import horse/movement
|
|
pub import horse/skill
|
|
|
|
val name2id: rbmap<string, skill-id> = rb-map/empty()
|
|
{{- range $s := $.Skills }}
|
|
.set({{ printf "%q" $s.Name }}{{ if $s.InheritID }} ++ " (Inherited)"{{ end }}, Skill-id({{ $s.ID }}))
|
|
{{- end }}
|
|
|
|
// Get the skill ID that has the given exact name.
|
|
// Inherited skills have `" (Inherited)"` appended to their names.
|
|
// If no skill matches the name, the result is an invalid ID.
|
|
pub fun from-name(name: string): skill-id
|
|
name2id.lookup(name).default(Skill-id(0))
|
|
|
|
// Get the name for a skill.
|
|
// Inherited skills have `" (Inherited)"` appended to their names.
|
|
// If no skill matches the ID, the result is the numeric ID.
|
|
pub fun show(s: skill-id): string
|
|
match s.game-id
|
|
{{- range $s := $.Skills }}
|
|
{{ $s.ID }} -> {{ printf "%q" $s.Name }}{{ if $s.InheritID }} ++ " (Inherited)"{{ end }}
|
|
{{- end }}
|
|
x -> "skill " ++ x.show
|
|
|
|
// Get the description for a skill.
|
|
// If no skill matches the ID, the result is the empty string.
|
|
pub fun description(s: skill-id): string
|
|
match s.game-id
|
|
{{- range $s := $.Skills }}
|
|
{{ $s.ID }} -> {{ printf "%q" $s.Description }}
|
|
{{- end }}
|
|
_ -> ""
|
|
|
|
// Get the skill group ID for a skill.
|
|
// If no skill matches the ID, the result is an invalid ID.
|
|
pub fun group(s: skill-id): skill-group-id
|
|
match s.game-id
|
|
{{- range $s := $.Skills }}
|
|
{{ $s.ID }} -> Skill-group-id( {{- $s.GroupID -}} )
|
|
{{- end }}
|
|
_ -> Skill-group-id(0)
|
|
|
|
// Get the rarity of a skill.
|
|
// If no skill matches the ID, the result is Common.
|
|
pub fun rarity(s: skill-id): rarity
|
|
match s.game-id
|
|
{{- range $s := $.Skills }}
|
|
{{ $s.ID }} -> {{ if eq $s.Rarity 1 }}Common{{ else if eq $s.Rarity 2 }}Rare{{ else if eq $s.Rarity 3 }}Unique-Low{{ else if eq $s.Rarity 4 }}Unique-Upgraded{{ else if eq $s.Rarity 5 }}Unique{{ else }}??? $s.Rarity={{ $s.Rarity }}{{ end }}
|
|
{{- end }}
|
|
_ -> Common
|
|
|
|
// Get the group rate of a skill.
|
|
// If no skill matches the ID, the result is 0.
|
|
pub fun group-rate(s: skill-id): int
|
|
match s.game-id
|
|
{{- range $s := $.Skills }}
|
|
{{ $s.ID }} -> {{ $s.GroupRate }}
|
|
{{- end }}
|
|
_ -> 0
|
|
|
|
// Get the grade value of a skill.
|
|
// If no skill matches the ID, the result is 0.
|
|
pub fun grade-value(s: skill-id): int
|
|
match s.game-id
|
|
{{- range $s := $.Skills }}
|
|
{{ $s.ID }} -> {{ $s.GradeValue }}
|
|
{{- end }}
|
|
_ -> 0
|
|
|
|
// Get whether a skill is a wit check.
|
|
// If no skill matches the ID, the result is False.
|
|
pub fun wit-check(s: skill-id): bool
|
|
match s.game-id
|
|
{{- range $s := $.Skills }}
|
|
{{ $s.ID }} -> {{ if $s.WitCheck }}True{{ else }}False{{ end }}
|
|
{{- end }}
|
|
_ -> False
|
|
|
|
// Get the activations of a skill.
|
|
// If no skill matches the ID, the result is an empty list.
|
|
pub fun activations(s: skill-id): list<activation>
|
|
match s.game-id
|
|
{{- range $s := $.Skills }}
|
|
{{ $s.ID }} -> [
|
|
{{- range $a := $s.Activations }}
|
|
{{- if $a.Condition }}
|
|
Activation(
|
|
precondition = {{ printf "%q" $a.Precondition }},
|
|
condition = {{ printf "%q" $a.Condition }},
|
|
duration = {{ $a.Duration }}.decimal{{ if gt $a.Duration 0 }}(-4){{ end }},
|
|
cooldown = {{ $a.Cooldown }}.decimal{{ if gt $a.Cooldown 0 }}(-4){{ end }},
|
|
abilities = [
|
|
{{- range $abil := $a.Abilities }}
|
|
{{- if $abil.Type }}
|
|
Ability(
|
|
ability-type = {{ if eq $abil.Type 1 }}Passive-Speed({{ $abil.Value }}.decimal(-4))
|
|
{{- else if eq $abil.Type 2 }}Passive-Stamina({{ $abil.Value }}.decimal(-4))
|
|
{{- else if eq $abil.Type 3 }}Passive-Power({{ $abil.Value }}.decimal(-4))
|
|
{{- else if eq $abil.Type 4 }}Passive-Guts({{ $abil.Value }}.decimal(-4))
|
|
{{- else if eq $abil.Type 5 }}Passive-Wit({{ $abil.Value }}.decimal(-4))
|
|
{{- else if eq $abil.Type 6 }}Great-Escape
|
|
{{- else if eq $abil.Type 8 }}Vision({{ $abil.Value }}.decimal(-4))
|
|
{{- else if eq $abil.Type 9 }}HP({{ $abil.Value }}.decimal(-4))
|
|
{{- else if eq $abil.Type 10 }}Gate-Delay({{ $abil.Value }}.decimal(-4))
|
|
{{- else if eq $abil.Type 13 }}Frenzy({{ $abil.Value }}.decimal(-4))
|
|
{{- else if eq $abil.Type 21 }}Current-Speed({{ $abil.Value }}.decimal(-4))
|
|
{{- else if eq $abil.Type 27 }}Target-Speed({{ $abil.Value }}.decimal(-4))
|
|
{{- else if eq $abil.Type 28 }}Lane-Speed({{ $abil.Value }}.decimal(-4))
|
|
{{- else if eq $abil.Type 31 }}Accel({{ $abil.Value }}.decimal(-4))
|
|
{{- else if eq $abil.Type 35 }}Lane-Change({{ $abil.Value }}.decimal(-4))
|
|
{{- else }}??? $abil.Type={{$abil.Type}}
|
|
{{- end }},
|
|
value-usage = {{ if eq $abil.ValueUsage 1 }}Direct
|
|
{{- else if eq $abil.ValueUsage 3 }}Team-Speed
|
|
{{- else if eq $abil.ValueUsage 4 }}Team-Stamina
|
|
{{- else if eq $abil.ValueUsage 5 }}Team-Power
|
|
{{- else if eq $abil.ValueUsage 6 }}Team-Guts
|
|
{{- else if eq $abil.ValueUsage 7 }}Team-Wit
|
|
{{- else if eq $abil.ValueUsage 8 }}Multiply-Random
|
|
{{- else if eq $abil.ValueUsage 9 }}Multiply-Random2
|
|
{{- else if eq $abil.ValueUsage 10 }}Climax
|
|
{{- else if eq $abil.ValueUsage 13 }}Max-Stat
|
|
{{- else if eq $abil.ValueUsage 14 }}Passive-Count
|
|
{{- else if eq $abil.ValueUsage 19 }}Front-Distance-Add
|
|
{{- else if eq $abil.ValueUsage 20 }}Midrace-Side-Block-Time
|
|
{{- else if eq $abil.ValueUsage 22 }}Speed-Scaling
|
|
{{- else if eq $abil.ValueUsage 23 }}Speed-Scaling2
|
|
{{- else if eq $abil.ValueUsage 24 }}Arc-Global-Potential
|
|
{{- else if eq $abil.ValueUsage 25 }}Max-Lead-Distance
|
|
{{- else }}??? $abil.ValueUsage={{ $abil.ValueUsage }}
|
|
{{- end }},
|
|
target = {{ if eq $abil.Target 1}}Self
|
|
{{- else if eq $abil.Target 4 }}Sympathizers
|
|
{{- else if eq $abil.Target 4 }}In-View
|
|
{{- else if eq $abil.Target 4 }}Frontmost
|
|
{{- else if eq $abil.Target 9 }}Ahead({{ $abil.TargetValue }})
|
|
{{- else if eq $abil.Target 10 }}Behind({{ $abil.TargetValue }})
|
|
{{- else if eq $abil.Target 4 }}All-Teammates
|
|
{{- else if eq $abil.Target 18 }}Style({{ if eq $abil.TargetValue 1 }}Front-Runner{{ else if eq $abil.TargetValue 2 }}Pace-Chaser{{ else if eq $abil.TargetValue 3 }}Late-Surger{{ else if eq $abil.TargetValue 4 }}End-Closer{{ else }}??? $abil.TargetValue={{ $abil.TargetValue }}{{ end }})
|
|
{{- else if eq $abil.Target 19 }}Rushing-Ahead({{ $abil.TargetValue }})
|
|
{{- else if eq $abil.Target 20 }}Rushing-Behind({{ $abil.TargetValue }})
|
|
{{- else if eq $abil.Target 21 }}Rushing-Style({{ if eq $abil.TargetValue 1 }}Front-Runner{{ else if eq $abil.TargetValue 2 }}Pace-Chaser{{ else if eq $abil.TargetValue 3 }}Late-Surger{{ else if eq $abil.TargetValue 4 }}End-Closer{{ else }}??? $abil.TargetValue={{ $abil.TargetValue }}{{ end }})
|
|
{{- else if eq $abil.Target 22 }}Specific-Character(Character-id({{ $abil.TargetValue }}))
|
|
{{- else if eq $abil.Target 23 }}Triggering
|
|
{{- end }}
|
|
),
|
|
{{- end }}
|
|
{{- end }}
|
|
]
|
|
),
|
|
{{- end }}
|
|
{{- end }}
|
|
]
|
|
{{- end }}
|
|
_ -> Nil
|
|
|
|
// Get the owner of a unique skill.
|
|
// If the skill is not unique, or if there is no skill with the given ID,
|
|
// the result is Nothing.
|
|
pub fun unique-owner(s: skill-id): maybe<trainee-id>
|
|
match s.game-id
|
|
{{- range $s := $.Skills }}
|
|
{{- if $s.UniqueOwnerID }}
|
|
{{ $s.ID }} -> Just(Trainee-id({{ $s.UniqueOwnerID }}))
|
|
{{- end }}
|
|
{{- end }}
|
|
_ -> Nothing
|
|
|
|
// Get the SP cost of a skill.
|
|
// If there is no skill with the given ID, the result is 0.
|
|
pub fun sp-cost(s: skill-id): int
|
|
match s.game-id
|
|
{{- range $s := $.Skills }}
|
|
{{ $s.ID }} -> {{ $s.SPCost }}
|
|
{{- end }}
|
|
_ -> 0
|
|
|
|
// Get the icon ID of a skill.
|
|
// If there is no skill with the given ID, the result is an invalid ID.
|
|
pub fun icon-id(s: skill-id): skill-icon-id
|
|
match s.game-id
|
|
{{- range $s := $.Skills }}
|
|
{{ $s.ID }} -> Skill-icon-id({{ $s.IconID }})
|
|
{{- end }}
|
|
_ -> Skill-icon-id(0)
|
|
|
|
// Get the name for a skill group.
|
|
// Skill group names are the name of the base skill in the group.
|
|
// If there is no skill group with the given ID, the result is the numeric ID.
|
|
pub fun skill-group/show(sg: skill-group-id): string
|
|
match sg.game-id
|
|
{{- range $g := $.Groups }}
|
|
{{ $g.ID }} -> {{- printf "%q" $g.Name -}}
|
|
{{- end }}
|
|
x -> "skill group " ++ x.show
|
|
|
|
// Get the list of skills in a skill group.
|
|
pub fun skill-group/skills(sg: skill-group-id): list<skill-id>
|
|
match sg.game-id
|
|
{{- range $g := $.Groups }}
|
|
{{ $g.ID }} -> [ {{- range $s := index $.Related $g.ID }}Skill-id({{ $s.ID }}), {{ end -}} ]
|
|
{{- end }}
|
|
_ -> Nil
|
|
|
|
{{- end }}
|