Compare commits
2 Commits
f3f070ca2b
...
2393bf2fa5
| Author | SHA1 | Date | |
|---|---|---|---|
| 2393bf2fa5 | |||
| bf06de0f5e |
@@ -67,29 +67,12 @@ pub fun grade/show(this : grade) : e string
|
|||||||
G1 -> "G1"
|
G1 -> "G1"
|
||||||
EX -> "EX"
|
EX -> "EX"
|
||||||
|
|
||||||
// Graded race that a veteran ran.
|
// Instance of a race.
|
||||||
pub struct race-result
|
pub struct race-instance-detail
|
||||||
|
race-instance-id: race-instance-id
|
||||||
race-id: race-id
|
race-id: race-id
|
||||||
place: int
|
|
||||||
turn: turn
|
turn: turn
|
||||||
|
|
||||||
// Automatically generated.
|
|
||||||
// Equality comparison of the `race-result` type.
|
|
||||||
pub fun race-result/(==)(this : race-result, other : race-result) : e bool
|
|
||||||
match (this, other)
|
|
||||||
(Race-result(race, place, turn), Race-result(race', place', turn')) -> race == race' && place == place' && turn == turn'
|
|
||||||
|
|
||||||
// Automatically generated.
|
|
||||||
// Shows a string representation of the `race-result` type.
|
|
||||||
pub fun race-result/show(this : race-result, ?race/show: (race-id) -> string) : e string
|
|
||||||
match this
|
|
||||||
Race-result(race-id, place, turn) -> turn.show ++ " " ++ race-id.show ++ ": " ++ place.show
|
|
||||||
|
|
||||||
// Determine whether two race results are for the same race.
|
|
||||||
// This differs from (==) which also requires the race to be on the same turn.
|
|
||||||
pub fun race-result/same-race(a: race-result, b: race-result): bool
|
|
||||||
a.race-id == b.race-id
|
|
||||||
|
|
||||||
// Turn that a race occurred.
|
// Turn that a race occurred.
|
||||||
pub struct turn
|
pub struct turn
|
||||||
year: turn-year
|
year: turn-year
|
||||||
|
|||||||
@@ -93,7 +93,25 @@ func (a Ability) String() string {
|
|||||||
r = append(r, " track widths"...)
|
r = append(r, " track widths"...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if a.Target != TargetSelf {
|
switch a.Target {
|
||||||
|
case TargetSelf:
|
||||||
|
// do nothing
|
||||||
|
case TargetStyle, TargetRushingStyle:
|
||||||
|
// TargetValue is the style to target, not the number of targets.
|
||||||
|
r = append(r, " to "...)
|
||||||
|
r = append(r, a.Target.String()...)
|
||||||
|
switch a.TargetValue {
|
||||||
|
case 1:
|
||||||
|
r = append(r, " Front Runner"...)
|
||||||
|
case 2:
|
||||||
|
r = append(r, " Pace Chaser"...)
|
||||||
|
case 3:
|
||||||
|
r = append(r, " Late Surger"...)
|
||||||
|
case 4:
|
||||||
|
r = append(r, " End Closer"...)
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
// For other targeting types, TargetValue is either irrelevant or limit.
|
||||||
r = append(r, " to "...)
|
r = append(r, " to "...)
|
||||||
if a.TargetValue > 1 && a.TargetValue < 18 {
|
if a.TargetValue > 1 && a.TargetValue < 18 {
|
||||||
r = strconv.AppendInt(r, int64(a.TargetValue), 10)
|
r = strconv.AppendInt(r, int64(a.TargetValue), 10)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
module horse/trainee
|
module horse/trainee
|
||||||
|
|
||||||
|
import horse/game-id
|
||||||
import horse/movement
|
import horse/movement
|
||||||
|
|
||||||
// Details of a trainee.
|
// Details of a trainee.
|
||||||
@@ -14,3 +15,24 @@ pub struct trainee-detail
|
|||||||
pace-chaser: level
|
pace-chaser: level
|
||||||
late-surger: level
|
late-surger: level
|
||||||
end-closer: level
|
end-closer: level
|
||||||
|
|
||||||
|
// Graded race that a veteran ran.
|
||||||
|
pub struct race-result
|
||||||
|
race-id: race-id
|
||||||
|
race-instance-id: race-instance-id
|
||||||
|
place: int
|
||||||
|
|
||||||
|
// Automatically generated.
|
||||||
|
// Equality comparison of the `race-result` type.
|
||||||
|
pub fun race-result/(==)(this : race-result, other : race-result) : e bool
|
||||||
|
match (this, other)
|
||||||
|
(Race-result(race-id, race-instance-id, place), Race-result(race-id', race-instance-id', place')) -> race-id == race-id' && race-instance-id == race-instance-id' && place == place'
|
||||||
|
|
||||||
|
pub fun race-result/show(r: race-result, ?race/show: (race-id) -> string) : e string
|
||||||
|
val Race-result(race, _, place) = r
|
||||||
|
race.show ++ ": " ++ place.show
|
||||||
|
|
||||||
|
// Determine whether two race results are for the same race.
|
||||||
|
// This differs from (==) which also requires the race to be on the same turn.
|
||||||
|
pub fun race-result/same-race(a: race-result, b: race-result): bool
|
||||||
|
a.race-id == b.race-id
|
||||||
|
|||||||
Reference in New Issue
Block a user