actors

package
v0.0.0-...-e374d70 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExitOnRest error = errors.New("Exit on rest")
View Source
var GatherSkills = [4]string{"mining", "woodcutting", "fishing", "alchemy"}

Functions

This section is empty.

Types

type ActionResult

type ActionResult struct {
	CooldownRemaining time.Duration
	Success           bool
}

type Actor

type Actor interface {
	Do(character *character.Character) error
}

func NewDropsFightingActor

func NewDropsFightingActor[C FightingCharacterAdapter](
	character *character.Character,
	code string,
	qty int,
	config *Config[C],
) (Actor, error)

func NewGatherActor

func NewGatherActor[C GatheringCharacterAdapter](
	character *character.Character,
	goalCode string,
	goalQuantity int,
	config *Config[C],
) (Actor, error)

func NewTaskFightingActor

func NewTaskFightingActor[C FightingCharacterAdapter](
	character *character.Character,
	exitOnRest bool,
	config *Config[C],
) (Actor, error)

type CharacterAdapter

type CharacterAdapter interface {
	UpdateCharacter(character *character.Character) error
	Move(character *character.Character, x int, y int) (*ActionResult, error)
}

type Config

type Config[C CharacterAdapter] struct {
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig[C CharacterAdapter](ca C, fs FightSimulator, ia ItemAdapter, ma MapAdapter, moa MonsterAdapter, logger *slog.Logger) *Config[C]

type CraftingActor

type CraftingActor[C CraftingCharacterAdapter] struct {
	GoalItem     *artifactsmmo.ItemSchema
	GoalQuantity int
	// contains filtered or unexported fields
}

func NewCraftingActor

func NewCraftingActor[C CraftingCharacterAdapter](
	goalCode string,
	goalQuantity int,
	config *Config[C],
) (*CraftingActor[C], error)

func (*CraftingActor[C]) Do

func (actor *CraftingActor[C]) Do(character *character.Character) error

type CraftingCharacterAdapter

type CraftingCharacterAdapter interface {
	CharacterAdapter
	GatheringCharacterAdapter
	Craft(character *character.Character, itemCode string, quantity int) (*ActionResult, error)
}

type DropsFightingActor

type DropsFightingActor struct {
	// contains filtered or unexported fields
}

func (*DropsFightingActor) Do

func (actor *DropsFightingActor) Do(character *character.Character) error

type FightResult

type FightResult struct {
	Win             bool
	Turns           int
	CharacterTurns  int
	CharacterHpLoss int
	RestoreTurns    int
	CharacterDmg    int
	MonsterDmg      int
}

type FightSimulator

type FightSimulator interface {
	CalculateFightResult(character *character.Character, monster *artifactsmmo.MonsterSchema) (*FightResult, error)
}

type FightingCharacterAdapter

type FightingCharacterAdapter interface {
	CharacterAdapter
	Fight(character *character.Character) (*ActionResult, error)
	Rest(character *character.Character) (*ActionResult, error)
	Use(character *character.Character, item *artifactsmmo.SimpleItemSchema) (*ActionResult, error)
}

type GatherActor

type GatherActor struct {
	GoalItem     *artifactsmmo.ItemSchema
	GoalQuantity int
	// contains filtered or unexported fields
}

func (*GatherActor) Do

func (actor *GatherActor) Do(character *character.Character) error

type GatheringCharacterAdapter

type GatheringCharacterAdapter interface {
	CharacterAdapter
	FightingCharacterAdapter
	Gather(character *character.Character) (*ActionResult, error)
}

type ItemAdapter

type ItemAdapter interface {
	GetItem(name string) (*artifactsmmo.ItemSchema, error)
	GetAllResources(skill *artifactsmmo.GatheringSkill, code *string) ([]artifactsmmo.ResourceSchema, error)
	GetCharacterEquipment(character *character.Character) *[]character.Equipment
	IsGatherable(item *artifactsmmo.ItemSchema) bool
	IsCraftable(item *artifactsmmo.ItemSchema) bool
}

type MapAdapter

type MapAdapter interface {
	GetAllMaps(contentType *string, contentCode *string, page *int, size *int) ([]artifactsmmo.MapSchema, error)
	GetMap(x int, y int) (*artifactsmmo.MapSchema, error)
}

type MonsterAdapter

type MonsterAdapter interface {
	GetAllMonsters(
		minLevel *int,
		maxLevel *int,
		drop *string,
		page *int,
		size *int,
	) (*[]artifactsmmo.MonsterSchema, error)
	GetMonster(code string) (*artifactsmmo.MonsterSchema, error)
}

type TaskFightingActor

type TaskFightingActor struct {
	// contains filtered or unexported fields
}

func (*TaskFightingActor) Do

func (actor *TaskFightingActor) Do(character *character.Character) error

Jump to

Keyboard shortcuts

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