last_light/game/player/player.go

74 lines
1.3 KiB
Go
Raw Normal View History

2024-05-21 23:08:51 +03:00
package player
2024-04-24 17:11:33 +03:00
import (
2024-05-06 21:19:08 +03:00
"mvvasilev/last_light/engine"
2024-05-21 23:08:51 +03:00
"mvvasilev/last_light/game/item"
"mvvasilev/last_light/game/rpg"
2024-04-24 17:11:33 +03:00
"github.com/gdamore/tcell/v2"
"github.com/google/uuid"
)
type Player struct {
id uuid.UUID
2024-05-06 21:19:08 +03:00
position engine.Position
2024-05-03 13:46:32 +03:00
2024-05-21 23:08:51 +03:00
inventory *item.EquippedInventory
*rpg.BasicRPGEntity
2024-04-24 17:11:33 +03:00
}
func CreatePlayer(x, y int) *Player {
2024-04-24 17:11:33 +03:00
p := new(Player)
p.id = uuid.New()
2024-05-06 21:19:08 +03:00
p.position = engine.PositionAt(x, y)
2024-05-21 23:08:51 +03:00
p.inventory = item.CreateEquippedInventory()
2024-05-30 23:39:54 +03:00
p.BasicRPGEntity = rpg.CreateBasicRPGEntity(
map[rpg.Stat]int{
rpg.Stat_Attributes_Constitution: 10,
rpg.Stat_Attributes_Dexterity: 10,
rpg.Stat_Attributes_Strength: 10,
rpg.Stat_Attributes_Intelligence: 10,
},
map[rpg.Stat][]rpg.StatModifier{},
)
2024-04-24 17:11:33 +03:00
return p
}
func (p *Player) UniqueId() uuid.UUID {
return p.id
}
2024-05-06 21:19:08 +03:00
func (p *Player) Position() engine.Position {
return p.position
}
2024-05-06 21:19:08 +03:00
func (p *Player) MoveTo(newPos engine.Position) {
2024-05-06 18:59:14 +03:00
p.position = newPos
}
2024-04-24 17:11:33 +03:00
2024-05-03 13:46:32 +03:00
func (p *Player) Presentation() (rune, tcell.Style) {
return '@', tcell.StyleDefault
2024-04-24 17:11:33 +03:00
}
func (p *Player) Passable() bool {
return false
2024-04-24 17:11:33 +03:00
}
2024-05-03 13:46:32 +03:00
func (p *Player) Transparent() bool {
return false
}
2024-05-21 23:08:51 +03:00
func (p *Player) Inventory() *item.EquippedInventory {
2024-05-03 13:46:32 +03:00
return p.inventory
}
2024-04-24 17:11:33 +03:00
func (p *Player) Input(e *tcell.EventKey) {
}
func (p *Player) Tick(dt int64) {
}