Files
horse/horse/spark.kk
T
2026-02-13 13:41:04 -05:00

122 lines
2.8 KiB
Plaintext

module horse/spark
import std/num/decimal
import horse/game-id
import horse/movement
// A spark on a veteran.
pub struct spark-detail
spark-id: spark-id
typ: spark-type
rarity: rarity
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 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"
// Stat (blue) spark.
pub type stat
Speed
Stamina
Power
Guts
Wit
// Automatically generated.
// Shows a string representation of the `stat` type.
pub fun stat/show(this : stat) : e string
match this
Speed -> "Speed"
Stamina -> "Stamina"
Power -> "Power"
Guts -> "Guts"
Wit -> "Wit"
// Aptitude (red/pink) spark.
pub type aptitude
Turf
Dirt
Sprint
Mile
Medium
Long
Front-Runner
Pace-Chaser
Late-Surger
End-Closer
// Shows a string representation of the `aptitude` type.
pub fun aptitude/show(this : aptitude): string
match this
Turf -> "Turf"
Dirt -> "Dirt"
Sprint -> "Sprint"
Mile -> "Mile"
Medium -> "Medium"
Long -> "Long"
Front-Runner -> "Front Runner"
Pace-Chaser -> "Pace Chaser"
Late-Surger -> "Late Surger"
End-Closer -> "End Closer"