artifact

package
v0.0.0-...-4fabf87 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const CreationScreenCostThreshold = 200 // TODO: validate this again with abilities

Variables

This section is empty.

Functions

func RenderArtifactBox

func RenderArtifactBox(screen *ebiten.Image, imageCache *util.ImageCache, artifact Artifact, counter uint64, titleFont *font.Font, attributeFont *font.Font, options ebiten.DrawImageOptions)

func RenderArtifactImage

func RenderArtifactImage(screen *ebiten.Image, imageCache *util.ImageCache, artifact Artifact, counter uint64, options ebiten.DrawImageOptions) *ebiten.Image

Types

type Artifact

type Artifact struct {
	Type         ArtifactType
	Image        int
	Name         string
	Cost         int
	Powers       []Power
	Requirements []Requirement
}

func MakeRandomArtifact

func MakeRandomArtifact(cache *lbx.LbxCache) Artifact

generate an artifact with random properties

func ReadArtifacts

func ReadArtifacts(cache *lbx.LbxCache) ([]Artifact, error)

func ShowCreateArtifactScreen

func ShowCreateArtifactScreen(yield coroutine.YieldFunc, cache *lbx.LbxCache, creationType CreationScreen, magicLevel MagicLevel, artificer bool, runemaster bool, availableSpells spellbook.Spells, draw *func(*ebiten.Image)) (*Artifact, bool)

returns the artifact that was created and true, * otherwise false for cancelled

func (*Artifact) AddPower

func (artifact *Artifact) AddPower(power Power)

func (*Artifact) DefenseBonus

func (artifact *Artifact) DefenseBonus() int

func (*Artifact) FirstAbility

func (artifact *Artifact) FirstAbility() data.ItemAbility

func (*Artifact) GetSpellCharge

func (artifact *Artifact) GetSpellCharge() (spellbook.Spell, int)

returns the spell and how many charges it has

func (*Artifact) HasAbilities

func (artifact *Artifact) HasAbilities() bool

if true then generally this artifact should be rendered with a glow around it

func (*Artifact) HasAbility

func (artifact *Artifact) HasAbility(ability data.AbilityType) bool

func (*Artifact) HasAbilityPower

func (artifact *Artifact) HasAbilityPower() bool

func (*Artifact) HasDefensePower

func (artifact *Artifact) HasDefensePower() bool

func (*Artifact) HasEnchantment

func (artifact *Artifact) HasEnchantment(enchantment data.UnitEnchantment) bool

func (*Artifact) HasItemAbility

func (artifact *Artifact) HasItemAbility(ability data.ItemAbility) bool

func (*Artifact) HasMovementPower

func (artifact *Artifact) HasMovementPower() bool

func (*Artifact) HasResistancePower

func (artifact *Artifact) HasResistancePower() bool

func (*Artifact) HasSpellCharges

func (artifact *Artifact) HasSpellCharges() bool

func (*Artifact) HasSpellSavePower

func (artifact *Artifact) HasSpellSavePower() bool

func (*Artifact) HasSpellSkillPower

func (artifact *Artifact) HasSpellSkillPower() bool

func (*Artifact) HasToHitPower

func (artifact *Artifact) HasToHitPower() bool

func (*Artifact) LastAbility

func (artifact *Artifact) LastAbility() data.ItemAbility

func (*Artifact) MagicAttackBonus

func (artifact *Artifact) MagicAttackBonus() int

func (*Artifact) MeleeBonus

func (artifact *Artifact) MeleeBonus() int

func (*Artifact) MovementBonus

func (artifact *Artifact) MovementBonus() int

func (*Artifact) RangedAttackBonus

func (artifact *Artifact) RangedAttackBonus() int

func (*Artifact) RemovePower

func (artifact *Artifact) RemovePower(remove Power)

func (*Artifact) ResistanceBonus

func (artifact *Artifact) ResistanceBonus() int

func (*Artifact) SpellSaveBonus

func (artifact *Artifact) SpellSaveBonus() int

func (*Artifact) SpellSkillBonus

func (artifact *Artifact) SpellSkillBonus() int

func (*Artifact) ToHitBonus

func (artifact *Artifact) ToHitBonus() int

type ArtifactFonts

type ArtifactFonts struct {
	PowerFont      *font.Font
	PowerFontWhite *font.Font
	NameFont       *font.Font
	TitleSpellFont *font.Font
	SpellFont      *font.Font
}

type ArtifactSlot

type ArtifactSlot int
const (
	ArtifactSlotMeleeWeapon ArtifactSlot = iota
	ArtifactSlotRangedWeapon
	ArtifactSlotMagicWeapon
	ArtifactSlotAnyWeapon
	ArtifactSlotArmor
	ArtifactSlotJewelry
)

func (ArtifactSlot) CompatibleWith

func (slot ArtifactSlot) CompatibleWith(kind ArtifactType) bool

func (ArtifactSlot) ImageIndex

func (slot ArtifactSlot) ImageIndex() int

the index in itemisc.lbx for this slot

type ArtifactType

type ArtifactType int
const (
	ArtifactTypeNone ArtifactType = iota
	ArtifactTypeSword
	ArtifactTypeMace
	ArtifactTypeAxe
	ArtifactTypeBow
	ArtifactTypeStaff
	ArtifactTypeWand
	ArtifactTypeMisc
	ArtifactTypeShield
	ArtifactTypeChain
	ArtifactTypePlate
)

func (ArtifactType) Name

func (a ArtifactType) Name() string

func (ArtifactType) String

func (a ArtifactType) String() string

type CreationScreen

type CreationScreen int

the screen can be invoked as either the 'Enchant Item' spell or 'Create Artifact'

const (
	CreationEnchantItem CreationScreen = iota
	CreationCreateArtifact
)

type MagicLevel

type MagicLevel interface {
	// for a given magic type, returns the number of books of that magic
	MagicLevel(kind data.MagicType) int
}

a way to know how many books of magic the wizard has

type Power

type Power struct {
	Type    PowerType
	Amount  int // for an ability this is the number of books of the Magic needed
	Name    string
	Ability data.ItemAbility
	Magic   data.MagicType // for abilities

	Spell        spellbook.Spell
	SpellCharges int

	// powers are sorted by how they are defined in itempow.lbx, so we just use that number here
	// this field has no utility other than sorting
	Index int
}

func ReadPowers

func ReadPowers(cache *lbx.LbxCache) ([]Power, map[Power]int, map[Power]set.Set[ArtifactType], error)

type PowerType

type PowerType int
const (
	PowerTypeNone PowerType = iota
	PowerTypeAttack
	PowerTypeDefense
	PowerTypeToHit
	PowerTypeSpellSkill
	PowerTypeSpellSave
	PowerTypeMovement
	PowerTypeResistance
	PowerTypeSpellCharges

	PowerTypeAbility1
	PowerTypeAbility2
	PowerTypeAbility3
)

func (PowerType) String

func (section PowerType) String() string

type Requirement

type Requirement struct {
	MagicType data.MagicType
	Amount    int
}

Jump to

Keyboard shortcuts

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