From b0c555f547e4603fe4bfc360f2549a7c7c904734 Mon Sep 17 00:00:00 2001 From: Branden J Brown Date: Thu, 15 Jan 2026 23:46:10 -0500 Subject: [PATCH] horse: stringify abilities --- horse/abilitytarget_string.go | 58 ++++++++++++++++++++ horse/abilitytype_string.go | 20 +++---- horse/abilityvalueusage_string.go | 29 ++++++++++ horse/skill.go | 91 ++++++++++++++++++++++++------- 4 files changed, 169 insertions(+), 29 deletions(-) create mode 100644 horse/abilitytarget_string.go create mode 100644 horse/abilityvalueusage_string.go diff --git a/horse/abilitytarget_string.go b/horse/abilitytarget_string.go new file mode 100644 index 0000000..f78fba7 --- /dev/null +++ b/horse/abilitytarget_string.go @@ -0,0 +1,58 @@ +// Code generated by "stringer -type AbilityTarget -trimprefix Target -linecomment"; DO NOT EDIT. + +package horse + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[TargetSelf-1] + _ = x[TargetSympathizers-2] + _ = x[TargetInView-4] + _ = x[TargetFrontmost-7] + _ = x[TargetAhead-9] + _ = x[TargetBehind-10] + _ = x[TargetAllTeammates-11] + _ = x[TargetStyle-18] + _ = x[TargetRushingAhead-19] + _ = x[TargetRushingBehind-20] + _ = x[TargetRushingStyle-21] + _ = x[TargetCharacter-22] + _ = x[TargetTriggering-23] +} + +const ( + _AbilityTarget_name_0 = "selfothers with Sympathy" + _AbilityTarget_name_1 = "others in view" + _AbilityTarget_name_2 = "frontmost" + _AbilityTarget_name_3 = "others aheadothers behindall teammates" + _AbilityTarget_name_4 = "using stylerushing others aheadrushing others behindrushing using stylespecific characterwhosoever triggered this skill" +) + +var ( + _AbilityTarget_index_0 = [...]uint8{0, 4, 24} + _AbilityTarget_index_3 = [...]uint8{0, 12, 25, 38} + _AbilityTarget_index_4 = [...]uint8{0, 11, 31, 52, 71, 89, 119} +) + +func (i AbilityTarget) String() string { + switch { + case 1 <= i && i <= 2: + i -= 1 + return _AbilityTarget_name_0[_AbilityTarget_index_0[i]:_AbilityTarget_index_0[i+1]] + case i == 4: + return _AbilityTarget_name_1 + case i == 7: + return _AbilityTarget_name_2 + case 9 <= i && i <= 11: + i -= 9 + return _AbilityTarget_name_3[_AbilityTarget_index_3[i]:_AbilityTarget_index_3[i+1]] + case 18 <= i && i <= 23: + i -= 18 + return _AbilityTarget_name_4[_AbilityTarget_index_4[i]:_AbilityTarget_index_4[i+1]] + default: + return "AbilityTarget(" + strconv.FormatInt(int64(i), 10) + ")" + } +} diff --git a/horse/abilitytype_string.go b/horse/abilitytype_string.go index 044587a..4d18ed2 100644 --- a/horse/abilitytype_string.go +++ b/horse/abilitytype_string.go @@ -1,4 +1,4 @@ -// Code generated by "stringer -type AbilityType -trimprefix Ability"; DO NOT EDIT. +// Code generated by "stringer -type AbilityType -trimprefix Ability -linecomment"; DO NOT EDIT. package horse @@ -26,19 +26,19 @@ func _() { } const ( - _AbilityType_name_0 = "PassiveSpeedPassiveStaminaPassivePowerPassiveGutsPassiveWitGreatEscape" - _AbilityType_name_1 = "VisionHPGateDelay" + _AbilityType_name_0 = "SpeedStaminaPowerGutsWitGreat Escape" + _AbilityType_name_1 = "VisionHPGate delay multiplier" _AbilityType_name_2 = "Frenzy" - _AbilityType_name_3 = "CurrentSpeed" - _AbilityType_name_4 = "TargetSpeedLaneSpeed" - _AbilityType_name_5 = "Accel" - _AbilityType_name_6 = "LaneChange" + _AbilityType_name_3 = "Current speed" + _AbilityType_name_4 = "Target speedLane change speed" + _AbilityType_name_5 = "Acceleration" + _AbilityType_name_6 = "Forced lane change" ) var ( - _AbilityType_index_0 = [...]uint8{0, 12, 26, 38, 49, 59, 70} - _AbilityType_index_1 = [...]uint8{0, 6, 8, 17} - _AbilityType_index_4 = [...]uint8{0, 11, 20} + _AbilityType_index_0 = [...]uint8{0, 5, 12, 17, 21, 24, 36} + _AbilityType_index_1 = [...]uint8{0, 6, 8, 29} + _AbilityType_index_4 = [...]uint8{0, 12, 29} ) func (i AbilityType) String() string { diff --git a/horse/abilityvalueusage_string.go b/horse/abilityvalueusage_string.go new file mode 100644 index 0000000..376b699 --- /dev/null +++ b/horse/abilityvalueusage_string.go @@ -0,0 +1,29 @@ +// Code generated by "stringer -type AbilityValueUsage -trimprefix ValueUsage -linecomment"; DO NOT EDIT. + +package horse + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[ValueUsageDirect-1] + _ = x[ValueUsageTeamSpeed-2] + _ = x[ValueUsageTeamStamina-3] + _ = x[ValueUsageTeamPower-4] + _ = x[ValueUsageTeamGuts-5] + _ = x[ValueUsageTeamWit-6] +} + +const _AbilityValueUsage_name = "directlyscaling with team Speedscaling with team Staminascaling with team Powerscaling with team Gutsscaling with team Wit" + +var _AbilityValueUsage_index = [...]uint8{0, 8, 31, 56, 79, 101, 122} + +func (i AbilityValueUsage) String() string { + idx := int(i) - 1 + if i < 1 || idx >= len(_AbilityValueUsage_index)-1 { + return "AbilityValueUsage(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _AbilityValueUsage_name[_AbilityValueUsage_index[idx]:_AbilityValueUsage_index[idx+1]] +} diff --git a/horse/skill.go b/horse/skill.go index 1fb696f..10ee287 100644 --- a/horse/skill.go +++ b/horse/skill.go @@ -44,29 +44,82 @@ type Activation struct { // Ability is an individual effect applied by a skill. type Ability struct { Type AbilityType - ValueUsage int8 - Value int32 - Target int8 + 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 +//go:generate go run golang.org/x/tools/cmd/stringer@v0.41.0 -type AbilityType -trimprefix Ability -linecomment const ( - AbilityPassiveSpeed AbilityType = 1 - AbilityPassiveStamina AbilityType = 2 - AbilityPassivePower AbilityType = 3 - AbilityPassiveGuts AbilityType = 4 - AbilityPassiveWit AbilityType = 5 - AbilityGreatEscape AbilityType = 6 - AbilityVision AbilityType = 8 - AbilityHP AbilityType = 9 - AbilityGateDelay AbilityType = 10 - AbilityFrenzy AbilityType = 13 - AbilityCurrentSpeed AbilityType = 21 - AbilityTargetSpeed AbilityType = 27 - AbilityLaneSpeed AbilityType = 28 - AbilityAccel AbilityType = 31 - AbilityLaneChange AbilityType = 35 + 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 )