city

package
v0.0.0-...-94f88f4 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const MAX_CITY_CITIZENS = 25

Variables

This section is empty.

Functions

This section is empty.

Types

type CatchmentProvider

type CatchmentProvider interface {
	GetCatchmentArea(x int, y int) map[image.Point]maplib.FullTile
}

type City

type City struct {
	Population int
	Farmers    int
	Workers    int
	Rebels     int
	Name       string
	Wall       bool
	Plane      data.Plane
	Race       data.Race
	X          int
	Y          int
	Outpost    bool
	Banner     data.BannerType
	Buildings  *set.Set[buildinglib.Building]

	CatchmentProvider CatchmentProvider

	TaxRate fraction.Fraction

	// 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, banner data.BannerType, taxRate fraction.Fraction, buildingInfo buildinglib.BuildingInfos, catchmentProvider CatchmentProvider) *City

func (*City) AddBuilding

func (city *City) AddBuilding(building buildinglib.Building)

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

func (city *City) BaseFoodLevel() int

compute amount of available food on tiles in catchment area

func (*City) Citizens

func (city *City) Citizens() int

func (*City) ComputePower

func (city *City) ComputePower() int

power production from buildings and citizens

func (*City) ComputeSubsistenceFarmers

func (city *City) ComputeSubsistenceFarmers() int

FIXME: take enchantments into account * https://masterofmagic.fandom.com/wiki/Farmer

func (*City) ComputeUnrest

func (city *City) ComputeUnrest(garrison []units.StackUnit) int

func (*City) ComputeUpkeep

func (city *City) ComputeUpkeep() int

func (*City) DoNextTurn

func (city *City) DoNextTurn(garrison []units.StackUnit) []CityEvent

do all the stuff needed per turn increase population, add production, add food/money, etc

func (*City) FarmerFoodProduction

func (city *City) FarmerFoodProduction(farmers int) int

func (*City) FoodProductionRate

func (city *City) FoodProductionRate() int

func (*City) GetBanner

func (city *City) GetBanner() data.BannerType

func (*City) GetOutpostHouses

func (city *City) GetOutpostHouses() int

func (*City) GetSize

func (city *City) GetSize() CitySize

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) GetX

func (city *City) GetX() int

func (*City) GetY

func (city *City) GetY() int

func (*City) GoldBank

func (city *City) GoldBank() int

func (*City) GoldMarketplace

func (city *City) GoldMarketplace() int

func (*City) GoldMerchantsGuild

func (city *City) GoldMerchantsGuild() int

func (*City) GoldMinerals

func (city *City) GoldMinerals() int

func (*City) GoldSurplus

func (city *City) GoldSurplus() int

func (*City) GoldTaxation

func (city *City) GoldTaxation() int

func (*City) GoldTradeGoods

func (city *City) GoldTradeGoods() int

func (*City) GrowOutpost

func (city *City) GrowOutpost() CityEvent

func (*City) HasFortress

func (city *City) HasFortress() bool

func (*City) HasSummoningCircle

func (city *City) HasSummoningCircle() bool

func (*City) MaximumCitySize

func (city *City) MaximumCitySize() int

returns the maximum number of citizens. population is citizens * 1000

func (*City) NonRebels

func (city *City) NonRebels() int

func (*City) PopulationGrowthRate

func (city *City) PopulationGrowthRate() int

func (*City) PowerCitizens

func (city *City) PowerCitizens() int

func (*City) PowerMinerals

func (city *City) PowerMinerals() int

func (*City) ProducingString

func (city *City) ProducingString() string

func (*City) ProducingTurnsLeft

func (city *City) ProducingTurnsLeft() int

func (*City) ProductionFarmers

func (city *City) ProductionFarmers() float32

func (*City) ProductionForestersGuild

func (city *City) ProductionForestersGuild() float32

func (*City) ProductionMechaniciansGuild

func (city *City) ProductionMechaniciansGuild() float32

func (*City) ProductionMinersGuild

func (city *City) ProductionMinersGuild() float32

func (*City) ProductionSawmill

func (city *City) ProductionSawmill() float32

func (*City) ProductionTerrain

func (city *City) ProductionTerrain() float32

func (*City) ProductionWorkers

func (city *City) ProductionWorkers() float32

func (*City) RequiredFood

func (city *City) RequiredFood() int

amount of food needed to feed the citizens

func (*City) ResearchProduction

func (city *City) ResearchProduction() int

func (*City) ResetCitizens

func (city *City) ResetCitizens(garrison []units.StackUnit)

func (*City) SurplusFood

func (city *City) SurplusFood() int

func (*City) UpdateTaxRate

func (city *City) UpdateTaxRate(taxRate fraction.Fraction, garrison []units.StackUnit)

func (*City) UpdateUnrest

func (city *City) UpdateUnrest(garrison []units.StackUnit)

func (*City) WorkProductionRate

func (city *City) WorkProductionRate() float32

type CityEvent

type CityEvent interface {
}

type CityEventNewBuilding

type CityEventNewBuilding struct {
	Building buildinglib.Building
}

type CityEventNewUnit

type CityEventNewUnit struct {
	Unit        units.Unit
	WeaponBonus data.WeaponBonus
}

type CityEventOutpostDestroyed

type CityEventOutpostDestroyed struct {
}

type CityEventOutpostHamlet

type CityEventOutpostHamlet struct {
}

type CityEventPopulationGrowth

type CityEventPopulationGrowth struct {
	Size int
}

type CitySize

type CitySize int
const (
	CitySizeHamlet CitySize = iota
	CitySizeVillage
	CitySizeTown
	CitySizeCity
	CitySizeCapital
)

func (CitySize) String

func (citySize CitySize) String() string

Jump to

Keyboard shortcuts

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