horsegen: redesign character template

This commit is contained in:
2026-01-27 21:27:43 -05:00
parent e890108591
commit 98afe7384a
5 changed files with 208 additions and 584 deletions

17
horse/character.kk Normal file
View File

@@ -0,0 +1,17 @@
module horse/character
import horse/game-id
pub struct character-detail
character-id: character-id
name: string
pub fun detail(
c: character-id,
?character/show: (character-id) -> string
): character-detail
Character-detail(c, c.show)
pub fun character-detail/show(d: character-detail): string
val Character-detail(Character-id(id), name) = d
name ++ " (ID " ++ id.show ++ ")"

View File

@@ -4,537 +4,176 @@ module horse/global/character
import std/core/vector
import std/core-extras
import std/data/rb-map
import horse/game-id
pub import horse/character
// Character identity.
pub type character
Special-Week
Silence-Suzuka
Tokai-Teio
Maruzensky
Fuji-Kiseki
Oguri-Cap
Gold-Ship
Vodka
Daiwa-Scarlet
Taiki-Shuttle
Grass-Wonder
Hishi-Amazon
Mejiro-McQueen
El-Condor-Pasa
TM-Opera-O
Narita-Brian
Symboli-Rudolf
Air-Groove
Agnes-Digital
Seiun-Sky
Tamamo-Cross
Fine-Motion
Biwa-Hayahide
Mayano-Top-Gun
Manhattan-Cafe
Mihono-Bourbon
Mejiro-Ryan
Hishi-Akebono
Rice-Shower
Agnes-Tachyon
Admire-Vega
Inari-One
Winning-Ticket
Eishin-Flash
Curren-Chan
Kawakami-Princess
Gold-City
Sakura-Bakushin-O
Sweep-Tosho
Super-Creek
Smart-Falcon
Tosen-Jordan
Narita-Taishin
Nishino-Flower
Haru-Urara
Matikanefukukitaru
Meisho-Doto
Mejiro-Dober
Nice-Nature
King-Halo
val name2id: rbmap<string, character-id> = rb-map/empty()
.set("Special Week", Character-id(1001))
.set("Silence Suzuka", Character-id(1002))
.set("Tokai Teio", Character-id(1003))
.set("Maruzensky", Character-id(1004))
.set("Fuji Kiseki", Character-id(1005))
.set("Oguri Cap", Character-id(1006))
.set("Gold Ship", Character-id(1007))
.set("Vodka", Character-id(1008))
.set("Daiwa Scarlet", Character-id(1009))
.set("Taiki Shuttle", Character-id(1010))
.set("Grass Wonder", Character-id(1011))
.set("Hishi Amazon", Character-id(1012))
.set("Mejiro McQueen", Character-id(1013))
.set("El Condor Pasa", Character-id(1014))
.set("T.M. Opera O", Character-id(1015))
.set("Narita Brian", Character-id(1016))
.set("Symboli Rudolf", Character-id(1017))
.set("Air Groove", Character-id(1018))
.set("Agnes Digital", Character-id(1019))
.set("Seiun Sky", Character-id(1020))
.set("Tamamo Cross", Character-id(1021))
.set("Fine Motion", Character-id(1022))
.set("Biwa Hayahide", Character-id(1023))
.set("Mayano Top Gun", Character-id(1024))
.set("Manhattan Cafe", Character-id(1025))
.set("Mihono Bourbon", Character-id(1026))
.set("Mejiro Ryan", Character-id(1027))
.set("Hishi Akebono", Character-id(1028))
.set("Rice Shower", Character-id(1030))
.set("Agnes Tachyon", Character-id(1032))
.set("Admire Vega", Character-id(1033))
.set("Inari One", Character-id(1034))
.set("Winning Ticket", Character-id(1035))
.set("Eishin Flash", Character-id(1037))
.set("Curren Chan", Character-id(1038))
.set("Kawakami Princess", Character-id(1039))
.set("Gold City", Character-id(1040))
.set("Sakura Bakushin O", Character-id(1041))
.set("Sweep Tosho", Character-id(1044))
.set("Super Creek", Character-id(1045))
.set("Smart Falcon", Character-id(1046))
.set("Tosen Jordan", Character-id(1048))
.set("Narita Taishin", Character-id(1050))
.set("Nishino Flower", Character-id(1051))
.set("Haru Urara", Character-id(1052))
.set("Matikanefukukitaru", Character-id(1056))
.set("Meisho Doto", Character-id(1058))
.set("Mejiro Dober", Character-id(1059))
.set("Nice Nature", Character-id(1060))
.set("King Halo", Character-id(1061))
// The list of all characters in order by ID, for easy iterating.
pub val character/all = [
Special-Week,
Silence-Suzuka,
Tokai-Teio,
Maruzensky,
Fuji-Kiseki,
Oguri-Cap,
Gold-Ship,
Vodka,
Daiwa-Scarlet,
Taiki-Shuttle,
Grass-Wonder,
Hishi-Amazon,
Mejiro-McQueen,
El-Condor-Pasa,
TM-Opera-O,
Narita-Brian,
Symboli-Rudolf,
Air-Groove,
Agnes-Digital,
Seiun-Sky,
Tamamo-Cross,
Fine-Motion,
Biwa-Hayahide,
Mayano-Top-Gun,
Manhattan-Cafe,
Mihono-Bourbon,
Mejiro-Ryan,
Hishi-Akebono,
Rice-Shower,
Agnes-Tachyon,
Admire-Vega,
Inari-One,
Winning-Ticket,
Eishin-Flash,
Curren-Chan,
Kawakami-Princess,
Gold-City,
Sakura-Bakushin-O,
Sweep-Tosho,
Super-Creek,
Smart-Falcon,
Tosen-Jordan,
Narita-Taishin,
Nishino-Flower,
Haru-Urara,
Matikanefukukitaru,
Meisho-Doto,
Mejiro-Dober,
Nice-Nature,
King-Halo,
]
// Get the character ID that has the given exact name.
// If no character matches the name, the result is an invalid ID.
pub fun from-name(name: string): character-id
name2id.lookup(name).default(Character-id(0))
// Get the character for a character ID.
// Generally, these are four digit numbers in the range 1000-1999.
pub fun character/from-id(id: int): maybe<character>
match id
1001 -> Just(Special-Week)
1002 -> Just(Silence-Suzuka)
1003 -> Just(Tokai-Teio)
1004 -> Just(Maruzensky)
1005 -> Just(Fuji-Kiseki)
1006 -> Just(Oguri-Cap)
1007 -> Just(Gold-Ship)
1008 -> Just(Vodka)
1009 -> Just(Daiwa-Scarlet)
1010 -> Just(Taiki-Shuttle)
1011 -> Just(Grass-Wonder)
1012 -> Just(Hishi-Amazon)
1013 -> Just(Mejiro-McQueen)
1014 -> Just(El-Condor-Pasa)
1015 -> Just(TM-Opera-O)
1016 -> Just(Narita-Brian)
1017 -> Just(Symboli-Rudolf)
1018 -> Just(Air-Groove)
1019 -> Just(Agnes-Digital)
1020 -> Just(Seiun-Sky)
1021 -> Just(Tamamo-Cross)
1022 -> Just(Fine-Motion)
1023 -> Just(Biwa-Hayahide)
1024 -> Just(Mayano-Top-Gun)
1025 -> Just(Manhattan-Cafe)
1026 -> Just(Mihono-Bourbon)
1027 -> Just(Mejiro-Ryan)
1028 -> Just(Hishi-Akebono)
1030 -> Just(Rice-Shower)
1032 -> Just(Agnes-Tachyon)
1033 -> Just(Admire-Vega)
1034 -> Just(Inari-One)
1035 -> Just(Winning-Ticket)
1037 -> Just(Eishin-Flash)
1038 -> Just(Curren-Chan)
1039 -> Just(Kawakami-Princess)
1040 -> Just(Gold-City)
1041 -> Just(Sakura-Bakushin-O)
1044 -> Just(Sweep-Tosho)
1045 -> Just(Super-Creek)
1046 -> Just(Smart-Falcon)
1048 -> Just(Tosen-Jordan)
1050 -> Just(Narita-Taishin)
1051 -> Just(Nishino-Flower)
1052 -> Just(Haru-Urara)
1056 -> Just(Matikanefukukitaru)
1058 -> Just(Meisho-Doto)
1059 -> Just(Mejiro-Dober)
1060 -> Just(Nice-Nature)
1061 -> Just(King-Halo)
_ -> Nothing
// Get the name for a character.
// If no character matches the ID, the result is the numeric ID.
pub fun show(c: character-id): string
match c.game-id
1001 -> "Special Week"
1002 -> "Silence Suzuka"
1003 -> "Tokai Teio"
1004 -> "Maruzensky"
1005 -> "Fuji Kiseki"
1006 -> "Oguri Cap"
1007 -> "Gold Ship"
1008 -> "Vodka"
1009 -> "Daiwa Scarlet"
1010 -> "Taiki Shuttle"
1011 -> "Grass Wonder"
1012 -> "Hishi Amazon"
1013 -> "Mejiro McQueen"
1014 -> "El Condor Pasa"
1015 -> "T.M. Opera O"
1016 -> "Narita Brian"
1017 -> "Symboli Rudolf"
1018 -> "Air Groove"
1019 -> "Agnes Digital"
1020 -> "Seiun Sky"
1021 -> "Tamamo Cross"
1022 -> "Fine Motion"
1023 -> "Biwa Hayahide"
1024 -> "Mayano Top Gun"
1025 -> "Manhattan Cafe"
1026 -> "Mihono Bourbon"
1027 -> "Mejiro Ryan"
1028 -> "Hishi Akebono"
1030 -> "Rice Shower"
1032 -> "Agnes Tachyon"
1033 -> "Admire Vega"
1034 -> "Inari One"
1035 -> "Winning Ticket"
1037 -> "Eishin Flash"
1038 -> "Curren Chan"
1039 -> "Kawakami Princess"
1040 -> "Gold City"
1041 -> "Sakura Bakushin O"
1044 -> "Sweep Tosho"
1045 -> "Super Creek"
1046 -> "Smart Falcon"
1048 -> "Tosen Jordan"
1050 -> "Narita Taishin"
1051 -> "Nishino Flower"
1052 -> "Haru Urara"
1056 -> "Matikanefukukitaru"
1058 -> "Meisho Doto"
1059 -> "Mejiro Dober"
1060 -> "Nice Nature"
1061 -> "King Halo"
x -> "character " ++ x.show
// Get the ID for a character.
pub fun character/character-id(c: character): int
match c
Special-Week -> 1001
Silence-Suzuka -> 1002
Tokai-Teio -> 1003
Maruzensky -> 1004
Fuji-Kiseki -> 1005
Oguri-Cap -> 1006
Gold-Ship -> 1007
Vodka -> 1008
Daiwa-Scarlet -> 1009
Taiki-Shuttle -> 1010
Grass-Wonder -> 1011
Hishi-Amazon -> 1012
Mejiro-McQueen -> 1013
El-Condor-Pasa -> 1014
TM-Opera-O -> 1015
Narita-Brian -> 1016
Symboli-Rudolf -> 1017
Air-Groove -> 1018
Agnes-Digital -> 1019
Seiun-Sky -> 1020
Tamamo-Cross -> 1021
Fine-Motion -> 1022
Biwa-Hayahide -> 1023
Mayano-Top-Gun -> 1024
Manhattan-Cafe -> 1025
Mihono-Bourbon -> 1026
Mejiro-Ryan -> 1027
Hishi-Akebono -> 1028
Rice-Shower -> 1030
Agnes-Tachyon -> 1032
Admire-Vega -> 1033
Inari-One -> 1034
Winning-Ticket -> 1035
Eishin-Flash -> 1037
Curren-Chan -> 1038
Kawakami-Princess -> 1039
Gold-City -> 1040
Sakura-Bakushin-O -> 1041
Sweep-Tosho -> 1044
Super-Creek -> 1045
Smart-Falcon -> 1046
Tosen-Jordan -> 1048
Narita-Taishin -> 1050
Nishino-Flower -> 1051
Haru-Urara -> 1052
Matikanefukukitaru -> 1056
Meisho-Doto -> 1058
Mejiro-Dober -> 1059
Nice-Nature -> 1060
King-Halo -> 1061
// Get the name of a character.
pub fun character/show(c: character): string
match c
Special-Week -> "Special Week"
Silence-Suzuka -> "Silence Suzuka"
Tokai-Teio -> "Tokai Teio"
Maruzensky -> "Maruzensky"
Fuji-Kiseki -> "Fuji Kiseki"
Oguri-Cap -> "Oguri Cap"
Gold-Ship -> "Gold Ship"
Vodka -> "Vodka"
Daiwa-Scarlet -> "Daiwa Scarlet"
Taiki-Shuttle -> "Taiki Shuttle"
Grass-Wonder -> "Grass Wonder"
Hishi-Amazon -> "Hishi Amazon"
Mejiro-McQueen -> "Mejiro McQueen"
El-Condor-Pasa -> "El Condor Pasa"
TM-Opera-O -> "T.M. Opera O"
Narita-Brian -> "Narita Brian"
Symboli-Rudolf -> "Symboli Rudolf"
Air-Groove -> "Air Groove"
Agnes-Digital -> "Agnes Digital"
Seiun-Sky -> "Seiun Sky"
Tamamo-Cross -> "Tamamo Cross"
Fine-Motion -> "Fine Motion"
Biwa-Hayahide -> "Biwa Hayahide"
Mayano-Top-Gun -> "Mayano Top Gun"
Manhattan-Cafe -> "Manhattan Cafe"
Mihono-Bourbon -> "Mihono Bourbon"
Mejiro-Ryan -> "Mejiro Ryan"
Hishi-Akebono -> "Hishi Akebono"
Rice-Shower -> "Rice Shower"
Agnes-Tachyon -> "Agnes Tachyon"
Admire-Vega -> "Admire Vega"
Inari-One -> "Inari One"
Winning-Ticket -> "Winning Ticket"
Eishin-Flash -> "Eishin Flash"
Curren-Chan -> "Curren Chan"
Kawakami-Princess -> "Kawakami Princess"
Gold-City -> "Gold City"
Sakura-Bakushin-O -> "Sakura Bakushin O"
Sweep-Tosho -> "Sweep Tosho"
Super-Creek -> "Super Creek"
Smart-Falcon -> "Smart Falcon"
Tosen-Jordan -> "Tosen Jordan"
Narita-Taishin -> "Narita Taishin"
Nishino-Flower -> "Nishino Flower"
Haru-Urara -> "Haru Urara"
Matikanefukukitaru -> "Matikanefukukitaru"
Meisho-Doto -> "Meisho Doto"
Mejiro-Dober -> "Mejiro Dober"
Nice-Nature -> "Nice Nature"
King-Halo -> "King Halo"
// Compare two characters.
pub fip fun character/order2(a: character, b: character): order2<character>
match (a, b)
(Special-Week, Special-Week) -> Eq2(Special-Week)
(Special-Week, b') -> Lt2(Special-Week, b')
(a', Special-Week) -> Gt2(Special-Week, a')
(Silence-Suzuka, Silence-Suzuka) -> Eq2(Silence-Suzuka)
(Silence-Suzuka, b') -> Lt2(Silence-Suzuka, b')
(a', Silence-Suzuka) -> Gt2(Silence-Suzuka, a')
(Tokai-Teio, Tokai-Teio) -> Eq2(Tokai-Teio)
(Tokai-Teio, b') -> Lt2(Tokai-Teio, b')
(a', Tokai-Teio) -> Gt2(Tokai-Teio, a')
(Maruzensky, Maruzensky) -> Eq2(Maruzensky)
(Maruzensky, b') -> Lt2(Maruzensky, b')
(a', Maruzensky) -> Gt2(Maruzensky, a')
(Fuji-Kiseki, Fuji-Kiseki) -> Eq2(Fuji-Kiseki)
(Fuji-Kiseki, b') -> Lt2(Fuji-Kiseki, b')
(a', Fuji-Kiseki) -> Gt2(Fuji-Kiseki, a')
(Oguri-Cap, Oguri-Cap) -> Eq2(Oguri-Cap)
(Oguri-Cap, b') -> Lt2(Oguri-Cap, b')
(a', Oguri-Cap) -> Gt2(Oguri-Cap, a')
(Gold-Ship, Gold-Ship) -> Eq2(Gold-Ship)
(Gold-Ship, b') -> Lt2(Gold-Ship, b')
(a', Gold-Ship) -> Gt2(Gold-Ship, a')
(Vodka, Vodka) -> Eq2(Vodka)
(Vodka, b') -> Lt2(Vodka, b')
(a', Vodka) -> Gt2(Vodka, a')
(Daiwa-Scarlet, Daiwa-Scarlet) -> Eq2(Daiwa-Scarlet)
(Daiwa-Scarlet, b') -> Lt2(Daiwa-Scarlet, b')
(a', Daiwa-Scarlet) -> Gt2(Daiwa-Scarlet, a')
(Taiki-Shuttle, Taiki-Shuttle) -> Eq2(Taiki-Shuttle)
(Taiki-Shuttle, b') -> Lt2(Taiki-Shuttle, b')
(a', Taiki-Shuttle) -> Gt2(Taiki-Shuttle, a')
(Grass-Wonder, Grass-Wonder) -> Eq2(Grass-Wonder)
(Grass-Wonder, b') -> Lt2(Grass-Wonder, b')
(a', Grass-Wonder) -> Gt2(Grass-Wonder, a')
(Hishi-Amazon, Hishi-Amazon) -> Eq2(Hishi-Amazon)
(Hishi-Amazon, b') -> Lt2(Hishi-Amazon, b')
(a', Hishi-Amazon) -> Gt2(Hishi-Amazon, a')
(Mejiro-McQueen, Mejiro-McQueen) -> Eq2(Mejiro-McQueen)
(Mejiro-McQueen, b') -> Lt2(Mejiro-McQueen, b')
(a', Mejiro-McQueen) -> Gt2(Mejiro-McQueen, a')
(El-Condor-Pasa, El-Condor-Pasa) -> Eq2(El-Condor-Pasa)
(El-Condor-Pasa, b') -> Lt2(El-Condor-Pasa, b')
(a', El-Condor-Pasa) -> Gt2(El-Condor-Pasa, a')
(TM-Opera-O, TM-Opera-O) -> Eq2(TM-Opera-O)
(TM-Opera-O, b') -> Lt2(TM-Opera-O, b')
(a', TM-Opera-O) -> Gt2(TM-Opera-O, a')
(Narita-Brian, Narita-Brian) -> Eq2(Narita-Brian)
(Narita-Brian, b') -> Lt2(Narita-Brian, b')
(a', Narita-Brian) -> Gt2(Narita-Brian, a')
(Symboli-Rudolf, Symboli-Rudolf) -> Eq2(Symboli-Rudolf)
(Symboli-Rudolf, b') -> Lt2(Symboli-Rudolf, b')
(a', Symboli-Rudolf) -> Gt2(Symboli-Rudolf, a')
(Air-Groove, Air-Groove) -> Eq2(Air-Groove)
(Air-Groove, b') -> Lt2(Air-Groove, b')
(a', Air-Groove) -> Gt2(Air-Groove, a')
(Agnes-Digital, Agnes-Digital) -> Eq2(Agnes-Digital)
(Agnes-Digital, b') -> Lt2(Agnes-Digital, b')
(a', Agnes-Digital) -> Gt2(Agnes-Digital, a')
(Seiun-Sky, Seiun-Sky) -> Eq2(Seiun-Sky)
(Seiun-Sky, b') -> Lt2(Seiun-Sky, b')
(a', Seiun-Sky) -> Gt2(Seiun-Sky, a')
(Tamamo-Cross, Tamamo-Cross) -> Eq2(Tamamo-Cross)
(Tamamo-Cross, b') -> Lt2(Tamamo-Cross, b')
(a', Tamamo-Cross) -> Gt2(Tamamo-Cross, a')
(Fine-Motion, Fine-Motion) -> Eq2(Fine-Motion)
(Fine-Motion, b') -> Lt2(Fine-Motion, b')
(a', Fine-Motion) -> Gt2(Fine-Motion, a')
(Biwa-Hayahide, Biwa-Hayahide) -> Eq2(Biwa-Hayahide)
(Biwa-Hayahide, b') -> Lt2(Biwa-Hayahide, b')
(a', Biwa-Hayahide) -> Gt2(Biwa-Hayahide, a')
(Mayano-Top-Gun, Mayano-Top-Gun) -> Eq2(Mayano-Top-Gun)
(Mayano-Top-Gun, b') -> Lt2(Mayano-Top-Gun, b')
(a', Mayano-Top-Gun) -> Gt2(Mayano-Top-Gun, a')
(Manhattan-Cafe, Manhattan-Cafe) -> Eq2(Manhattan-Cafe)
(Manhattan-Cafe, b') -> Lt2(Manhattan-Cafe, b')
(a', Manhattan-Cafe) -> Gt2(Manhattan-Cafe, a')
(Mihono-Bourbon, Mihono-Bourbon) -> Eq2(Mihono-Bourbon)
(Mihono-Bourbon, b') -> Lt2(Mihono-Bourbon, b')
(a', Mihono-Bourbon) -> Gt2(Mihono-Bourbon, a')
(Mejiro-Ryan, Mejiro-Ryan) -> Eq2(Mejiro-Ryan)
(Mejiro-Ryan, b') -> Lt2(Mejiro-Ryan, b')
(a', Mejiro-Ryan) -> Gt2(Mejiro-Ryan, a')
(Hishi-Akebono, Hishi-Akebono) -> Eq2(Hishi-Akebono)
(Hishi-Akebono, b') -> Lt2(Hishi-Akebono, b')
(a', Hishi-Akebono) -> Gt2(Hishi-Akebono, a')
(Rice-Shower, Rice-Shower) -> Eq2(Rice-Shower)
(Rice-Shower, b') -> Lt2(Rice-Shower, b')
(a', Rice-Shower) -> Gt2(Rice-Shower, a')
(Agnes-Tachyon, Agnes-Tachyon) -> Eq2(Agnes-Tachyon)
(Agnes-Tachyon, b') -> Lt2(Agnes-Tachyon, b')
(a', Agnes-Tachyon) -> Gt2(Agnes-Tachyon, a')
(Admire-Vega, Admire-Vega) -> Eq2(Admire-Vega)
(Admire-Vega, b') -> Lt2(Admire-Vega, b')
(a', Admire-Vega) -> Gt2(Admire-Vega, a')
(Inari-One, Inari-One) -> Eq2(Inari-One)
(Inari-One, b') -> Lt2(Inari-One, b')
(a', Inari-One) -> Gt2(Inari-One, a')
(Winning-Ticket, Winning-Ticket) -> Eq2(Winning-Ticket)
(Winning-Ticket, b') -> Lt2(Winning-Ticket, b')
(a', Winning-Ticket) -> Gt2(Winning-Ticket, a')
(Eishin-Flash, Eishin-Flash) -> Eq2(Eishin-Flash)
(Eishin-Flash, b') -> Lt2(Eishin-Flash, b')
(a', Eishin-Flash) -> Gt2(Eishin-Flash, a')
(Curren-Chan, Curren-Chan) -> Eq2(Curren-Chan)
(Curren-Chan, b') -> Lt2(Curren-Chan, b')
(a', Curren-Chan) -> Gt2(Curren-Chan, a')
(Kawakami-Princess, Kawakami-Princess) -> Eq2(Kawakami-Princess)
(Kawakami-Princess, b') -> Lt2(Kawakami-Princess, b')
(a', Kawakami-Princess) -> Gt2(Kawakami-Princess, a')
(Gold-City, Gold-City) -> Eq2(Gold-City)
(Gold-City, b') -> Lt2(Gold-City, b')
(a', Gold-City) -> Gt2(Gold-City, a')
(Sakura-Bakushin-O, Sakura-Bakushin-O) -> Eq2(Sakura-Bakushin-O)
(Sakura-Bakushin-O, b') -> Lt2(Sakura-Bakushin-O, b')
(a', Sakura-Bakushin-O) -> Gt2(Sakura-Bakushin-O, a')
(Sweep-Tosho, Sweep-Tosho) -> Eq2(Sweep-Tosho)
(Sweep-Tosho, b') -> Lt2(Sweep-Tosho, b')
(a', Sweep-Tosho) -> Gt2(Sweep-Tosho, a')
(Super-Creek, Super-Creek) -> Eq2(Super-Creek)
(Super-Creek, b') -> Lt2(Super-Creek, b')
(a', Super-Creek) -> Gt2(Super-Creek, a')
(Smart-Falcon, Smart-Falcon) -> Eq2(Smart-Falcon)
(Smart-Falcon, b') -> Lt2(Smart-Falcon, b')
(a', Smart-Falcon) -> Gt2(Smart-Falcon, a')
(Tosen-Jordan, Tosen-Jordan) -> Eq2(Tosen-Jordan)
(Tosen-Jordan, b') -> Lt2(Tosen-Jordan, b')
(a', Tosen-Jordan) -> Gt2(Tosen-Jordan, a')
(Narita-Taishin, Narita-Taishin) -> Eq2(Narita-Taishin)
(Narita-Taishin, b') -> Lt2(Narita-Taishin, b')
(a', Narita-Taishin) -> Gt2(Narita-Taishin, a')
(Nishino-Flower, Nishino-Flower) -> Eq2(Nishino-Flower)
(Nishino-Flower, b') -> Lt2(Nishino-Flower, b')
(a', Nishino-Flower) -> Gt2(Nishino-Flower, a')
(Haru-Urara, Haru-Urara) -> Eq2(Haru-Urara)
(Haru-Urara, b') -> Lt2(Haru-Urara, b')
(a', Haru-Urara) -> Gt2(Haru-Urara, a')
(Matikanefukukitaru, Matikanefukukitaru) -> Eq2(Matikanefukukitaru)
(Matikanefukukitaru, b') -> Lt2(Matikanefukukitaru, b')
(a', Matikanefukukitaru) -> Gt2(Matikanefukukitaru, a')
(Meisho-Doto, Meisho-Doto) -> Eq2(Meisho-Doto)
(Meisho-Doto, b') -> Lt2(Meisho-Doto, b')
(a', Meisho-Doto) -> Gt2(Meisho-Doto, a')
(Mejiro-Dober, Mejiro-Dober) -> Eq2(Mejiro-Dober)
(Mejiro-Dober, b') -> Lt2(Mejiro-Dober, b')
(a', Mejiro-Dober) -> Gt2(Mejiro-Dober, a')
(Nice-Nature, Nice-Nature) -> Eq2(Nice-Nature)
(Nice-Nature, b') -> Lt2(Nice-Nature, b')
(a', Nice-Nature) -> Gt2(Nice-Nature, a')
(King-Halo, King-Halo) -> Eq2(King-Halo)
// Character equality.
pub fun character/(==)(a: character, b: character): bool
match (a, b)
(Special-Week, Special-Week) -> True
(Silence-Suzuka, Silence-Suzuka) -> True
(Tokai-Teio, Tokai-Teio) -> True
(Maruzensky, Maruzensky) -> True
(Fuji-Kiseki, Fuji-Kiseki) -> True
(Oguri-Cap, Oguri-Cap) -> True
(Gold-Ship, Gold-Ship) -> True
(Vodka, Vodka) -> True
(Daiwa-Scarlet, Daiwa-Scarlet) -> True
(Taiki-Shuttle, Taiki-Shuttle) -> True
(Grass-Wonder, Grass-Wonder) -> True
(Hishi-Amazon, Hishi-Amazon) -> True
(Mejiro-McQueen, Mejiro-McQueen) -> True
(El-Condor-Pasa, El-Condor-Pasa) -> True
(TM-Opera-O, TM-Opera-O) -> True
(Narita-Brian, Narita-Brian) -> True
(Symboli-Rudolf, Symboli-Rudolf) -> True
(Air-Groove, Air-Groove) -> True
(Agnes-Digital, Agnes-Digital) -> True
(Seiun-Sky, Seiun-Sky) -> True
(Tamamo-Cross, Tamamo-Cross) -> True
(Fine-Motion, Fine-Motion) -> True
(Biwa-Hayahide, Biwa-Hayahide) -> True
(Mayano-Top-Gun, Mayano-Top-Gun) -> True
(Manhattan-Cafe, Manhattan-Cafe) -> True
(Mihono-Bourbon, Mihono-Bourbon) -> True
(Mejiro-Ryan, Mejiro-Ryan) -> True
(Hishi-Akebono, Hishi-Akebono) -> True
(Rice-Shower, Rice-Shower) -> True
(Agnes-Tachyon, Agnes-Tachyon) -> True
(Admire-Vega, Admire-Vega) -> True
(Inari-One, Inari-One) -> True
(Winning-Ticket, Winning-Ticket) -> True
(Eishin-Flash, Eishin-Flash) -> True
(Curren-Chan, Curren-Chan) -> True
(Kawakami-Princess, Kawakami-Princess) -> True
(Gold-City, Gold-City) -> True
(Sakura-Bakushin-O, Sakura-Bakushin-O) -> True
(Sweep-Tosho, Sweep-Tosho) -> True
(Super-Creek, Super-Creek) -> True
(Smart-Falcon, Smart-Falcon) -> True
(Tosen-Jordan, Tosen-Jordan) -> True
(Narita-Taishin, Narita-Taishin) -> True
(Nishino-Flower, Nishino-Flower) -> True
(Haru-Urara, Haru-Urara) -> True
(Matikanefukukitaru, Matikanefukukitaru) -> True
(Meisho-Doto, Meisho-Doto) -> True
(Mejiro-Dober, Mejiro-Dober) -> True
(Nice-Nature, Nice-Nature) -> True
(King-Halo, King-Halo) -> True
_ -> False
fip fun character/index(^c: character): int
match c
Special-Week -> 0
Silence-Suzuka -> 1
Tokai-Teio -> 2
Maruzensky -> 3
Fuji-Kiseki -> 4
Oguri-Cap -> 5
Gold-Ship -> 6
Vodka -> 7
Daiwa-Scarlet -> 8
Taiki-Shuttle -> 9
Grass-Wonder -> 10
Hishi-Amazon -> 11
Mejiro-McQueen -> 12
El-Condor-Pasa -> 13
TM-Opera-O -> 14
Narita-Brian -> 15
Symboli-Rudolf -> 16
Air-Groove -> 17
Agnes-Digital -> 18
Seiun-Sky -> 19
Tamamo-Cross -> 20
Fine-Motion -> 21
Biwa-Hayahide -> 22
Mayano-Top-Gun -> 23
Manhattan-Cafe -> 24
Mihono-Bourbon -> 25
Mejiro-Ryan -> 26
Hishi-Akebono -> 27
Rice-Shower -> 28
Agnes-Tachyon -> 29
Admire-Vega -> 30
Inari-One -> 31
Winning-Ticket -> 32
Eishin-Flash -> 33
Curren-Chan -> 34
Kawakami-Princess -> 35
Gold-City -> 36
Sakura-Bakushin-O -> 37
Sweep-Tosho -> 38
Super-Creek -> 39
Smart-Falcon -> 40
Tosen-Jordan -> 41
Narita-Taishin -> 42
Nishino-Flower -> 43
Haru-Urara -> 44
Matikanefukukitaru -> 45
Meisho-Doto -> 46
Mejiro-Dober -> 47
Nice-Nature -> 48
King-Halo -> 49
fun character/index(c: character-id): int
match c.game-id
1001 -> 0
1002 -> 1
1003 -> 2
1004 -> 3
1005 -> 4
1006 -> 5
1007 -> 6
1008 -> 7
1009 -> 8
1010 -> 9
1011 -> 10
1012 -> 11
1013 -> 12
1014 -> 13
1015 -> 14
1016 -> 15
1017 -> 16
1018 -> 17
1019 -> 18
1020 -> 19
1021 -> 20
1022 -> 21
1023 -> 22
1024 -> 23
1025 -> 24
1026 -> 25
1027 -> 26
1028 -> 27
1030 -> 28
1032 -> 29
1033 -> 30
1034 -> 31
1035 -> 32
1037 -> 33
1038 -> 34
1039 -> 35
1040 -> 36
1041 -> 37
1044 -> 38
1045 -> 39
1046 -> 40
1048 -> 41
1050 -> 42
1051 -> 43
1052 -> 44
1056 -> 45
1058 -> 46
1059 -> 47
1060 -> 48
1061 -> 49
_ -> -99999999
// Create the table of all pair affinities.
// The affinity is the value at a.index*count + b.index.
@@ -544,7 +183,7 @@ extern global/create-pair-table(): vector<int>
val global/pair-table = global/create-pair-table()
// Base affinity between a pair using the global ruleset.
pub fun global/pair-affinity(a: character, b: character): int
pub fun global/pair-affinity(a: character-id, b: character-id): int
global/pair-table.at(a.index * 50 + b.index).default(0)
// Create the table of all trio affinities.
@@ -555,5 +194,5 @@ extern global/create-trio-table(): vector<int>
val global/trio-table = global/create-trio-table()
// Base affinity for a trio using the global ruleset.
pub fun global/trio-affinity(a: character, b: character, c: character): int
pub fun global/trio-affinity(a: character-id, b: character-id, c: character-id): int
global/trio-table.at(a.index * 50 * 50 + b.index * 50 + c.index).default(0)

View File

@@ -512,7 +512,7 @@ val name2id: rbmap<string, skill-id> = rb-map/empty()
// Get the skill ID that has the given exact name.
// Inherited skills have `" (Inherited)"` appended to their names.
// If no skill matches the ID, the result is an invalid ID.
// If no skill matches the name, the result is an invalid ID.
pub fun from-name(name: string): skill-id
name2id.lookup(name).default(Skill-id(0))

View File

@@ -5,67 +5,35 @@ module horse/{{ $.Region }}/character
import std/core/vector
import std/core-extras
import std/data/rb-map
import horse/game-id
pub import horse/character
// Character identity.
pub type character
val name2id: rbmap<string, character-id> = rb-map/empty()
{{- range $uma := $.Characters }}
{{ kkenum $uma.Name }}
.set({{ printf "%q" $uma.Name }}, Character-id({{ $uma.ID}}))
{{- end }}
// The list of all characters in order by ID, for easy iterating.
pub val character/all = [
{{- range $uma := $.Characters }}
{{ kkenum $uma.Name }},
{{- end }}
]
// Get the character ID that has the given exact name.
// If no character matches the name, the result is an invalid ID.
pub fun from-name(name: string): character-id
name2id.lookup(name).default(Character-id(0))
// Get the character for a character ID.
// Generally, these are four digit numbers in the range 1000-1999.
pub fun character/from-id(id: int): maybe<character>
match id
// Get the name for a character.
// If no character matches the ID, the result is the numeric ID.
pub fun show(c: character-id): string
match c.game-id
{{- range $uma := $.Characters }}
{{ $uma.ID }} -> Just( {{- kkenum $uma.Name -}} )
{{ $uma.ID }} -> {{ printf "%q" $uma.Name }}
{{- end }}
_ -> Nothing
x -> "character " ++ x.show
// Get the ID for a character.
pub fun character/character-id(c: character): int
match c
fun character/index(c: character-id): int
match c.game-id
{{- range $uma := $.Characters }}
{{ kkenum $uma.Name }} -> {{ $uma.ID }}
{{- end }}
// Get the name of a character.
pub fun character/show(c: character): string
match c
{{- range $uma := $.Characters }}
{{ kkenum $uma.Name }} -> {{ printf "%q" $uma.Name }}
{{- end }}
// Compare two characters.
pub fip fun character/order2(a: character, b: character): order2<character>
match (a, b)
{{- range $uma := $.Characters }}{{ $e := kkenum $uma.Name }}
( {{- $e }}, {{ $e -}} ) -> Eq2( {{- $e -}} )
{{- if ne $uma.ID $.MaxID }}
( {{- $e }}, b') -> Lt2( {{- $e }}, b')
(a', {{ $e -}} ) -> Gt2( {{- $e }}, a')
{{- end }}
{{- end }}
// Character equality.
pub fun character/(==)(a: character, b: character): bool
match (a, b)
{{- range $uma := $.Characters }}{{ $e := kkenum $uma.Name }}
( {{- $e }}, {{ $e -}} ) -> True
{{- end }}
_ -> False
fip fun character/index(^c: character): int
match c
{{- range $uma := $.Characters }}
{{ kkenum $uma.Name }} -> {{ $uma.Index }}
{{ $uma.ID }} -> {{ $uma.Index }}
{{- end }}
_ -> -99999999
// Create the table of all pair affinities.
// The affinity is the value at a.index*count + b.index.
@@ -87,7 +55,7 @@ extern global/create-pair-table(): vector<int>
val global/pair-table = global/create-pair-table()
// Base affinity between a pair using the global ruleset.
pub fun global/pair-affinity(a: character, b: character): int
pub fun global/pair-affinity(a: character-id, b: character-id): int
global/pair-table.at(a.index * {{ $.Count }} + b.index).default(0)
// Create the table of all trio affinities.
@@ -114,7 +82,7 @@ extern global/create-trio-table(): vector<int>
val global/trio-table = global/create-trio-table()
// Base affinity for a trio using the global ruleset.
pub fun global/trio-affinity(a: character, b: character, c: character): int
pub fun global/trio-affinity(a: character-id, b: character-id, c: character-id): int
global/trio-table.at(a.index * {{ $.Count }} * {{ $.Count }} + b.index * {{ $.Count }} + c.index).default(0)
{{- end }}

View File

@@ -16,7 +16,7 @@ val name2id: rbmap<string, skill-id> = rb-map/empty()
// Get the skill ID that has the given exact name.
// Inherited skills have `" (Inherited)"` appended to their names.
// If no skill matches the ID, the result is an invalid ID.
// If no skill matches the name, the result is an invalid ID.
pub fun from-name(name: string): skill-id
name2id.lookup(name).default(Skill-id(0))