schema

package
v0.0.0-...-1abd016 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2022 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AbilityArrayTemplate = func() map[string]int {
	return map[string]int{
		"Strength":     0,
		"Dexterity":    0,
		"Constitution": 0,
		"Intelligence": 0,
		"Wisdom":       0,
		"Charisma":     0,
	}
}

AbilityArrayTemplate is used to get a map with the abilities as keys

View Source
var AbilityAssign = func() map[string][]int {
	return map[string][]int{
		"predefined":        {},
		"strict":            {},
		"common":            {},
		"standard":          {15, 14, 13, 12, 10, 8},
		"pointbuy_even":     {13, 13, 13, 12, 12, 12},
		"pointbuy_onemax":   {15, 12, 12, 12, 11, 11},
		"pointbuy_twomax":   {15, 15, 11, 10, 10, 10},
		"pointbuy_threemax": {15, 15, 15, 8, 8, 8},
	}
}

AbilityAssign returns a map with all the options for "rolling" the ability values and in the case of set ones, the values to be used.

View Source
var AbilityDescriptions = func() map[string]string {
	return map[string]string{
		"Strength":     "measure of physical power",
		"Dexterity":    "measure of agility",
		"Constitution": "measure of endurance",
		"Intelligence": "measure of reasoning and memory",
		"Wisdom":       "measure of perception and insight",
		"Charisma":     "measure of personality force",
	}
}

AbilityDescriptions returns a map[string]string holding all the ability descriptions

View Source
var AbilityScoreModifier = func() map[int]int {
	return map[int]int{
		1: -5, 2: -4, 3: -4,
		4: -3, 5: -3,
		6: -2, 7: -2,
		8: -1, 9: -1,
		10: 0, 11: 0,
		12: 1, 13: 1,
		14: 2, 15: 2,
		16: 3, 17: 3,
		18: 4, 19: 4,
		20: 5, 21: 5,
		22: 6, 23: 6,
		24: 7, 25: 7,
		26: 8, 27: 8,
		28: 9, 29: 9, 30: 10,
	}
}

AbilityScoreModifier returns a map of modifiers for ability score rolls.

Functions

func AbilityMapToString

func AbilityMapToString(src map[string]int) (tgt string)

AbilityMapToString converts a map keyed with the abilities to a single string.

func GetAbilityRollingOptions

func GetAbilityRollingOptions() (options []string)

GetAbilityRollingOptions returns a slice of strings getting the possible values to pass for "rolling" options.

func GetBaseAbilityArray

func GetBaseAbilityArray(sortOrder []string, rollingOption string,
	logger *zap.SugaredLogger) (r map[string]int, rawValueSlice []int, err error)

GetBaseAbilityArray returns a generated Base Ability array and the unsorted

values that went into it. The values are generated depending on the
rollingOption passed (see AbilityAssign). How they are assigned to the
abilities depends on a sorting order provided by the sortSlice and
a rolling option.

func GetPreGeneratedBaseAbilityArray

func GetPreGeneratedBaseAbilityArray(pre []int) (map[string]int, []string)

GetPreGeneratedBaseAbilityArray returns a Base Ability array based on a supplied

array that has an assumed order.  This will be used mostly for testing or
balance comparisons.  If a player has used this method we are expecting
this is an import of an existing player.  If not, it would be suspicious.

func ValidateAbilityName

func ValidateAbilityName(ability string) bool

Types

type AbilityArray

type AbilityArray struct {
	Raw                   []int
	RollingOption         string
	SortOrder             []string
	Base                  map[string]int
	ArchetypeBonus        map[string]int
	ArchetypeBonusIgnored bool
	LevelChangeIncrease   map[string]int
	AdditionalBonus       map[string]int
	Values                map[string]int
	Modifiers             map[string]int
	CtxRef                string
	IsMonsterOrGod        bool
}

AbilityArray is the struct that completely defines the Ability Array and all the pieces that make it up.

Where:
  Raw are the values as they were originally generated
  RollingOption describes how the Raw values were generated
  SortOrder is the order applied to the Raw values to make Base
  Base is the base point for the Ability scores
  ArchetypeBonus are values that reflect racial/archetypal bonuses
  ArchetypeBonusIgnored if true don't include any of the racial/archetypal bonuses
  LevelChangeIncrease are values added when levels achieved
  AdditionalBonus any other values that influence ability values
  Values are the summation of Base + ArchetypeBonus (if used) +
         LevelChangeIncrease + AdditionalBonus
  Modifiers are the modifiers based on Values
  CtxRef is the context reference for the assignment

func GetAbilityArray

func GetAbilityArray(RollingOption string,
	SortOrder []string, ArchetypeBonus map[string]int,
	ArchetypeBonusIgnored bool, LevelChangeIncrease map[string]int,
	AdditionalBonus map[string]int, CtxRef string, IsMonsterOrGod bool,
	logger *zap.SugaredLogger) (*AbilityArray, error)

GetAbilityArray is the function to use to get a Fully populated ability array for a character. The Ability Array struct will contain everything you need to build a character and all the info to know how it was all put together. It returns a pointer to an AbilityArray

Parameters:
 RollingOption describes how the Raw values were generated
 SortOrder is the order applied to the Raw values
 ArchetypeBonus are values that reflect racial/archetypal bonuses
 ArchetypeBonusIgnored if true don't include any of the racial/archetypal bonuses
 LevelChangeIncrease are values added when levels achieved
 AdditionalBonus any other values that influence ability values
 CtxRef is the context reference for the assignment. A freetext
   string that you can use to keep track of it in the logs.

func GetPreGeneratedAbilityArray

func GetPreGeneratedAbilityArray(Raw []int, ArchetypeBonus map[string]int,
	ArchetypeBonusIgnored bool, LevelChangeIncrease map[string]int,
	AdditionalBonus map[string]int, CtxRef string, IsMonsterOrGod bool) *AbilityArray

func (*AbilityArray) AdjustValues

func (pa *AbilityArray) AdjustValues(ValueType string, Ability string,
	ChangeValue int, logger *zap.SugaredLogger)

AdjustValues changes the totals in the maps within an AbilityArray and recalculates the total values.

Where:
  ValueType is "ArchetypeBonus", "LevelChangeIncrease", or "AdditionalBonus".
  Values is a map containing the adjustments to make

func (*AbilityArray) ConvertToString

func (pa *AbilityArray) ConvertToString(p bool) (s string)

ConvertToString converts an AbilityArray to a single string. The p argument is for pretty print where everything lines up.

func (*AbilityArray) GetModifier

func (pa *AbilityArray) GetModifier(ability string) (int, error)

GetModifier gets a single modifier from the array. Valid abilities are: Strength, Dexterity, Constitution, Intelligence, Wisdom, and Charisma

func (*AbilityArray) GetScore

func (pa *AbilityArray) GetScore(ability string) (int, error)

GetScore gets a single ability score from the array. Valid abilities are: Strength, Dexterity, Constitution, Intelligence, Wisdom, and Charisma

func (*AbilityArray) MarshalLogObject

func (pa *AbilityArray) MarshalLogObject(enc zapcore.ObjectEncoder) error

func (*AbilityArray) ToJson

func (pa *AbilityArray) ToJson() string

func (*AbilityArray) ToPrettyString

func (pa *AbilityArray) ToPrettyString() string

func (*AbilityArray) ToString

func (pa *AbilityArray) ToString() string

Jump to

Keyboard shortcuts

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