Add biome revisions readable content and visible projectile outcomes
This commit is contained in:
+19
-14
@@ -6,23 +6,28 @@ import (
|
||||
)
|
||||
|
||||
type CombatAttack struct {
|
||||
ID string `json:"id" yaml:"id"`
|
||||
Name string `json:"name" yaml:"name"`
|
||||
Description string `json:"description" yaml:"description"`
|
||||
Delivery string `json:"delivery" yaml:"delivery"`
|
||||
Effect string `json:"effect" yaml:"effect"`
|
||||
Stat string `json:"stat" yaml:"stat"`
|
||||
Multiplier float64 `json:"multiplier" yaml:"multiplier"`
|
||||
Range float64 `json:"range" yaml:"range"`
|
||||
Cooldown float64 `json:"cooldown" yaml:"cooldown"`
|
||||
Stamina float64 `json:"stamina" yaml:"stamina"`
|
||||
Speed float64 `json:"speed" yaml:"speed"`
|
||||
Radius float64 `json:"radius" yaml:"radius"`
|
||||
Duration float64 `json:"duration" yaml:"duration"`
|
||||
Interval float64 `json:"interval" yaml:"interval"`
|
||||
DexteritySpeed float64 `json:"dexteritySpeed,omitempty" yaml:"dexteritySpeed"`
|
||||
StrengthSpeed float64 `json:"strengthSpeed,omitempty" yaml:"strengthSpeed"`
|
||||
ID string `json:"id" yaml:"id"`
|
||||
Name string `json:"name" yaml:"name"`
|
||||
Description string `json:"description" yaml:"description"`
|
||||
Delivery string `json:"delivery" yaml:"delivery"`
|
||||
Effect string `json:"effect" yaml:"effect"`
|
||||
Stat string `json:"stat" yaml:"stat"`
|
||||
Multiplier float64 `json:"multiplier" yaml:"multiplier"`
|
||||
Range float64 `json:"range" yaml:"range"`
|
||||
Cooldown float64 `json:"cooldown" yaml:"cooldown"`
|
||||
Stamina float64 `json:"stamina" yaml:"stamina"`
|
||||
Speed float64 `json:"speed" yaml:"speed"`
|
||||
Radius float64 `json:"radius" yaml:"radius"`
|
||||
Duration float64 `json:"duration" yaml:"duration"`
|
||||
Interval float64 `json:"interval" yaml:"interval"`
|
||||
}
|
||||
|
||||
func (a CombatAttack) Validate() error {
|
||||
if !finiteRange(a.DexteritySpeed, 0, 5) || !finiteRange(a.StrengthSpeed, 0, 5) {
|
||||
return fmt.Errorf("invalid projectile speed coefficients")
|
||||
}
|
||||
if !validSetIdentity(a.ID, a.Name, a.Description) || !slices.Contains([]string{"melee", "projectile"}, a.Delivery) || !slices.Contains([]string{"damage", "heal"}, a.Effect) || !slices.Contains([]string{"meleeDamage", "rangedDamage", "magicDamage"}, a.Stat) || !finiteRange(a.Multiplier, .01, 100) || !finiteRange(a.Range, 1, 128) || !finiteRange(a.Cooldown, .1, 120) || !finiteRange(a.Stamina, 0, 10000) || !finiteRange(a.Speed, 1, 100) || !finiteRange(a.Radius, 0, 24) || !finiteRange(a.Duration, 0, 60) || !finiteRange(a.Interval, .2, 60) {
|
||||
return fmt.Errorf("invalid attack %q", a.ID)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user