Documentation ¶
Index ¶
- Variables
- type AbilityBurrow
- type AbilityResurrection
- type AbilitySplit
- type Line
- type Lines
- func (ls *Lines) FindCurrentPlayer() Player
- func (ls *Lines) FindLineByID(id int) *Line
- func (ls *Lines) FindPlayerByID(id string) Player
- func (ls *Lines) FindPlayerByLineID(lid int) Player
- func (ls *Lines) GetIncomeTimer() int
- func (ls *Lines) ListLines() []*Line
- func (ls *Lines) ListPlayers() []*Player
- func (ls *Lines) Reduce(state, a interface{}) interface{}
- type LinesState
- type Lobbies
- type LobbiesState
- type Lobby
- type Map
- type MapState
- type Player
- type Store
- type Tower
- type Unit
- func (u *Unit) AddBuff(b buff.Buff)
- func (u *Unit) AttackKey() string
- func (u *Unit) CanAttack(tm time.Time) bool
- func (u *Unit) CanBeAttacked(t time.Time) bool
- func (u *Unit) CanResurrect(t time.Time) bool
- func (u *Unit) CanUnburrow(t time.Time) bool
- func (u *Unit) FacesetKey() string
- func (u *Unit) HasAbility(a ability.Ability) bool
- func (u *Unit) HasBuff(b buff.Buff) bool
- func (u *Unit) Hybrid(cp, op int)
- func (u *Unit) IdleKey() string
- func (u *Unit) MustUnburrow(t time.Time) bool
- func (u *Unit) RemoveBuff(b buff.Buff)
- func (u *Unit) Resurrect()
- func (u *Unit) TakeDamage(d float64)
- func (u *Unit) Unburrow()
- func (u *Unit) WalkKey() string
- func (u *Unit) WasBurrowed() bool
- func (u *Unit) WasResurrected() bool
- type UnitUpdate
Constants ¶
This section is empty.
Variables ¶
View Source
var ( MapImages = map[int]image.Image{} MapImageKeyFmt = "m-%d" )
Functions ¶
This section is empty.
Types ¶
type AbilityBurrow ¶ added in v1.2.0
type AbilityBurrow struct { // BurrowAt is the time in which it was burrowed. // It'll stay there for 15s and then the next unit // that steps on it it'll pop up again. // If in 45s no unit stept on it it'll unburrow // itself up BurrowAt time.Time `mapstructure:"BurrowAt"` Unburrowed bool `mapstructure:"Unburrowed"` }
func (AbilityBurrow) CanUnburrow ¶ added in v1.2.0
func (ab AbilityBurrow) CanUnburrow(t time.Time) bool
func (AbilityBurrow) MustUnburrow ¶ added in v1.2.0
func (ab AbilityBurrow) MustUnburrow(t time.Time) bool
type AbilityResurrection ¶ added in v1.2.0
type AbilityResurrection struct { KilledAt time.Time `mapstructure:"killed_at"` Resurrected bool `mapstructure:"resurrected"` }
func (AbilityResurrection) CanResurrect ¶ added in v1.2.0
func (ar AbilityResurrection) CanResurrect(t time.Time) bool
type AbilitySplit ¶ added in v1.2.0
type AbilitySplit struct { // UnitID is the other unit // that belong to this Split. // The bounty must only be given // when all are dead UnitID string `mapstructure:"UnitID"` }
type Line ¶ added in v1.0.3
type Line struct { ID int Towers map[string]*Tower Units map[string]*Unit Graph *graph.Graph // UpdatedAt is the last time // something was updated on this Line. // Towers added, Units added or // when the Units position was updated // the last time. // Used for the SyncState to know how much // time has passed since the last update // and move the Units accordingly // (60 moves per second pass) UpdatedAt time.Time }
func (*Line) ListSortedUnits ¶ added in v1.2.0
type Lines ¶ added in v1.0.3
type Lines struct { *flux.ReduceStore // contains filtered or unexported fields }
func (*Lines) FindCurrentPlayer ¶ added in v1.1.0
func (*Lines) FindLineByID ¶ added in v1.1.0
func (*Lines) FindPlayerByID ¶ added in v1.1.0
func (*Lines) FindPlayerByLineID ¶ added in v1.1.0
func (*Lines) GetIncomeTimer ¶ added in v1.1.0
func (*Lines) ListPlayers ¶ added in v1.1.0
ListPlayers returns the players list and it's meant for reading only purposes
type LinesState ¶ added in v1.0.3
type Lobbies ¶ added in v1.1.0
type Lobbies struct { *flux.ReduceStore // contains filtered or unexported fields }
func NewLobbies ¶ added in v1.1.0
func NewLobbies(d *flux.Dispatcher) *Lobbies
func (*Lobbies) FindCurrent ¶ added in v1.1.0
type LobbiesState ¶ added in v1.1.0
type Map ¶
type Map struct { *flux.ReduceStore // contains filtered or unexported fields }
Map is a struct that holds all the information of the current map
func (*Map) GetImageKey ¶ added in v1.0.3
GetY returns the max Y value of the map
func (*Map) GetNextLineID ¶
GetNextLineID based on the map and max number of players it returns the next one and when it reaches the end then starts again
type Player ¶
type Player struct { ID string Name string Lives int LineID int Income int Gold int Current bool Winner bool // UnitUpdates holds the current unit level UnitUpdates map[string]UnitUpdate }
func (Player) CanPlaceTower ¶
func (Player) CanSummonUnit ¶
func (Player) CanUpdateUnit ¶ added in v1.1.0
type Store ¶
type Tower ¶
type Tower struct { utils.Object ID string Type string LineID int PlayerID string Health float64 TargetUnitID string LastAttack time.Time }
func (*Tower) CanAttackUnit ¶ added in v1.2.0
func (*Tower) CanTarget ¶ added in v1.1.0
func (t *Tower) CanTarget(env environment.Environment) bool
func (*Tower) CanUpdateTo ¶ added in v1.2.0
type Unit ¶
type Unit struct { utils.MovingObject AnimationCount int ID string Type string PlayerID string PlayerLineID int CurrentLineID int MaxHealth float64 Health float64 MaxShield float64 Shield float64 MovementSpeed float64 Bounty int // The current level of the unit from the PlayerID Level int Path []graph.Step HashPath string // CreatedAt has the time of creation so // on the next SyncState will be moved just // the diff amount and then it'll be set to 'nil' // so we know it's on sync CreatedAt time.Time // Abilities stores data from the abilities that // the unit has and need to be kept in check, for example // if it's a slime which is the other unit and if it died // then give the bounty. Or if the unit already resurected // The key is an ability.Ability.String() and the value is // a type that is specific for the ability. Abilities map[string]interface{} Buffs map[string]interface{} // If the Unit has the ability 'Attack' it'll have a // TargetTowerID if it has a Tower to attack TargetTowerID string LastAttack time.Time }
func (*Unit) FacesetKey ¶ added in v1.0.3
func (*Unit) RemoveBuff ¶ added in v1.2.0
func (*Unit) TakeDamage ¶ added in v1.2.0
func (*Unit) WasBurrowed ¶ added in v1.2.0
func (*Unit) WasResurrected ¶ added in v1.2.0
type UnitUpdate ¶ added in v1.1.0
Click to show internal directories.
Click to hide internal directories.