player

package
v0.0.0-...-29f7fc1 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AIBehavior

type AIBehavior interface {
	Update(*Player, []*Player, PathFinder) []AIDecision
	NewTurn()
}

type AICreateUnitDecision

type AICreateUnitDecision struct {
	Unit  units.Unit
	X     int
	Y     int
	Plane data.Plane
}

type AIDecision

type AIDecision interface {
}

type AIMoveStackDecision

type AIMoveStackDecision struct {
	Stack    *UnitStack
	Location image.Point
}

type ActiveMap

type ActiveMap map[units.StackUnit]bool

type PathFinder

type PathFinder interface {
	FindPath(oldX int, oldY int, newX int, newY int, stack *UnitStack, fog [][]bool) pathfinding.Path
}

type Player

type Player struct {
	// matrix the same size as the map, where true means the player can see the tile
	// and false means the tile has not yet been discovered
	ArcanusFog [][]bool
	MyrrorFog  [][]bool

	TaxRate fraction.Fraction

	Gold int
	Mana int

	Human    bool
	Defeated bool

	Fame int

	// used to seed the random number generator for generating the order of how magic books are drawn
	BookOrderSeed1 uint64
	BookOrderSeed2 uint64

	// known spells
	KnownSpells spellbook.Spells

	// the full set of spells that can be known by the wizard
	ResearchPoolSpells spellbook.Spells

	// spells that can be researched
	ResearchCandidateSpells spellbook.Spells

	GlobalEnchantments *set.Set[data.Enchantment]

	PowerDistribution PowerDistribution

	AIBehavior AIBehavior

	// relations with other players (treaties, etc)
	PlayerRelations map[*Player]*Relationship

	Heroes         [6]*herolib.Hero
	VaultEquipment [4]*artifact.Artifact

	// total power points put into the casting skill
	CastingSkillPower int
	// how much casting skill remains in this turn
	RemainingCastingSkill int

	ResearchingSpell spellbook.Spell
	ResearchProgress int

	// current spell being cast
	CastingSpell spellbook.Spell
	// how much mana has been put towards the current spell. When this value equals
	// the spell's casting cost, the spell is cast
	CastingSpellProgress int

	// the artifact currently being created by a spell cast of Create Artifact or Enchant Item
	CreateArtifact *artifact.Artifact

	Wizard setup.WizardCustom

	Units  []units.StackUnit
	Stacks []*UnitStack
	Cities []*citylib.City

	// counter for the next created unit owned by this player
	UnitId        uint64
	SelectedStack *UnitStack
}

func MakePlayer

func MakePlayer(wizard setup.WizardCustom, human bool, arcanusFog [][]bool, myrrorFog [][]bool) *Player

func (*Player) AddCity

func (player *Player) AddCity(city *citylib.City) *citylib.City

func (*Player) AddHero

func (player *Player) AddHero(hero *herolib.Hero) bool

returns true if the hero was actually added to the player

func (*Player) AddStack

func (player *Player) AddStack(stack *UnitStack)

func (*Player) AddUnit

func (player *Player) AddUnit(unit units.StackUnit) units.StackUnit

func (*Player) AliveHeroes

func (player *Player) AliveHeroes() []*herolib.Hero

func (*Player) AllianceWithPlayer

func (player *Player) AllianceWithPlayer(other *Player)

func (*Player) AwarePlayer

func (player *Player) AwarePlayer(other *Player)

this player should now be aware of the other player

func (*Player) CastingSkillPerTurn

func (player *Player) CastingSkillPerTurn(power int) int

func (*Player) ComputeCastingSkill

func (player *Player) ComputeCastingSkill() int

func (*Player) FindCity

func (player *Player) FindCity(x int, y int) *citylib.City

func (*Player) FindFortressCity

func (player *Player) FindFortressCity() *citylib.City

return the city that contains the summoning circle

func (*Player) FindStack

func (player *Player) FindStack(x int, y int) *UnitStack

func (*Player) FindStackByUnit

func (player *Player) FindStackByUnit(unit units.StackUnit) *UnitStack

func (*Player) FindSummoningCity

func (player *Player) FindSummoningCity() *citylib.City

return the city that contains the summoning circle

func (*Player) FoodPerTurn

func (player *Player) FoodPerTurn() int

func (*Player) GetBanner

func (player *Player) GetBanner() data.BannerType

func (*Player) GetFog

func (player *Player) GetFog(plane data.Plane) [][]bool

func (*Player) GetKnownPlayers

func (player *Player) GetKnownPlayers() []*Player

func (*Player) GetUnits

func (player *Player) GetUnits(x int, y int) []units.StackUnit

func (*Player) GoldPerTurn

func (player *Player) GoldPerTurn() int

func (*Player) IsAI

func (player *Player) IsAI() bool

func (*Player) IsHuman

func (player *Player) IsHuman() bool

func (*Player) LearnSpell

func (player *Player) LearnSpell(spell spellbook.Spell)

func (*Player) LiftFog

func (player *Player) LiftFog(x int, y int, radius int, plane data.Plane)

make anything within the given radius viewable by the player

func (*Player) LiftFogSquare

func (player *Player) LiftFogSquare(x int, y int, squares int, plane data.Plane)

func (*Player) MakeExperienceInfo

func (player *Player) MakeExperienceInfo() units.ExperienceInfo

func (*Player) ManaPerTurn

func (player *Player) ManaPerTurn(power int) int

func (*Player) MergeStacks

func (player *Player) MergeStacks(stack1 *UnitStack, stack2 *UnitStack) *UnitStack

func (*Player) PactWithPlayer

func (player *Player) PactWithPlayer(other *Player)

func (*Player) RemoveCity

func (player *Player) RemoveCity(city *citylib.City)

func (*Player) RemoveUnit

func (player *Player) RemoveUnit(unit units.StackUnit)

func (*Player) SetSelectedStack

func (player *Player) SetSelectedStack(stack *UnitStack)

func (*Player) SpellResearchPerTurn

func (player *Player) SpellResearchPerTurn(power int) float64

func (*Player) TotalUnitUpkeepFood

func (player *Player) TotalUnitUpkeepFood() int

func (*Player) TotalUnitUpkeepGold

func (player *Player) TotalUnitUpkeepGold() int

func (*Player) TotalUnitUpkeepMana

func (player *Player) TotalUnitUpkeepMana() int

func (*Player) UpdateResearchCandidates

func (player *Player) UpdateResearchCandidates()

fill up the research candidate spells so that there are at most 8. * choose spells from the research pool that are not already known, but preferring * lower rarity spells first.

func (*Player) UpdateTaxRate

func (player *Player) UpdateTaxRate(rate fraction.Fraction)

func (*Player) WarWithPlayer

func (player *Player) WarWithPlayer(other *Player)

func (*Player) WrapX

func (player *Player) WrapX(x int) int

type PowerDistribution

type PowerDistribution struct {
	Mana     float64
	Research float64
	Skill    float64
}

in the magic screen, power is distributed across the 3 categories

type Relationship

type Relationship struct {
	Treaty data.TreatyType
}

type UnitStack

type UnitStack struct {
	CurrentPath pathfinding.Path
	// contains filtered or unexported fields
}

func MakeUnitStack

func MakeUnitStack() *UnitStack

func MakeUnitStackFromUnits

func MakeUnitStackFromUnits(units []units.StackUnit) *UnitStack

func (*UnitStack) ActiveUnits

func (stack *UnitStack) ActiveUnits() []units.StackUnit

func (*UnitStack) AddUnit

func (stack *UnitStack) AddUnit(unit units.StackUnit)

func (*UnitStack) AllFlyers

func (stack *UnitStack) AllFlyers() bool

func (*UnitStack) ContainsUnit

func (stack *UnitStack) ContainsUnit(unit units.StackUnit) bool

func (*UnitStack) EnableMovers

func (stack *UnitStack) EnableMovers()

func (*UnitStack) ExhaustMoves

func (stack *UnitStack) ExhaustMoves()

func (*UnitStack) HasMoves

func (stack *UnitStack) HasMoves() bool

true if any unit in the stack has moves left

func (*UnitStack) InactiveUnits

func (stack *UnitStack) InactiveUnits() []units.StackUnit

func (*UnitStack) IsActive

func (stack *UnitStack) IsActive(unit units.StackUnit) bool

func (*UnitStack) IsEmpty

func (stack *UnitStack) IsEmpty() bool

func (*UnitStack) Leader

func (stack *UnitStack) Leader() units.StackUnit

func (*UnitStack) Move

func (stack *UnitStack) Move(dx int, dy int, cost fraction.Fraction)

func (*UnitStack) NaturalHeal

func (stack *UnitStack) NaturalHeal(rate float64)

func (*UnitStack) OffsetX

func (stack *UnitStack) OffsetX() float64

func (*UnitStack) OffsetY

func (stack *UnitStack) OffsetY() float64

func (*UnitStack) OutOfMoves

func (stack *UnitStack) OutOfMoves() bool

true if no unit has any moves left

func (*UnitStack) Plane

func (stack *UnitStack) Plane() data.Plane

func (*UnitStack) RemoveUnit

func (stack *UnitStack) RemoveUnit(unit units.StackUnit)

func (*UnitStack) RemoveUnits

func (stack *UnitStack) RemoveUnits(units []units.StackUnit)

func (*UnitStack) ResetMoves

func (stack *UnitStack) ResetMoves()

func (*UnitStack) SetOffset

func (stack *UnitStack) SetOffset(x float64, y float64)

func (*UnitStack) SetPlane

func (stack *UnitStack) SetPlane(plane data.Plane)

func (*UnitStack) ToggleActive

func (stack *UnitStack) ToggleActive(unit units.StackUnit)

func (*UnitStack) Units

func (stack *UnitStack) Units() []units.StackUnit

func (*UnitStack) X

func (stack *UnitStack) X() int

func (*UnitStack) Y

func (stack *UnitStack) Y() int

Jump to

Keyboard shortcuts

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