horsegen: use decimal instead of float64 for skill rates
This commit is contained in:
1032
horse/skill.kk
1032
horse/skill.kk
File diff suppressed because it is too large
Load Diff
@@ -198,15 +198,15 @@ type Skill struct {
|
||||
type SkillActivation struct {
|
||||
Precondition string
|
||||
Condition string
|
||||
Duration float64
|
||||
Cooldown float64
|
||||
Duration int
|
||||
Cooldown int
|
||||
Abilities [3]SkillAbility
|
||||
}
|
||||
|
||||
type SkillAbility struct {
|
||||
Type int
|
||||
ValueUsage int
|
||||
Value float64
|
||||
Value int
|
||||
Target int
|
||||
TargetValue int
|
||||
}
|
||||
@@ -246,27 +246,27 @@ func Skills(ctx context.Context, db *sqlitex.Pool) ([]Skill, error) {
|
||||
{
|
||||
Precondition: stmt.ColumnText(9),
|
||||
Condition: stmt.ColumnText(10),
|
||||
Duration: stmt.ColumnFloat(11),
|
||||
Cooldown: stmt.ColumnFloat(12),
|
||||
Duration: stmt.ColumnInt(11),
|
||||
Cooldown: stmt.ColumnInt(12),
|
||||
Abilities: [3]SkillAbility{
|
||||
{
|
||||
Type: stmt.ColumnInt(13),
|
||||
ValueUsage: stmt.ColumnInt(14),
|
||||
Value: stmt.ColumnFloat(15),
|
||||
Value: stmt.ColumnInt(15),
|
||||
Target: stmt.ColumnInt(16),
|
||||
TargetValue: stmt.ColumnInt(17),
|
||||
},
|
||||
{
|
||||
Type: stmt.ColumnInt(18),
|
||||
ValueUsage: stmt.ColumnInt(19),
|
||||
Value: stmt.ColumnFloat(20),
|
||||
Value: stmt.ColumnInt(20),
|
||||
Target: stmt.ColumnInt(21),
|
||||
TargetValue: stmt.ColumnInt(22),
|
||||
},
|
||||
{
|
||||
Type: stmt.ColumnInt(23),
|
||||
ValueUsage: stmt.ColumnInt(24),
|
||||
Value: stmt.ColumnFloat(25),
|
||||
Value: stmt.ColumnInt(25),
|
||||
Target: stmt.ColumnInt(26),
|
||||
TargetValue: stmt.ColumnInt(27),
|
||||
},
|
||||
@@ -275,27 +275,27 @@ func Skills(ctx context.Context, db *sqlitex.Pool) ([]Skill, error) {
|
||||
{
|
||||
Precondition: stmt.ColumnText(28),
|
||||
Condition: stmt.ColumnText(29),
|
||||
Duration: stmt.ColumnFloat(30),
|
||||
Cooldown: stmt.ColumnFloat(31),
|
||||
Duration: stmt.ColumnInt(30),
|
||||
Cooldown: stmt.ColumnInt(31),
|
||||
Abilities: [3]SkillAbility{
|
||||
{
|
||||
Type: stmt.ColumnInt(32),
|
||||
ValueUsage: stmt.ColumnInt(33),
|
||||
Value: stmt.ColumnFloat(34),
|
||||
Value: stmt.ColumnInt(34),
|
||||
Target: stmt.ColumnInt(35),
|
||||
TargetValue: stmt.ColumnInt(36),
|
||||
},
|
||||
{
|
||||
Type: stmt.ColumnInt(37),
|
||||
ValueUsage: stmt.ColumnInt(38),
|
||||
Value: stmt.ColumnFloat(39),
|
||||
Value: stmt.ColumnInt(39),
|
||||
Target: stmt.ColumnInt(40),
|
||||
TargetValue: stmt.ColumnInt(41),
|
||||
},
|
||||
{
|
||||
Type: stmt.ColumnInt(42),
|
||||
ValueUsage: stmt.ColumnInt(43),
|
||||
Value: stmt.ColumnFloat(44),
|
||||
Value: stmt.ColumnInt(44),
|
||||
Target: stmt.ColumnInt(45),
|
||||
TargetValue: stmt.ColumnInt(46),
|
||||
},
|
||||
|
||||
@@ -50,7 +50,7 @@ pub fun skill-group/(==)(a: skill-group, b: skill-group): bool
|
||||
{{- define "koka-skill" -}}
|
||||
module horse/skill
|
||||
|
||||
import std/num/float64
|
||||
import std/num/decimal
|
||||
pub import horse/skill-group
|
||||
|
||||
// Skill instances.
|
||||
@@ -131,9 +131,9 @@ pub fun rarity/show(r: rarity): string
|
||||
match r
|
||||
Common -> "Common"
|
||||
Rare -> "Rare"
|
||||
Unique-Low -> "Unique (1☆/2☆)"
|
||||
Unique-Upgraded -> "Unique (3☆+ from 1☆/2☆ upgraded)"
|
||||
Unique -> "Unique (3☆+)"
|
||||
Unique-Low -> "Unique (1\u2606/2\u2606)"
|
||||
Unique-Upgraded -> "Unique (3\u2606+ from 1\u2606/2\u2606 upgraded)"
|
||||
Unique -> "Unique (3\u2606+)"
|
||||
|
||||
// Condition and precondition logic.
|
||||
pub alias condition = string
|
||||
@@ -143,17 +143,17 @@ pub alias condition = string
|
||||
pub struct activation
|
||||
precondition: condition
|
||||
condition: condition
|
||||
duration: float64 // seconds
|
||||
cooldown: float64 // seconds
|
||||
duration: decimal // seconds
|
||||
cooldown: decimal // seconds
|
||||
abilities: list<ability> // one to three elements
|
||||
|
||||
pub fun activation/show(a: activation): string
|
||||
match a
|
||||
Activation("", condition, -1.0, _, abilities) -> condition ++ " -> " ++ abilities.show
|
||||
Activation("", condition, duration, cooldown, abilities) | cooldown >= 500.0 -> condition ++ " -> " ++ abilities.show ++ " for " ++ duration.show ++ "s"
|
||||
Activation("", condition, duration, _, abilities) | duration <= 0.decimal -> condition ++ " -> " ++ abilities.show
|
||||
Activation("", condition, duration, cooldown, abilities) | cooldown >= 500.decimal -> condition ++ " -> " ++ abilities.show ++ " for " ++ duration.show ++ "s"
|
||||
Activation("", condition, duration, cooldown, abilities) -> condition ++ " -> " ++ abilities.show ++ " for " ++ duration.show ++ "s on " ++ cooldown.show ++ "s cooldown"
|
||||
Activation(precondition, condition, -1.0, _, abilities)-> precondition ++ " -> " ++ condition ++ " -> " ++ abilities.show
|
||||
Activation(precondition, condition, duration, cooldown, abilities) | cooldown >= 500.0 -> precondition ++ " -> " ++ condition ++ " -> " ++ abilities.show ++ " for " ++ duration.show ++ "s"
|
||||
Activation(precondition, condition, duration, _, abilities) | duration <= 0.decimal -> precondition ++ " -> " ++ condition ++ " -> " ++ abilities.show
|
||||
Activation(precondition, condition, duration, cooldown, abilities) | cooldown >= 500.decimal -> precondition ++ " -> " ++ condition ++ " -> " ++ abilities.show ++ " for " ++ duration.show ++ "s"
|
||||
Activation(precondition, condition, duration, cooldown, abilities) -> precondition ++ "-> " ++ condition ++ " -> " ++ abilities.show ++ " for " ++ duration.show ++ "s on " ++ cooldown.show ++ "s cooldown"
|
||||
|
||||
// Effects of activating a skill.
|
||||
@@ -171,21 +171,21 @@ pub fun ability/show(a: ability): string
|
||||
|
||||
// Target of a skill activation effect.
|
||||
pub type ability-type
|
||||
Passive-Speed(bonus: float64)
|
||||
Passive-Stamina(bonus: float64)
|
||||
Passive-Power(bonus: float64)
|
||||
Passive-Guts(bonus: float64)
|
||||
Passive-Wit(bonus: float64)
|
||||
Passive-Speed(bonus: decimal)
|
||||
Passive-Stamina(bonus: decimal)
|
||||
Passive-Power(bonus: decimal)
|
||||
Passive-Guts(bonus: decimal)
|
||||
Passive-Wit(bonus: decimal)
|
||||
Great-Escape
|
||||
Vision(bonus: float64)
|
||||
HP(rate: float64)
|
||||
Gate-Delay(rate: float64)
|
||||
Frenzy(add: float64)
|
||||
Current-Speed(rate: float64)
|
||||
Target-Speed(rate: float64)
|
||||
Lane-Speed(rate: float64)
|
||||
Accel(rate: float64)
|
||||
Lane-Change(rate: float64)
|
||||
Vision(bonus: decimal)
|
||||
HP(rate: decimal)
|
||||
Gate-Delay(rate: decimal)
|
||||
Frenzy(add: decimal)
|
||||
Current-Speed(rate: decimal)
|
||||
Target-Speed(rate: decimal)
|
||||
Lane-Speed(rate: decimal)
|
||||
Accel(rate: decimal)
|
||||
Lane-Change(rate: decimal)
|
||||
|
||||
pub fun ability-type/show(a: ability-type): string
|
||||
match a
|
||||
@@ -196,14 +196,14 @@ pub fun ability-type/show(a: ability-type): string
|
||||
Passive-Wit(bonus) -> "passive " ++ bonus.show ++ " Wit"
|
||||
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"
|
||||
HP(rate) | rate >= 0.decimal -> show(rate * 100.decimal) ++ "% HP recovery"
|
||||
HP(rate) -> show(rate * 100.decimal) ++ "% HP loss"
|
||||
Gate-Delay(rate) -> rate.show ++ "× gate delay"
|
||||
Frenzy(add) -> add.show ++ "s longer Rushed"
|
||||
Current-Speed(rate) -> show(rate * 100.0) ++ "% current speed"
|
||||
Target-Speed(rate) -> show(rate * 100.0) ++ "% target speed"
|
||||
Lane-Speed(rate) -> show(rate * 100.0) ++ "% lane speed"
|
||||
Accel(rate) -> show(rate * 100.0) ++ "% acceleration"
|
||||
Current-Speed(rate) -> show(rate * 100.decimal) ++ "% current speed"
|
||||
Target-Speed(rate) -> show(rate * 100.decimal) ++ "% target speed"
|
||||
Lane-Speed(rate) -> show(rate * 100.decimal) ++ "% lane speed"
|
||||
Accel(rate) -> show(rate * 100.decimal) ++ "% acceleration"
|
||||
Lane-Change(rate) -> rate.show ++ " course width movement"
|
||||
|
||||
// Special scaling for skill activation effects.
|
||||
@@ -283,27 +283,27 @@ Skill-detail(skill-id = {{ $.ID -}}
|
||||
{{- if ne $a.Condition "" -}}
|
||||
Activation(precondition = {{ printf "%q" $a.Precondition -}}
|
||||
, condition = {{ printf "%q" $a.Condition -}}
|
||||
, duration = {{ printf "%f" $a.Duration -}}
|
||||
, cooldown = {{ printf "%f" $a.Cooldown -}}
|
||||
, duration = {{ $a.Duration -}}{{ if gt $a.Duration 0 }}.decimal(-4){{ else }}.decimal{{ end -}}
|
||||
, cooldown = {{ $a.Cooldown -}}{{ if gt $a.Cooldown 0 }}.decimal(-4){{ else }}.decimal{{ end -}}
|
||||
, abilities = [
|
||||
{{- range $abil := $a.Abilities -}}
|
||||
{{- if ne $abil.Type 0 -}}
|
||||
Ability(ability-type =
|
||||
{{- if eq $abil.Type 1 -}}Passive-Speed({{ printf "%f" $abil.Value }})
|
||||
{{- else if eq $abil.Type 2 -}}Passive-Stamina({{ printf "%f" $abil.Value }})
|
||||
{{- 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 }})
|
||||
{{- 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({{ 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 }})
|
||||
{{- else if eq $abil.Type 13 -}}Frenzy({{ printf "%f" $abil.Value }})
|
||||
{{- else if eq $abil.Type 21 -}}Current-Speed({{ printf "%f" $abil.Value }})
|
||||
{{- else if eq $abil.Type 27 -}}Target-Speed({{ printf "%f" $abil.Value }})
|
||||
{{- else if eq $abil.Type 28 -}}Lane-Speed({{ printf "%f" $abil.Value }})
|
||||
{{- else if eq $abil.Type 31 -}}Accel({{ printf "%f" $abil.Value }})
|
||||
{{- else if eq $abil.Type 35 -}}Lane-Change({{ printf "%f" $abil.Value }})
|
||||
{{- 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 =
|
||||
|
||||
@@ -29,40 +29,40 @@ SELECT
|
||||
d.activate_lot,
|
||||
d.precondition_1,
|
||||
d.condition_1,
|
||||
IIF(d.float_ability_time_1 <= 0, CAST(d.float_ability_time_1 AS REAL), d.float_ability_time_1 / 1e4) AS float_ability_time_1,
|
||||
IIF(d.float_cooldown_time_1 <= 0, CAST(d.float_cooldown_time_1 AS REAL), d.float_cooldown_time_1 / 1e4) AS float_cooldown_time_1,
|
||||
d.float_ability_time_1,
|
||||
d.float_cooldown_time_1,
|
||||
d.ability_type_1_1,
|
||||
d.ability_value_usage_1_1,
|
||||
d.float_ability_value_1_1 / 1e4 AS float_ability_value_1_1,
|
||||
d.float_ability_value_1_1,
|
||||
d.target_type_1_1,
|
||||
d.target_value_1_1,
|
||||
d.ability_type_1_2,
|
||||
d.ability_value_usage_1_2,
|
||||
d.float_ability_value_1_2 / 1e4 AS float_ability_value_1_2,
|
||||
d.float_ability_value_1_2,
|
||||
d.target_type_1_2,
|
||||
d.target_value_1_2,
|
||||
d.ability_type_1_3,
|
||||
d.ability_value_usage_1_3,
|
||||
d.float_ability_value_1_3 / 1e4 AS float_ability_value_1_3,
|
||||
d.float_ability_value_1_3,
|
||||
d.target_type_1_3,
|
||||
d.target_value_1_3,
|
||||
d.precondition_2,
|
||||
d.condition_2,
|
||||
IIF(d.float_ability_time_2 <= 0, CAST(d.float_ability_time_2 AS REAL), d.float_ability_time_2 / 1e4) AS float_ability_time_2,
|
||||
IIF(d.float_cooldown_time_2 <= 0, CAST(d.float_cooldown_time_2 AS REAL), d.float_cooldown_time_2 / 1e4) AS float_cooldown_time_2,
|
||||
float_ability_time_2,
|
||||
float_cooldown_time_2,
|
||||
d.ability_type_2_1,
|
||||
d.ability_value_usage_2_1,
|
||||
d.float_ability_value_2_1 / 1e4 AS float_ability_value_2_1,
|
||||
d.float_ability_value_2_1,
|
||||
d.target_type_2_1,
|
||||
d.target_value_2_1,
|
||||
d.ability_type_2_2,
|
||||
d.ability_value_usage_2_2,
|
||||
d.float_ability_value_2_2 / 1e4 AS float_ability_value_2_2,
|
||||
d.float_ability_value_2_2,
|
||||
d.target_type_2_2,
|
||||
d.target_value_2_2,
|
||||
d.ability_type_2_3,
|
||||
d.ability_value_usage_2_3,
|
||||
d.float_ability_value_2_3 / 1e4 AS float_ability_value_2_3,
|
||||
d.float_ability_value_2_3,
|
||||
d.target_type_2_3,
|
||||
d.target_value_2_3,
|
||||
IFNULL(p.need_skill_point, 0) AS sp_cost,
|
||||
|
||||
Reference in New Issue
Block a user