gameobject

package
v0.0.0-...-193d145 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const ZeroLevel int32 = 0

Variables

This section is empty.

Functions

func AttributesOperation

func AttributesOperation(receiver *api.Attributes, booster *api.Attributes, skipped map[string]struct{}, mustBePresent bool, operation func(r, b *float32)) error

func AttributesValue

func AttributesValue(playerAttributes *api.Attributes, a *api.Attributes) (float64, error)

func CalculateDistanceAndLineOfSight

func CalculateDistanceAndLineOfSight(currentMap *api.Level, currentPosition *api.Position) map[PlainPos]MapCellExt

func CoordinatesToPosition

func CoordinatesToPosition(coordinates *api.Coordinates) *api.Position

func EvaluateDamage

func EvaluateDamage(power float64, t api.DamageType, a *api.Attributes) float32

func EvaluateSkillAttributes

func EvaluateSkillAttributes(sa *api.SkillAttributes, casterAttributes *api.Attributes) (*api.Attributes, error)

func FilterEffect

func FilterEffect(e *api.Effect)

func GetLoS

func GetLoS(currentLevel *api.Level, resultMap map[PlainPos]MapCellExt, distanceToFirstObstacle map[float32]float32, pos1 *api.Position, pos2 PlainPos) bool

func GetNewId

func GetNewId() string

func HideUnidentifiedFields

func HideUnidentifiedFields(i *api.Item)

func Knockback

func Knockback(s Skiller, from *api.Coordinates)

func MaxAllAttributes

func MaxAllAttributes(receiver *api.Attributes, booster *api.Attributes, mustBePresent bool) error

func MergeAllAttributes

func MergeAllAttributes(receiver *api.Attributes, booster *api.Attributes, mustBePresent bool) error

func MergeAttributes

func MergeAttributes(receiver *api.Attributes, booster *api.Attributes, skipped map[string]struct{}, mustBePresent bool) error

func PositionToCoordinates

func PositionToCoordinates(p *api.Position, l int32) *api.Coordinates

func RoundRange

func RoundRange(r float64) float64

func RoundSkill

func RoundSkill(r float64) float64

func SatisfyingAttributes

func SatisfyingAttributes(attributes *api.Attributes, requirements *api.Attributes) (bool, error)

func SubtractAllAttributes

func SubtractAllAttributes(receiver *api.Attributes, booster *api.Attributes, mustBePresent bool) error

func SumAttributes

func SumAttributes(attributes *api.Attributes) (float32, error)

func TeleportMoveTo

func TeleportMoveTo(s Skiller, c *api.Coordinates)

Types

type Alive

type Alive interface {
	Positioner
	IsStunned() bool
	DamageTaken()
}

type Ider

type Ider interface {
	GetId() string
	GetName() string
}

type MapCellExt

type MapCellExt struct {
	MapObjects  *api.MapObjects
	Distance    int
	LineOfSight bool
}

type Monster

type Monster struct {
	Position     *api.Coordinates      `json:"position"`
	MovingTo     *paths.Path           `json:"-"`
	Monster      *api.Monster          `json:"-"`
	Skills       map[string]*api.Skill `json:"-"`
	TeleportedTo TeleportPosition      `json:"-"`
	KillCounter  *int32                `json:"-"`
}

func CreateMonster

func CreateMonster(mon *api.Monster, p *api.Coordinates) *Monster

func (*Monster) AddEffect

func (m *Monster) AddEffect(e *api.Effect)

func (*Monster) DamageTaken

func (m *Monster) DamageTaken()

func (*Monster) GetAttributes

func (m *Monster) GetAttributes() *api.Attributes

func (*Monster) GetId

func (m *Monster) GetId() string

func (*Monster) GetLastDamageTaken

func (m *Monster) GetLastDamageTaken() int32

func (*Monster) GetMovingTo

func (m *Monster) GetMovingTo() *paths.Path

func (*Monster) GetName

func (m *Monster) GetName() string

func (*Monster) GetPosition

func (m *Monster) GetPosition() *api.Coordinates

func (*Monster) GetSkill

func (m *Monster) GetSkill(id string) (*api.Skill, bool)

func (*Monster) GetSkills

func (m *Monster) GetSkills() map[string]*api.Skill

func (*Monster) GetTeleportTo

func (m *Monster) GetTeleportTo() *TeleportPosition

func (*Monster) IsStunned

func (m *Monster) IsStunned() bool

func (*Monster) ResetTeleportTo

func (m *Monster) ResetTeleportTo()

func (*Monster) SetMovingTo

func (m *Monster) SetMovingTo(p *paths.Path)

func (*Monster) SetPosition

func (m *Monster) SetPosition(c *api.Coordinates)

func (*Monster) Stun

func (m *Monster) Stun() *api.Stun

func (*Monster) Stunned

func (m *Monster) Stunned()

func (*Monster) UpdateAttributes

func (m *Monster) UpdateAttributes()

type PlainPos

type PlainPos struct {
	PositionX int32
	PositionY int32
}

func PlainPosFromApiPos

func PlainPosFromApiPos(position *api.Position) PlainPos

type Player

type Player struct {
	MovingTo       *paths.Path                 `json:"-"`
	Equipped       map[api.Item_Type]*api.Item `json:"-"`
	Character      *api.Character              `json:"character"`
	BaseAttributes *api.Attributes             `json:"-"`
	ItemAttributes *api.Attributes             `json:"-"`
	MaxStats       *api.Attributes             `json:"-"`
	Skills         map[string]*api.Skill       `json:"-"`
	IsAdmin        bool                        `json:"admin"`
	TeleportedTo   TeleportPosition            `json:"-"`
}

func CreatePlayer

func CreatePlayer(name string) *Player

func (*Player) AddEffect

func (p *Player) AddEffect(e *api.Effect)

func (*Player) DamageTaken

func (p *Player) DamageTaken()

func (*Player) Equip

func (p *Player) Equip(item *api.Item) error

func (*Player) GetAttributes

func (p *Player) GetAttributes() *api.Attributes

func (*Player) GetId

func (p *Player) GetId() string

func (*Player) GetLastDamageTaken

func (p *Player) GetLastDamageTaken() int32

func (*Player) GetMovingTo

func (p *Player) GetMovingTo() *paths.Path

func (*Player) GetName

func (p *Player) GetName() string

func (*Player) GetPosition

func (p *Player) GetPosition() *api.Coordinates

func (*Player) GetSkill

func (p *Player) GetSkill(id string) (*api.Skill, bool)

func (*Player) GetSkills

func (p *Player) GetSkills() map[string]*api.Skill

func (*Player) GetTeleportTo

func (p *Player) GetTeleportTo() *TeleportPosition

func (*Player) InitAttributes

func (p *Player) InitAttributes()

func (*Player) IsStunned

func (p *Player) IsStunned() bool

func (*Player) ResetAttributes

func (p *Player) ResetAttributes() error

func (*Player) ResetTeleportTo

func (p *Player) ResetTeleportTo()

func (*Player) SetMovingTo

func (p *Player) SetMovingTo(m *paths.Path)

func (*Player) SetPosition

func (p *Player) SetPosition(c *api.Coordinates)

func (*Player) Stun

func (p *Player) Stun() *api.Stun

func (*Player) Stunned

func (p *Player) Stunned()

func (*Player) UpdateAttributes

func (p *Player) UpdateAttributes() error

type Positioner

type Positioner interface {
	Ider
	GetPosition() *api.Coordinates
	SetPosition(c *api.Coordinates)
	GetMovingTo() *paths.Path
	SetMovingTo(m *paths.Path)
}

type Skiller

type Skiller interface {
	Alive
	GetSkill(id string) (*api.Skill, bool)
	GetAttributes() *api.Attributes
	GetLastDamageTaken() int32
	GetTeleportTo() *TeleportPosition
	ResetTeleportTo()
	Stunned()
	Stun() *api.Stun
	AddEffect(e *api.Effect)
	GetSkills() map[string]*api.Skill
}

type Stun

type Stun struct {
	IsStunned bool
	IsImmune  bool
}

type TeleportPosition

type TeleportPosition struct {
	Move      *api.Coordinates
	Knockback *utils.V
}

Jump to

Keyboard shortcuts

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