diff options
| author | historia <[not public]> | 2026-06-19 13:28:06 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-19 13:28:06 -0400 |
| commit | 3a58125d14bb307f861b38c6c5b0a63babde7e08 (patch) | |
| tree | bd89e866447d55e6dffd447d8ef5fabf9b8fbe9d /internal/player/player.go | |
| parent | 575a71dcfed3b9fa44af244836f638a23df05a9a (diff) | |
| download | thehouseoficarus-3a58125d14bb307f861b38c6c5b0a63babde7e08.tar.gz | |
feat: all skills kind of implemented, random prototype content added
Diffstat (limited to 'internal/player/player.go')
| -rw-r--r-- | internal/player/player.go | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/internal/player/player.go b/internal/player/player.go index a3ca4ce..88cf7f8 100644 --- a/internal/player/player.go +++ b/internal/player/player.go @@ -136,6 +136,7 @@ var OptionDefs = []OptionDef{ {"cook_all", OptBool, false, nil, "Auto-start cooking when only one product is possible"}, {"smelt_all", OptBool, false, nil, "Auto-start smelting when only one product is possible"}, {"mix_all", OptBool, false, nil, "Auto-start mixing when only one product is possible"}, + {"construct_all", OptBool, false, nil, "Auto-start constructing when only one product is possible"}, } var optionByName map[string]*OptionDef @@ -155,6 +156,7 @@ type Player struct { Name string `yaml:"name"` Skills map[SkillName]int `yaml:"skills"` Inventory map[int]*InventorySlot `yaml:"inventory"` + Bank map[int]*InventorySlot `yaml:"bank"` Equipment map[object.EquipSlot]string `yaml:"equipment"` EquipQuality map[string]int `yaml:"equip_quality,omitempty"` RoomID int `yaml:"room_id"` @@ -184,6 +186,13 @@ type Player struct { TechActivatedSinceTick map[string]bool `yaml:"-"` Sneaking bool `yaml:"-"` SneakNotified map[string]bool `yaml:"-"` + ActiveBuffs []PotionBuff `yaml:"-"` +} + +type PotionBuff struct { + Stat string + BonusPercent int + TicksLeft int } func (p *Player) ClearMoveState() { @@ -289,6 +298,7 @@ func New(name string) *Player { p := &Player{ Name: name, Skills: make(map[SkillName]int), + Bank: make(map[int]*InventorySlot), Equipment: make(map[object.EquipSlot]string), AttackStyle: Accurate, Prompt: "> ", @@ -421,6 +431,53 @@ func (p *Player) DeactivateAllTechs() { p.TechActivatedSinceTick = nil } +func (p *Player) BankSlot(i int) *InventorySlot { + if p.Bank == nil { + return nil + } + return p.Bank[i] +} + +func (p *Player) SetBankSlot(i int, slot *InventorySlot) { + if p.Bank == nil { + p.Bank = make(map[int]*InventorySlot) + } + if slot == nil { + delete(p.Bank, i) + } else { + p.Bank[i] = slot + } +} + +func (p *Player) NextBankSlot() int { + if p.Bank == nil { + return 0 + } + i := 0 + for { + if p.Bank[i] == nil { + return i + } + i++ + } +} + +func (p *Player) BankSlots() []int { + if p.Bank == nil { + return nil + } + keys := make([]int, 0, len(p.Bank)) + for k := range p.Bank { + keys = append(keys, k) + } + sort.Ints(keys) + return keys +} + +func (p *Player) BankCount() int { + return len(p.Bank) +} + func (p *Player) ActiveTechList() []string { var result []string for id := range p.ActiveTechs { |
