Documentation ¶
Index ¶
- func CombatterRollInitiative(c Combatter) (int, string)
- func CombatterToString(c Combatter) string
- func DamagerToString(d Damager) string
- type ActionDamager
- type AttackSpec
- type CharacterCombatter
- func (cc CharacterCombatter) AdjustAC(mod int)
- func (cc CharacterCombatter) AdjustHP(mod int)
- func (cc CharacterCombatter) GetArmorClass() int
- func (cc CharacterCombatter) GetAttr(k character.AttrKind) int
- func (cc CharacterCombatter) GetDamager(name string) Damager
- func (cc CharacterCombatter) GetDamagerNames() []string
- func (cc CharacterCombatter) GetGroup() string
- func (cc CharacterCombatter) GetHP() (int, int)
- func (cc CharacterCombatter) GetName() string
- func (cc CharacterCombatter) HasBuff(b string) bool
- func (cc CharacterCombatter) TakeDamage(d int)
- type Combatter
- type Damager
- type Encounter
- func (e *Encounter) Add(c Combatter)
- func (e *Encounter) Attack(spec AttackSpec) string
- func (e *Encounter) AttackWithSpell(spec AttackSpec) string
- func (e *Encounter) AttackWithWeapon(spec AttackSpec) string
- func (e Encounter) IsNil() bool
- func (e *Encounter) Lookup(name string) (Combatter, bool)
- func (e *Encounter) NextGroupIndex(name string) int
- func (e Encounter) String() string
- type Initiative
- type MagicDamager
- type MonsterCombatter
- func (mc MonsterCombatter) AdjustAC(mod int)
- func (mc MonsterCombatter) AdjustHP(mod int)
- func (mc MonsterCombatter) GetArmorClass() int
- func (mc MonsterCombatter) GetAttr(k character.AttrKind) int
- func (mc MonsterCombatter) GetDamager(name string) Damager
- func (mc MonsterCombatter) GetDamagerNames() []string
- func (mc MonsterCombatter) GetGroup() string
- func (mc MonsterCombatter) GetHP() (int, int)
- func (mc MonsterCombatter) GetName() string
- func (mc MonsterCombatter) HasBuff(b string) bool
- func (mc MonsterCombatter) TakeDamage(d int)
- type WeaponDamager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CombatterRollInitiative ¶
func CombatterToString ¶
func DamagerToString ¶
Types ¶
type ActionDamager ¶
type ActionDamager struct { DamageIndex int // TODO: Handle multiple damage entries under one action ? Action rules.ActionStruct }
ActionDamager wraps up a monster action (from rules) as a Damager
func (ActionDamager) GetDamageRoll ¶
func (ad ActionDamager) GetDamageRoll() string
func (ActionDamager) GetHitModifier ¶
func (ad ActionDamager) GetHitModifier() int
func (ActionDamager) GetName ¶
func (ad ActionDamager) GetName() string
type AttackSpec ¶
type AttackSpec struct { Targets []Combatter // Set this a fully auto attack using the attacker's damager Attacker Combatter // Attacking with a spell, or with a weapon (damager) SpellName string DamagerName string // Various conditions that can apply to an attack SpellCastingLevel int // If zero, means the base level of the spell WithAdvantage bool WithDisadvantage bool }
func NewAttackSpec ¶
func NewAttackSpec() AttackSpec
type CharacterCombatter ¶
type CharacterCombatter struct { Counts map[string]int // We abstract any values we need to mutate; we can't pass mc by pointer character.Character }
func (CharacterCombatter) AdjustAC ¶
func (cc CharacterCombatter) AdjustAC(mod int)
func (CharacterCombatter) AdjustHP ¶
func (cc CharacterCombatter) AdjustHP(mod int)
func (CharacterCombatter) GetArmorClass ¶
func (cc CharacterCombatter) GetArmorClass() int
func (CharacterCombatter) GetDamager ¶
func (cc CharacterCombatter) GetDamager(name string) Damager
func (CharacterCombatter) GetDamagerNames ¶
func (cc CharacterCombatter) GetDamagerNames() []string
func (CharacterCombatter) GetGroup ¶
func (cc CharacterCombatter) GetGroup() string
func (CharacterCombatter) GetHP ¶
func (cc CharacterCombatter) GetHP() (int, int)
func (CharacterCombatter) GetName ¶
func (cc CharacterCombatter) GetName() string
func (CharacterCombatter) HasBuff ¶
func (cc CharacterCombatter) HasBuff(b string) bool
func (CharacterCombatter) TakeDamage ¶
func (cc CharacterCombatter) TakeDamage(d int)
type Combatter ¶
type Combatter interface { GetName() string GetGroup() string // for monster, this is just its type, e.g. "goblin" GetDamager(name string) Damager GetDamagerNames() []string GetArmorClass() int GetHP() (int, int) GetAttr(character.AttrKind) int // Lookup Str,Dex, etc HasBuff(string) bool AdjustHP(mod int) AdjustAC(mod int) }
Combatter represents an entity that will be fighting. This will be a wrapped monster, or a wrapped character.
func NewCombatterFromCharacter ¶
NewCombatterFromMonster takes a monster definition, clones it all, and wraps it up so it can act as a Comatter instance in an encounter
type Damager ¶
type Damager interface { GetName() string GetHitModifier() int // What gets added to the base attack roll GetDamageRoll() string // e.g. "4d6+3". If "", then no damage roll. }
Damager is something that can be used to make an attack, via a roll
type Encounter ¶
type Encounter struct { Name string Combatants map[string]Combatter Init Initiative TurnNumber int GroupCounts map[string]int // e.g. GroupCounts["goblin"] = 8 when there are 8 goblins in play }
func NewEncounter ¶
func NewEncounter() Encounter
func (*Encounter) Attack ¶
func (e *Encounter) Attack(spec AttackSpec) string
func (*Encounter) AttackWithSpell ¶
func (e *Encounter) AttackWithSpell(spec AttackSpec) string
func (*Encounter) AttackWithWeapon ¶
func (e *Encounter) AttackWithWeapon(spec AttackSpec) string
func (*Encounter) NextGroupIndex ¶
Returns 1 for monster instance of that name, then 2, etc
type Initiative ¶
func NewInitiative ¶
func NewInitiative() Initiative
func (*Initiative) Get ¶
func (init *Initiative) Get(s string) int
func (*Initiative) Set ¶
func (init *Initiative) Set(name string, val int)
func (*Initiative) String ¶
func (init *Initiative) String() string
type MagicDamager ¶
MagicDamager is a shim to represent a magic attack; it has no damage, since that's all worked out manually
func (MagicDamager) GetDamageRoll ¶
func (md MagicDamager) GetDamageRoll() string
func (MagicDamager) GetHitModifier ¶
func (md MagicDamager) GetHitModifier() int
func (MagicDamager) GetName ¶
func (md MagicDamager) GetName() string
type MonsterCombatter ¶
type MonsterCombatter struct { Counts map[string]int // We abstract any values we need to mutate; we can't pass mc by pointer SpecificName string // e.g. "goblin.1" rules.Monster }
func (MonsterCombatter) AdjustAC ¶
func (mc MonsterCombatter) AdjustAC(mod int)
func (MonsterCombatter) AdjustHP ¶
func (mc MonsterCombatter) AdjustHP(mod int)
func (MonsterCombatter) GetArmorClass ¶
func (mc MonsterCombatter) GetArmorClass() int
func (MonsterCombatter) GetDamager ¶
func (mc MonsterCombatter) GetDamager(name string) Damager
func (MonsterCombatter) GetDamagerNames ¶
func (mc MonsterCombatter) GetDamagerNames() []string
func (MonsterCombatter) GetGroup ¶
func (mc MonsterCombatter) GetGroup() string
func (MonsterCombatter) GetHP ¶
func (mc MonsterCombatter) GetHP() (int, int)
func (MonsterCombatter) GetName ¶
func (mc MonsterCombatter) GetName() string
func (MonsterCombatter) HasBuff ¶
func (mc MonsterCombatter) HasBuff(b string) bool
func (MonsterCombatter) TakeDamage ¶
func (mc MonsterCombatter) TakeDamage(d int)
type WeaponDamager ¶
WeaponDamager wraps up a weapon object (from rules) as a Damager
func (WeaponDamager) GetDamageRoll ¶
func (wd WeaponDamager) GetDamageRoll() string
func (WeaponDamager) GetHitModifier ¶
func (wd WeaponDamager) GetHitModifier() int
func (WeaponDamager) GetName ¶
func (wd WeaponDamager) GetName() string
Click to show internal directories.
Click to hide internal directories.