diff --git a/horse/skill.kk b/horse/skill.kk new file mode 100644 index 0000000..f07d7a1 --- /dev/null +++ b/horse/skill.kk @@ -0,0 +1,1025 @@ +module horse/skill + +// Automatically generated with the horsegen tool; DO NOT EDIT + +// Skill groups. +// A skill group may contain white, circle, double-circle, gold, and purple skills +// for the same effect. +// Sparks that grant skills refer to a skill group. +pub type skill-group + Warning-Shot + Xceleration + Red-Ace + Focused-Mind + Corazon-Ardiente + Empresss-Pride + First-Place-Kiss + Feel-the-Burn + Introduction-to-Physiology + V-Is-for-Victory + Class-Rep-Speed-Bakushin + Clear-Heart + Super-Duper-Stoked + Luck-Be-with-Me + I-Can-Win-Sometimes-Right + Call-Me-King + Shooting-Star + The-View-from-the-Lead-Is-Mine + Sky-High-Teio-Step + Red-Shift-LP1211-M + Lights-of-Vaudeville + Triumphant-Pulse + Anchors-Aweigh + Cut-and-Drive + Resplendent-Red-Ace + Shooting-for-Victory + Where-Theres-a-Will-Theres-a-Way + You-and-Me-One-on-One + The-Duty-of-Dignity-Calls + Victoria-por-plancha + This-Dance-Is-for-Vittoria + Shadow-Break + Behold-Thine-Emperors-Divine-Might + Blazing-Pride + OMG-The-Final-Sprint + Angling-and-Scheming + Win-QED + Flashy-Landing + Chasing-After-You + G00-First-FInfinity + Lets-Pump-Some-Iron + YUMMY-SPEED + Blue-Rose-Closer + U-ma2 + Our-Ticket-to-Win + Schwarzes-Schwert + LookatCurren + A-Princess-Must-Seize-Victory + KEEP-IT-REAL + Genius-x-Bakushin-Victory + Pure-Heart + SPARKLY-STARDOM + Pop-Polish + Nemesis + Super-Duper-Climax + I-See-Victory-in-My-Future + I-Never-Goof-Up + Moving-Past-and-Beyond + Just-a-Little-Farther + Prideful-King + Dazzl-n-Diver + Certain-Victory + A-Kiss-for-Courage + Festive-Miracle + Superior-Heal + Legacy-of-the-Strong + Condors-Fury + Arrows-Whistle-Shadows-Disperse + Eternal-Moments + Presents-from-X + Flowery-Maneuver + Every-Rose-Has-Its-Fangs + Dancing-in-the-Leaves + Give-Mummy-a-Hug + Bountiful-Harvest + Right-Handed + Left-Handed + Tokyo-Racecourse + Nakayama-Racecourse + Hanshin-Racecourse + Kyoto-Racecourse + Chukyo-Racecourse + Sapporo-Racecourse + Hakodate-Racecourse + Fukushima-Racecourse + Niigata-Racecourse + Kokura-Racecourse + Standard-Distance + Non-Standard-Distance + Firm-Conditions + Wet-Conditions + Spring-Runner + Summer-Runner + Fall-Runner + Winter-Runner + Sunny-Days + Cloudy-Days + Rainy-Days + Snowy-Days + Inner-Post-Proficiency + Outer-Post-Proficiency + Maverick + Competitive-Spirit + Target-in-Sight + Long-Shot + Corner-Adept + Corner-Acceleration + Corner-Recovery + Straightaway-Adept + Straightaway-Acceleration + Straightaway-Recovery + Focus + Lay-Low + Prudent-Positioning + Ramp-Up + Pace-Strategy + Calm-in-a-Crowd + Nimble-Navigator + Go-with-the-Flow + Homestretch-Haste + Early-Lead + Fast-Paced + Final-Push + Stamina-to-Spare + Preferred-Position + Prepared-to-Pass + Position-Pilfer + Slick-Surge + Outer-Swell + Standing-By + Masterful-Gambit + Straightaway-Spurt + Sprinting-Gear + Wait-and-See + Gap-Closer + Productive-Plan + Watchful-Eye + Updrafters + Rosy-Outlook + Up-Tempo + Steadfast + Deep-Breaths + Inside-Scoop + Extra-Tank + Trick-Front + Trick-Rear + Frenzied-Front-Runners + Frenzied-Pace-Chasers + Frenzied-Late-Surgers + Frenzied-End-Closers + Subdued-Front-Runners + Flustered-Front-Runners + Hesitant-Front-Runners + Subdued-Pace-Chasers + Flustered-Pace-Chasers + Hesitant-Pace-Chasers + Subdued-Late-Surgers + Flustered-Late-Surgers + Hesitant-Late-Surgers + Subdued-End-Closers + Flustered-End-Closers + Hesitant-End-Closers + Oi-Racecourse + Sprint-Straightaways + Sprint-Corners + Huge-Lead + Countermeasure + Meticulous-Measures + Intimidate + Stop-Right-There + Mile-Straightaways + Mile-Corners + Shifting-Gears + Acceleration + Unyielding-Spirit + Speed-Eater + Opening-Gambit + Medium-Straightaways + Medium-Corners + Hawkeye + Thunderbolt-Step + Soft-Step + Tether + Murmur + Long-Straightaways + Long-Corners + Keeping-the-Lead + Passing-Pro + Pressure + Stamina-Eater + Smoke-Screen + Front-Runner-Straightaways + Front-Runner-Corners + Dodging-Danger + Leaders-Pride + Moxie + Second-Wind + Restart + Pace-Chaser-Straightaways + Pace-Chaser-Corners + Shrewd-Step + Straight-Descent + Hydrate + Tactical-Tweak + Disorient + Late-Surger-Straightaways + Late-Surger-Corners + Fighter + Million-CC + A-Small-Breather + Studious + Sharp-Gaze + End-Closer-Straightaways + End-Closer-Corners + I-Can-See-Right-Through-You + After-School-Stroll + Levelheaded + Strategist + Intense-Gaze + Front-Runner-Savvy + Pace-Chaser-Savvy + Late-Surger-Savvy + End-Closer-Savvy + Lucky-Seven + Triple-Sevens + Highlander + Uma-Stan + Groundwork + Tail-Held-High + Shake-It-Out + Sympathy + Lone-Wolf + Slipstream + Playtimes-Over + Top-Pick + Forward-March + Be-Still + All-I-ve-Got + Head-On + Early-Start + Risky-Business + Ignited-Spirit-SPD + Ignited-Spirit-STA + Ignited-Spirit-PWR + Ignited-Spirit-GUTS + Ignited-Spirit-WIT + Unquenched-Thirst + Unchanging + +// Map a skill group to its ID. +pub fip fun skill-group/group-id(^sg: skill-group): int + match sg + Warning-Shot -> 1007 + Xceleration -> 1008 + Red-Ace -> 1009 + Focused-Mind -> 1011 + Corazon-Ardiente -> 1014 + Empresss-Pride -> 1018 + First-Place-Kiss -> 1024 + Feel-the-Burn -> 1027 + Introduction-to-Physiology -> 1032 + V-Is-for-Victory -> 1035 + Class-Rep-Speed-Bakushin -> 1041 + Clear-Heart -> 1045 + Super-Duper-Stoked -> 1052 + Luck-Be-with-Me -> 1056 + I-Can-Win-Sometimes-Right -> 1060 + Call-Me-King -> 1061 + Shooting-Star -> 10001 + The-View-from-the-Lead-Is-Mine -> 10002 + Sky-High-Teio-Step -> 10003 + Red-Shift-LP1211-M -> 10004 + Lights-of-Vaudeville -> 10005 + Triumphant-Pulse -> 10006 + Anchors-Aweigh -> 10007 + Cut-and-Drive -> 10008 + Resplendent-Red-Ace -> 10009 + Shooting-for-Victory -> 10010 + Where-Theres-a-Will-Theres-a-Way -> 10011 + You-and-Me-One-on-One -> 10012 + The-Duty-of-Dignity-Calls -> 10013 + Victoria-por-plancha -> 10014 + This-Dance-Is-for-Vittoria -> 10015 + Shadow-Break -> 10016 + Behold-Thine-Emperors-Divine-Might -> 10017 + Blazing-Pride -> 10018 + OMG-The-Final-Sprint -> 10019 + Angling-and-Scheming -> 10020 + Win-QED -> 10023 + Flashy-Landing -> 10024 + Chasing-After-You -> 10025 + G00-First-FInfinity -> 10026 + Lets-Pump-Some-Iron -> 10027 + YUMMY-SPEED -> 10028 + Blue-Rose-Closer -> 10030 + U-ma2 -> 10032 + Our-Ticket-to-Win -> 10035 + Schwarzes-Schwert -> 10037 + LookatCurren -> 10038 + A-Princess-Must-Seize-Victory -> 10039 + KEEP-IT-REAL -> 10040 + Genius-x-Bakushin-Victory -> 10041 + Pure-Heart -> 10045 + SPARKLY-STARDOM -> 10046 + Pop-Polish -> 10048 + Nemesis -> 10050 + Super-Duper-Climax -> 10052 + I-See-Victory-in-My-Future -> 10056 + I-Never-Goof-Up -> 10058 + Moving-Past-and-Beyond -> 10059 + Just-a-Little-Farther -> 10060 + Prideful-King -> 10061 + Dazzl-n-Diver -> 11001 + Certain-Victory -> 11003 + A-Kiss-for-Courage -> 11004 + Festive-Miracle -> 11006 + Superior-Heal -> 11011 + Legacy-of-the-Strong -> 11013 + Condors-Fury -> 11014 + Arrows-Whistle-Shadows-Disperse -> 11017 + Eternal-Moments -> 11018 + Presents-from-X -> 11023 + Flowery-Maneuver -> 11024 + Every-Rose-Has-Its-Fangs -> 11030 + Dancing-in-the-Leaves -> 11040 + Give-Mummy-a-Hug -> 11045 + Bountiful-Harvest -> 11056 + Right-Handed -> 20001 + Left-Handed -> 20002 + Tokyo-Racecourse -> 20003 + Nakayama-Racecourse -> 20004 + Hanshin-Racecourse -> 20005 + Kyoto-Racecourse -> 20006 + Chukyo-Racecourse -> 20007 + Sapporo-Racecourse -> 20008 + Hakodate-Racecourse -> 20009 + Fukushima-Racecourse -> 20010 + Niigata-Racecourse -> 20011 + Kokura-Racecourse -> 20012 + Standard-Distance -> 20013 + Non-Standard-Distance -> 20014 + Firm-Conditions -> 20015 + Wet-Conditions -> 20016 + Spring-Runner -> 20017 + Summer-Runner -> 20018 + Fall-Runner -> 20019 + Winter-Runner -> 20020 + Sunny-Days -> 20021 + Cloudy-Days -> 20022 + Rainy-Days -> 20023 + Snowy-Days -> 20024 + Inner-Post-Proficiency -> 20025 + Outer-Post-Proficiency -> 20026 + Maverick -> 20027 + Competitive-Spirit -> 20028 + Target-in-Sight -> 20029 + Long-Shot -> 20030 + Corner-Adept -> 20033 + Corner-Acceleration -> 20034 + Corner-Recovery -> 20035 + Straightaway-Adept -> 20036 + Straightaway-Acceleration -> 20037 + Straightaway-Recovery -> 20038 + Focus -> 20043 + Lay-Low -> 20044 + Prudent-Positioning -> 20045 + Ramp-Up -> 20046 + Pace-Strategy -> 20047 + Calm-in-a-Crowd -> 20048 + Nimble-Navigator -> 20049 + Go-with-the-Flow -> 20050 + Homestretch-Haste -> 20051 + Early-Lead -> 20053 + Fast-Paced -> 20054 + Final-Push -> 20055 + Stamina-to-Spare -> 20056 + Preferred-Position -> 20057 + Prepared-to-Pass -> 20058 + Position-Pilfer -> 20059 + Slick-Surge -> 20060 + Outer-Swell -> 20061 + Standing-By -> 20062 + Masterful-Gambit -> 20063 + Straightaway-Spurt -> 20064 + Sprinting-Gear -> 20065 + Wait-and-See -> 20066 + Gap-Closer -> 20067 + Productive-Plan -> 20068 + Watchful-Eye -> 20069 + Updrafters -> 20070 + Rosy-Outlook -> 20071 + Up-Tempo -> 20072 + Steadfast -> 20073 + Deep-Breaths -> 20074 + Inside-Scoop -> 20075 + Extra-Tank -> 20076 + Trick-Front -> 20077 + Trick-Rear -> 20078 + Frenzied-Front-Runners -> 20079 + Frenzied-Pace-Chasers -> 20080 + Frenzied-Late-Surgers -> 20081 + Frenzied-End-Closers -> 20082 + Subdued-Front-Runners -> 20083 + Flustered-Front-Runners -> 20084 + Hesitant-Front-Runners -> 20085 + Subdued-Pace-Chasers -> 20086 + Flustered-Pace-Chasers -> 20087 + Hesitant-Pace-Chasers -> 20088 + Subdued-Late-Surgers -> 20089 + Flustered-Late-Surgers -> 20090 + Hesitant-Late-Surgers -> 20091 + Subdued-End-Closers -> 20092 + Flustered-End-Closers -> 20093 + Hesitant-End-Closers -> 20094 + Oi-Racecourse -> 20095 + Sprint-Straightaways -> 20096 + Sprint-Corners -> 20097 + Huge-Lead -> 20098 + Countermeasure -> 20099 + Meticulous-Measures -> 20100 + Intimidate -> 20101 + Stop-Right-There -> 20102 + Mile-Straightaways -> 20103 + Mile-Corners -> 20104 + Shifting-Gears -> 20105 + Acceleration -> 20106 + Unyielding-Spirit -> 20107 + Speed-Eater -> 20108 + Opening-Gambit -> 20109 + Medium-Straightaways -> 20110 + Medium-Corners -> 20111 + Hawkeye -> 20112 + Thunderbolt-Step -> 20113 + Soft-Step -> 20114 + Tether -> 20115 + Murmur -> 20116 + Long-Straightaways -> 20117 + Long-Corners -> 20118 + Keeping-the-Lead -> 20119 + Passing-Pro -> 20120 + Pressure -> 20121 + Stamina-Eater -> 20122 + Smoke-Screen -> 20123 + Front-Runner-Straightaways -> 20124 + Front-Runner-Corners -> 20125 + Dodging-Danger -> 20126 + Leaders-Pride -> 20127 + Moxie -> 20128 + Second-Wind -> 20129 + Restart -> 20130 + Pace-Chaser-Straightaways -> 20131 + Pace-Chaser-Corners -> 20132 + Shrewd-Step -> 20133 + Straight-Descent -> 20134 + Hydrate -> 20135 + Tactical-Tweak -> 20136 + Disorient -> 20137 + Late-Surger-Straightaways -> 20138 + Late-Surger-Corners -> 20139 + Fighter -> 20140 + Million-CC -> 20141 + A-Small-Breather -> 20142 + Studious -> 20143 + Sharp-Gaze -> 20144 + End-Closer-Straightaways -> 20145 + End-Closer-Corners -> 20146 + I-Can-See-Right-Through-You -> 20147 + After-School-Stroll -> 20148 + Levelheaded -> 20149 + Strategist -> 20150 + Intense-Gaze -> 20151 + Front-Runner-Savvy -> 20152 + Pace-Chaser-Savvy -> 20153 + Late-Surger-Savvy -> 20154 + End-Closer-Savvy -> 20155 + Lucky-Seven -> 20156 + Triple-Sevens -> 20157 + Highlander -> 20158 + Uma-Stan -> 20159 + Groundwork -> 20160 + Tail-Held-High -> 20161 + Shake-It-Out -> 20162 + Sympathy -> 20163 + Lone-Wolf -> 20164 + Slipstream -> 20165 + Playtimes-Over -> 20166 + Top-Pick -> 20167 + Forward-March -> 20168 + Be-Still -> 20169 + All-I-ve-Got -> 20170 + Head-On -> 20190 + Early-Start -> 20202 + Risky-Business -> 20203 + Ignited-Spirit-SPD -> 21001 + Ignited-Spirit-STA -> 21002 + Ignited-Spirit-PWR -> 21003 + Ignited-Spirit-GUTS -> 21004 + Ignited-Spirit-WIT -> 21005 + Unquenched-Thirst -> 30001 + Unchanging -> 30002 + +// Get the skill group for an ID. +pub fip(1) fun skill-group/from-id(^id: int): maybe + match id + 1007 -> Just(Warning-Shot) + 1008 -> Just(Xceleration) + 1009 -> Just(Red-Ace) + 1011 -> Just(Focused-Mind) + 1014 -> Just(Corazon-Ardiente) + 1018 -> Just(Empresss-Pride) + 1024 -> Just(First-Place-Kiss) + 1027 -> Just(Feel-the-Burn) + 1032 -> Just(Introduction-to-Physiology) + 1035 -> Just(V-Is-for-Victory) + 1041 -> Just(Class-Rep-Speed-Bakushin) + 1045 -> Just(Clear-Heart) + 1052 -> Just(Super-Duper-Stoked) + 1056 -> Just(Luck-Be-with-Me) + 1060 -> Just(I-Can-Win-Sometimes-Right) + 1061 -> Just(Call-Me-King) + 10001 -> Just(Shooting-Star) + 10002 -> Just(The-View-from-the-Lead-Is-Mine) + 10003 -> Just(Sky-High-Teio-Step) + 10004 -> Just(Red-Shift-LP1211-M) + 10005 -> Just(Lights-of-Vaudeville) + 10006 -> Just(Triumphant-Pulse) + 10007 -> Just(Anchors-Aweigh) + 10008 -> Just(Cut-and-Drive) + 10009 -> Just(Resplendent-Red-Ace) + 10010 -> Just(Shooting-for-Victory) + 10011 -> Just(Where-Theres-a-Will-Theres-a-Way) + 10012 -> Just(You-and-Me-One-on-One) + 10013 -> Just(The-Duty-of-Dignity-Calls) + 10014 -> Just(Victoria-por-plancha) + 10015 -> Just(This-Dance-Is-for-Vittoria) + 10016 -> Just(Shadow-Break) + 10017 -> Just(Behold-Thine-Emperors-Divine-Might) + 10018 -> Just(Blazing-Pride) + 10019 -> Just(OMG-The-Final-Sprint) + 10020 -> Just(Angling-and-Scheming) + 10023 -> Just(Win-QED) + 10024 -> Just(Flashy-Landing) + 10025 -> Just(Chasing-After-You) + 10026 -> Just(G00-First-FInfinity) + 10027 -> Just(Lets-Pump-Some-Iron) + 10028 -> Just(YUMMY-SPEED) + 10030 -> Just(Blue-Rose-Closer) + 10032 -> Just(U-ma2) + 10035 -> Just(Our-Ticket-to-Win) + 10037 -> Just(Schwarzes-Schwert) + 10038 -> Just(LookatCurren) + 10039 -> Just(A-Princess-Must-Seize-Victory) + 10040 -> Just(KEEP-IT-REAL) + 10041 -> Just(Genius-x-Bakushin-Victory) + 10045 -> Just(Pure-Heart) + 10046 -> Just(SPARKLY-STARDOM) + 10048 -> Just(Pop-Polish) + 10050 -> Just(Nemesis) + 10052 -> Just(Super-Duper-Climax) + 10056 -> Just(I-See-Victory-in-My-Future) + 10058 -> Just(I-Never-Goof-Up) + 10059 -> Just(Moving-Past-and-Beyond) + 10060 -> Just(Just-a-Little-Farther) + 10061 -> Just(Prideful-King) + 11001 -> Just(Dazzl-n-Diver) + 11003 -> Just(Certain-Victory) + 11004 -> Just(A-Kiss-for-Courage) + 11006 -> Just(Festive-Miracle) + 11011 -> Just(Superior-Heal) + 11013 -> Just(Legacy-of-the-Strong) + 11014 -> Just(Condors-Fury) + 11017 -> Just(Arrows-Whistle-Shadows-Disperse) + 11018 -> Just(Eternal-Moments) + 11023 -> Just(Presents-from-X) + 11024 -> Just(Flowery-Maneuver) + 11030 -> Just(Every-Rose-Has-Its-Fangs) + 11040 -> Just(Dancing-in-the-Leaves) + 11045 -> Just(Give-Mummy-a-Hug) + 11056 -> Just(Bountiful-Harvest) + 20001 -> Just(Right-Handed) + 20002 -> Just(Left-Handed) + 20003 -> Just(Tokyo-Racecourse) + 20004 -> Just(Nakayama-Racecourse) + 20005 -> Just(Hanshin-Racecourse) + 20006 -> Just(Kyoto-Racecourse) + 20007 -> Just(Chukyo-Racecourse) + 20008 -> Just(Sapporo-Racecourse) + 20009 -> Just(Hakodate-Racecourse) + 20010 -> Just(Fukushima-Racecourse) + 20011 -> Just(Niigata-Racecourse) + 20012 -> Just(Kokura-Racecourse) + 20013 -> Just(Standard-Distance) + 20014 -> Just(Non-Standard-Distance) + 20015 -> Just(Firm-Conditions) + 20016 -> Just(Wet-Conditions) + 20017 -> Just(Spring-Runner) + 20018 -> Just(Summer-Runner) + 20019 -> Just(Fall-Runner) + 20020 -> Just(Winter-Runner) + 20021 -> Just(Sunny-Days) + 20022 -> Just(Cloudy-Days) + 20023 -> Just(Rainy-Days) + 20024 -> Just(Snowy-Days) + 20025 -> Just(Inner-Post-Proficiency) + 20026 -> Just(Outer-Post-Proficiency) + 20027 -> Just(Maverick) + 20028 -> Just(Competitive-Spirit) + 20029 -> Just(Target-in-Sight) + 20030 -> Just(Long-Shot) + 20033 -> Just(Corner-Adept) + 20034 -> Just(Corner-Acceleration) + 20035 -> Just(Corner-Recovery) + 20036 -> Just(Straightaway-Adept) + 20037 -> Just(Straightaway-Acceleration) + 20038 -> Just(Straightaway-Recovery) + 20043 -> Just(Focus) + 20044 -> Just(Lay-Low) + 20045 -> Just(Prudent-Positioning) + 20046 -> Just(Ramp-Up) + 20047 -> Just(Pace-Strategy) + 20048 -> Just(Calm-in-a-Crowd) + 20049 -> Just(Nimble-Navigator) + 20050 -> Just(Go-with-the-Flow) + 20051 -> Just(Homestretch-Haste) + 20053 -> Just(Early-Lead) + 20054 -> Just(Fast-Paced) + 20055 -> Just(Final-Push) + 20056 -> Just(Stamina-to-Spare) + 20057 -> Just(Preferred-Position) + 20058 -> Just(Prepared-to-Pass) + 20059 -> Just(Position-Pilfer) + 20060 -> Just(Slick-Surge) + 20061 -> Just(Outer-Swell) + 20062 -> Just(Standing-By) + 20063 -> Just(Masterful-Gambit) + 20064 -> Just(Straightaway-Spurt) + 20065 -> Just(Sprinting-Gear) + 20066 -> Just(Wait-and-See) + 20067 -> Just(Gap-Closer) + 20068 -> Just(Productive-Plan) + 20069 -> Just(Watchful-Eye) + 20070 -> Just(Updrafters) + 20071 -> Just(Rosy-Outlook) + 20072 -> Just(Up-Tempo) + 20073 -> Just(Steadfast) + 20074 -> Just(Deep-Breaths) + 20075 -> Just(Inside-Scoop) + 20076 -> Just(Extra-Tank) + 20077 -> Just(Trick-Front) + 20078 -> Just(Trick-Rear) + 20079 -> Just(Frenzied-Front-Runners) + 20080 -> Just(Frenzied-Pace-Chasers) + 20081 -> Just(Frenzied-Late-Surgers) + 20082 -> Just(Frenzied-End-Closers) + 20083 -> Just(Subdued-Front-Runners) + 20084 -> Just(Flustered-Front-Runners) + 20085 -> Just(Hesitant-Front-Runners) + 20086 -> Just(Subdued-Pace-Chasers) + 20087 -> Just(Flustered-Pace-Chasers) + 20088 -> Just(Hesitant-Pace-Chasers) + 20089 -> Just(Subdued-Late-Surgers) + 20090 -> Just(Flustered-Late-Surgers) + 20091 -> Just(Hesitant-Late-Surgers) + 20092 -> Just(Subdued-End-Closers) + 20093 -> Just(Flustered-End-Closers) + 20094 -> Just(Hesitant-End-Closers) + 20095 -> Just(Oi-Racecourse) + 20096 -> Just(Sprint-Straightaways) + 20097 -> Just(Sprint-Corners) + 20098 -> Just(Huge-Lead) + 20099 -> Just(Countermeasure) + 20100 -> Just(Meticulous-Measures) + 20101 -> Just(Intimidate) + 20102 -> Just(Stop-Right-There) + 20103 -> Just(Mile-Straightaways) + 20104 -> Just(Mile-Corners) + 20105 -> Just(Shifting-Gears) + 20106 -> Just(Acceleration) + 20107 -> Just(Unyielding-Spirit) + 20108 -> Just(Speed-Eater) + 20109 -> Just(Opening-Gambit) + 20110 -> Just(Medium-Straightaways) + 20111 -> Just(Medium-Corners) + 20112 -> Just(Hawkeye) + 20113 -> Just(Thunderbolt-Step) + 20114 -> Just(Soft-Step) + 20115 -> Just(Tether) + 20116 -> Just(Murmur) + 20117 -> Just(Long-Straightaways) + 20118 -> Just(Long-Corners) + 20119 -> Just(Keeping-the-Lead) + 20120 -> Just(Passing-Pro) + 20121 -> Just(Pressure) + 20122 -> Just(Stamina-Eater) + 20123 -> Just(Smoke-Screen) + 20124 -> Just(Front-Runner-Straightaways) + 20125 -> Just(Front-Runner-Corners) + 20126 -> Just(Dodging-Danger) + 20127 -> Just(Leaders-Pride) + 20128 -> Just(Moxie) + 20129 -> Just(Second-Wind) + 20130 -> Just(Restart) + 20131 -> Just(Pace-Chaser-Straightaways) + 20132 -> Just(Pace-Chaser-Corners) + 20133 -> Just(Shrewd-Step) + 20134 -> Just(Straight-Descent) + 20135 -> Just(Hydrate) + 20136 -> Just(Tactical-Tweak) + 20137 -> Just(Disorient) + 20138 -> Just(Late-Surger-Straightaways) + 20139 -> Just(Late-Surger-Corners) + 20140 -> Just(Fighter) + 20141 -> Just(Million-CC) + 20142 -> Just(A-Small-Breather) + 20143 -> Just(Studious) + 20144 -> Just(Sharp-Gaze) + 20145 -> Just(End-Closer-Straightaways) + 20146 -> Just(End-Closer-Corners) + 20147 -> Just(I-Can-See-Right-Through-You) + 20148 -> Just(After-School-Stroll) + 20149 -> Just(Levelheaded) + 20150 -> Just(Strategist) + 20151 -> Just(Intense-Gaze) + 20152 -> Just(Front-Runner-Savvy) + 20153 -> Just(Pace-Chaser-Savvy) + 20154 -> Just(Late-Surger-Savvy) + 20155 -> Just(End-Closer-Savvy) + 20156 -> Just(Lucky-Seven) + 20157 -> Just(Triple-Sevens) + 20158 -> Just(Highlander) + 20159 -> Just(Uma-Stan) + 20160 -> Just(Groundwork) + 20161 -> Just(Tail-Held-High) + 20162 -> Just(Shake-It-Out) + 20163 -> Just(Sympathy) + 20164 -> Just(Lone-Wolf) + 20165 -> Just(Slipstream) + 20166 -> Just(Playtimes-Over) + 20167 -> Just(Top-Pick) + 20168 -> Just(Forward-March) + 20169 -> Just(Be-Still) + 20170 -> Just(All-I-ve-Got) + 20190 -> Just(Head-On) + 20202 -> Just(Early-Start) + 20203 -> Just(Risky-Business) + 21001 -> Just(Ignited-Spirit-SPD) + 21002 -> Just(Ignited-Spirit-STA) + 21003 -> Just(Ignited-Spirit-PWR) + 21004 -> Just(Ignited-Spirit-GUTS) + 21005 -> Just(Ignited-Spirit-WIT) + 30001 -> Just(Unquenched-Thirst) + 30002 -> Just(Unchanging) + _ -> Nothing + +// Get names for skill groups. +// Skill group names are the name of the base skill in the group. +pub fun skill-group/show(sg: skill-group): string + match sg + Warning-Shot -> "Warning Shot!" + Xceleration -> "Xceleration" + Red-Ace -> "Red Ace" + Focused-Mind -> "Focused Mind" + Corazon-Ardiente -> "Corazón ☆ Ardiente" + Empresss-Pride -> "Empress's Pride" + First-Place-Kiss -> "1st Place Kiss☆" + Feel-the-Burn -> "Feel the Burn!" + Introduction-to-Physiology -> "Introduction to Physiology" + V-Is-for-Victory -> "V Is for Victory!" + Class-Rep-Speed-Bakushin -> "Class Rep + Speed = Bakushin" + Clear-Heart -> "Clear Heart" + Super-Duper-Stoked -> "Super-Duper Stoked" + Luck-Be-with-Me -> "Luck Be with Me!" + I-Can-Win-Sometimes-Right -> "I Can Win Sometimes, Right?" + Call-Me-King -> "Call Me King" + Shooting-Star -> "Shooting Star" + The-View-from-the-Lead-Is-Mine -> "The View from the Lead Is Mine!" + Sky-High-Teio-Step -> "Sky-High Teio Step" + Red-Shift-LP1211-M -> "Red Shift/LP1211-M" + Lights-of-Vaudeville -> "Lights of Vaudeville" + Triumphant-Pulse -> "Triumphant Pulse" + Anchors-Aweigh -> "Anchors Aweigh!" + Cut-and-Drive -> "Cut and Drive!" + Resplendent-Red-Ace -> "Resplendent Red Ace" + Shooting-for-Victory -> "Shooting for Victory!" + Where-Theres-a-Will-Theres-a-Way -> "Where There's a Will, There's a Way" + You-and-Me-One-on-One -> "You and Me! One-on-One!" + The-Duty-of-Dignity-Calls -> "The Duty of Dignity Calls" + Victoria-por-plancha -> "Victoria por plancha ☆" + This-Dance-Is-for-Vittoria -> "This Dance Is for Vittoria!" + Shadow-Break -> "Shadow Break" + Behold-Thine-Emperors-Divine-Might -> "Behold Thine Emperor's Divine Might" + Blazing-Pride -> "Blazing Pride" + OMG-The-Final-Sprint -> "OMG! (゚∀゚) The Final Sprint! ☆" + Angling-and-Scheming -> "Angling and Scheming" + Win-QED -> "∴win Q.E.D." + Flashy-Landing -> "Flashy☆Landing" + Chasing-After-You -> "Chasing After You" + G00-First-FInfinity -> "G00 1st. F∞;" + Lets-Pump-Some-Iron -> "Let's Pump Some Iron!" + YUMMY-SPEED -> "YUMMY☆SPEED!" + Blue-Rose-Closer -> "Blue Rose Closer" + U-ma2 -> "U=ma2" + Our-Ticket-to-Win -> "Our Ticket to Win!" + Schwarzes-Schwert -> "Schwarzes Schwert" + LookatCurren -> "#LookatCurren" + A-Princess-Must-Seize-Victory -> "A Princess Must Seize Victory!" + KEEP-IT-REAL -> "KEEP IT REAL." + Genius-x-Bakushin-Victory -> "Genius x Bakushin = Victory" + Pure-Heart -> "Pure Heart" + SPARKLY-STARDOM -> "SPARKLY☆STARDOM" + Pop-Polish -> "Pop & Polish" + Nemesis -> "Nemesis" + Super-Duper-Climax -> "Super-Duper Climax" + I-See-Victory-in-My-Future -> "I See Victory in My Future!" + I-Never-Goof-Up -> "I Never Goof Up!" + Moving-Past-and-Beyond -> "Moving Past, and Beyond" + Just-a-Little-Farther -> "Just a Little Farther!" + Prideful-King -> "Prideful King" + Dazzl-n-Diver -> "Dazzl'n ♪ Diver" + Certain-Victory -> "Certain Victory" + A-Kiss-for-Courage -> "A Kiss for Courage" + Festive-Miracle -> "Festive Miracle" + Superior-Heal -> "Superior Heal" + Legacy-of-the-Strong -> "Legacy of the Strong" + Condors-Fury -> "Condor's Fury" + Arrows-Whistle-Shadows-Disperse -> "Arrows Whistle, Shadows Disperse" + Eternal-Moments -> "Eternal Moments" + Presents-from-X -> "Presents from X" + Flowery-Maneuver -> "Flowery☆Maneuver" + Every-Rose-Has-Its-Fangs -> "Every Rose Has Its Fangs" + Dancing-in-the-Leaves -> "Dancing in the Leaves" + Give-Mummy-a-Hug -> "Give Mummy a Hug ♡" + Bountiful-Harvest -> "Bountiful Harvest" + Right-Handed -> "Right-Handed ○" + Left-Handed -> "Left-Handed ○" + Tokyo-Racecourse -> "Tokyo Racecourse ○" + Nakayama-Racecourse -> "Nakayama Racecourse ○" + Hanshin-Racecourse -> "Hanshin Racecourse ○" + Kyoto-Racecourse -> "Kyoto Racecourse ○" + Chukyo-Racecourse -> "Chukyo Racecourse ○" + Sapporo-Racecourse -> "Sapporo Racecourse ○" + Hakodate-Racecourse -> "Hakodate Racecourse ○" + Fukushima-Racecourse -> "Fukushima Racecourse ○" + Niigata-Racecourse -> "Niigata Racecourse ○" + Kokura-Racecourse -> "Kokura Racecourse ○" + Standard-Distance -> "Standard Distance ○" + Non-Standard-Distance -> "Non-Standard Distance ○" + Firm-Conditions -> "Firm Conditions ○" + Wet-Conditions -> "Wet Conditions ○" + Spring-Runner -> "Spring Runner ○" + Summer-Runner -> "Summer Runner ○" + Fall-Runner -> "Fall Runner ○" + Winter-Runner -> "Winter Runner ○" + Sunny-Days -> "Sunny Days ○" + Cloudy-Days -> "Cloudy Days ○" + Rainy-Days -> "Rainy Days ○" + Snowy-Days -> "Snowy Days ○" + Inner-Post-Proficiency -> "Inner Post Proficiency ○" + Outer-Post-Proficiency -> "Outer Post Proficiency ○" + Maverick -> "Maverick ○" + Competitive-Spirit -> "Competitive Spirit ○" + Target-in-Sight -> "Target in Sight ○" + Long-Shot -> "Long Shot ○" + Corner-Adept -> "Corner Adept ○" + Corner-Acceleration -> "Corner Acceleration ○" + Corner-Recovery -> "Corner Recovery ○" + Straightaway-Adept -> "Straightaway Adept" + Straightaway-Acceleration -> "Straightaway Acceleration" + Straightaway-Recovery -> "Straightaway Recovery" + Focus -> "Focus" + Lay-Low -> "Lay Low" + Prudent-Positioning -> "Prudent Positioning" + Ramp-Up -> "Ramp Up" + Pace-Strategy -> "Pace Strategy" + Calm-in-a-Crowd -> "Calm in a Crowd" + Nimble-Navigator -> "Nimble Navigator" + Go-with-the-Flow -> "Go with the Flow" + Homestretch-Haste -> "Homestretch Haste" + Early-Lead -> "Early Lead" + Fast-Paced -> "Fast-Paced" + Final-Push -> "Final Push" + Stamina-to-Spare -> "Stamina to Spare" + Preferred-Position -> "Preferred Position" + Prepared-to-Pass -> "Prepared to Pass" + Position-Pilfer -> "Position Pilfer" + Slick-Surge -> "Slick Surge" + Outer-Swell -> "Outer Swell" + Standing-By -> "Standing By" + Masterful-Gambit -> "Masterful Gambit" + Straightaway-Spurt -> "Straightaway Spurt" + Sprinting-Gear -> "Sprinting Gear" + Wait-and-See -> "Wait-and-See" + Gap-Closer -> "Gap Closer" + Productive-Plan -> "Productive Plan" + Watchful-Eye -> "Watchful Eye" + Updrafters -> "Updrafters" + Rosy-Outlook -> "Rosy Outlook" + Up-Tempo -> "Up-Tempo" + Steadfast -> "Steadfast" + Deep-Breaths -> "Deep Breaths" + Inside-Scoop -> "Inside Scoop" + Extra-Tank -> "Extra Tank" + Trick-Front -> "Trick (Front)" + Trick-Rear -> "Trick (Rear)" + Frenzied-Front-Runners -> "Frenzied Front Runners" + Frenzied-Pace-Chasers -> "Frenzied Pace Chasers" + Frenzied-Late-Surgers -> "Frenzied Late Surgers" + Frenzied-End-Closers -> "Frenzied End Closers" + Subdued-Front-Runners -> "Subdued Front Runners" + Flustered-Front-Runners -> "Flustered Front Runners" + Hesitant-Front-Runners -> "Hesitant Front Runners" + Subdued-Pace-Chasers -> "Subdued Pace Chasers" + Flustered-Pace-Chasers -> "Flustered Pace Chasers" + Hesitant-Pace-Chasers -> "Hesitant Pace Chasers" + Subdued-Late-Surgers -> "Subdued Late Surgers" + Flustered-Late-Surgers -> "Flustered Late Surgers" + Hesitant-Late-Surgers -> "Hesitant Late Surgers" + Subdued-End-Closers -> "Subdued End Closers" + Flustered-End-Closers -> "Flustered End Closers" + Hesitant-End-Closers -> "Hesitant End Closers" + Oi-Racecourse -> "Oi Racecourse ○" + Sprint-Straightaways -> "Sprint Straightaways ○" + Sprint-Corners -> "Sprint Corners ○" + Huge-Lead -> "Huge Lead" + Countermeasure -> "Countermeasure" + Meticulous-Measures -> "Meticulous Measures" + Intimidate -> "Intimidate" + Stop-Right-There -> "Stop Right There!" + Mile-Straightaways -> "Mile Straightaways ○" + Mile-Corners -> "Mile Corners ○" + Shifting-Gears -> "Shifting Gears" + Acceleration -> "Acceleration" + Unyielding-Spirit -> "Unyielding Spirit" + Speed-Eater -> "Speed Eater" + Opening-Gambit -> "Opening Gambit" + Medium-Straightaways -> "Medium Straightaways ○" + Medium-Corners -> "Medium Corners ○" + Hawkeye -> "Hawkeye" + Thunderbolt-Step -> "Thunderbolt Step" + Soft-Step -> "Soft Step" + Tether -> "Tether" + Murmur -> "Murmur" + Long-Straightaways -> "Long Straightaways ○" + Long-Corners -> "Long Corners ○" + Keeping-the-Lead -> "Keeping the Lead" + Passing-Pro -> "Passing Pro" + Pressure -> "Pressure" + Stamina-Eater -> "Stamina Eater" + Smoke-Screen -> "Smoke Screen" + Front-Runner-Straightaways -> "Front Runner Straightaways ○" + Front-Runner-Corners -> "Front Runner Corners ○" + Dodging-Danger -> "Dodging Danger" + Leaders-Pride -> "Leader's Pride" + Moxie -> "Moxie" + Second-Wind -> "Second Wind" + Restart -> "Restart" + Pace-Chaser-Straightaways -> "Pace Chaser Straightaways ○" + Pace-Chaser-Corners -> "Pace Chaser Corners ○" + Shrewd-Step -> "Shrewd Step" + Straight-Descent -> "Straight Descent" + Hydrate -> "Hydrate" + Tactical-Tweak -> "Tactical Tweak" + Disorient -> "Disorient" + Late-Surger-Straightaways -> "Late Surger Straightaways ○" + Late-Surger-Corners -> "Late Surger Corners ○" + Fighter -> "Fighter" + Million-CC -> "1,500,000 CC" + A-Small-Breather -> "A Small Breather" + Studious -> "Studious" + Sharp-Gaze -> "Sharp Gaze" + End-Closer-Straightaways -> "End Closer Straightaways ○" + End-Closer-Corners -> "End Closer Corners ○" + I-Can-See-Right-Through-You -> "I Can See Right Through You" + After-School-Stroll -> "After-School Stroll" + Levelheaded -> "Levelheaded" + Strategist -> "Strategist" + Intense-Gaze -> "Intense Gaze" + Front-Runner-Savvy -> "Front Runner Savvy ○" + Pace-Chaser-Savvy -> "Pace Chaser Savvy ○" + Late-Surger-Savvy -> "Late Surger Savvy ○" + End-Closer-Savvy -> "End Closer Savvy ○" + Lucky-Seven -> "Lucky Seven" + Triple-Sevens -> "Triple 7s" + Highlander -> "Highlander" + Uma-Stan -> "Uma Stan" + Groundwork -> "Groundwork" + Tail-Held-High -> "Tail Held High" + Shake-It-Out -> "Shake It Out" + Sympathy -> "Sympathy" + Lone-Wolf -> "Lone Wolf" + Slipstream -> "Slipstream" + Playtimes-Over -> "Playtime's Over!" + Top-Pick -> "Top Pick" + Forward-March -> "Forward, March!" + Be-Still -> "Be Still" + All-I-ve-Got -> "All I've Got" + Head-On -> "Head-On" + Early-Start -> "Early Start" + Risky-Business -> "Risky Business" + Ignited-Spirit-SPD -> "Ignited Spirit SPD" + Ignited-Spirit-STA -> "Ignited Spirit STA" + Ignited-Spirit-PWR -> "Ignited Spirit PWR" + Ignited-Spirit-GUTS -> "Ignited Spirit GUTS" + Ignited-Spirit-WIT -> "Ignited Spirit WIT" + Unquenched-Thirst -> "Unquenched Thirst" + Unchanging -> "Unchanging" + +// Compare two skill groups by ID order. +pub fip fun skill-group/order2(a: skill-group, b: skill-group): order2 + match cmp(a.group-id, b.group-id) + Lt -> Lt2(a, b) + Eq -> Eq2(a) + Gt -> Gt2(a, b) + +pub fun skill-group/(==)(a: skill-group, b: skill-group): bool + a.group-id == b.group-id \ No newline at end of file diff --git a/horsegen/gen.go b/horsegen/gen.go index 6f22e26..f994a38 100644 --- a/horsegen/gen.go +++ b/horsegen/gen.go @@ -1,15 +1,17 @@ package main import ( - _ "embed" + "embed" "fmt" "io" + "regexp" "strings" "text/template" + "unicode" ) -//go:embed character.kk.template -var characterKK string +//go:embed character.kk.template skill.kk.template +var templates embed.FS // LoadTemplates sets up templates to render game data to source code. func LoadTemplates() (*template.Template, error) { @@ -17,15 +19,11 @@ func LoadTemplates() (*template.Template, error) { t.Funcs(template.FuncMap{ "kkenum": kkenum, }) - t, err := t.Parse(characterKK) - if err != nil { - return nil, fmt.Errorf("parsing characterKK: %w", err) - } - return t, nil + return t.ParseFS(templates, "*") } // ExecCharacterKK renders the Koka character module to w. -func ExecCharacterKK(t *template.Template, w io.Writer, c []Character, pairs, trios []AffinityRelation) error { +func ExecCharacterKK(t *template.Template, w io.Writer, c []NamedID[Character], pairs, trios []AffinityRelation) error { if len(pairs) != len(c)*len(c) { return fmt.Errorf("there are %d pairs but there must be %d for %d characters", len(pairs), len(c)*len(c), len(c)) } @@ -52,7 +50,7 @@ func ExecCharacterKK(t *template.Template, w io.Writer, c []Character, pairs, tr } data := struct { - Characters []Character + Characters []NamedID[Character] Pairs []AffinityRelation Trios []AffinityRelation PairMaps map[int]map[int]int @@ -63,8 +61,56 @@ func ExecCharacterKK(t *template.Template, w io.Writer, c []Character, pairs, tr return t.ExecuteTemplate(w, "koka-character", &data) } +func ExecSkillKK(t *template.Template, w io.Writer, g []NamedID[SkillGroup]) error { + data := struct { + Groups []NamedID[SkillGroup] + }{g} + return t.ExecuteTemplate(w, "koka-skill", &data) +} + +const replaceDash = " ,!?/+();#○◎☆♡'&=♪∀゚∴" + +var ( + kkReplace = func() *strings.Replacer { + r := []string{ + "Triple 7s", "Triple-Sevens", // hard to replace with the right thing automatically + "1,500,000 CC", "Million-CC", + "1st", "First", + ".", "", + "'s", "s", + "ó", "o", + "∞", "Infinity", + } + for _, c := range replaceDash { + r = append(r, string(c), "-") + } + return strings.NewReplacer(r...) + }() + kkMultidash = regexp.MustCompile(`-+`) + kkDashNonletter = regexp.MustCompile(`-[^A-Za-z]`) +) + func kkenum(name string) string { - name = strings.ReplaceAll(name, ".", "") - name = strings.ReplaceAll(name, " ", "-") + orig := name + name = kkReplace.Replace(name) + name = kkMultidash.ReplaceAllLiteralString(name, "-") + name = strings.Trim(name, "-") + if len(name) == 0 { + panic(fmt.Errorf("%q became empty as Koka enum variant", orig)) + } + name = strings.ToUpper(name[:1]) + name[1:] + if !unicode.IsLetter(rune(name[0])) { + panic(fmt.Errorf("Koka enum variant %q (from %q) starts with a non-letter", name, orig)) + } + for _, c := range name { + if c > 127 { + // Koka does not allow non-ASCII characters in source code. + // Don't proceed if we've missed one. + panic(fmt.Errorf("non-ASCII character %q (%[1]U) in Koka enum variant %q (from %q)", c, name, orig)) + } + } + if kkDashNonletter.MatchString(name) { + panic(fmt.Errorf("non-letter character after a dash in Koka enum variant %q (from %q)", name, orig)) + } return name } diff --git a/horsegen/load.go b/horsegen/load.go index c96a976..3e50aa3 100644 --- a/horsegen/load.go +++ b/horsegen/load.go @@ -17,15 +17,26 @@ var characterAffinity2SQL string //go:embed character.affinity3.sql var characterAffinity3SQL string -type Character struct { +//go:embed skill-group.sql +var skillGroupSQL string + +type ( + Character struct{} + SkillGroup struct{} +) + +type NamedID[T any] struct { + // Disallow conversions between NamedID types. + _ [0]*T + ID int Name string - // For internal use, the index of the character. + // For internal use, the index of the identity, when it's needed. // We don't show this in public API, but it lets us use vectors for lookups. Index int } -func Characters(ctx context.Context, db *sqlitex.Pool) ([]Character, error) { +func Characters(ctx context.Context, db *sqlitex.Pool) ([]NamedID[Character], error) { conn, err := db.Take(ctx) defer db.Put(conn) if err != nil { @@ -37,7 +48,7 @@ func Characters(ctx context.Context, db *sqlitex.Pool) ([]Character, error) { } defer stmt.Finalize() - var r []Character + var r []NamedID[Character] for { ok, err := stmt.Step() if err != nil { @@ -46,7 +57,7 @@ func Characters(ctx context.Context, db *sqlitex.Pool) ([]Character, error) { if !ok { break } - c := Character{ + c := NamedID[Character]{ ID: stmt.ColumnInt(0), Name: stmt.ColumnText(1), Index: stmt.ColumnInt(2), @@ -133,3 +144,33 @@ func CharacterTrios(ctx context.Context, db *sqlitex.Pool) ([]AffinityRelation, } return r, nil } + +func SkillGroups(ctx context.Context, db *sqlitex.Pool) ([]NamedID[SkillGroup], error) { + conn, err := db.Take(ctx) + defer db.Put(conn) + if err != nil { + return nil, fmt.Errorf("couldn't get connection for skill groups: %w", err) + } + stmt, _, err := conn.PrepareTransient(skillGroupSQL) + if err != nil { + return nil, fmt.Errorf("couldn't prepare statement for skill groups: %w", err) + } + defer stmt.Finalize() + + var r []NamedID[SkillGroup] + for { + ok, err := stmt.Step() + if err != nil { + return nil, fmt.Errorf("error stepping skill groups: %w", err) + } + if !ok { + break + } + g := NamedID[SkillGroup]{ + ID: stmt.ColumnInt(0), + Name: stmt.ColumnText(1), + } + r = append(r, g) + } + return r, nil +} diff --git a/horsegen/main.go b/horsegen/main.go index 2bd004f..ae32fbe 100644 --- a/horsegen/main.go +++ b/horsegen/main.go @@ -58,6 +58,12 @@ func main() { slog.Error("getting trios", slog.Any("err", err)) os.Exit(1) } + slog.Info("get skill groups") + sg, err := SkillGroups(ctx, db) + if err != nil { + slog.Error("getting skill groups", slog.Any("err", err)) + os.Exit(1) + } cf, err := os.Create(filepath.Join(out, "character.kk")) if err != nil { @@ -69,4 +75,14 @@ func main() { slog.Error("writing character.kk", slog.Any("err", err)) // continue on } + sf, err := os.Create(filepath.Join(out, "skill.kk")) + if err != nil { + slog.Error("creating skill.kk", slog.Any("err", err)) + os.Exit(1) + } + slog.Info("write skills") + if err := ExecSkillKK(t, sf, sg); err != nil { + slog.Error("writing skill.kk", slog.Any("err", err)) + // continue on + } } diff --git a/horsegen/skill-group.sql b/horsegen/skill-group.sql new file mode 100644 index 0000000..bf43916 --- /dev/null +++ b/horsegen/skill-group.sql @@ -0,0 +1,14 @@ +WITH skill_names AS ( + SELECT + "index" AS "id", + "text" AS "name" + FROM text_data + WHERE category = 47 +) +SELECT + group_id, + name +FROM skill_data d + JOIN skill_names n ON d.id = n.id +WHERE d.group_rate = 1 +ORDER BY group_id diff --git a/horsegen/skill.kk.template b/horsegen/skill.kk.template new file mode 100644 index 0000000..1ddde94 --- /dev/null +++ b/horsegen/skill.kk.template @@ -0,0 +1,48 @@ +{{ define "koka-skill" -}} +module horse/skill + +// Automatically generated with the horsegen tool; DO NOT EDIT + +// Skill groups. +// A skill group may contain white, circle, double-circle, gold, and purple skills +// for the same effect. +// Sparks that grant skills refer to a skill group. +pub type skill-group + {{- range $g := $.Groups }} + {{ kkenum $g.Name }} + {{- end }} + +// Map a skill group to its ID. +pub fip fun skill-group/group-id(^sg: skill-group): int + match sg + {{- range $g := $.Groups }} + {{ kkenum $g.Name }} -> {{ $g.ID }} + {{- end }} + +// Get the skill group for an ID. +pub fip(1) fun skill-group/from-id(^id: int): maybe + match id + {{- range $g := $.Groups }} + {{ $g.ID }} -> Just( {{- kkenum $g.Name -}} ) + {{- end }} + _ -> Nothing + +// Get names for skill groups. +// Skill group names are the name of the base skill in the group. +pub fun skill-group/show(sg: skill-group): string + match sg + {{- range $g := $.Groups }} + {{ kkenum $g.Name }} -> {{ printf "%q" $g.Name }} + {{- end }} + +// Compare two skill groups by ID order. +pub fip fun skill-group/order2(a: skill-group, b: skill-group): order2 + match cmp(a.group-id, b.group-id) + Lt -> Lt2(a, b) + Eq -> Eq2(a) + Gt -> Gt2(a, b) + +pub fun skill-group/(==)(a: skill-group, b: skill-group): bool + a.group-id == b.group-id + +{{- end }}