Documentation ¶
Index ¶
- func OptActive(active bool) func(m *figure)
- func OptAlive(alive bool) func(m *figure)
- func OptAttackMax(a int) func(m *figure)
- func OptAttackMin(a int) func(m *figure)
- func OptDefence(d int) func(m *figure)
- func OptHP(hp int) func(m *figure)
- func OptMP(mp int) func(m *figure)
- func OptMovable(movable bool) func(m *figure)
- func OptOwner(owner string) func(m *figure)
- func OptPrevX(x int) func(m *figure)
- func OptPrevY(y int) func(m *figure)
- func OptX(x int) func(m *figure)
- func OptY(y int) func(m *figure)
- type AppliedSkill
- type Buffable
- type Clonable
- type CombatEvent
- type Combatable
- type Figurable
- type Mage
- func (m *Mage) Activate(walking bool)
- func (m *Mage) AddAttack(minAtk, maxAtk int)
- func (m *Mage) AddDefense(def int)
- func (m *Mage) AddSkillToRotation(boardName string, skillName string, from Point, to Point)
- func (m *Mage) ApplySkills(updatedFigures *[]Figurable, updatedPlayers *[]Player, clog *[]CombatEvent)
- func (m *Mage) Clone() Figurable
- func (m *Mage) GetActive() bool
- func (m *Mage) GetAlive() bool
- func (m *Mage) GetAttack() (int, int)
- func (m *Mage) GetAttackStr() string
- func (m *Mage) GetCoords() (int, int)
- func (m *Mage) GetDefence() int
- func (m *Mage) GetHP() int
- func (m *Mage) GetInitiative() int
- func (m *Mage) GetMP() int
- func (m *Mage) GetMovable() bool
- func (m *Mage) GetName() string
- func (m *Mage) GetOwnerName() string
- func (m *Mage) GetPrevCoords() (int, int)
- func (m *Mage) GetRotation() []*AppliedSkill
- func (m *Mage) GetSkillSet() *SkillSet
- func (m *Mage) GetVisualMark() string
- func (m *Mage) LearnSkill(name string, skill SkillFunc)
- func (m *Mage) PerformAttack() int
- func (m *Mage) SetAlive(alive bool)
- func (m *Mage) SetCoords(X, Y int)
- func (m *Mage) SetHP(hp int)
- func (m *Mage) SetMP(mp int)
- func (m *Mage) SetMovable(movable bool)
- func (m *Mage) SetPrevCoords(X, Y int)
- func (m *Mage) SetSkillSet(ss *SkillSet)
- type Movable
- type Player
- type Point
- type Poolable
- type SkillFunc
- type SkillSet
- type SkillUsable
- type Visualizable
- type Warrior
- func (m *Warrior) Activate(walking bool)
- func (m *Warrior) AddAttack(minAtk, maxAtk int)
- func (m *Warrior) AddDefense(def int)
- func (m *Warrior) AddSkillToRotation(boardName string, skillName string, from Point, to Point)
- func (m *Warrior) ApplySkills(updatedFigures *[]Figurable, updatedPlayers *[]Player, clog *[]CombatEvent)
- func (m *Warrior) Clone() Figurable
- func (m *Warrior) GetActive() bool
- func (m *Warrior) GetAlive() bool
- func (m *Warrior) GetAttack() (int, int)
- func (m *Warrior) GetAttackStr() string
- func (m *Warrior) GetCoords() (int, int)
- func (m *Warrior) GetDefence() int
- func (m *Warrior) GetHP() int
- func (m *Warrior) GetInitiative() int
- func (m *Warrior) GetMP() int
- func (m *Warrior) GetMovable() bool
- func (m *Warrior) GetName() string
- func (m *Warrior) GetOwnerName() string
- func (m *Warrior) GetPrevCoords() (int, int)
- func (m *Warrior) GetRotation() []*AppliedSkill
- func (m *Warrior) GetSkillSet() *SkillSet
- func (m *Warrior) GetVisualMark() string
- func (m *Warrior) LearnSkill(name string, skill SkillFunc)
- func (m *Warrior) PerformAttack() int
- func (m *Warrior) SetAlive(alive bool)
- func (m *Warrior) SetCoords(X, Y int)
- func (m *Warrior) SetHP(hp int)
- func (m *Warrior) SetMP(mp int)
- func (m *Warrior) SetMovable(movable bool)
- func (m *Warrior) SetPrevCoords(X, Y int)
- func (m *Warrior) SetSkillSet(ss *SkillSet)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AppliedSkill ¶
type AppliedSkill struct { Board string // How many times skill will be applied Times int From Point To Point Name string }
AppliedSkill Entity of skill application from one unit to another
type Clonable ¶
type Clonable interface {
Clone() Figurable
}
Clonable let object behind interface be cloned
type CombatEvent ¶
type CombatEvent struct { // think about consumption and different skills animation From *Point To *Point Dmg int // if it's empty, figure uses auto-attack AnimationName string }
CombatEvent represents combat event for front-ent animation
type Combatable ¶
type Combatable interface { PerformAttack() int GetInitiative() int GetAlive() bool SetAlive(bool) SetHP(int) GetHP() int SetMP(int) GetMP() int GetDefence() int GetAttack() (int, int) GetAttackStr() string }
Combatable represents actions performed in combat with other units
type Figurable ¶
type Figurable interface { Clonable Movable Buffable Combatable SkillUsable Visualizable }
Figurable represents actions with figures
type Mage ¶
type Mage struct { SkillSet *SkillSet // contains filtered or unexported fields }
Mage unit
func (*Mage) Activate ¶
func (m *Mage) Activate(walking bool)
Activate activates unit making it walk forward for one cell
func (*Mage) AddAttack ¶
func (m *Mage) AddAttack(minAtk, maxAtk int)
AddAttack adds min/max attack according to buff mechanics
func (*Mage) AddDefense ¶
func (m *Mage) AddDefense(def int)
AddDefense adds defense according to buff mechanics
func (*Mage) AddSkillToRotation ¶
AddSkillToRotation Adds skill to rotation
func (*Mage) ApplySkills ¶
func (m *Mage) ApplySkills(updatedFigures *[]Figurable, updatedPlayers *[]Player, clog *[]CombatEvent)
ApplySkills Applies skills from rotation in order, calling every skill from self skillbook
func (*Mage) GetAttackStr ¶
func (m *Mage) GetAttackStr() string
GetAttackStr gets unit min-max attack for visualization
func (*Mage) GetPrevCoords ¶
GetPrevCoords gets previous turn unit coords
func (*Mage) GetRotation ¶
func (m *Mage) GetRotation() []*AppliedSkill
GetRotation Gets skills rotation
func (*Mage) GetVisualMark ¶
func (m *Mage) GetVisualMark() string
GetVisualMark gets mark for visualization
func (*Mage) LearnSkill ¶
LearnSkill Learns skill consuming xp
func (*Mage) SetPrevCoords ¶
func (m *Mage) SetPrevCoords(X, Y int)
SetPrevCoords sets previous turn unit coords, needed for front-end to delete figure
type Movable ¶
type Movable interface { GetMovable() bool SetMovable(bool) Activate(bool) GetActive() bool SetCoords(int, int) GetCoords() (int, int) SetPrevCoords(int, int) GetPrevCoords() (int, int) }
Movable represents actions to move figures on the board
type SkillSet ¶
type SkillSet struct { // SKill rotation to be applied in order Rotation []*AppliedSkill // All learned skills mechanics will be here // front-end doesn't need to know them SkillBook map[string]SkillFunc `json:"-"` }
SkillSet Entity of current skills figure may have
func NewEmptySkillSet ¶
func NewEmptySkillSet() *SkillSet
NewEmptySkillSet Creates new empty skillset
type SkillUsable ¶
type SkillUsable interface { GetSkillSet() *SkillSet SetSkillSet(*SkillSet) ApplySkills(*[]Figurable, *[]Player, *[]CombatEvent) AddSkillToRotation(string, string, Point, Point) LearnSkill(string, SkillFunc) }
SkillUsable represents actions for figures with skills
type Visualizable ¶
Visualizable represents actions with visualization of figures
type Warrior ¶
type Warrior struct { SkillSet *SkillSet // contains filtered or unexported fields }
Warrior unit
func NewConstDmgWarrior ¶
func NewConstDmgWarrior(opts ...func(m *figure)) *Warrior
NewConstDmgWarrior creates new peon unit with const dps
func NewWarrior ¶
func NewWarrior(opts ...func(m *figure)) *Warrior
NewWarrior creates new peon unit
func (*Warrior) Activate ¶
func (m *Warrior) Activate(walking bool)
Activate activates unit making it walk forward for one cell
func (*Warrior) AddAttack ¶
func (m *Warrior) AddAttack(minAtk, maxAtk int)
AddAttack adds min/max attack according to buff mechanics
func (*Warrior) AddDefense ¶
func (m *Warrior) AddDefense(def int)
AddDefense adds defense according to buff mechanics
func (*Warrior) AddSkillToRotation ¶
AddSkillToRotation adds skill to skill rotation
func (*Warrior) ApplySkills ¶
func (m *Warrior) ApplySkills(updatedFigures *[]Figurable, updatedPlayers *[]Player, clog *[]CombatEvent)
ApplySkills Applies skills from rotation in order, calling every skill from self skillbook
func (*Warrior) GetAttackStr ¶
func (m *Warrior) GetAttackStr() string
GetAttackStr gets unit min-max attack for visualization
func (*Warrior) GetInitiative ¶
func (m *Warrior) GetInitiative() int
GetInitiative gets unit initiative
func (*Warrior) GetPrevCoords ¶
GetPrevCoords gets previous turn unit coords
func (*Warrior) GetRotation ¶
func (m *Warrior) GetRotation() []*AppliedSkill
GetRotation Gets skill rotation
func (*Warrior) GetVisualMark ¶
func (m *Warrior) GetVisualMark() string
GetVisualMark gets mark for visualization
func (*Warrior) LearnSkill ¶
LearnSkill Learns skill consuming xp
func (*Warrior) PerformAttack ¶
func (m *Warrior) PerformAttack() int
PerformAttack calculates unit dmg
func (*Warrior) SetMovable ¶
func (m *Warrior) SetMovable(movable bool)
SetMovable sets unit movable flag
func (*Warrior) SetPrevCoords ¶
func (m *Warrior) SetPrevCoords(X, Y int)
SetPrevCoords sets previous turn unit coords, needed for front-end to delete figure
func (*Warrior) SetSkillSet ¶
SetSkillSet Sets skill set