npc

package
v0.0.0-...-5198b88 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	FemaleFarmerAvatar = avatar.New(avatar.Avatar{
		CanvasPath: "static/female-farmer.png",
	})
	FemaleFarmer = New(Stats{
		Name:    "Farmer",
		Avatar:  FemaleFarmerAvatar,
		Dialog:  "Hello, my name is Mylène :-)",
		Pronoun: "she",
		Hostile: false,
		HP:      hp.New(10),
	})

	FemaleMageAvatar = avatar.New(avatar.Avatar{
		CanvasPath: "static/woman-mage.png",
	})
	FemaleMage = New(Stats{
		Name:    "Mage",
		Avatar:  FemaleMageAvatar,
		Pronoun: "she",
		Hostile: false,
		HP:      hp.New(15),
		MP:      mp.New(20),
	})

	KoboldAvatar = avatar.New(avatar.Avatar{
		CanvasPath: "static/kobold-short.png",
	})
	Kobold = New(Stats{
		Name:     "Kobold",
		Avatar:   KoboldAvatar,
		Pronoun:  "it",
		Hostile:  true,
		HP:       hp.New(4),
		LootXP:   30,
		LootGold: 2,
	})

	GoblinAvatar = avatar.New(avatar.Avatar{
		CanvasPath: "static/goblin-short.png",
	})
	Goblin = New(Stats{
		Name:     "Goblin",
		Avatar:   GoblinAvatar,
		Pronoun:  "he",
		Hostile:  true,
		HP:       hp.New(6),
		LootXP:   50,
		LootGold: 4,
	})

	GiantAntAvatar = avatar.New(avatar.Avatar{
		CanvasPath: "static/giant-ant.png",
	})
	GiantAnt = New(Stats{
		Name:     "Giant Ant",
		Avatar:   GiantAntAvatar,
		Pronoun:  "it",
		Hostile:  true,
		HP:       hp.New(10),
		LootXP:   60,
		LootGold: 0,
	})

	OrkAvatar = avatar.New(avatar.Avatar{
		CanvasPath: "static/ork-short.png",
	})
	Ork = New(Stats{
		Name:     "Ork",
		Avatar:   OrkAvatar,
		Pronoun:  "he",
		Hostile:  true,
		HP:       hp.New(14),
		LootXP:   80,
		LootGold: 10,
	})

	WolfAvatar = avatar.New(avatar.Avatar{
		CanvasPath: "static/wolf.png",
	})
	Wolf = New(Stats{
		Name:     "Wolf",
		Avatar:   WolfAvatar,
		Pronoun:  "it",
		Hostile:  true,
		HP:       hp.New(10),
		LootXP:   100,
		LootGold: 0,
	})

	GiantRedAntAvatar = avatar.New(avatar.Avatar{
		CanvasPath: "static/giant-red-ant.png",
	})
	GiantRedAnt = New(Stats{
		Name:     "Giant Red Ant",
		Avatar:   GiantRedAntAvatar,
		Pronoun:  "it",
		Hostile:  true,
		HP:       hp.New(20),
		LootXP:   150,
		LootGold: 0,
	})

	MimicAvatar = avatar.New(avatar.Avatar{
		CanvasPath: "static/mimic.png",
	})
	Mimic = New(Stats{
		Name:     "Mimic",
		Avatar:   MimicAvatar,
		Pronoun:  "it",
		Hostile:  true,
		HP:       hp.New(25),
		LootXP:   300,
		LootGold: 500,
	})

	OgreAvatar = avatar.New(avatar.Avatar{
		CanvasPath: "static/ogre.png",
	})
	Ogre = New(Stats{
		Name:     "Ogre",
		Avatar:   OgreAvatar,
		Pronoun:  "he",
		Hostile:  true,
		HP:       hp.New(35),
		LootXP:   500,
		LootGold: 100,
	})

	MinotaurAvatar = avatar.New(avatar.Avatar{
		CanvasPath: "static/minotaur-short.png",
	})
	Minotaur = New(Stats{
		Name:     "Minotaur",
		Avatar:   MinotaurAvatar,
		Pronoun:  "he",
		Hostile:  true,
		HP:       hp.New(50),
		LootXP:   1000,
		LootGold: 300,
	})
)

Functions

This section is empty.

Types

type Stats

type Stats struct {
	Name     string
	Pronoun  string
	Dialog   string
	Hostile  bool
	Avatar   avatar.Avatar
	HP       *hp.HP
	MP       *mp.MP
	LootXP   int
	LootGold int
}

func New

func New(npc Stats) Stats

New create new NPC.

func Spawn

func Spawn(npc Stats, coord coord.Coord) *Stats

Spawn creates a copy of a given NPC on given coordinates.

func (*Stats) Copy

func (s *Stats) Copy() *Stats

func (*Stats) HandleNPCDamage

func (npc *Stats) HandleNPCDamage() string

HandleNPCDamage returns strings for having nice logs during combat with NPCs.

func (*Stats) IsNPCDead

func (npc *Stats) IsNPCDead() bool

IsNPCDead checks if NPC's HP <= 0.

Jump to

Keyboard shortcuts

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