Documentation
¶
Index ¶
- type AIBehavior
- type AIBuildOutpostDecision
- type AICastSpellDecision
- type AICreateUnitDecision
- type AIDecision
- type AIMoveStackDecision
- type AIProduceDecision
- type AIResearchSpellDecision
- type AIServices
- type ActiveMap
- type CityEnchantment
- type CityEnchantmentsProvider
- type Player
- func (player *Player) AddCity(city *citylib.City) *citylib.City
- func (player *Player) AddHero(hero *herolib.Hero) bool
- func (player *Player) AddStack(stack *UnitStack) *UnitStack
- func (player *Player) AddUnit(unit units.StackUnit) units.StackUnit
- func (player *Player) AliveHeroes() []*herolib.Hero
- func (player *Player) AllianceWithPlayer(other *Player)
- func (player *Player) AwarePlayer(other *Player)
- func (player *Player) CastingSkillPerTurn(power int) int
- func (player *Player) ComputeCastingSkill() int
- func (player *Player) ComputePlunderedGold(city *citylib.City) int
- func (player *Player) ExploreFogSquare(x int, y int, squares int, plane data.Plane)
- func (player *Player) FindAllStacks(x int, y int, plane data.Plane) []*UnitStack
- func (player *Player) FindCity(x int, y int, plane data.Plane) *citylib.City
- func (player *Player) FindFortressCity() *citylib.City
- func (player *Player) FindStack(x int, y int, plane data.Plane) *UnitStack
- func (player *Player) FindStackByUnit(unit units.StackUnit) *UnitStack
- func (player *Player) FindSummoningCity() *citylib.City
- func (player *Player) FoodPerTurn() int
- func (player *Player) GetBanner() data.BannerType
- func (player *Player) GetFame() int
- func (player *Player) GetFog(plane data.Plane) data.FogMap
- func (player *Player) GetGlobalEnchantments() *set.Set[data.Enchantment]
- func (player *Player) GetKnownPlayers() []*Player
- func (player *Player) GetRulingRace() data.Race
- func (player *Player) GetTaxRate() fraction.Fraction
- func (player *Player) GetUnits(x int, y int, plane data.Plane) []units.StackUnit
- func (player *Player) GoldPerTurn() int
- func (player *Player) HasDeathBooks() bool
- func (player *Player) HasDivinePower() bool
- func (player *Player) HasInfernalPower() bool
- func (player *Player) HasLifeBooks() bool
- func (player *Player) IsAI() bool
- func (player *Player) IsHuman() bool
- func (player *Player) IsTileExplored(x int, y int, plane data.Plane) bool
- func (player *Player) IsVisible(x int, y int, plane data.Plane) bool
- func (player *Player) LearnSpell(spell spellbook.Spell)
- func (player *Player) LiftFog(x int, y int, radius int, plane data.Plane)
- func (player *Player) LiftFogAll(plane data.Plane)
- func (player *Player) LiftFogSquare(x int, y int, squares int, plane data.Plane)
- func (player *Player) MakeExperienceInfo() units.ExperienceInfo
- func (player *Player) ManaPerTurn(power int, cityEnchantmentsProvider CityEnchantmentsProvider) int
- func (player *Player) MergeStacks(stack1 *UnitStack, stack2 *UnitStack) *UnitStack
- func (player *Player) OwnsCity(city *citylib.City) bool
- func (player *Player) OwnsStack(stack *UnitStack) bool
- func (player *Player) PactWithPlayer(other *Player)
- func (player *Player) RemoveCity(city *citylib.City)
- func (player *Player) RemoveUnit(unit units.StackUnit)
- func (player *Player) SetSelectedStack(stack *UnitStack)
- func (player *Player) SpellResearchPerTurn(power int) float64
- func (player *Player) SplitActiveStack(stack *UnitStack) *UnitStack
- func (player *Player) TotalBooks() int
- func (player *Player) TotalEnchantmentUpkeep(cityEnchantmentsProvider CityEnchantmentsProvider) int
- func (player *Player) TotalUnitUpkeepFood() int
- func (player *Player) TotalUnitUpkeepGold() int
- func (player *Player) TotalUnitUpkeepMana() int
- func (player *Player) UpdateFogVisibility()
- func (player *Player) UpdateResearchCandidates()
- func (player *Player) UpdateTaxRate(rate fraction.Fraction)
- func (player *Player) WarWithPlayer(other *Player)
- func (player *Player) WrapX(x int) int
- type PowerDistribution
- type Relationship
- type UnitStack
- func (stack *UnitStack) ActiveUnits() []units.StackUnit
- func (stack *UnitStack) ActiveUnitsDoesntHaveAbility(ability data.AbilityType) bool
- func (stack *UnitStack) ActiveUnitsHasAbility(ability data.AbilityType) bool
- func (stack *UnitStack) ActiveUnitsHasEnchantment(ability data.UnitEnchantment) bool
- func (stack *UnitStack) AddUnit(unit units.StackUnit)
- func (stack *UnitStack) AllActive() bool
- func (stack *UnitStack) AllFlyers() bool
- func (stack *UnitStack) AllLandWalkers() bool
- func (stack *UnitStack) AllSwimmers() bool
- func (stack *UnitStack) AnyOutOfMoves() bool
- func (stack *UnitStack) ContainsUnit(unit units.StackUnit) bool
- func (stack *UnitStack) EnableMovers()
- func (stack *UnitStack) ExhaustMoves()
- func (stack *UnitStack) GetBanner() data.BannerType
- func (stack *UnitStack) GetRemainingMoves() fraction.Fraction
- func (stack *UnitStack) GetSightRange() int
- func (stack *UnitStack) HasHero() bool
- func (stack *UnitStack) HasMoves() bool
- func (stack *UnitStack) HasPathfinding() bool
- func (stack *UnitStack) HasSailingUnits(onlyActive bool) bool
- func (stack *UnitStack) InactiveUnits() []units.StackUnit
- func (stack *UnitStack) IsActive(unit units.StackUnit) bool
- func (stack *UnitStack) IsEmpty() bool
- func (stack *UnitStack) Leader() units.StackUnit
- func (stack *UnitStack) Move(dx int, dy int, cost fraction.Fraction, ...)
- func (stack *UnitStack) NaturalHeal(rate float64)
- func (stack *UnitStack) OffsetX() float64
- func (stack *UnitStack) OffsetY() float64
- func (stack *UnitStack) OutOfMoves() bool
- func (stack *UnitStack) Plane() data.Plane
- func (stack *UnitStack) RemoveUnit(unit units.StackUnit)
- func (stack *UnitStack) RemoveUnits(units []units.StackUnit)
- func (stack *UnitStack) ResetMoves()
- func (stack *UnitStack) SetOffset(x float64, y float64)
- func (stack *UnitStack) SetPlane(plane data.Plane)
- func (stack *UnitStack) SetX(x int)
- func (stack *UnitStack) SetY(y int)
- func (stack *UnitStack) SplitActiveUnits() *UnitStack
- func (stack *UnitStack) ToggleActive(unit units.StackUnit)
- func (stack *UnitStack) Units() []units.StackUnit
- func (stack *UnitStack) X() int
- func (stack *UnitStack) Y() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AIBehavior ¶
type AIBehavior interface { // return a list of decisions to make for the current turn Update(*Player, []*Player, AIServices, int) []AIDecision // called after all decisions have been processed for an AI player PostUpdate(*Player, []*Player) // reset any state that needs to be reset at the start of a new turn NewTurn(*Player) // called when a new unit is produced in the city ProducedUnit(*citylib.City, *Player) // true to raze, false to occupy ConfirmRazeTown(*citylib.City) bool }
type AIBuildOutpostDecision ¶
type AIBuildOutpostDecision struct {
Stack *UnitStack
}
type AICastSpellDecision ¶
type AICreateUnitDecision ¶
type AIDecision ¶
type AIDecision interface { }
type AIMoveStackDecision ¶
type AIProduceDecision ¶
type AIResearchSpellDecision ¶
choose a new spell to research
type AIServices ¶
type CityEnchantment ¶
type CityEnchantment struct { City *citylib.City Enchantment citylib.Enchantment }
type CityEnchantmentsProvider ¶
type CityEnchantmentsProvider interface {
GetCityEnchantmentsByBanner(banner data.BannerType) []CityEnchantment
}
type Player ¶
type Player struct { // matrix the same size as the map containg information if the tile is explored, // unexplored or in the range of sight ArcanusFog data.FogMap MyrrorFog data.FogMap TaxRate fraction.Fraction Gold int Mana int Human bool Defeated bool // Fame (without just cause and/or heroes) Fame int // used to seed the random number generator for generating the order of how magic books are drawn BookOrderSeed1 uint64 BookOrderSeed2 uint64 // if true, the game will only do strategic (non-graphics/non-realtime) based combat if both sides are strategic StrategicCombat bool // godmode that lets the player interact with enemy cities/units Admin bool // true if the wizard is currently banished Banished bool // 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 // possible heros that can be employed. some heroes might be dead HeroPool map[herolib.HeroType]*herolib.Hero // currently employed heroes 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 // FIXME: probably remove Units and just use Stacks to track the units 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 (*Player) AliveHeroes ¶
func (*Player) AllianceWithPlayer ¶
func (*Player) AwarePlayer ¶
this player should now be aware of the other player
func (*Player) CastingSkillPerTurn ¶
func (*Player) ComputeCastingSkill ¶
func (*Player) ComputePlunderedGold ¶
how much gold is stored in this city relative to the player's overall wealth
func (*Player) ExploreFogSquare ¶
Doesn't provide direct visibility, whilst making the tiles explored.
func (*Player) FindAllStacks ¶
multiple stacks can be on the same tile
func (*Player) FindFortressCity ¶
return the city that contains the summoning circle
func (*Player) FindStackByUnit ¶
func (*Player) FindSummoningCity ¶
return the city that contains the summoning circle
func (*Player) FoodPerTurn ¶
func (*Player) GetBanner ¶
func (player *Player) GetBanner() data.BannerType
func (*Player) GetGlobalEnchantments ¶
func (player *Player) GetGlobalEnchantments() *set.Set[data.Enchantment]
func (*Player) GetKnownPlayers ¶
func (*Player) GetRulingRace ¶
func (*Player) GetTaxRate ¶
func (*Player) GoldPerTurn ¶
func (*Player) HasDeathBooks ¶
func (*Player) HasDivinePower ¶
func (*Player) HasInfernalPower ¶
func (*Player) HasLifeBooks ¶
func (*Player) IsTileExplored ¶
func (*Player) LearnSpell ¶
func (*Player) LiftFogAll ¶
func (*Player) LiftFogSquare ¶
func (*Player) MakeExperienceInfo ¶
func (player *Player) MakeExperienceInfo() units.ExperienceInfo
func (*Player) ManaPerTurn ¶
func (player *Player) ManaPerTurn(power int, cityEnchantmentsProvider CityEnchantmentsProvider) int
func (*Player) MergeStacks ¶
func (*Player) PactWithPlayer ¶
func (*Player) RemoveCity ¶
func (*Player) RemoveUnit ¶
func (*Player) SetSelectedStack ¶
func (*Player) SpellResearchPerTurn ¶
func (*Player) SplitActiveStack ¶
func (*Player) TotalBooks ¶
func (*Player) TotalEnchantmentUpkeep ¶
func (player *Player) TotalEnchantmentUpkeep(cityEnchantmentsProvider CityEnchantmentsProvider) int
func (*Player) TotalUnitUpkeepFood ¶
func (*Player) TotalUnitUpkeepGold ¶
func (*Player) TotalUnitUpkeepMana ¶
func (*Player) UpdateFogVisibility ¶
func (player *Player) UpdateFogVisibility()
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) WarWithPlayer ¶
type PowerDistribution ¶
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 (*UnitStack) ActiveUnits ¶
func (*UnitStack) ActiveUnitsDoesntHaveAbility ¶
func (stack *UnitStack) ActiveUnitsDoesntHaveAbility(ability data.AbilityType) bool
returns true if none of the active units in the stack have the given ability if a single unit has the ability then return false
func (*UnitStack) ActiveUnitsHasAbility ¶
func (stack *UnitStack) ActiveUnitsHasAbility(ability data.AbilityType) bool
returns true if any of the active units in the stack have the given ability
func (*UnitStack) ActiveUnitsHasEnchantment ¶
func (stack *UnitStack) ActiveUnitsHasEnchantment(ability data.UnitEnchantment) bool
func (*UnitStack) AllLandWalkers ¶
true if every active unit can only walk on land
func (*UnitStack) AllSwimmers ¶
func (*UnitStack) AnyOutOfMoves ¶
func (*UnitStack) EnableMovers ¶
func (stack *UnitStack) EnableMovers()
func (*UnitStack) ExhaustMoves ¶
func (stack *UnitStack) ExhaustMoves()
func (*UnitStack) GetBanner ¶
func (stack *UnitStack) GetBanner() data.BannerType
func (*UnitStack) GetRemainingMoves ¶
func (*UnitStack) GetSightRange ¶
func (*UnitStack) HasPathfinding ¶
func (*UnitStack) HasSailingUnits ¶
pass in true to only check active units
func (*UnitStack) InactiveUnits ¶
func (*UnitStack) NaturalHeal ¶
func (*UnitStack) OutOfMoves ¶
true if no unit has any moves left
func (*UnitStack) RemoveUnit ¶
func (*UnitStack) RemoveUnits ¶
func (*UnitStack) ResetMoves ¶
func (stack *UnitStack) ResetMoves()
func (*UnitStack) SplitActiveUnits ¶
return a new stack that only contains the active units this might return the same stack if all units are active