horsegen: generate inherited skills

This commit is contained in:
2026-01-10 22:26:19 -05:00
parent 107a85b384
commit fae0fa7699
6 changed files with 806 additions and 456 deletions

View File

@@ -59,7 +59,7 @@ pub type skill-group
Genius-x-Bakushin-Victory
Pure-Heart
SPARKLY-STARDOM
Pop-Polish
Pop-and-Polish
Nemesis
Super-Duper-Climax
I-See-Victory-in-My-Future
@@ -311,7 +311,7 @@ pub fip fun skill-group/group-id(^sg: skill-group): int
Genius-x-Bakushin-Victory -> 10041
Pure-Heart -> 10045
SPARKLY-STARDOM -> 10046
Pop-Polish -> 10048
Pop-and-Polish -> 10048
Nemesis -> 10050
Super-Duper-Climax -> 10052
I-See-Victory-in-My-Future -> 10056
@@ -563,7 +563,7 @@ pub fip(1) fun skill-group/from-id(^id: int): maybe<skill-group>
10041 -> Just(Genius-x-Bakushin-Victory)
10045 -> Just(Pure-Heart)
10046 -> Just(SPARKLY-STARDOM)
10048 -> Just(Pop-Polish)
10048 -> Just(Pop-and-Polish)
10050 -> Just(Nemesis)
10052 -> Just(Super-Duper-Climax)
10056 -> Just(I-See-Victory-in-My-Future)
@@ -817,7 +817,7 @@ pub fun skill-group/show(sg: skill-group): string
Genius-x-Bakushin-Victory -> "Genius x Bakushin = Victory"
Pure-Heart -> "Pure Heart"
SPARKLY-STARDOM -> "SPARKLY☆STARDOM"
Pop-Polish -> "Pop & Polish"
Pop-and-Polish -> "Pop & Polish"
Nemesis -> "Nemesis"
Super-Duper-Climax -> "Super-Duper Climax"
I-See-Victory-in-My-Future -> "I See Victory in My Future!"

File diff suppressed because it is too large Load Diff

View File

@@ -77,7 +77,7 @@ func ExecSkillGroupKK(t *template.Template, w io.Writer, g []NamedID[SkillGroup]
return t.ExecuteTemplate(w, "koka-skill-group", &data)
}
const replaceDash = " ,!?/+();#○☆♡'&=♪∀゚∴"
const replaceDash = " ,!?/+();#○☆♡'=♪∀゚∴"
var (
kkReplace = func() *strings.Replacer {
@@ -86,7 +86,9 @@ var (
"1,500,000 CC", "One-Million-CC",
"15,000,000 CC", "Fifteen-Million-CC",
"1st", "First",
"♡ 3D Nail Art", "Nail-Art",
".", "",
"&", "-and-",
"'s", "s",
"ó", "o",
"∞", "Infinity",

View File

@@ -190,6 +190,7 @@ type Skill struct {
WitCheck bool
Activations [2]SkillActivation
SPCost int
InheritID int
IconID int
Index int
}
@@ -301,9 +302,10 @@ func Skills(ctx context.Context, db *sqlitex.Pool) ([]Skill, error) {
},
},
},
SPCost: stmt.ColumnInt(47),
IconID: stmt.ColumnInt(48),
Index: stmt.ColumnInt(49),
SPCost: stmt.ColumnInt(47),
InheritID: stmt.ColumnInt(48),
IconID: stmt.ColumnInt(49),
Index: stmt.ColumnInt(50),
}
r = append(r, s)
}

View File

@@ -53,32 +53,33 @@ module horse/skill
import std/num/float64
pub import horse/skill-group
// Skills instances.
// Skill instances.
pub type skill
{{- range $s := $.Skills }}
{{ kkenum $s.Name }}
{{ kkenum $s.Name }}{{ if ne $s.InheritID 0 }}-Inherit{{ end -}}
{{- end }}
// Map a skill to its ID.
pub fip fun skill/skill-id(^s: skill): int
match s
{{- range $s := $.Skills }}
{{ kkenum $s.Name }} -> {{ $s.ID }}
{{ kkenum $s.Name }}{{ if ne $s.InheritID 0 }}-Inherit{{ end }} -> {{ $s.ID }}
{{- end }}
// Get the skill for an ID.
pub fip(1) fun skill/from-id(^id: int): maybe<skill>
match id
{{- range $s := $.Skills }}
{{ $s.ID }} -> Just( {{- kkenum $s.Name -}} )
{{ $s.ID }} -> Just( {{- kkenum $s.Name -}}{{ if ne $s.InheritID 0 }}-Inherit{{ end -}} )
{{- end }}
_ -> Nothing
// Get the name of a skill.
// Inherited skills have the same names as their original counterparts.
pub fun skill/show(s: skill): string
match s
{{- range $s := $.Skills }}
{{ kkenum $s.Name }} -> {{ printf "%q" $s.Name }}
{{ kkenum $s.Name }}{{ if ne $s.InheritID 0 }}-Inherit{{ end }} -> {{ printf "%q" $s.Name }}
{{- end }}
// Compare two skills by ID order.
@@ -95,7 +96,7 @@ pub fun skill/(==)(a: skill, b: skill): bool
pub fun skill/detail(^s: skill): skill-detail
match s
{{- range $s := $.Skills }}
{{ kkenum $s.Name }} -> {{ template "kk-render-skill-detail" $s }}
{{ kkenum $s.Name }}{{ if ne $s.InheritID 0 }}-Inherit{{ end }} -> {{ template "kk-render-skill-detail" $s }}
{{- end }}
// Details about a skill.
@@ -103,7 +104,7 @@ pub struct skill-detail
skill-id: int
name: string
description: string
group: skill-group
group: maybe<skill-group>
rarity: rarity
group-rate: int
grade-value: int
@@ -175,7 +176,7 @@ pub type ability-type
Passive-Power(bonus: float64)
Passive-Guts(bonus: float64)
Passive-Wit(bonus: float64)
Runaway
Great-Escape
Vision(bonus: float64)
HP(rate: float64)
Gate-Delay(rate: float64)
@@ -193,7 +194,7 @@ pub fun ability-type/show(a: ability-type): string
Passive-Power(bonus) -> "passive " ++ bonus.show ++ " Power"
Passive-Guts(bonus) -> "passive " ++ bonus.show ++ " Guts"
Passive-Wit(bonus) -> "passive " ++ bonus.show ++ " Wit"
Runaway -> "enable Great Escape style"
Great-Escape -> "enable Great Escape style"
Vision(bonus) -> bonus.show ++ " vision"
HP(rate) | rate >= 0.0 -> show(rate * 100.0) ++ "% HP recovery"
HP(rate) -> show(rate * 100.0) ++ "% HP loss"
@@ -223,7 +224,7 @@ pub fun value-usage/show(v: value-usage): string
Team-Power -> "team's Power"
Team-Guts -> "team's Guts"
Team-Wit -> "team's Wit"
Multiply-Random -> "random multiplier (0× to 0.04×)"
Multiply-Random -> "random multiplier (0×, 0.02×, or 0.04×)"
// Who a skill activation targets.
pub type target
@@ -258,7 +259,7 @@ pub fun target/show(t: target): string
Rushing-Style(End-Closer) -> "rushing End Closers"
// Running style for skill targets.
// TODO(zeph): there is definitely a better place for this to live
{{- /* TODO(zeph): there is definitely a better place for this to live */}}
pub type style
Front-Runner
Pace-Chaser
@@ -272,7 +273,7 @@ pub type style
Skill-detail(skill-id = {{ $.ID -}}
, name = {{ printf "%q" $.Name -}}
, description = {{ printf "%q" $.Description -}}
, group = {{ kkenum $.GroupName -}}
, group = {{ if ne $.GroupName "" }}Just({{ kkenum $.GroupName }}){{ else }}Nothing{{ end -}}
, rarity = {{ if eq $.Rarity 1 }}Common{{ else if eq $.Rarity 2 }}Rare{{ else if eq $.Rarity 3 }}Unique-Low{{ else if eq $.Rarity 4 }}Unique-Upgraded{{ else if eq $.Rarity 5 }}Unique{{ else }}??? $.Rarity={{ $.Rarity }}{{ end -}}
, group-rate = {{ $.GroupRate -}}
, grade-value = {{ $.GradeValue -}}
@@ -293,7 +294,7 @@ Skill-detail(skill-id = {{ $.ID -}}
{{- else if eq $abil.Type 3 -}}Passive-Power({{ printf "%f" $abil.Value }})
{{- else if eq $abil.Type 4 -}}Passive-Guts({{ printf "%f" $abil.Value }})
{{- else if eq $abil.Type 5 -}}Passive-Wit({{ printf "%f" $abil.Value }})
{{- else if eq $abil.Type 6 -}}Runaway
{{- else if eq $abil.Type 6 -}}Great-Escape
{{- else if eq $abil.Type 8 -}}Vision({{ printf "%f" $abil.Value }})
{{- else if eq $abil.Type 9 -}}HP({{ printf "%f" $abil.Value }})
{{- else if eq $abil.Type 10 -}}Gate-Delay({{ printf "%f" $abil.Value }})
@@ -332,6 +333,6 @@ Skill-detail(skill-id = {{ $.ID -}}
{{- end -}}
{{- end -}}
], sp-cost = {{ $.SPCost -}}
,icon-id = {{ $.IconID -}}
, icon-id = {{ $.IconID -}}
)
{{- end -}}

View File

@@ -18,7 +18,11 @@ SELECT
n.name,
n.description,
d.group_id,
g.name,
CASE
WHEN g.name IS NOT NULL THEN g.name
WHEN d.unique_skill_id_1 != 0 THEN n.name
ELSE ''
END AS group_name,
d.rarity,
d.group_rate,
d.grade_value,
@@ -62,10 +66,11 @@ SELECT
d.target_type_2_3,
d.target_value_2_3,
IFNULL(p.need_skill_point, 0) AS sp_cost,
d.unique_skill_id_1,
d.icon_id,
ROW_NUMBER() OVER (ORDER BY d.id) - 1 AS "index"
FROM skill_data d
JOIN skill_names n ON d.id = n.id
JOIN skill_groups g ON d.group_id = g.group_id
LEFT JOIN skill_groups g ON d.group_id = g.group_id
LEFT JOIN single_mode_skill_need_point p ON d.id = p.id
ORDER BY d.id