ruleset

package
v0.0.0-...-5dfbc55 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyVtMPredatorType

func ApplyVtMPredatorType(predatorType string, stats map[string]any)

ApplyVtMPredatorType modifies a character stats map in-place with the grants for the named Predator Type. No-op if the type is not found.

func CanAffordAny

func CanAffordAny(system string, currentXP int, statsJSON string) bool

CanAffordAny returns true if the character can afford at least one valid advancement for the system, given their current XP and stats. Pass statsJSON for VtM discipline checks. Returns false for coc and paranoia (no XP advancement).

func CharacterOptions

func CharacterOptions(system string) map[string][]string

CharacterOptions returns a map of field key → possible values for every chooseable (text/select) field in a given ruleset system. Fields whose values depend on another field (e.g. l5r family depends on clan) are omitted. Returns nil for unknown or fully-numeric systems.

func CostRulesDescription

func CostRulesDescription(system string) string

CostRulesDescription returns a brief human-readable summary of XP costs for a system.

func FieldHints

func FieldHints(system string) string

FieldHints returns a string listing valid field keys for the system, suitable for injection into an AI prompt. This prevents the AI from guessing human-readable names (e.g. "ballistic_skill") instead of the actual JSON stat keys (e.g. "bs").

func MinimumXPCost

func MinimumXPCost(system string) (int, bool)

MinimumXPCost returns the cheapest legal advancement threshold for a system. It is the shared eligibility floor; exact costs still come from XPCostFor.

func RollStats

func RollStats(system, archetype string) map[string]any

RollStats returns a map of randomly generated starting field values for the given ruleset system. Every schema field is populated — text fields are randomly chosen from canonical options. An unrecognised system returns an empty map.

If a system isn't handled by the switch below, RollStats falls back to reading "default" values from the schema_json if provided. This allows new rulesets to be added without Go code changes — just define defaults in the migration SQL.

func RollStatsFromSchema

func RollStatsFromSchema(schemaJSON string) map[string]any

RollStatsFromSchema generates starting stats purely from schema_json field defaults. This allows adding new rulesets without any Go code changes. Fields with a "default" value use it directly; fields with "options" but no default pick randomly; everything else gets a zero/empty value.

func ValidFields

func ValidFields(system string) []string

ValidFields returns the list of advanceable field names for the given system. For talent advances (wrath_glory), the prefix "talent:" is used but talents are not enumerated here — use WGTalentExists to check a specific talent.

func VtMInClanDisciplinesFor

func VtMInClanDisciplinesFor(clan string) ([]string, bool)

VtMInClanDisciplinesFor returns the in-clan discipline field keys for a VtM clan. Lookup is case-insensitive. The second return value is false if the clan is not recognized. Caitiff returns an empty slice (all disciplines are out-of-clan for them).

func WGRecalcDerived

func WGRecalcDerived(stats map[string]any, field string)

WGRecalcDerived recalculates W&G derived stats that depend on the given field. stats is the full character stats map (modified in place). field is the attribute that was just advanced (e.g., "toughness"). Requires "archetype" key in stats to look up tier.

func WGTalentCost

func WGTalentCost(name string) int

WGTalentCost returns the XP cost for a named W&G talent. Returns 20 (default) for unknown talent names.

func WGTalentExists

func WGTalentExists(name string) bool

WGTalentExists returns true if name is a known purchasable W&G talent. Archetype starting abilities (Fiery Invective, Psyker, etc.) return false.

func XPCostFor

func XPCostFor(system, field string, newVal int, statsJSON string) int

XPCostFor returns the XP cost for advancing field to newVal for the given system. statsJSON is required only for VtM discipline in/out-of-clan determination; pass "" otherwise. Returns 0 for systems where XP is threshold-based rather than spent (dnd5e level-up).

func XPKey

func XPKey(system string) string

XPKey returns the character stats JSON field that holds the XP currency for the given system.

func XPLabel

func XPLabel(system string) string

XPLabel returns the display label for the XP currency of the given system.

Types

type WGArchetypeView

type WGArchetypeView struct {
	// contains filtered or unexported fields
}

WGArchetypeView is an exported view of a wgArchetypeDef for use outside this package.

func WGArchetypeDefFor

func WGArchetypeDefFor(name string) (WGArchetypeView, bool)

WGArchetypeDefFor looks up the W&G archetype definition for the given name. Returns an exported WGArchetypeView and true if found, or zero-value and false if not found.

func (WGArchetypeView) Abilities

func (v WGArchetypeView) Abilities() []string

Abilities returns the archetype's starting abilities (free, cannot be repurchased).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL