ability

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2018 License: AGPL-3.0 Imports: 3 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type A

type A struct {
	ID   ulid.ID `json:"id"`
	Type Type    `json:"type"`
	Name string  `json:"name"`

	MPConsumption uint64 `json:"mp_consumption"`
	CD            uint32 `json:"cd"`
	CurrentCD     uint32 `json:"current_cd"`

	Components []Component `json:"components"`
}

A A represents a ability.

func (A) Affect

func (a A) Affect(target *entity.E) Feedback

Affect applies ability a on target.

type Component

type Component interface {
	Affect(*entity.E) FeedbackComponent
}

Component is a part of a skill.

type DamageDirect

type DamageDirect struct {
	Amount uint64
	Type   uint8
}

DamageDirect instant damage.

func (DamageDirect) Affect

func (c DamageDirect) Affect(target *entity.E) FeedbackComponent

Affect a DamageDirect on target.

type DamageDirectFeedback

type DamageDirectFeedback struct {
	Amount int64
}

DamageDirectFeedback is the feedback of a DamageDirect casted by entity.

func (DamageDirectFeedback) Affect

func (fb DamageDirectFeedback) Affect(e *entity.E)

Affect applies fb on entity.

type DamageOverTime

type DamageOverTime struct {
	Amount    uint64
	Type      uint8
	Frequency uint64
	Duration  uint64
}

DamageOverTime inflicts damage per tick.

func (DamageOverTime) Affect

func (c DamageOverTime) Affect(target *entity.E) FeedbackComponent

Affect a DamageOverTime on target.

type DamageOverTimeFeedback

type DamageOverTimeFeedback struct {
}

DamageOverTimeFeedback is the feedback of a DamageOverTime casted by entity.

func (DamageOverTimeFeedback) Affect

func (fb DamageOverTimeFeedback) Affect(e *entity.E)

Affect applies fb on entity.

type Feedback

type Feedback struct {
	ID         ulid.ID
	AbilityID  ulid.ID
	Components []FeedbackComponent
}

Feedback represents the effects a ability had on a target.

type FeedbackComponent

type FeedbackComponent interface {
	Affect(*entity.E)
}

FeedbackComponent is the feedback of AbilityComponent.

type FeedbackMapper

type FeedbackMapper interface {
	SetAbilityFeedback(Feedback) error
	GetAbilityFeedback(FeedbackSubset) (Feedback, error)
}

FeedbackMapper is the communication interface for ability feedbacks.

type FeedbackSubset

type FeedbackSubset struct {
	ID ulid.ID
}

FeedbackSubset retrieves per ID.

type HealDirect

type HealDirect struct {
	Amount uint64
	Type   uint8
}

HealDirect instant heals.

func (HealDirect) Affect

func (c HealDirect) Affect(target *entity.E) FeedbackComponent

Affect a HealDirect on target.

type HealDirectFeedback

type HealDirectFeedback struct {
	Amount int64
}

HealDirectFeedback is the feedback of a HealDirect casted by entity.

func (HealDirectFeedback) Affect

func (fb HealDirectFeedback) Affect(e *entity.E)

Affect applies fb on entity.

type HealOverTime

type HealOverTime struct {
	Amount    uint64
	Type      uint8
	Frequency uint64
	Duration  uint64
}

HealOverTime heals per tick.

func (HealOverTime) Affect

func (c HealOverTime) Affect(target *entity.E) FeedbackComponent

Affect a HealOverTime on target.

type HealOverTimeFeedback

type HealOverTimeFeedback struct {
}

HealOverTimeFeedback is the feedback of a HealOverTime casted by entity.

func (HealOverTimeFeedback) Affect

func (fb HealOverTimeFeedback) Affect(e *entity.E)

Affect applies fb on entity.

type Mapper

type Mapper interface {
	SetAbility(A, ulid.ID) error
	GetAbility(Subset) (A, error)
	ListAbility(Subset) ([]A, error)
}

Mapper is the communication interface for abilities.

type Subset

type Subset struct {
	ID       ulid.ID
	EntityID ulid.ID
}

Subset retrieves per EntityID+ID or list per EntityID.

type Template

type Template A

Template alias an entity. It represents semi static data. When creating abilities, those templates are used.

func (*Template) UnmarshalJSON

func (a *Template) UnmarshalJSON(raw []byte) error

UnmarshalJSON adds a new field for components `struct` to determine component type.

type TemplateMapper

type TemplateMapper interface {
	SetAbilityTemplate(Template) error
	GetAbilityTemplate(TemplateSubset) (Template, error)
	ListAbilityTemplate() ([]Template, error)
}

TemplateMapper is an interface for Template object.

type TemplateSubset

type TemplateSubset struct {
	Type Type
}

TemplateSubset is a subset to retrieve one template.

type Type

type Type = ulid.ID

Type represents the ability type.

Jump to

Keyboard shortcuts

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