horsegen: generate sparks
This commit is contained in:
@@ -46,6 +46,16 @@ pub struct race-thumbnail-id
|
||||
pub struct saddle-id
|
||||
game-id: game-id
|
||||
|
||||
// Game ID for sparks,
|
||||
// i.e. succession factors.
|
||||
pub struct spark-id
|
||||
game-id: game-id
|
||||
|
||||
// Game ID for spark groups,
|
||||
// i.e. all rarities (star counts) of a single spark.
|
||||
pub struct spark-group-id
|
||||
game-id: game-id
|
||||
|
||||
// order2 comparison between any game ID types.
|
||||
pub inline fun order2(x: a, y: a, ?a/game-id: (a) -> game-id): order2<a>
|
||||
match x.game-id.cmp(y.game-id)
|
||||
|
||||
13052
horse/global/spark.go
Normal file
13052
horse/global/spark.go
Normal file
File diff suppressed because it is too large
Load Diff
12245
horse/global/spark.kk
Normal file
12245
horse/global/spark.kk
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,33 @@
|
||||
module horse/movement
|
||||
|
||||
// Surface types.
|
||||
pub type surface
|
||||
Turf
|
||||
Dirt
|
||||
|
||||
// Automatically generated.
|
||||
// Shows a string representation of the `surface` type.
|
||||
pub fun surface/show(this : surface) : e string
|
||||
match this
|
||||
Turf -> "Turf"
|
||||
Dirt -> "Dirt"
|
||||
|
||||
// Race distance types.
|
||||
pub type distance
|
||||
Sprint
|
||||
Mile
|
||||
Medium
|
||||
Long
|
||||
|
||||
// Automatically generated.
|
||||
// Shows a string representation of the `distance` type.
|
||||
pub fun distance/show(this : distance) : e string
|
||||
match this
|
||||
Sprint -> "Sprint"
|
||||
Mile -> "Mile"
|
||||
Medium -> "Medium"
|
||||
Long -> "Long"
|
||||
|
||||
// Running styles.
|
||||
pub type style
|
||||
Front-Runner
|
||||
|
||||
87
horse/spark.go
Normal file
87
horse/spark.go
Normal file
@@ -0,0 +1,87 @@
|
||||
package horse
|
||||
|
||||
type (
|
||||
SparkID int32
|
||||
SparkGroupID int32
|
||||
)
|
||||
|
||||
type Spark struct {
|
||||
ID SparkID
|
||||
Name string
|
||||
Description string
|
||||
Group SparkGroupID
|
||||
Rarity SparkRarity
|
||||
Type SparkType
|
||||
Effects [][]SparkEffect
|
||||
}
|
||||
|
||||
type SparkType int8
|
||||
|
||||
//go:generate go run golang.org/x/tools/cmd/stringer@v0.41.0 -type SparkType -trimprefix Spark
|
||||
const (
|
||||
SparkStat SparkType = iota + 1
|
||||
SparkAptitude
|
||||
SparkUnique
|
||||
SparkSkill
|
||||
SparkRace
|
||||
SparkScenario
|
||||
SparkCarnival
|
||||
SparkDistance
|
||||
SparkHidden
|
||||
SparkSurface
|
||||
SparkStyle
|
||||
)
|
||||
|
||||
type SparkRarity int8
|
||||
|
||||
const (
|
||||
OneStar SparkRarity = iota + 1 // ★
|
||||
TwoStar // ★★
|
||||
ThreeStar // ★★★
|
||||
)
|
||||
|
||||
func (r SparkRarity) String() string {
|
||||
const s = "★★★"
|
||||
return s[:int(r)*len("★")]
|
||||
}
|
||||
|
||||
type SparkEffect struct {
|
||||
Target SparkTarget
|
||||
Value1 int32
|
||||
Value2 int32
|
||||
}
|
||||
|
||||
type SparkTarget int8
|
||||
|
||||
//go:generate go run golang.org/x/tools/cmd/stringer@v0.41.0 -type SparkTarget -trimprefix Spark
|
||||
const (
|
||||
SparkSpeed SparkTarget = iota + 1
|
||||
SparkStam
|
||||
SparkPower
|
||||
SparkGuts
|
||||
SparkWit
|
||||
SparkSkillPoints
|
||||
SparkRandomStat
|
||||
|
||||
SparkTurf SparkTarget = 11
|
||||
SparkDirt SparkTarget = 12
|
||||
|
||||
SparkFrontRunner SparkTarget = iota + 12
|
||||
SparkPaceChaser
|
||||
SparkLateSurger
|
||||
SparkEndCloser
|
||||
|
||||
SparkSprint SparkTarget = iota + 18
|
||||
SparkMile
|
||||
SparkMedium
|
||||
SparkLong
|
||||
|
||||
SparkSkillHint SparkTarget = 41
|
||||
SparkCarnivalBonus SparkTarget = 51
|
||||
|
||||
SparkSpeedCap SparkTarget = iota + 42
|
||||
SparkStamCap
|
||||
SparkPowerCap
|
||||
SparkGutsCap
|
||||
SparkWitCap
|
||||
)
|
||||
@@ -1,22 +1,76 @@
|
||||
module horse/spark
|
||||
|
||||
import std/num/decimal
|
||||
import horse/game-id
|
||||
import horse/movement
|
||||
|
||||
pub type spark
|
||||
Stat(s: stat, l: level)
|
||||
Aptitude(a: aptitude, l: level)
|
||||
Unique(s: skill-id, l: level)
|
||||
Race(r: race-id, l: level)
|
||||
Skill(s: skill-id, l: level)
|
||||
Scenario(s: scenario-id, l: level)
|
||||
// A spark on a veteran.
|
||||
pub struct spark-detail
|
||||
spark-id: spark-id
|
||||
typ: spark-type
|
||||
rarity: rarity
|
||||
|
||||
pub type level
|
||||
pub fun spark-detail/show(s: spark-detail, ?spark/show: (spark-id) -> string): string
|
||||
s.spark-id.show ++ " " ++ "\u2605".repeat(s.rarity.int)
|
||||
|
||||
// The category of a spark; roughly, blue, pink, green, or white, with some
|
||||
// further subdivisions.
|
||||
pub type spark-type
|
||||
Stat // blue
|
||||
Aptitude // red/pink
|
||||
Unique // green
|
||||
Race
|
||||
Skill
|
||||
// skip Carnival Bonus
|
||||
Scenario
|
||||
Surface
|
||||
Distance
|
||||
Style
|
||||
Hidden
|
||||
|
||||
// Spark targets and effects.
|
||||
pub type spark-effect
|
||||
Stat-Up(s: stat, amount: int)
|
||||
SP-Up(amount: int)
|
||||
// skip Carnival Bonus
|
||||
Random-Stat-Up(amount: int)
|
||||
Aptitude-Up(a: aptitude, amount: int)
|
||||
Skill-Hint(s: skill-id, levels: int)
|
||||
Stat-Cap-Up(s: stat, amount: int)
|
||||
|
||||
// Get the base probability for a spark to trigger during a single inheritance.
|
||||
pub fun decimal/base-proc(s: spark-detail): decimal
|
||||
match s
|
||||
Spark-detail(_, Stat, One) -> 70.decimal(-2)
|
||||
Spark-detail(_, Stat, Two) -> 80.decimal(-2)
|
||||
Spark-detail(_, Stat, Three) -> 90.decimal(-2)
|
||||
Spark-detail(_, Aptitude, One) -> 1.decimal(-2)
|
||||
Spark-detail(_, Aptitude, Two) -> 3.decimal(-2)
|
||||
Spark-detail(_, Aptitude, Three) -> 5.decimal(-2)
|
||||
Spark-detail(_, Unique, One) -> 5.decimal(-2)
|
||||
Spark-detail(_, Unique, Two) -> 10.decimal(-2)
|
||||
Spark-detail(_, Unique, Three) -> 15.decimal(-2)
|
||||
Spark-detail(_, Race, One) -> 1.decimal(-2)
|
||||
Spark-detail(_, Race, Two) -> 2.decimal(-2)
|
||||
Spark-detail(_, Race, Three) -> 3.decimal(-2)
|
||||
Spark-detail(_, _, One) -> 3.decimal(-2)
|
||||
Spark-detail(_, _, Two) -> 6.decimal(-2)
|
||||
Spark-detail(_, _, Three) -> 9.decimal(-2)
|
||||
|
||||
// The level or star count of a spark.
|
||||
pub type rarity
|
||||
One
|
||||
Two
|
||||
Three
|
||||
|
||||
pub fun level/show(this: level): string
|
||||
match this
|
||||
pub fun rarity/int(l: rarity): int
|
||||
match l
|
||||
One -> 1
|
||||
Two -> 2
|
||||
Three -> 3
|
||||
|
||||
pub fun rarity/show(l: rarity): string
|
||||
match l
|
||||
One -> "1"
|
||||
Two -> "2"
|
||||
Three -> "3"
|
||||
|
||||
79
horse/sparktarget_string.go
Normal file
79
horse/sparktarget_string.go
Normal file
@@ -0,0 +1,79 @@
|
||||
// Code generated by "stringer -type SparkTarget -trimprefix Spark"; DO NOT EDIT.
|
||||
|
||||
package horse
|
||||
|
||||
import "strconv"
|
||||
|
||||
func _() {
|
||||
// An "invalid array index" compiler error signifies that the constant values have changed.
|
||||
// Re-run the stringer command to generate them again.
|
||||
var x [1]struct{}
|
||||
_ = x[SparkSpeed-1]
|
||||
_ = x[SparkStam-2]
|
||||
_ = x[SparkPower-3]
|
||||
_ = x[SparkGuts-4]
|
||||
_ = x[SparkWit-5]
|
||||
_ = x[SparkSkillPoints-6]
|
||||
_ = x[SparkRandomStat-7]
|
||||
_ = x[SparkTurf-11]
|
||||
_ = x[SparkDirt-12]
|
||||
_ = x[SparkFrontRunner-21]
|
||||
_ = x[SparkPaceChaser-22]
|
||||
_ = x[SparkLateSurger-23]
|
||||
_ = x[SparkEndCloser-24]
|
||||
_ = x[SparkSprint-31]
|
||||
_ = x[SparkMile-32]
|
||||
_ = x[SparkMedium-33]
|
||||
_ = x[SparkLong-34]
|
||||
_ = x[SparkSkillHint-41]
|
||||
_ = x[SparkCarnivalBonus-51]
|
||||
_ = x[SparkSpeedCap-61]
|
||||
_ = x[SparkStamCap-62]
|
||||
_ = x[SparkPowerCap-63]
|
||||
_ = x[SparkGutsCap-64]
|
||||
_ = x[SparkWitCap-65]
|
||||
}
|
||||
|
||||
const (
|
||||
_SparkTarget_name_0 = "SpeedStamPowerGutsWitSkillPointsRandomStat"
|
||||
_SparkTarget_name_1 = "TurfDirt"
|
||||
_SparkTarget_name_2 = "FrontRunnerPaceChaserLateSurgerEndCloser"
|
||||
_SparkTarget_name_3 = "SprintMileMediumLong"
|
||||
_SparkTarget_name_4 = "SkillHint"
|
||||
_SparkTarget_name_5 = "CarnivalBonus"
|
||||
_SparkTarget_name_6 = "SpeedCapStamCapPowerCapGutsCapWitCap"
|
||||
)
|
||||
|
||||
var (
|
||||
_SparkTarget_index_0 = [...]uint8{0, 5, 9, 14, 18, 21, 32, 42}
|
||||
_SparkTarget_index_1 = [...]uint8{0, 4, 8}
|
||||
_SparkTarget_index_2 = [...]uint8{0, 11, 21, 31, 40}
|
||||
_SparkTarget_index_3 = [...]uint8{0, 6, 10, 16, 20}
|
||||
_SparkTarget_index_6 = [...]uint8{0, 8, 15, 23, 30, 36}
|
||||
)
|
||||
|
||||
func (i SparkTarget) String() string {
|
||||
switch {
|
||||
case 1 <= i && i <= 7:
|
||||
i -= 1
|
||||
return _SparkTarget_name_0[_SparkTarget_index_0[i]:_SparkTarget_index_0[i+1]]
|
||||
case 11 <= i && i <= 12:
|
||||
i -= 11
|
||||
return _SparkTarget_name_1[_SparkTarget_index_1[i]:_SparkTarget_index_1[i+1]]
|
||||
case 21 <= i && i <= 24:
|
||||
i -= 21
|
||||
return _SparkTarget_name_2[_SparkTarget_index_2[i]:_SparkTarget_index_2[i+1]]
|
||||
case 31 <= i && i <= 34:
|
||||
i -= 31
|
||||
return _SparkTarget_name_3[_SparkTarget_index_3[i]:_SparkTarget_index_3[i+1]]
|
||||
case i == 41:
|
||||
return _SparkTarget_name_4
|
||||
case i == 51:
|
||||
return _SparkTarget_name_5
|
||||
case 61 <= i && i <= 65:
|
||||
i -= 61
|
||||
return _SparkTarget_name_6[_SparkTarget_index_6[i]:_SparkTarget_index_6[i+1]]
|
||||
default:
|
||||
return "SparkTarget(" + strconv.FormatInt(int64(i), 10) + ")"
|
||||
}
|
||||
}
|
||||
34
horse/sparktype_string.go
Normal file
34
horse/sparktype_string.go
Normal file
@@ -0,0 +1,34 @@
|
||||
// Code generated by "stringer -type SparkType -trimprefix Spark"; DO NOT EDIT.
|
||||
|
||||
package horse
|
||||
|
||||
import "strconv"
|
||||
|
||||
func _() {
|
||||
// An "invalid array index" compiler error signifies that the constant values have changed.
|
||||
// Re-run the stringer command to generate them again.
|
||||
var x [1]struct{}
|
||||
_ = x[SparkStat-1]
|
||||
_ = x[SparkAptitude-2]
|
||||
_ = x[SparkUnique-3]
|
||||
_ = x[SparkSkill-4]
|
||||
_ = x[SparkRace-5]
|
||||
_ = x[SparkScenario-6]
|
||||
_ = x[SparkCarnival-7]
|
||||
_ = x[SparkDistance-8]
|
||||
_ = x[SparkHidden-9]
|
||||
_ = x[SparkSurface-10]
|
||||
_ = x[SparkStyle-11]
|
||||
}
|
||||
|
||||
const _SparkType_name = "StatAptitudeUniqueSkillRaceScenarioCarnivalDistanceHiddenSurfaceStyle"
|
||||
|
||||
var _SparkType_index = [...]uint8{0, 4, 12, 18, 23, 27, 35, 43, 51, 57, 64, 69}
|
||||
|
||||
func (i SparkType) String() string {
|
||||
idx := int(i) - 1
|
||||
if i < 1 || idx >= len(_SparkType_index)-1 {
|
||||
return "SparkType(" + strconv.FormatInt(int64(i), 10) + ")"
|
||||
}
|
||||
return _SparkType_name[_SparkType_index[idx]:_SparkType_index[idx+1]]
|
||||
}
|
||||
Reference in New Issue
Block a user