126 lines
3.9 KiB
Go
126 lines
3.9 KiB
Go
package horse
|
|
|
|
import "strconv"
|
|
|
|
type SkillID int32
|
|
|
|
type TenThousandths int32
|
|
|
|
func (x TenThousandths) String() string {
|
|
b := make([]byte, 0, 12)
|
|
b = strconv.AppendInt(b, int64(x/1e4), 10)
|
|
b = append(b, '.')
|
|
if x < 0 {
|
|
x = -x
|
|
}
|
|
b = strconv.AppendInt(b, int64(x%1e4), 10)
|
|
return string(b)
|
|
}
|
|
|
|
// Skill is the internal data about a skill.
|
|
type Skill struct {
|
|
ID SkillID
|
|
Name string
|
|
Description string
|
|
Group int32
|
|
Rarity int8
|
|
GroupRate int8
|
|
GradeValue int32
|
|
WitCheck bool
|
|
Activations []Activation
|
|
SPCost int
|
|
IconID int
|
|
}
|
|
|
|
// Activation is the parameters controlling when a skill activates.
|
|
type Activation struct {
|
|
Precondition string
|
|
Condition string
|
|
Duration TenThousandths
|
|
Cooldown TenThousandths
|
|
Abilities []Ability
|
|
}
|
|
|
|
// Ability is an individual effect applied by a skill.
|
|
type Ability struct {
|
|
Type AbilityType
|
|
ValueUsage AbilityValueUsage
|
|
Value TenThousandths
|
|
Target AbilityTarget
|
|
TargetValue int32
|
|
}
|
|
|
|
func (a Ability) String() string {
|
|
r := make([]byte, 0, 64)
|
|
r = append(r, a.Type.String()...)
|
|
if a.Value != 0 {
|
|
r = append(r, ' ')
|
|
r = append(r, a.Value.String()...)
|
|
}
|
|
if a.Target != TargetSelf {
|
|
r = append(r, " to "...)
|
|
if a.TargetValue > 1 && a.TargetValue < 18 {
|
|
r = strconv.AppendInt(r, int64(a.TargetValue), 10)
|
|
r = append(r, ' ')
|
|
}
|
|
r = append(r, a.Target.String()...)
|
|
}
|
|
if a.ValueUsage != ValueUsageDirect {
|
|
r = append(r, ' ')
|
|
r = append(r, a.ValueUsage.String()...)
|
|
}
|
|
return string(r)
|
|
}
|
|
|
|
type AbilityType int8
|
|
|
|
//go:generate go run golang.org/x/tools/cmd/stringer@v0.41.0 -type AbilityType -trimprefix Ability -linecomment
|
|
const (
|
|
AbilityPassiveSpeed AbilityType = 1 // Speed
|
|
AbilityPassiveStamina AbilityType = 2 // Stamina
|
|
AbilityPassivePower AbilityType = 3 // Power
|
|
AbilityPassiveGuts AbilityType = 4 // Guts
|
|
AbilityPassiveWit AbilityType = 5 // Wit
|
|
AbilityGreatEscape AbilityType = 6 // Great Escape
|
|
AbilityVision AbilityType = 8 // Vision
|
|
AbilityHP AbilityType = 9 // HP
|
|
AbilityGateDelay AbilityType = 10 // Gate delay multiplier
|
|
AbilityFrenzy AbilityType = 13 // Frenzy
|
|
AbilityCurrentSpeed AbilityType = 21 // Current speed
|
|
AbilityTargetSpeed AbilityType = 27 // Target speed
|
|
AbilityLaneSpeed AbilityType = 28 // Lane change speed
|
|
AbilityAccel AbilityType = 31 // Acceleration
|
|
AbilityLaneChange AbilityType = 35 // Forced lane change
|
|
)
|
|
|
|
type AbilityValueUsage int8
|
|
|
|
//go:generate go run golang.org/x/tools/cmd/stringer@v0.41.0 -type AbilityValueUsage -trimprefix ValueUsage -linecomment
|
|
const (
|
|
ValueUsageDirect AbilityValueUsage = 1 // directly
|
|
ValueUsageTeamSpeed AbilityValueUsage = 2 // scaling with team Speed
|
|
ValueUsageTeamStamina AbilityValueUsage = 3 // scaling with team Stamina
|
|
ValueUsageTeamPower AbilityValueUsage = 4 // scaling with team Power
|
|
ValueUsageTeamGuts AbilityValueUsage = 5 // scaling with team Guts
|
|
ValueUsageTeamWit AbilityValueUsage = 6 // scaling with team Wit
|
|
)
|
|
|
|
type AbilityTarget int8
|
|
|
|
//go:generate go run golang.org/x/tools/cmd/stringer@v0.41.0 -type AbilityTarget -trimprefix Target -linecomment
|
|
const (
|
|
TargetSelf AbilityTarget = 1 // self
|
|
TargetSympathizers AbilityTarget = 2 // others with Sympathy
|
|
TargetInView AbilityTarget = 4 // others in view
|
|
TargetFrontmost AbilityTarget = 7 // frontmost
|
|
TargetAhead AbilityTarget = 9 // others ahead
|
|
TargetBehind AbilityTarget = 10 // others behind
|
|
TargetAllTeammates AbilityTarget = 11 // all teammates
|
|
TargetStyle AbilityTarget = 18 // using style
|
|
TargetRushingAhead AbilityTarget = 19 // rushing others ahead
|
|
TargetRushingBehind AbilityTarget = 20 // rushing others behind
|
|
TargetRushingStyle AbilityTarget = 21 // rushing using style
|
|
TargetCharacter AbilityTarget = 22 // specific character
|
|
TargetTriggering AbilityTarget = 23 // whosoever triggered this skill
|
|
)
|