character

package
v0.0.0-...-c6286b5 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// This list is for buffs that we make use of elsewhere in the bot; keys match the JSON objects
	BuffClericDivineDomainSpells = "domain-spells-1"

	BuffFighterChampionImprovedCritical = "improved-critical"

	// Fighting styles apply to multiple classes
	BuffFightingStyleDefense = "fighting-style-defense"
	BuffFightingStyleDueling = "fighting-style-dueling"
)

Variables

This section is empty.

Functions

func AttrModifier

func AttrModifier(attrVal int) int

func XPAtLevel

func XPAtLevel(lvl int) int

Types

type AttrKind

type AttrKind int
const (
	Undef AttrKind = iota
	Str
	Int
	Wis
	Con
	Cha
	Dex
	Per // Remove sometime ?
)

func ParseAttr

func ParseAttr(s string) AttrKind

func (AttrKind) String

func (a AttrKind) String() string

type Character

type Character struct {
	Name string

	Race      string
	Class     string
	Subclass  string
	Level     int
	Alignment string

	Str, Int, Wis, Con, Cha, Dex, Per int

	MaxHitpoints  int
	CurrHitpoints int

	XP int

	Weapons map[string]int

	Armor      string
	CurrWeapon string
	Shield     bool

	SpellsMemorized spells.Set
	Slots           spells.Slots

	Buffs map[string]int

	Inventory
}

A Character holds info about a typical RPG character

func NewCharacter

func NewCharacter() Character

func (*Character) AddBuff

func (c *Character) AddBuff(b string) error

func (*Character) AutoBuffs

func (c *Character) AutoBuffs() map[string]int

Autobuffs returns a list of the buffs you get automatically just because of class/subclass/level/race.

func (*Character) CastSpell

func (c *Character) CastSpell(name string, castingLevel int) (string, error)

CastSpell verifies the spellname, consumes a spell slot, and returns a string with the spell description in. if `castingLevel` is zero, it's taken as the base level of the spell.

func (*Character) GetArmorClass

func (c *Character) GetArmorClass() (int, string)

Compute a character's AC. The string returns a description.

func (Character) GetAttr

func (c Character) GetAttr(k AttrKind) int

func (Character) GetAttrAndModifier

func (c Character) GetAttrAndModifier(k AttrKind) (int, int)

func (*Character) GetCastableSpells

func (c *Character) GetCastableSpells() spells.Set

GetSpellsMemorized returns a set of all the spells that can be cast right now

func (*Character) GetMagicAttackModifier

func (c *Character) GetMagicAttackModifier() (int, string)

For when the character casts a spell, and needs a 'magic attack roll'

func (Character) GetModifier

func (c Character) GetModifier(k AttrKind) int

func (*Character) GetSpellcastingAbilityAttr

func (c *Character) GetSpellcastingAbilityAttr() AttrKind

func (*Character) GetWeaponAbilityModifier

func (c *Character) GetWeaponAbilityModifier(w rules.Item) (int, string)

GetWeaponAbilityModifier computes the modifier deriving from the character's ability for the given weapon.

func (*Character) GetWeaponAttackModifier

func (c *Character) GetWeaponAttackModifier(w rules.Item) (int, string)

func (*Character) GetWeaponDamageModifier

func (c *Character) GetWeaponDamageModifier(w rules.Item) (int, string)

func (*Character) GetWeaponDamageRoll

func (c *Character) GetWeaponDamageRoll(w rules.Item) string

func (*Character) HasBuff

func (c *Character) HasBuff(b string) bool

func (*Character) IsSpellCaster

func (c *Character) IsSpellCaster() bool

func (*Character) MagicString

func (c *Character) MagicString() string

func (*Character) MaxSpellLevel

func (c *Character) MaxSpellLevel() int

func (*Character) NextLevelAt

func (c *Character) NextLevelAt() int

func (*Character) ProficiencyBonus

func (c *Character) ProficiencyBonus() int

func (*Character) RemoveBuff

func (c *Character) RemoveBuff(b string) error

func (*Character) SpellsAlwaysMemorized

func (c *Character) SpellsAlwaysMemorized() spells.Set

SpellsAlwaysMemorized lists whatever spells the character has hardwired for whatever reason

func (*Character) String

func (c *Character) String() string

func (*Character) Summary

func (c *Character) Summary() string

Summary returns a oneliner

type Inventory

type Inventory struct {
	Items []Item
}

func NewInventory

func NewInventory() Inventory

func (*Inventory) Append

func (i *Inventory) Append(desc string)

func (*Inventory) Clear

func (i *Inventory) Clear()

func (*Inventory) ParseIndex

func (i *Inventory) ParseIndex(args []string) (int, string)

Returns a 0-indexed, range-checked index for the slice - or an error

func (*Inventory) Remove

func (i *Inventory) Remove(n int)

Arg `n` is zero-indexed

func (*Inventory) String

func (i *Inventory) String() string

type Item

type Item struct {
	Time        time.Time
	Description string
}

func (Item) String

func (a Item) String() string

Jump to

Keyboard shortcuts

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