Documentation
¶
Index ¶
- Constants
- func ReadCityNames(cache *lbx.LbxCache) ([]string, error)
- type CatchmentProvider
- type City
- func (city *City) AddBuilding(building buildinglib.Building)
- func (city *City) AddEnchantment(enchantment data.CityEnchantment, owner data.BannerType)
- func (city *City) AllowedBuildings(what buildinglib.Building) []buildinglib.Building
- func (city *City) AllowedUnits(what buildinglib.Building) []units.Unit
- func (city *City) BaseFoodLevel() int
- func (city *City) CancelEnchantment(enchantment data.CityEnchantment, owner data.BannerType)
- func (city *City) Citizens() int
- func (city *City) ComputeForeignTrade() float64
- func (city *City) ComputePossibleBuildings() *set.Set[buildinglib.Building]
- func (city *City) ComputePossibleUnits() []units.Unit
- func (city *City) ComputePower() int
- func (city *City) ComputeSubsistenceFarmers() int
- func (city *City) ComputeTotalBonusPercent() float64
- func (city *City) ComputeUnrest() int
- func (city *City) ComputeUpkeep() int
- func (city *City) ComputeWildGame() int
- func (city *City) DoNextTurn(mapObject *maplib.Map) []CityEvent
- func (city *City) FameForCaptureOrRaze(captured bool) int
- func (city *City) FarmerFoodProduction(farmers int) int
- func (city *City) FoodProductionRate() int
- func (city *City) GetBanner() data.BannerType
- func (city *City) GetBuildableBuildings() *set.Set[buildinglib.Building]
- func (city *City) GetEnchantmentsCastBy(banner data.BannerType) []Enchantment
- func (city *City) GetOutpostHouses() int
- func (city *City) GetSightRange() int
- func (city *City) GetSize() CitySize
- func (city *City) GetWeaponBonus() data.WeaponBonus
- func (city *City) GetX() int
- func (city *City) GetY() int
- func (city *City) GoldBank() int
- func (city *City) GoldBonus(percent float64) int
- func (city *City) GoldMarketplace() int
- func (city *City) GoldMerchantsGuild() int
- func (city *City) GoldMinerals() int
- func (city *City) GoldProsperity() int
- func (city *City) GoldSurplus() int
- func (city *City) GoldTaxation() int
- func (city *City) GoldTradeGoods() int
- func (city *City) GrowOutpost() CityEvent
- func (city *City) HasAnyOfEnchantments(enchantmentsToCheck ...data.CityEnchantment) bool
- func (city *City) HasEnchantment(check data.CityEnchantment) bool
- func (city *City) HasFortress() bool
- func (city *City) HasSummoningCircle() bool
- func (city *City) HasWall() bool
- func (city *City) HasWallOfDarkness() bool
- func (city *City) HasWallOfFire() bool
- func (city *City) InteracialUnrest() float64
- func (city *City) MaximumCitySize() int
- func (city *City) NonRebels() int
- func (city *City) OnShore() bool
- func (city *City) PopulationGrowthRate() int
- func (city *City) PowerAlchemistsGuild() int
- func (city *City) PowerCathedral() float64
- func (city *City) PowerCitizens() int
- func (city *City) PowerDarkRituals() float64
- func (city *City) PowerFortress() int
- func (city *City) PowerMinerals() int
- func (city *City) PowerMoonBonus() float64
- func (city *City) PowerParthenon() float64
- func (city *City) PowerShrine() float64
- func (city *City) PowerTemple() float64
- func (city *City) PowerWizardsGuild() int
- func (city *City) ProducingString() string
- func (city *City) ProducingTurnsLeft() int
- func (city *City) ProductionFarmers() float32
- func (city *City) ProductionForestersGuild() float32
- func (city *City) ProductionInspirations() float32
- func (city *City) ProductionMechaniciansGuild() float32
- func (city *City) ProductionMinersGuild() float32
- func (city *City) ProductionSawmill() float32
- func (city *City) ProductionTerrain() float32
- func (city *City) ProductionWorkers() float32
- func (city *City) RemoveAllEnchantmentsByOwner(owner data.BannerType)
- func (city *City) RemoveEnchantments(enchantmentsToRemove ...data.CityEnchantment)
- func (city *City) RequiredFood() int
- func (city *City) ResearchProduction() int
- func (city *City) ResetCitizens()
- func (city *City) String() string
- func (city *City) SurplusFood() int
- func (city *City) UpdateUnrest()
- func (city *City) WorkProductionRate() float32
- type CityEvent
- type CityEventCityAbandoned
- type CityEventNewBuilding
- type CityEventNewUnit
- type CityEventOutpostDestroyed
- type CityEventOutpostHamlet
- type CityEventPopulationGrowth
- type CityServicesProvider
- type CitySize
- type Enchantment
- type ReignProvider
Constants ¶
const MAX_CITY_CITIZENS = 25
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CatchmentProvider ¶
type City ¶
type City struct { Population int Farmers int Workers int Rebels int Name string Plane data.Plane // the race of the towns people Race data.Race X int Y int Outpost bool Buildings *set.Set[buildinglib.Building] Enchantments *set.Set[Enchantment] CatchmentProvider CatchmentProvider CityServices CityServicesProvider ReignProvider ReignProvider // reset every turn, keeps track of whether the player sold a building SoldBuilding bool // how many hammers the city has produced towards the current project Production float32 ProducingBuilding buildinglib.Building ProducingUnit units.Unit BuildingInfo buildinglib.BuildingInfos }
func MakeCity ¶
func MakeCity(name string, x int, y int, race data.Race, buildingInfo buildinglib.BuildingInfos, catchmentProvider CatchmentProvider, cityServices CityServicesProvider, reignProvider ReignProvider) *City
FIXME: Add plane?
func (*City) AddBuilding ¶
func (city *City) AddBuilding(building buildinglib.Building)
func (*City) AddEnchantment ¶
func (city *City) AddEnchantment(enchantment data.CityEnchantment, owner data.BannerType)
func (*City) AllowedBuildings ¶
func (city *City) AllowedBuildings(what buildinglib.Building) []buildinglib.Building
func (*City) AllowedUnits ¶
func (city *City) AllowedUnits(what buildinglib.Building) []units.Unit
func (*City) BaseFoodLevel ¶
compute amount of available food on tiles in catchment area
func (*City) CancelEnchantment ¶
func (city *City) CancelEnchantment(enchantment data.CityEnchantment, owner data.BannerType)
Used when an enchantment removal is an explicit player action (e.g. disabling a specific enchantment from a city screen)
func (*City) ComputeForeignTrade ¶
return the percent of foreign trade bonus
population of other city * 0.5% if same race population of other city * 1% if different
func (*City) ComputePossibleBuildings ¶
func (city *City) ComputePossibleBuildings() *set.Set[buildinglib.Building]
return the buildings that can be built, based on what the city already has and what dependencies are met
func (*City) ComputePossibleUnits ¶
func (*City) ComputePower ¶
power production from buildings and citizens
func (*City) ComputeSubsistenceFarmers ¶
FIXME: take enchantments into account * https://masterofmagic.fandom.com/wiki/Farmer
func (*City) ComputeTotalBonusPercent ¶
return the bonus gold percent, capped at citizens*3
func (*City) ComputeUnrest ¶
func (*City) ComputeUpkeep ¶
func (*City) ComputeWildGame ¶
func (*City) DoNextTurn ¶
do all the stuff needed per turn increase population, add production, add food/money, etc
func (*City) FameForCaptureOrRaze ¶
pass in true to compute fame for capturing, and false to compute fame for razing/losing
func (*City) FarmerFoodProduction ¶
func (*City) FoodProductionRate ¶
func (*City) GetBanner ¶
func (city *City) GetBanner() data.BannerType
func (*City) GetBuildableBuildings ¶
func (city *City) GetBuildableBuildings() *set.Set[buildinglib.Building]
returns the set of buildings that could possibly be built by this city, taking terrain dependencies into account
func (*City) GetEnchantmentsCastBy ¶
func (city *City) GetEnchantmentsCastBy(banner data.BannerType) []Enchantment
func (*City) GetOutpostHouses ¶
func (*City) GetSightRange ¶
func (*City) GetWeaponBonus ¶
func (city *City) GetWeaponBonus() data.WeaponBonus
if the city contains an alchemist's guild then new units get one of the following bonuses
- magic weapon
- mythril weapon (if mythril ore in catchment area)
- adamantium weapon (if adamantium ore in catchment area)
func (*City) GoldMarketplace ¶
func (*City) GoldMerchantsGuild ¶
func (*City) GoldMinerals ¶
func (*City) GoldProsperity ¶
func (*City) GoldSurplus ¶
func (*City) GoldTaxation ¶
func (*City) GoldTradeGoods ¶
func (*City) GrowOutpost ¶
func (*City) HasAnyOfEnchantments ¶
func (city *City) HasAnyOfEnchantments(enchantmentsToCheck ...data.CityEnchantment) bool
Returns true if the city has at least one of the enchantments from arguments
func (*City) HasEnchantment ¶
func (city *City) HasEnchantment(check data.CityEnchantment) bool
func (*City) HasFortress ¶
func (*City) HasSummoningCircle ¶
func (*City) HasWallOfDarkness ¶
func (*City) HasWallOfFire ¶
func (*City) InteracialUnrest ¶
func (*City) MaximumCitySize ¶
returns the maximum number of citizens. population is citizens * 1000
func (*City) PopulationGrowthRate ¶
func (*City) PowerAlchemistsGuild ¶
func (*City) PowerCathedral ¶
func (*City) PowerCitizens ¶
func (*City) PowerDarkRituals ¶
func (*City) PowerFortress ¶
func (*City) PowerMinerals ¶
func (*City) PowerMoonBonus ¶
func (*City) PowerParthenon ¶
func (*City) PowerShrine ¶
func (*City) PowerTemple ¶
func (*City) PowerWizardsGuild ¶
func (*City) ProducingString ¶
func (*City) ProducingTurnsLeft ¶
func (*City) ProductionFarmers ¶
func (*City) ProductionForestersGuild ¶
func (*City) ProductionInspirations ¶
func (*City) ProductionMechaniciansGuild ¶
func (*City) ProductionMinersGuild ¶
func (*City) ProductionSawmill ¶
func (*City) ProductionTerrain ¶
func (*City) ProductionWorkers ¶
func (*City) RemoveAllEnchantmentsByOwner ¶
func (city *City) RemoveAllEnchantmentsByOwner(owner data.BannerType)
remove all enchantments owned by a specific wizard
func (*City) RemoveEnchantments ¶
func (city *City) RemoveEnchantments(enchantmentsToRemove ...data.CityEnchantment)
Used when an enchantment removal is caused by some mechanic (e.g. consecration spell).
func (*City) RequiredFood ¶
amount of food needed to feed the citizens
func (*City) ResearchProduction ¶
func (*City) ResetCitizens ¶
func (city *City) ResetCitizens()
func (*City) SurplusFood ¶
func (*City) UpdateUnrest ¶
func (city *City) UpdateUnrest()
func (*City) WorkProductionRate ¶
type CityEventCityAbandoned ¶
type CityEventCityAbandoned struct { }
type CityEventNewBuilding ¶
type CityEventNewBuilding struct {
Building buildinglib.Building
}
type CityEventNewUnit ¶
type CityEventNewUnit struct { Unit units.Unit WeaponBonus data.WeaponBonus Experience int }
type CityEventOutpostDestroyed ¶
type CityEventOutpostDestroyed struct { }
type CityEventOutpostHamlet ¶
type CityEventOutpostHamlet struct { }
type CityServicesProvider ¶
type Enchantment ¶
type Enchantment struct { Enchantment data.CityEnchantment // this keeps track of the owning wizard by implicitly associating a banner to the wizard that cast it Owner data.BannerType }
type ReignProvider ¶
type ReignProvider interface { HasDivinePower() bool HasInfernalPower() bool HasLifeBooks() bool HasDeathBooks() bool TotalBooks() int GetRulingRace() data.Race GetTaxRate() fraction.Fraction GetBanner() data.BannerType GetGlobalEnchantments() *set.Set[data.Enchantment] GetUnits(x int, y int, plane data.Plane) []units.StackUnit }