spellbook

package
v0.0.0-...-e988257 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CastLeftSideDistortions1

func CastLeftSideDistortions1(page *ebiten.Image) util.Distortion

func CastLeftSideDistortions2

func CastLeftSideDistortions2(page *ebiten.Image) util.Distortion

func CastRightSideDistortions1

func CastRightSideDistortions1(page *ebiten.Image) util.Distortion

func CastRightSideDistortions2

func CastRightSideDistortions2(page *ebiten.Image) util.Distortion

func LeftSideDistortions1

func LeftSideDistortions1(page *ebiten.Image) util.Distortion

flipping the page to the left

func LeftSideDistortions2

func LeftSideDistortions2(page *ebiten.Image) util.Distortion

func MakeSpellBookCastUI

func MakeSpellBookCastUI(ui *uilib.UI, cache *lbx.LbxCache, spells Spells, charges map[Spell]int, castingSkill int, currentSpell Spell, currentProgress int, overland bool, chosenCallback func(Spell, bool)) []*uilib.UIElement

FIXME: take in the wizard/player that is casting the spell chosenCallback is invoked when the spellbook ui goes away, either because the user selected a spell or because they canceled the ui if a spell is chosen then it will be passed in as the first argument to the callback along with true if the ui is cancelled then the second argument will be false

func ReadSpellDescriptions

func ReadSpellDescriptions(file *lbx.LbxFile) ([]string, error)

pass in desc.lbx

func ReadSpellDescriptionsFromCache

func ReadSpellDescriptionsFromCache(cache *lbx.LbxCache) ([]string, error)

func RightSideDistortions1

func RightSideDistortions1(page *ebiten.Image) util.Distortion

func RightSideDistortions2

func RightSideDistortions2(page *ebiten.Image) util.Distortion

func ShowSpellBook

func ShowSpellBook(yield coroutine.YieldFunc, cache *lbx.LbxCache, allSpells Spells, knownSpells Spells, researchSpells Spells, researchingSpell Spell, researchProgress int, researchPoints int, castingSkill int, learnedSpell Spell, pickResearchSpell bool, chosenSpell *Spell, drawFunc *func(screen *ebiten.Image))

three modes: * 1. when a new spell is learned, flip to the page where the spell would go and show the sparkle animation over the new spell * 2. flip to the 'research spells' page and let the user pick a new spell * 3. show book and let user flip between pages. on the 'research spells' page, show currently * researching spell as glowing text * * This function does all 3, which makes it kind of ugly and has too many parameters.

Types

type EligibilityType

type EligibilityType int
const (
	EligibilityCombatOnly               EligibilityType = 0xff
	EligibilityCombatOnly2              EligibilityType = 0xfe
	EligibilityBoth                     EligibilityType = 0x0
	EligibilityOverlandOnly             EligibilityType = 0x1
	EligibilityBoth2                    EligibilityType = 0x2
	EligibilityOverlandOnlyFriendlyCity EligibilityType = 0x3
	EligibilityBothSameCost                             = 0x4
	EligibilityOverlandWhileBanished                    = 0x5
)

func (EligibilityType) CanCastInCombat

func (eligibility EligibilityType) CanCastInCombat() bool

func (EligibilityType) CanCastInOverland

func (eligibility EligibilityType) CanCastInOverland() bool

type Page

type Page struct {
	Title  string
	Spells Spells
	// true if this page should render a title even if the spells are empty
	ForceRender bool
	// true if the text for the spell should always use normal font rather than alien
	IsResearch bool
}

type Section

type Section int
const (
	SectionSpecial     Section = 0
	SectionSummoning   Section = 1
	SectionEnchantment Section = 2
	SectionCitySpell   Section = 3
	SectionUnitSpell   Section = 4
	SectionCombatSpell Section = 5
)

func (Section) HasNext

func (section Section) HasNext() bool

true if there is a section after this one

func (Section) HasPrevious

func (section Section) HasPrevious() bool

func (Section) Name

func (section Section) Name() string

func (Section) NextSection

func (section Section) NextSection() Section

func (Section) PreviousSection

func (section Section) PreviousSection() Section

func (Section) String

func (section Section) String() string

type Spell

type Spell struct {
	Name         string
	Index        int
	AiGroup      int
	AiValue      int
	SpellType    int
	Section      Section
	Realm        int
	Eligibility  EligibilityType
	CastCost     int
	OverrideCost int
	ResearchCost int
	Sound        int
	Summoned     int
	Flag1        int
	Flag2        int
	Flag3        int

	// which book of magic this spell is a part of
	Magic  data.MagicType
	Rarity SpellRarity
}

func (Spell) Cost

func (spell Spell) Cost(overland bool) int

overland=true if casting in overland, otherwise casting in combat

func (Spell) Invalid

func (spell Spell) Invalid() bool

func (Spell) IsVariableCost

func (spell Spell) IsVariableCost() bool

func (Spell) Valid

func (spell Spell) Valid() bool

type SpellRarity

type SpellRarity int
const (
	SpellRarityCommon SpellRarity = iota
	SpellRarityUncommon
	SpellRarityRare
	SpellRarityVeryRare
)

func (SpellRarity) String

func (rarity SpellRarity) String() string

type Spells

type Spells struct {
	Spells []Spell
}

func ReadSpells

func ReadSpells(lbxFile *lbx.LbxFile, entry int) (Spells, error)

pass in spelldat.lbx and 0

func ReadSpellsFromCache

func ReadSpellsFromCache(cache *lbx.LbxCache) (Spells, error)

func SpellsFromArray

func SpellsFromArray(spells []Spell) Spells

func (*Spells) AddAllSpells

func (spells *Spells) AddAllSpells(more Spells)

func (*Spells) AddSpell

func (spells *Spells) AddSpell(spell Spell) bool

returns true if the spell was added, false if it was not

func (Spells) CombatSpells

func (spells Spells) CombatSpells() Spells

the subset of spells that can be cast in combat

func (*Spells) Contains

func (spells *Spells) Contains(spell Spell) bool

func (*Spells) Copy

func (spells *Spells) Copy() Spells

func (*Spells) FindById

func (spells *Spells) FindById(id int) Spell

func (*Spells) FindByName

func (spells *Spells) FindByName(name string) Spell

func (Spells) GetSpellsByMagic

func (spells Spells) GetSpellsByMagic(magic data.MagicType) Spells

func (Spells) GetSpellsByRarity

func (spells Spells) GetSpellsByRarity(rarity SpellRarity) Spells

func (Spells) GetSpellsBySection

func (spells Spells) GetSpellsBySection(section Section) Spells

func (*Spells) HasSpell

func (spells *Spells) HasSpell(spell Spell) bool

func (Spells) OverlandSpells

func (spells Spells) OverlandSpells() Spells

the subset of spells that can be cast on the overworld

func (*Spells) RemoveSpell

func (spells *Spells) RemoveSpell(toRemove Spell)

func (*Spells) RemoveSpells

func (spells *Spells) RemoveSpells(toRemove Spells)

func (*Spells) RemoveSpellsByMagic

func (spells *Spells) RemoveSpellsByMagic(magic data.MagicType)

func (*Spells) ShuffleSpells

func (spells *Spells) ShuffleSpells()

func (*Spells) SortByRarity

func (spells *Spells) SortByRarity()

func (*Spells) Sub

func (spells *Spells) Sub(min int, max int) Spells

Jump to

Keyboard shortcuts

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