core

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2023 License: MIT Imports: 16 Imported by: 25

Documentation

Overview

Package core provides core functionality for a simulation:

  • combat
  • tasks
  • event handling
  • logging
  • constructs (really should be just generic objects?)
  • status

Index

Constants

View Source
const MaxTeamSize = 4

Variables

This section is empty.

Functions

func RegisterCharFunc

func RegisterCharFunc(char keys.Char, f NewCharacterFunc)

func RegisterSetFunc

func RegisterSetFunc(set keys.Set, f NewSetFunc)

func RegisterWeaponFunc

func RegisterWeaponFunc(weap keys.Weapon, f NewWeaponFunc)

Types

type Coord added in v1.0.0

type Coord struct {
	X float64 `json:"x"`
	Y float64 `json:"y"`
	R float64 `json:"r"`
}

type Core

type Core struct {
	F     int
	Flags Flags
	Seed  int64
	Rand  *rand.Rand
	//various functionalities of core
	Log        glog.Logger    //we use an interface here so that we can pass in a nil logger for all except 1 run
	Events     *event.Handler //track events: subscribe/unsubscribe/emit
	Status     *status.Handler
	Tasks      *task.Handler
	Combat     *combat.Handler
	Constructs *construct.Handler
	Player     *player.Handler
}

func New

func New(opt CoreOpt) (*Core, error)

func (*Core) AddChar

func (c *Core) AddChar(p profile.CharacterProfile) (int, error)

func (*Core) Init

func (c *Core) Init() error

func (*Core) QueueAttack added in v1.0.0

func (c *Core) QueueAttack(
	a combat.AttackInfo,
	p combat.AttackPattern,
	snapshotDelay int,
	dmgDelay int,
	callbacks ...combat.AttackCBFunc,
)

func (*Core) QueueAttackEvent added in v1.0.0

func (c *Core) QueueAttackEvent(ae *combat.AttackEvent, dmgDelay int)

func (*Core) QueueAttackWithSnap added in v1.0.0

func (c *Core) QueueAttackWithSnap(
	a combat.AttackInfo,
	s combat.Snapshot,
	p combat.AttackPattern,
	dmgDelay int,
	callbacks ...combat.AttackCBFunc,
)

func (*Core) QueueParticle added in v1.0.0

func (c *Core) QueueParticle(src string, num float64, ele attributes.Element, delay int)

func (*Core) SetupOnNormalHitEnergy added in v1.0.0

func (c *Core) SetupOnNormalHitEnergy()

func (*Core) Tick

func (c *Core) Tick()

type CoreOpt added in v1.0.0

type CoreOpt struct {
	Seed         int64
	Debug        bool
	EnableHitlag bool
	DefHalt      bool
	DamageMode   bool
	Delays       player.Delays
}

type Flags

type Flags struct {
	LogDebug     bool // Used to determine logging level
	DamageMode   bool //for hp mode
	DefHalt      bool //for hitlag
	EnableHitlag bool //hitlag enabled
	Custom       map[string]int
}

type NewCharacterFunc

type NewCharacterFunc func(core *Core, char *character.CharWrapper, p profile.CharacterProfile) error

type NewSetFunc

type NewSetFunc func(core *Core, char *character.CharWrapper, count int, param map[string]int) (artifact.Set, error)

type NewWeaponFunc

type NewWeaponFunc func(core *Core, char *character.CharWrapper, p weapon.WeaponProfile) (weapon.Weapon, error)

type Reactable added in v1.0.0

type Reactable interface {
	React(a *combat.AttackEvent)
	AuraContains(e ...attributes.Element) bool
	Tick()
}

Directories

Path Synopsis
Package action describes the valid actions that any character may take
Package action describes the valid actions that any character may take
Package combat handles all combat related functionalities including
Package combat handles all combat related functionalities including
Package player contains player related tracking and functionalities: - tracking characters on the team - handling animations state - handling normal attack state - handling character stats and attributes - handling shielding
Package player contains player related tracking and functionalities: - tracking characters on the team - handling animations state - handling normal attack state - handling character stats and attributes - handling shielding
animation
package animation provides a simple way of tracking the current animation state at any given frame, as well as if the current frame is in animation lock or not
package animation provides a simple way of tracking the current animation state at any given frame, as well as if the current frame is in animation lock or not
shield
Package shield provide a handler to keep track of shields and add shields etc...
Package shield provide a handler to keep track of shields and add shields etc...

Jump to

Keyboard shortcuts

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