game

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LargeOriginY = 44
	HugeOriginY  = 64
)

These origins are used to re-position a room "pie" image so that its center is in the appropriate place.

View Source
const (
	ErrRoomIndexInvalid = Error("invalid room index")
	ErrRoomTooLarge     = Error("room too large")
	ErrRoomNoSpace      = Error("no space for room")
	ErrRoomNotPresent   = Error("room not present")
)
View Source
const (
	DirectionVertical = iota
	DirectionHorizontal
)

======== UIItemList ========

View Source
const AUDIO_FADE_IN_TICK = 60
View Source
const CombatTickrate = 30 // Tick combat every 30 ticks
View Source
const ENEMY_SCALE = 1.0
View Source
const PortalDistance = 44 // Distance from the center of the tower to the portal.
View Source
const PortalRotationHuge = 7.0 * -(math.Pi / 8) // Rotation of the portal.
View Source
const PortalRotationLarge = 7.0*-(math.Pi/8) - math.Pi/4.5 // Rotation of the portal.
View Source
const PortalRotationMedium = 7.0*-(math.Pi/8) - math.Pi/3.5 // Rotation of the portal.
View Source
const PortalRotationSmall = 7.0*-(math.Pi/8) - math.Pi/2.5 // Rotation of the portal.
View Source
const RoomPath = 53
View Source
const RoomStairsEntrance = 12

RoomStairsEntrance is the distance from the center that a room's stairs is expected to be at.

View Source
const StoryHeight = 28 // StoryHeight is used to space stories apart from each other vertically.

StoryHeight is the height of a story in da tower.

View Source
const StorySlices = 28 // The amount of slices used for the frame buffers, should be equal to maximum staxie slice count used in a story.
View Source
const StoryVGroupHeight = 162 // Framebuffer's maximum height for rendering.
View Source
const StoryVGroupWidth = 244 // Framebuffer's maximum width for rendering.
View Source
const StoryWallHeight = 9 // The height of the wall stack -- this is repeated 3 times to get the full height (roughly)
View Source
const TowerCenterX = StoryVGroupWidth/2 - 5 // Center of the tower. Have to offset lightly for some dumb reason...
View Source
const TowerCenterY = StoryVGroupHeight/2 - 5 // Center of the tower.
View Source
const TowerEntrance = 80
View Source
const TowerStairs = 60
View Source
const VOL_MULT = 1.75

Variables

View Source
var (
	FeedbackGeneric = FeedbackKind{255, 255, 255, 255}
	FeedbackGood    = FeedbackKind{0, 255, 0, 255}
	FeedbackBad     = FeedbackKind{255, 0, 0, 255}
	FeedbackWarning = FeedbackKind{255, 255, 0, 255}
)
View Source
var RoomDefs = make(map[string]*RoomDef)

Functions

func GetEquipmentNamesWithTypes

func GetEquipmentNamesWithTypes(equipmentTypes []EquipmentType) []*string

func GetRoomCost

func GetRoomCost(kind RoomKind, size RoomSize, level int) int

Cost of the room scales with the story level With each level, the cost of the room increases by 25%

func InBounds

func InBounds(x, y, width, height, mx, my float64) bool

func IntToFloat2

func IntToFloat2(a, b int) (float64, float64)

func Must

func Must[T any](v T, err error) T

func PaddedIntString

func PaddedIntString(i int, pad int) string

func PanicIfErr

func PanicIfErr(err error)

Types

type Activity

type Activity interface {
	Apply()
	Cb() func(success bool)
}

type ActivityRequests

type ActivityRequests []Activity

func (*ActivityRequests) Add

func (a *ActivityRequests) Add(act Activity)

type AudioController

type AudioController struct {
	// contains filtered or unexported fields
}

func NewAudioController

func NewAudioController() *AudioController

func (*AudioController) MuteAll

func (a *AudioController) MuteAll()

func (*AudioController) PauseRoomTracks

func (a *AudioController) PauseRoomTracks()

func (*AudioController) PlayRoomTracks

func (a *AudioController) PlayRoomTracks()

func (*AudioController) PlaySfx

func (a *AudioController) PlaySfx(name string, vol float64, pan float64)

func (*AudioController) SetBackgroundTrackVolPercent

func (a *AudioController) SetBackgroundTrackVolPercent(volume float64)

func (*AudioController) SetPan

func (a *AudioController) SetPan(roomKind RoomKind, pan float64)

func (*AudioController) SetStoryPanVol

func (a *AudioController) SetStoryPanVol(roomPanVol map[RoomKind]PanVol)

For the tracks that we have, set the volume and pan If the track doesn't exist, set it to 0 Allows muting rooms that are removed

func (*AudioController) SetTitleTrackVolPercent

func (a *AudioController) SetTitleTrackVolPercent(perc float64)

func (*AudioController) SetVol

func (a *AudioController) SetVol(roomKind RoomKind, volume float64)

type BossPanel

type BossPanel struct {
	// contains filtered or unexported fields
}

func MakeBossPanel

func MakeBossPanel() BossPanel

func (*BossPanel) Draw

func (bp *BossPanel) Draw(o *render.Options)

func (*BossPanel) Layout

func (bp *BossPanel) Layout(o *UIOptions)

func (*BossPanel) Update

func (bp *BossPanel) Update(o *UIOptions)

type ButtonPanel

type ButtonPanel struct {
	// contains filtered or unexported fields
}

func MakeButtonPanel

func MakeButtonPanel(font assets.Font, style PanelStyle) ButtonPanel

func (*ButtonPanel) Check

func (bp *ButtonPanel) Check(mx, my float64, kind UICheckKind) bool

func (*ButtonPanel) Disable

func (bp *ButtonPanel) Disable()

func (*ButtonPanel) Draw

func (bp *ButtonPanel) Draw(o *render.Options)

func (*ButtonPanel) Enable

func (bp *ButtonPanel) Enable()

func (*ButtonPanel) Height

func (bp *ButtonPanel) Height() float64

func (*ButtonPanel) Layout

func (bp *ButtonPanel) Layout(parent UIElement, o *UIOptions)

func (*ButtonPanel) Position

func (bp *ButtonPanel) Position() (float64, float64)

func (*ButtonPanel) SetPosition

func (bp *ButtonPanel) SetPosition(x, y float64)

func (*ButtonPanel) SetSize

func (bp *ButtonPanel) SetSize(w, h float64)

func (*ButtonPanel) Size

func (bp *ButtonPanel) Size() (float64, float64)

func (*ButtonPanel) Update

func (bp *ButtonPanel) Update(o *UIOptions)

func (*ButtonPanel) Width

func (bp *ButtonPanel) Width() float64

func (*ButtonPanel) X

func (bp *ButtonPanel) X() float64

func (*ButtonPanel) Y

func (bp *ButtonPanel) Y() float64

type ControlsPanel

type ControlsPanel struct {
	render.Positionable
	render.Sizeable
	// contains filtered or unexported fields
}

func MakeControlsPanel

func MakeControlsPanel() ControlsPanel

func (*ControlsPanel) Check

func (p *ControlsPanel) Check(mx, my float64, kind UICheckKind) bool

func (*ControlsPanel) Draw

func (p *ControlsPanel) Draw(o *render.Options)

func (*ControlsPanel) Layout

func (p *ControlsPanel) Layout(parent UIElement, o *UIOptions)

func (*ControlsPanel) Update

func (p *ControlsPanel) Update(o *UIOptions)

type Dude

type Dude struct {
	// contains filtered or unexported fields
}

func NewDude

func NewDude(pk ProfessionKind, level int) *Dude

func (*Dude) AddToInventory

func (d *Dude) AddToInventory(eq *Equipment)

func (*Dude) AddXP

func (d *Dude) AddXP(xp int)

func (*Dude) ApplyDamage

func (d *Dude) ApplyDamage(amount int) (int, bool)

func (*Dude) Cursify

func (d *Dude) Cursify(roomLevel int)

Cursify the dude Rolls twice, once with wisdom, the other with luck, and takes the highest Has a chance to - Delevel equipment (high chance) - Delevel perk (medium chance) - Delevel dude (low chance)

func (*Dude) Draw

func (d *Dude) Draw(o *render.Options)

func (*Dude) DrawProfile

func (d *Dude) DrawProfile(o *render.Options)

func (*Dude) Equip

func (d *Dude) Equip(eq *Equipment)

Equips item to dude

func (*Dude) Equipped

func (d *Dude) Equipped() map[EquipmentType]*Equipment

func (*Dude) FullHeal

func (d *Dude) FullHeal()

func (*Dude) GetCalculatedStats

func (d *Dude) GetCalculatedStats() *Stats

Returns the stats of the dude with the equipment stats added

func (*Dude) GetDamage

func (d *Dude) GetDamage() (int, bool)

TODO: Refine this

func (*Dude) Gold

func (d *Dude) Gold() int

func (*Dude) Heal

func (d *Dude) Heal(amount int) int

func (*Dude) Inventory

func (d *Dude) Inventory() []*Equipment

func (*Dude) IsDead

func (d *Dude) IsDead() bool

func (*Dude) Level

func (d *Dude) Level() int

func (*Dude) LevelUpEquipment

func (d *Dude) LevelUpEquipment(amount int, maxQuality EquipmentQuality)

func (*Dude) Name

func (d *Dude) Name() string

func (*Dude) NextLevelXP

func (d *Dude) NextLevelXP() int

func (*Dude) Perkify

func (d *Dude) Perkify(maxQuality PerkQuality)

func (*Dude) Position

func (d *Dude) Position() (float64, float64)

func (*Dude) Profession

func (d *Dude) Profession() ProfessionKind

func (*Dude) RandomEquippedItem

func (d *Dude) RandomEquippedItem() *Equipment

func (*Dude) RestoreUses

func (d *Dude) RestoreUses()

func (*Dude) Room

func (d *Dude) Room() *Room

func (*Dude) Rotation

func (d *Dude) Rotation() float64

func (*Dude) SetActivity

func (d *Dude) SetActivity(a DudeActivity)

func (*Dude) SetPosition

func (d *Dude) SetPosition(x, y float64)

func (*Dude) SetRoom

func (d *Dude) SetRoom(r *Room)

func (*Dude) SetRotation

func (d *Dude) SetRotation(r float64)

func (*Dude) Speed

func (d *Dude) Speed() float64

Scale speed with agility Thinkin we probably shouldn't calculate this like this...

func (*Dude) Stats

func (d *Dude) Stats() *Stats

func (*Dude) SyncEquipment

func (d *Dude) SyncEquipment()

func (*Dude) TrapDamage

func (d *Dude) TrapDamage(roomLevel int) Activity

func (*Dude) Trigger

func (d *Dude) Trigger(e Event) Activity

func (*Dude) Unequip

func (d *Dude) Unequip(t EquipmentType) *Equipment

func (*Dude) Update

func (d *Dude) Update(story *Story, req *ActivityRequests)

func (*Dude) UpdateGold

func (d *Dude) UpdateGold(amount int)

func (*Dude) XP

func (d *Dude) XP() int

type DudeActivity

type DudeActivity int
const (
	Idle          DudeActivity = iota
	FirstEntering              // First entering the tower.
	StairsToUp
	StairsFromDown
	GoingUp   // Entering the room from a staircase, this basically does the fancy slice offset/limiting.
	Centering // Move the dude to the center of the room.
	Moving    // Move the dude counter-clockwise.
	Leaving   // Move the dude to the stairs.
	GoingDown // Leaving the room to the stairs, opposite of GoingUp.
	EnterPortal
	Ded
	BornAgain
	Waiting // maybe some random shufflin about
	FightBoss
)

type DudeDeadActivity

type DudeDeadActivity struct {
	// contains filtered or unexported fields
}

func (DudeDeadActivity) Apply

func (d DudeDeadActivity) Apply()

func (DudeDeadActivity) Cb

func (d DudeDeadActivity) Cb() func(success bool)

type DudeInfoPanel

type DudeInfoPanel struct {
	// contains filtered or unexported fields
}

func NewDudeInfoPanel

func NewDudeInfoPanel() *DudeInfoPanel

func (*DudeInfoPanel) Check

func (dip *DudeInfoPanel) Check(mx, my float64, kind UICheckKind) bool

func (*DudeInfoPanel) Draw

func (dip *DudeInfoPanel) Draw(o *render.Options)

func (*DudeInfoPanel) Layout

func (dip *DudeInfoPanel) Layout(o *UIOptions)

func (*DudeInfoPanel) SetDude

func (dip *DudeInfoPanel) SetDude(dude *Dude)

func (*DudeInfoPanel) SyncDude

func (dip *DudeInfoPanel) SyncDude()

func (*DudeInfoPanel) Update

func (dip *DudeInfoPanel) Update(o *UIOptions)

type DudePanel

type DudePanel struct {
	// contains filtered or unexported fields
}

func MakeDudePanel

func MakeDudePanel() DudePanel

func (*DudePanel) Check

func (dp *DudePanel) Check(mx, my float64, kind UICheckKind) bool

func (*DudePanel) Draw

func (dp *DudePanel) Draw(o *render.Options)

func (*DudePanel) DudeToImage

func (dp *DudePanel) DudeToImage(dude *Dude) *UIImage

func (*DudePanel) Layout

func (dp *DudePanel) Layout(o *UIOptions)

func (*DudePanel) SetDudes

func (dp *DudePanel) SetDudes(dudes []*Dude)

func (*DudePanel) Update

func (dp *DudePanel) Update(o *UIOptions)

type Enemy

type Enemy struct {
	// contains filtered or unexported fields
}

func NewEnemy

func NewEnemy(name EnemyKind, level int, stack *render.Stack) *Enemy

func (*Enemy) Damage

func (e *Enemy) Damage(amount int) bool

Damage deals damage to the enemy, returns true if the enemy is dead.

func (*Enemy) Draw

func (e *Enemy) Draw(o render.Options)

func (*Enemy) GetTarget

func (e *Enemy) GetTarget(dudes []*Dude) *Dude

Hit target with highest confidence

func (*Enemy) Gold

func (e *Enemy) Gold() int

Random gold multiplier between 0.5 and 1.25

func (*Enemy) Hit

func (e *Enemy) Hit() int

func (*Enemy) IsDead

func (e *Enemy) IsDead() bool

func (*Enemy) Name

func (e *Enemy) Name() string

func (*Enemy) RoomUpdate

func (e *Enemy) RoomUpdate(r *Room)

func (*Enemy) Update

func (e *Enemy) Update(d *Dude)

func (*Enemy) XP

func (e *Enemy) XP() int

type EnemyKind

type EnemyKind int
const (
	EnemyRat EnemyKind = iota
	EnemySlime
	EnemySkelly
	EnemyEbi
	EnemyBossRat
	EnemyBossSlime
	EnemyBossSkelly
	EnemyBossEbi
	EnemyUnknown
)

func (EnemyKind) BossStack

func (e EnemyKind) BossStack() string

func (EnemyKind) Stats

func (e EnemyKind) Stats() *Stats

func (EnemyKind) String

func (e EnemyKind) String() string

type Equipment

type Equipment struct {
	Draw func(*render.Options)
	// contains filtered or unexported fields
}

An equipment is the stuff you get

func GetRandomEquipment

func GetRandomEquipment(level int) *Equipment

func NewEquipment

func NewEquipment(name string, level int, quality EquipmentQuality, perk IPerk) *Equipment

Fetches the equipment by name Used for creating equipment in the game. Should find the equipment by name from loaded equipment

func (*Equipment) Activate

func (e *Equipment) Activate(event Event)

Activate the equipment's perk and decrement the uses.

func (*Equipment) CanEquip

func (e *Equipment) CanEquip(p ProfessionKind) bool

func (*Equipment) ChangeQuality

func (e *Equipment) ChangeQuality(delta int)

func (*Equipment) Description

func (e *Equipment) Description() string

Description returns the description of the equipment.

func (*Equipment) FullName

func (e *Equipment) FullName() string

Name returns the full name of the equipment including perk.

func (*Equipment) GoldValue

func (e *Equipment) GoldValue() int

func (*Equipment) Level

func (e *Equipment) Level() int

Level returns the level of the equipment.

func (*Equipment) LevelDown

func (e *Equipment) LevelDown()

Levels down weapon

func (*Equipment) LevelUp

func (e *Equipment) LevelUp(maxQuality EquipmentQuality) bool

Levels up the weapon. If it hits 5 we can upgrade the quality

func (*Equipment) LevelWithQuality

func (e *Equipment) LevelWithQuality() int

func (*Equipment) Name

func (e *Equipment) Name() string

Name returns the name of the equipment with quality

func (*Equipment) Quality

func (e *Equipment) Quality() EquipmentQuality

Quality returns the quality of the equipment.

func (*Equipment) RestoreUses

func (e *Equipment) RestoreUses() bool

func (*Equipment) Stats

func (e *Equipment) Stats() *Stats

An equipment's stats will be combined with the dude's stats after being scaled by the equipment's quality and level

func (*Equipment) Type

func (e *Equipment) Type() EquipmentType

func (*Equipment) Update

func (e *Equipment) Update()

func (*Equipment) Uses

func (e *Equipment) Uses() int

Uses returns the uses of the equipment.

type EquipmentDetailsPanel

type EquipmentDetailsPanel struct {
	// contains filtered or unexported fields
}

func NewEquipmentDetailsPanel

func NewEquipmentDetailsPanel(small bool) *EquipmentDetailsPanel

func (*EquipmentDetailsPanel) Check

func (edp *EquipmentDetailsPanel) Check(mx, my float64, kind UICheckKind) bool

func (*EquipmentDetailsPanel) Draw

func (edp *EquipmentDetailsPanel) Draw(o *render.Options)

func (*EquipmentDetailsPanel) Layout

func (edp *EquipmentDetailsPanel) Layout(o *UIOptions)

func (*EquipmentDetailsPanel) SetEquipment

func (edp *EquipmentDetailsPanel) SetEquipment(equipment *Equipment)

func (*EquipmentDetailsPanel) Update

func (edp *EquipmentDetailsPanel) Update(o *UIOptions)

type EquipmentPanel

type EquipmentPanel struct {
	// contains filtered or unexported fields
}

func MakeEquipmentPanel

func MakeEquipmentPanel() EquipmentPanel

func (*EquipmentPanel) Check

func (ep *EquipmentPanel) Check(mx, my float64, kind UICheckKind) bool

func (*EquipmentPanel) Draw

func (ep *EquipmentPanel) Draw(o *render.Options)

func (*EquipmentPanel) Layout

func (ep *EquipmentPanel) Layout(o *UIOptions)

func (*EquipmentPanel) SetEquipment

func (ep *EquipmentPanel) SetEquipment(equipment []*Equipment)

func (*EquipmentPanel) Update

func (ep *EquipmentPanel) Update(o *UIOptions)

type EquipmentQuality

type EquipmentQuality float32
const (
	EquipmentQualityCommon    EquipmentQuality = 0
	EquipmentQualityUncommon  EquipmentQuality = 1
	EquipmentQualityRare      EquipmentQuality = 2
	EquipmentQualityEpic      EquipmentQuality = 3
	EquipmentQualityLegendary EquipmentQuality = 4
)

Number of uses for equipment

func (EquipmentQuality) Color

func (eq EquipmentQuality) Color() ebiten.ColorScale

func (EquipmentQuality) String

func (eq EquipmentQuality) String() string

func (EquipmentQuality) TextColor

func (eq EquipmentQuality) TextColor() color.Color

type EquipmentType

type EquipmentType string
const (
	EquipmentTypeWeapon    EquipmentType = "weapon"
	EquipmentTypeArmor     EquipmentType = "armor"
	EquipmentTypeAccessory EquipmentType = "accessory"
)

Type of equipment

func RandomEquipmentType

func RandomEquipmentType() EquipmentType

func (EquipmentType) String

func (et EquipmentType) String() string

type Error

type Error string

func (Error) Error

func (e Error) Error() string

type Event

type Event interface {
	String() string
}

Event represents when something in the game has happened, such as entering a room, a dude dying, etc.

type EventCenterRoom

type EventCenterRoom struct {
	// contains filtered or unexported fields
}

EventCenterRoom is triggered when a dude is roughly in the center of a room

func (EventCenterRoom) String

func (e EventCenterRoom) String() string

type EventCombatRoom

type EventCombatRoom struct {
	// contains filtered or unexported fields
}

EventCombatRoom is triggered when combat should occur in a room.

func (EventCombatRoom) String

func (e EventCombatRoom) String() string

type EventDudeCrit

type EventDudeCrit struct {
	// contains filtered or unexported fields
}

func (EventDudeCrit) String

func (e EventDudeCrit) String() string

type EventDudeDodge

type EventDudeDodge struct {
	// contains filtered or unexported fields
}

func (EventDudeDodge) String

func (e EventDudeDodge) String() string

type EventDudeHit

type EventDudeHit struct {
	// contains filtered or unexported fields
}

func (EventDudeHit) String

func (e EventDudeHit) String() string

type EventDudeMiss

type EventDudeMiss struct {
	// contains filtered or unexported fields
}

func (EventDudeMiss) String

func (e EventDudeMiss) String() string

type EventEndBoss

type EventEndBoss struct {
	// contains filtered or unexported fields
}

func (EventEndBoss) String

func (e EventEndBoss) String() string

type EventEndRoom

type EventEndRoom struct {
	// contains filtered or unexported fields
}

EventEndRoom is triggered when a dude is near the end part of a room.

func (EventEndRoom) String

func (e EventEndRoom) String() string

type EventEnemyHit

type EventEnemyHit struct {
	// contains filtered or unexported fields
}

func (EventEnemyHit) String

func (e EventEnemyHit) String() string

type EventEnterRoom

type EventEnterRoom struct {
	// contains filtered or unexported fields
}

EventEnterRoom is triggered when a dude enters a room

func (EventEnterRoom) String

func (e EventEnterRoom) String() string

type EventEquip

type EventEquip struct {
	// contains filtered or unexported fields
}

EventEquip is triggered when a dude equips an item

func (EventEquip) String

func (e EventEquip) String() string

type EventGlobalTick

type EventGlobalTick struct{}

EventGlobalTick is triggered every tick

func (EventGlobalTick) String

func (e EventGlobalTick) String() string

type EventGoldGain

type EventGoldGain struct {
	// contains filtered or unexported fields
}

EventGoldGain occurs when a dude gains gold

func (EventGoldGain) String

func (e EventGoldGain) String() string

type EventGoldLoss

type EventGoldLoss struct {
	// contains filtered or unexported fields
}

EventGoldGain occurs when a dude gains gold

func (EventGoldLoss) String

func (e EventGoldLoss) String() string

type EventLeaveRoom

type EventLeaveRoom struct {
	// contains filtered or unexported fields
}

EventLeaveRoom is triggered when a dude leaves a room

func (EventLeaveRoom) String

func (e EventLeaveRoom) String() string

type EventSell

type EventSell struct {
	// contains filtered or unexported fields
}

EventSell occurs when an equipment is sold

func (EventSell) String

func (e EventSell) String() string

type EventStartBoss

type EventStartBoss struct {
	// contains filtered or unexported fields
}

func (EventStartBoss) String

func (e EventStartBoss) String() string

type EventUnequip

type EventUnequip struct {
	// contains filtered or unexported fields
}

EventUnequip is triggered when a dude unequips an item

func (EventUnequip) String

func (e EventUnequip) String() string

type EventWaitRoom

type EventWaitRoom struct {
	// contains filtered or unexported fields
}

func (EventWaitRoom) String

func (e EventWaitRoom) String() string

type FeedbackKind

type FeedbackKind color.NRGBA

type FeedbackPopup

type FeedbackPopup struct {
	// contains filtered or unexported fields
}

func MakeFeedbackPopup

func MakeFeedbackPopup() FeedbackPopup

func (*FeedbackPopup) Draw

func (fp *FeedbackPopup) Draw(o *render.Options)

func (*FeedbackPopup) Layout

func (fp *FeedbackPopup) Layout(o *UIOptions)

func (*FeedbackPopup) Msg

func (fp *FeedbackPopup) Msg(kind FeedbackKind, text string)

func (*FeedbackPopup) Update

func (fp *FeedbackPopup) Update(o *UIOptions)

type FloatingText

type FloatingText struct {
	render.Originable
	render.Positionable
	YOffset float64
	// contains filtered or unexported fields
}

func MakeFloatingText

func MakeFloatingText(text string, clr color.NRGBA, lifetime int, speed float64) FloatingText

func MakeFloatingTextFromDude

func MakeFloatingTextFromDude(d *Dude, text string, color color.NRGBA, lifetime int, speed float64) FloatingText

func (*FloatingText) Alive

func (t *FloatingText) Alive() bool

func (*FloatingText) Draw

func (t *FloatingText) Draw(o *render.Options)

func (*FloatingText) Update

func (t *FloatingText) Update()

type Game

type Game struct {
	// contains filtered or unexported fields
}

func New

func New() *Game

func (*Game) AdjustCamera

func (g *Game) AdjustCamera()

func (*Game) AdjustSpeed

func (g *Game) AdjustSpeed()

func (*Game) CheckUI

func (g *Game) CheckUI() (bool, UICheckKind)

func (*Game) CursorPosition added in v1.1.0

func (g *Game) CursorPosition() (float64, float64)

func (*Game) Draw

func (g *Game) Draw(screen *ebiten.Image)

func (*Game) DrawTower

func (g *Game) DrawTower(screen *ebiten.Image)

func (*Game) GetAliveDudes

func (g *Game) GetAliveDudes() []*Dude

func (*Game) Init

func (g *Game) Init()

func (*Game) Layout

func (g *Game) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeight int)

func (*Game) SetAutoplay

func (g *Game) SetAutoplay(autoplay bool)

func (*Game) ToggleAutoplay

func (g *Game) ToggleAutoplay()

func (*Game) TogglePause

func (g *Game) TogglePause()

func (*Game) Update

func (g *Game) Update() error

func (*Game) UpdateInfo

func (g *Game) UpdateInfo()

type GameInfoPanel

type GameInfoPanel struct {
	// contains filtered or unexported fields
}

func MakeGameInfoPanel

func MakeGameInfoPanel() GameInfoPanel

func (*GameInfoPanel) Draw

func (gip *GameInfoPanel) Draw(o *render.Options)

func (*GameInfoPanel) Layout

func (gip *GameInfoPanel) Layout(o *UIOptions)

type GameState

type GameState interface {
	Begin(g *Game)
	End(g *Game)
	Update(g *Game) GameState
	Draw(g *Game, screen *ebiten.Image)
}

type GameStateBuild

type GameStateBuild struct {
	// contains filtered or unexported fields
}

func (*GameStateBuild) Begin

func (s *GameStateBuild) Begin(g *Game)

func (*GameStateBuild) BuyDude

func (s *GameStateBuild) BuyDude(g *Game)

func (*GameStateBuild) BuyEquipment

func (s *GameStateBuild) BuyEquipment(g *Game)

func (*GameStateBuild) Draw

func (s *GameStateBuild) Draw(g *Game, screen *ebiten.Image)

func (*GameStateBuild) DudeCost

func (s *GameStateBuild) DudeCost(dudeCount int) int

Increase cost of dudes as the game progresses.

func (*GameStateBuild) End

func (s *GameStateBuild) End(g *Game)

func (*GameStateBuild) EquipmentCost

func (s *GameStateBuild) EquipmentCost() int

func (*GameStateBuild) RerollCost

func (s *GameStateBuild) RerollCost() int

func (*GameStateBuild) RerollOptionalRooms

func (s *GameStateBuild) RerollOptionalRooms(g *Game)

Re-roll optional rooms and keep any required rooms

func (*GameStateBuild) RerollRooms

func (s *GameStateBuild) RerollRooms(g *Game)

func (*GameStateBuild) RollRooms

func (s *GameStateBuild) RollRooms(g *Game)

func (*GameStateBuild) SellEquipment

func (s *GameStateBuild) SellEquipment(g *Game, e *Equipment)

func (*GameStateBuild) TryPlaceRoom

func (s *GameStateBuild) TryPlaceRoom(g *Game) PlaceResult

func (*GameStateBuild) Update

func (s *GameStateBuild) Update(g *Game) GameState

type GameStateLose

type GameStateLose struct {
	// contains filtered or unexported fields
}

func (*GameStateLose) Begin

func (s *GameStateLose) Begin(g *Game)

func (*GameStateLose) Draw

func (s *GameStateLose) Draw(g *Game, screen *ebiten.Image)

func (*GameStateLose) End

func (s *GameStateLose) End(g *Game)

func (*GameStateLose) Update

func (s *GameStateLose) Update(g *Game) GameState

type GameStatePlay

type GameStatePlay struct {
	// contains filtered or unexported fields
}

func (*GameStatePlay) Begin

func (s *GameStatePlay) Begin(g *Game)

func (*GameStatePlay) CollectGold

func (s *GameStatePlay) CollectGold(g *Game)

For all dudes, remove their gold and add it to the player's gold.

func (*GameStatePlay) CollectInventory

func (s *GameStatePlay) CollectInventory(g *Game)

For all dudes, remove their inventory and add it to player's inventory

func (*GameStatePlay) Draw

func (s *GameStatePlay) Draw(g *Game, screen *ebiten.Image)

func (*GameStatePlay) End

func (s *GameStatePlay) End(g *Game)

func (*GameStatePlay) Update

func (s *GameStatePlay) Update(g *Game) GameState

type GameStatePre

type GameStatePre struct {
	// contains filtered or unexported fields
}

func (*GameStatePre) Begin

func (s *GameStatePre) Begin(g *Game)

func (*GameStatePre) Draw

func (s *GameStatePre) Draw(g *Game, screen *ebiten.Image)

func (*GameStatePre) End

func (s *GameStatePre) End(g *Game)

func (*GameStatePre) Update

func (s *GameStatePre) Update(g *Game) GameState

type GameStateStart

type GameStateStart struct {
	// contains filtered or unexported fields
}

func (*GameStateStart) Begin

func (s *GameStateStart) Begin(g *Game)

func (*GameStateStart) Draw

func (s *GameStateStart) Draw(g *Game, screen *ebiten.Image)

func (*GameStateStart) End

func (s *GameStateStart) End(g *Game)

func (*GameStateStart) Update

func (s *GameStateStart) Update(g *Game) GameState

type GameStateWin

type GameStateWin struct {
	// contains filtered or unexported fields
}

func (*GameStateWin) Begin

func (s *GameStateWin) Begin(g *Game)

func (*GameStateWin) Draw

func (s *GameStateWin) Draw(g *Game, screen *ebiten.Image)

func (*GameStateWin) DrawRainbow

func (s *GameStateWin) DrawRainbow(screen *ebiten.Image, t string)

func (*GameStateWin) End

func (s *GameStateWin) End(g *Game)

func (*GameStateWin) Update

func (s *GameStateWin) Update(g *Game) GameState

type HintPopup

type HintPopup struct {
	// contains filtered or unexported fields
}

func MakeHintPopup

func MakeHintPopup() HintPopup

func (*HintPopup) Draw

func (hp *HintPopup) Draw(o *render.Options)

func (*HintPopup) Hide

func (hp *HintPopup) Hide()

func (*HintPopup) Layout

func (hp *HintPopup) Layout(o *UIOptions)

func (*HintPopup) Show

func (hp *HintPopup) Show()

func (*HintPopup) Update

func (hp *HintPopup) Update(o *UIOptions)

type IPerk

type IPerk interface {
	Check(Event) bool
	Name() string   // Name of the perk
	String() string // Full name of the perk
	Description() string
	Quality() PerkQuality
	LevelUp(PerkQuality)
	LevelDown()
}

IPerk is our interface for perks that can be applied to equipment, dudes, etc.

func GetRandomPerk

func GetRandomPerk(quality PerkQuality) IPerk

type Message

type Message struct {
	// contains filtered or unexported fields
}

func AddMessage

func AddMessage(kind MessageKind, text string) *Message

AddMessage adds a message to the message log

func GetMessages

func GetMessages() []*Message

type MessageKind

type MessageKind int

MessageKind is the kind of message that is being sent.

const (
	// System Messages
	MessageDebug MessageKind = iota
	MessageUnknown

	MessageNeutral
	MessageLoot
	MessageGood
	MessageBad
)

func (*MessageKind) Color

func (mk *MessageKind) Color() color.Color

type MessagePanel

type MessagePanel struct {
	render.Positionable
	// contains filtered or unexported fields
}

func (*MessagePanel) Draw

func (mp *MessagePanel) Draw(o *render.Options)

func (*MessagePanel) Layout

func (mp *MessagePanel) Layout(o *UIOptions)

func (*MessagePanel) Update

func (mp *MessagePanel) Update(o *UIOptions)

type MoveActivity

type MoveActivity struct {
	// contains filtered or unexported fields
}

func (MoveActivity) Apply

func (m MoveActivity) Apply()

func (MoveActivity) Cb

func (m MoveActivity) Cb() func(success bool)

type PanVol

type PanVol struct {
	Pan float64
	Vol float64
}

type PanelStyle

type PanelStyle int
const (
	PanelStyleNormal PanelStyle = iota
	PanelStyleInteractive
	PanelStyleButton
	PanelStyleButtonDisabled
	PanelStyleBar
	PanelStyleTransparent
	PanelStyleButtonAttached
)

type Perk

type Perk struct {
	IPerk
	// contains filtered or unexported fields
}

func (*Perk) Check

func (p *Perk) Check(e Event) bool

func (*Perk) Description

func (p *Perk) Description() string

func (*Perk) LevelDown

func (p *Perk) LevelDown()

func (*Perk) LevelUp

func (p *Perk) LevelUp(maxQuality PerkQuality)

func (*Perk) Name

func (p *Perk) Name() string

func (*Perk) Quality

func (p *Perk) Quality() PerkQuality

func (*Perk) String

func (p *Perk) String() string

type PerkFindGold

type PerkFindGold struct {
	*Perk
}

PerkFindGold finds gold based upon the quality of the perk. +0.25 per quality level per room.

func (PerkFindGold) Check

func (p PerkFindGold) Check(e Event) bool

func (PerkFindGold) Description

func (p PerkFindGold) Description() string

func (PerkFindGold) Name

func (p PerkFindGold) Name() string

func (PerkFindGold) String

func (p PerkFindGold) String() string

type PerkGoldBoost

type PerkGoldBoost struct {
	*Perk
}

PerkGoldBoost increases gold gain

func (PerkGoldBoost) Check

func (p PerkGoldBoost) Check(e Event) bool

func (PerkGoldBoost) Description

func (p PerkGoldBoost) Description() string

func (PerkGoldBoost) Name

func (p PerkGoldBoost) Name() string

func (PerkGoldBoost) String

func (p PerkGoldBoost) String() string

type PerkHealOnCrit

type PerkHealOnCrit struct {
	*Perk
}

func (PerkHealOnCrit) Check

func (p PerkHealOnCrit) Check(e Event) bool

func (PerkHealOnCrit) Description

func (p PerkHealOnCrit) Description() string

func (PerkHealOnCrit) Name

func (p PerkHealOnCrit) Name() string

func (PerkHealOnCrit) String

func (p PerkHealOnCrit) String() string

type PerkHealOnDodge

type PerkHealOnDodge struct {
	*Perk
}

func (PerkHealOnDodge) Check

func (p PerkHealOnDodge) Check(e Event) bool

func (PerkHealOnDodge) Description

func (p PerkHealOnDodge) Description() string

func (PerkHealOnDodge) Name

func (p PerkHealOnDodge) Name() string

func (PerkHealOnDodge) String

func (p PerkHealOnDodge) String() string

type PerkHealOnGoldGain

type PerkHealOnGoldGain struct {
	*Perk
}

PerkHealOnGoldGain heals dude when they get gold

func (PerkHealOnGoldGain) Check

func (p PerkHealOnGoldGain) Check(e Event) bool

func (PerkHealOnGoldGain) Description

func (p PerkHealOnGoldGain) Description() string

func (PerkHealOnGoldGain) Name

func (p PerkHealOnGoldGain) Name() string

func (PerkHealOnGoldGain) String

func (p PerkHealOnGoldGain) String() string

type PerkHealOnGoldLoss

type PerkHealOnGoldLoss struct {
	*Perk
}

PerkHealOnGoldGain heals dude when they get gold

func (PerkHealOnGoldLoss) Check

func (p PerkHealOnGoldLoss) Check(e Event) bool

func (PerkHealOnGoldLoss) Description

func (p PerkHealOnGoldLoss) Description() string

func (PerkHealOnGoldLoss) Name

func (p PerkHealOnGoldLoss) Name() string

func (PerkHealOnGoldLoss) String

func (p PerkHealOnGoldLoss) String() string

type PerkHealOnRoomEnter

type PerkHealOnRoomEnter struct {
	*Perk
}

PerkHeal heals dude based on wisdom when entering a room.

func (PerkHealOnRoomEnter) Check

func (p PerkHealOnRoomEnter) Check(e Event) bool

func (PerkHealOnRoomEnter) Description

func (p PerkHealOnRoomEnter) Description() string

func (PerkHealOnRoomEnter) Name

func (p PerkHealOnRoomEnter) Name() string

func (PerkHealOnRoomEnter) String

func (p PerkHealOnRoomEnter) String() string

type PerkHealOnSell

type PerkHealOnSell struct {
	*Perk
}

PerkHealOnSell heals all dudes based on quality when equip is sold

func (PerkHealOnSell) Check

func (p PerkHealOnSell) Check(e Event) bool

func (PerkHealOnSell) Description

func (p PerkHealOnSell) Description() string

func (PerkHealOnSell) Name

func (p PerkHealOnSell) Name() string

func (PerkHealOnSell) String

func (p PerkHealOnSell) String() string

type PerkNone

type PerkNone struct {
	Perk
}

PerkNone represents an empty perk. Not sure if this will be used.

func (PerkNone) Quality

func (p PerkNone) Quality() PerkQuality

type PerkQuality

type PerkQuality int

PerkQuality is the quality of a given perk.

const (
	PerkQualityTrash PerkQuality = iota
	PerkQualityPathetic
	PerkQualityLesser
	PerkQualityCommon
	PerkQualityGreater
	PerkQualityGodly
)

func (*PerkQuality) String

func (pq *PerkQuality) String() string

func (PerkQuality) TextColor

func (pq PerkQuality) TextColor() color.Color

type PerkStatBoost

type PerkStatBoost struct {
	*Perk
	// contains filtered or unexported fields
}

PerkStatBoost is a perk that modifies a stat based on teh quality of the perk. +1 target stat per quality level.

func (PerkStatBoost) Check

func (p PerkStatBoost) Check(e Event) bool

func (PerkStatBoost) Description

func (p PerkStatBoost) Description() string

func (PerkStatBoost) Name

func (p PerkStatBoost) Name() string

func (PerkStatBoost) String

func (p PerkStatBoost) String() string

type PerkStickyFingers

type PerkStickyFingers struct {
	*Perk
}

PerkStickyFingers reduces gold loss

func (PerkStickyFingers) Check

func (p PerkStickyFingers) Check(e Event) bool

func (PerkStickyFingers) Description

func (p PerkStickyFingers) Description() string

func (PerkStickyFingers) Name

func (p PerkStickyFingers) Name() string

func (PerkStickyFingers) String

func (p PerkStickyFingers) String() string

type PlaceResult

type PlaceResult int
const (
	PlaceResultSuccess PlaceResult = iota
	PlaceResultFail
	PlaceResultBroke
	PlaceResultTake
)

type Profession

type Profession struct {
	// contains filtered or unexported fields
}

A profession defines a dude's abilities. It also defines the dude's appearance.

func NewProfession

func NewProfession(kind ProfessionKind, level int) *Profession

func (*Profession) Description

func (p *Profession) Description() string

func (*Profession) StartingEquipment

func (p *Profession) StartingEquipment() []*Equipment

func (*Profession) StartingStats

func (p *Profession) StartingStats() Stats

func (*Profession) String

func (p *Profession) String() string

type ProfessionKind

type ProfessionKind string

ProfessionKind is an enumeration of the different kinds of Professions a dude can have

const (
	// Medium defense, medium attack, medium hp
	Vagabond ProfessionKind = "vagabond"

	// High defense, low attack, high hp
	Knight ProfessionKind = "knight"

	// Low defense, low attack, *can heal*
	Cleric ProfessionKind = "cleric"

	// Medium defense, high attack, low hp *ranged*
	Ranger ProfessionKind = "ranger"
)

func RandomProfessionKind

func RandomProfessionKind() ProfessionKind

func WeightedRandomProfessionKind

func WeightedRandomProfessionKind(dudes []*Dude) ProfessionKind

WeightedRandomProfessionKind returns a profession kind based on the dudes' professions The lower the frequency of a profession, the higher the weight

func (*ProfessionKind) String

func (p *ProfessionKind) String() string

type Room

type Room struct {
	// contains filtered or unexported fields
}

Room is a room within a story of za toweru.

func NewRoom

func NewRoom(size RoomSize, kind RoomKind, required bool) *Room

func (*Room) AddDude

func (r *Room) AddDude(d *Dude)

func (*Room) AddDudeToCenter

func (r *Room) AddDudeToCenter(a *Dude)

func (*Room) AddDudeToWaiting

func (r *Room) AddDudeToWaiting(a *Dude)

func (*Room) AreAllDudesWaiting

func (r *Room) AreAllDudesWaiting(n int) bool

func (*Room) Draw

func (r *Room) Draw(o *render.Options)

Draw our room bits and bobs.

func (*Room) GetRoomEffect

func (r *Room) GetRoomEffect(e Event) Activity

func (*Room) IsDudeInCenter

func (r *Room) IsDudeInCenter(a *Dude) bool

func (*Room) IsDudeWaiting

func (r *Room) IsDudeWaiting(a *Dude) bool

func (*Room) RemoveDude

func (r *Room) RemoveDude(d *Dude)

func (*Room) RemoveDudeFromCenter

func (r *Room) RemoveDudeFromCenter(a *Dude)

func (*Room) RemoveDudesFromWaiting

func (r *Room) RemoveDudesFromWaiting()

func (*Room) Reset

func (r *Room) Reset()

func (*Room) RollLoot

func (r *Room) RollLoot(luck int) *Equipment

Roll for new equipment from list Modifies the equipment by luck stat and room height Luck and room level determines chance of finding equipment, harder to find at higher levels Luck determines the quality

func (*Room) Update

func (r *Room) Update(req *ActivityRequests, g *Game)

Update updates the stuff in the room.

type RoomBossCombatActivity

type RoomBossCombatActivity struct {
	// contains filtered or unexported fields
}

func (RoomBossCombatActivity) Apply

func (r RoomBossCombatActivity) Apply()

func (RoomBossCombatActivity) Cb

func (r RoomBossCombatActivity) Cb() func(success bool)

type RoomCenterActivity

type RoomCenterActivity struct {
	// contains filtered or unexported fields
}

func (RoomCenterActivity) Apply

func (r RoomCenterActivity) Apply()

func (RoomCenterActivity) Cb

func (r RoomCenterActivity) Cb() func(success bool)

type RoomCombatActivity

type RoomCombatActivity struct {
	// contains filtered or unexported fields
}

func (RoomCombatActivity) Apply

func (r RoomCombatActivity) Apply()

func (RoomCombatActivity) Cb

func (r RoomCombatActivity) Cb() func(success bool)

type RoomDef

type RoomDef struct {
	// contains filtered or unexported fields
}

RoomDef is used for providing the visuals for placing a room. It renders a stack at a pitch of 1 to a new image and stores that image for use during rendering.

func GetOptionalRooms

func GetOptionalRooms(storyLevel int, roomSpace int) []*RoomDef

Returns an amount of rooms until the given size/space count is reached.

func GetRequiredRooms

func GetRequiredRooms(storyLevel int, roomCount int) []*RoomDef

For populating the required rooms to place Number of bad rooms based on requested size count. Every 3 stories is a boss room.

func GetRoomDef

func GetRoomDef(kind RoomKind, size RoomSize, required bool) *RoomDef

func SortRooms

func SortRooms(rooms []*RoomDef) []*RoomDef

func (*RoomDef) GetDescription

func (r *RoomDef) GetDescription() string

type RoomEndActivity

type RoomEndActivity struct {
	// contains filtered or unexported fields
}

func (RoomEndActivity) Apply

func (r RoomEndActivity) Apply()

func (RoomEndActivity) Cb

func (r RoomEndActivity) Cb() func(success bool)

type RoomEndBossActivity

type RoomEndBossActivity struct {
	// contains filtered or unexported fields
}

func (RoomEndBossActivity) Apply

func (r RoomEndBossActivity) Apply()

func (RoomEndBossActivity) Cb

func (r RoomEndBossActivity) Cb() func(success bool)

type RoomEnterActivity

type RoomEnterActivity struct {
	// contains filtered or unexported fields
}

func (RoomEnterActivity) Apply

func (r RoomEnterActivity) Apply()

func (RoomEnterActivity) Cb

func (r RoomEnterActivity) Cb() func(success bool)

type RoomInfoPanel

type RoomInfoPanel struct {
	// contains filtered or unexported fields
}

func MakeRoomInfoPanel

func MakeRoomInfoPanel() RoomInfoPanel

func (*RoomInfoPanel) Check

func (rip *RoomInfoPanel) Check(mx, my float64, kind UICheckKind) bool

func (*RoomInfoPanel) Draw

func (rip *RoomInfoPanel) Draw(o *render.Options)

func (*RoomInfoPanel) Layout

func (rip *RoomInfoPanel) Layout(o *UIOptions)

func (*RoomInfoPanel) Update

func (rip *RoomInfoPanel) Update(o *UIOptions)

type RoomKind

type RoomKind int

RoomKind is an enumeration of the different kinds of rooms in za toweru.

const (
	Empty RoomKind = iota
	//
	Stairs
	// Armory provide... armor up? damage up? Maybe should be different types.
	Armory
	// Healing shrine heals the adventurers over time.
	HealingShrine
	// Combat is where it goes down. $$$ is acquired.
	Combat
	// Well restores magic items?
	Well
	// Treasure room - $$$
	Treasure
	// Library - enchant
	Library
	// Curse - % to curse dude
	Curse
	// Trap - % to damage dude based on stats
	Trap

	// Boss room
	Boss

	// Marker for the end... allows for iteration
	RoomKindEnd
)

func (*RoomKind) Equipment

func (r *RoomKind) Equipment() []*string

Equipment you can find in room

func (*RoomKind) GetRoomEnemy

func (r *RoomKind) GetRoomEnemy(roomSize RoomSize, storyLevel int) EnemyKind

func (*RoomKind) String

func (r *RoomKind) String() string

type RoomLeaveActivity

type RoomLeaveActivity struct {
	// contains filtered or unexported fields
}

func (RoomLeaveActivity) Apply

func (r RoomLeaveActivity) Apply()

func (RoomLeaveActivity) Cb

func (r RoomLeaveActivity) Cb() func(success bool)

type RoomPanel

type RoomPanel struct {
	// contains filtered or unexported fields
}

func MakeRoomPanel

func MakeRoomPanel() RoomPanel

func (*RoomPanel) Check

func (rp *RoomPanel) Check(mx, my float64, kind UICheckKind) bool

func (*RoomPanel) Draw

func (rp *RoomPanel) Draw(o *render.Options)

func (*RoomPanel) Layout

func (rp *RoomPanel) Layout(o *UIOptions)

func (*RoomPanel) SetRoomDefs

func (rp *RoomPanel) SetRoomDefs(roomDefs []*RoomDef)

func (*RoomPanel) Update

func (rp *RoomPanel) Update(o *UIOptions)

type RoomSize

type RoomSize int

RoomSize represents the different sizes of rooms, with 1 equating to 1/8th of a circle.

const (
	Small  RoomSize = 1
	Medium RoomSize = 2
	Large  RoomSize = 3
	Huge   RoomSize = 4
)

func (RoomSize) String

func (r RoomSize) String() string

type RoomStartBossActivity

type RoomStartBossActivity struct {
	// contains filtered or unexported fields
}

func (RoomStartBossActivity) Apply

func (r RoomStartBossActivity) Apply()

func (RoomStartBossActivity) Cb

func (r RoomStartBossActivity) Cb() func(success bool)

type RoomTemplate

type RoomTemplate struct {
	// contains filtered or unexported fields
}

type RoomWaitActivity

type RoomWaitActivity struct {
	// contains filtered or unexported fields
}

func (RoomWaitActivity) Apply

func (r RoomWaitActivity) Apply()

func (RoomWaitActivity) Cb

func (r RoomWaitActivity) Cb() func(success bool)

type SpeedPanel

type SpeedPanel struct {
	render.Positionable
	render.Sizeable
	// contains filtered or unexported fields
}

func MakeSpeedPanel

func MakeSpeedPanel() SpeedPanel

func (*SpeedPanel) Check

func (sp *SpeedPanel) Check(mx, my float64, kind UICheckKind) bool

func (*SpeedPanel) Draw

func (sp *SpeedPanel) Draw(o *render.Options)

func (*SpeedPanel) Layout

func (sp *SpeedPanel) Layout(parent UIElement, o *UIOptions)

func (*SpeedPanel) Update

func (sp *SpeedPanel) Update(o *UIOptions)

type Stat

type Stat string

A dude's inherent capability to deal with their environment (how they survive dem rooms)

const (
	StatStrength   Stat = "Str"
	StatWisdom     Stat = "Wis"
	StatDefense    Stat = "Def"
	StatAgility    Stat = "Agi"
	StatConfidence Stat = "Con"
	StatLuck       Stat = "Luc"
	StatMaxHP      Stat = "MaxHP"
	StatCurrentHP  Stat = "CurrentHP"
)

type Stats

type Stats struct {
	// contains filtered or unexported fields
}

func NewStats

func NewStats(levelUpChange *Stats, isEnemy bool) *Stats

func (*Stats) Add

func (s *Stats) Add(a *Stats) *Stats

func (*Stats) ApplyDefense

func (s *Stats) ApplyDefense(damage int) int

func (*Stats) LevelDown

func (s *Stats) LevelDown()

ApplyLevelDown applies the level down changes to the stats

func (*Stats) LevelUp

func (s *Stats) LevelUp(isEnemy bool)

ApplyLevelUp applies the level up changes to the stats with some variance depend on wisdom

func (*Stats) ModifyStat

func (s *Stats) ModifyStat(stat Stat, amount int)

func (*Stats) Print

func (s *Stats) Print()

type StereoPanStream

type StereoPanStream struct {
	io.ReadSeeker
	// contains filtered or unexported fields
}

StereoPanStream is an audio buffer that changes the stereo channel's signal based on the Panning.

func NewStereoPanStream

func NewStereoPanStream(src io.ReadSeeker) *StereoPanStream

NewStereoPanStream returns a new StereoPanStream with a buffered src.

The src's format must be linear PCM (16bits little endian, 2 channel stereo) without a header (e.g. RIFF header). The sample rate must be same as that of the audio context.

func (*StereoPanStream) Pan

func (s *StereoPanStream) Pan() float64

func (*StereoPanStream) Read

func (s *StereoPanStream) Read(p []byte) (int, error)

func (*StereoPanStream) SetPan

func (s *StereoPanStream) SetPan(pan float64)

type Story

type Story struct {
	// contains filtered or unexported fields
}

Story is a single story in the tower. It contains rooms.

func NewStory

func NewStory() *Story

NewStory creates a grand new spankin' story.

func NewStoryWithSize

func NewStoryWithSize(size int) *Story

func (*Story) AddClouds

func (s *Story) AddClouds()

func (*Story) AddDude

func (s *Story) AddDude(d *Dude)

func (*Story) AddPortal

func (s *Story) AddPortal()

func (*Story) AddText

func (s *Story) AddText(t FloatingText)

func (*Story) AngleFromCenter

func (s *Story) AngleFromCenter(x, y float64) float64

func (*Story) Complete

func (s *Story) Complete() bool

Complete returns if the story is considered complete based upon full room saturation.

func (*Story) DistanceFromCenter

func (s *Story) DistanceFromCenter(x, y float64) float64

func (*Story) Draw

func (s *Story) Draw(o *render.Options)

Draw draws the rooms.

func (*Story) GetRoomCenterRad

func (s *Story) GetRoomCenterRad(roomIndex int) float64

func (*Story) IsInCenterOfRoom

func (s *Story) IsInCenterOfRoom(rads float64, roomIndex int) bool

func (*Story) Open

func (s *Story) Open()

Open marks the story as being open. This activates full updates and rendering.

func (*Story) PlaceRoom

func (s *Story) PlaceRoom(r *Room, index int) error

PlaceRoom places a room in the story, populating the rooms slice's pointer references accordingly.

func (*Story) PositionFromCenter

func (s *Story) PositionFromCenter(rads float64, amount float64) (float64, float64)

func (*Story) RemoveClouds

func (s *Story) RemoveClouds()

func (*Story) RemoveDoor

func (s *Story) RemoveDoor()

func (*Story) RemoveDude

func (s *Story) RemoveDude(d *Dude)

func (*Story) RemovePortal

func (s *Story) RemovePortal()

func (*Story) RemoveRoom

func (s *Story) RemoveRoom(index int) error

RemoveRoom removes the room at the given index. This function always gets the "head" of the room and removes its size, regardless of if the target index is not the head.

func (*Story) Reset

func (s *Story) Reset()

func (*Story) RoomIndexFromAngle

func (s *Story) RoomIndexFromAngle(rads float64) int

RoomIndexFromAngle returns the room index based upon the radians provided.

func (*Story) Update

func (s *Story) Update(req *ActivityRequests, g *Game)

Update updates the rooms.

type StoryEnterNextActivity

type StoryEnterNextActivity struct {
	// contains filtered or unexported fields
}

func (StoryEnterNextActivity) Apply

func (s StoryEnterNextActivity) Apply()

func (StoryEnterNextActivity) Cb

func (s StoryEnterNextActivity) Cb() func(success bool)

type Tower

type Tower struct {
	render.Positionable // I guess it's okay to re-use this in such a fashion.
	Stories             []*Story
	// contains filtered or unexported fields
}

Tower is our glorious tower :o

func NewTower

func NewTower() *Tower

NewTower creates a new tower.

func (*Tower) AddDude

func (t *Tower) AddDude(d *Dude)

AddDude adds a new dude at the lowest story of the tower and assigns the dude's appropriate activity state.

func (*Tower) AddDudes

func (t *Tower) AddDudes(dudes ...*Dude)

func (*Tower) AddStory

func (t *Tower) AddStory(s *Story)

AddStory does as it says.

func (*Tower) ClearBodies

func (t *Tower) ClearBodies()

func (*Tower) ClearTexts

func (t *Tower) ClearTexts()

func (*Tower) Draw

func (t *Tower) Draw(o *render.Options)

Draw our glorious tower.

func (*Tower) HasAliveDudes

func (t *Tower) HasAliveDudes() bool

func (*Tower) RemoveDude

func (t *Tower) RemoveDude(d *Dude)

func (*Tower) Reset

func (t *Tower) Reset()

func (*Tower) Update

func (t *Tower) Update(req *ActivityRequests, g *Game)

Update the tower.

type TowerCompleteActivity

type TowerCompleteActivity struct {
	// contains filtered or unexported fields
}

func (TowerCompleteActivity) Apply

func (t TowerCompleteActivity) Apply()

func (TowerCompleteActivity) Cb

func (t TowerCompleteActivity) Cb() func(success bool)

type TowerLeaveActivity

type TowerLeaveActivity struct {
	// contains filtered or unexported fields
}

func (TowerLeaveActivity) Apply

func (t TowerLeaveActivity) Apply()

func (TowerLeaveActivity) Cb

func (t TowerLeaveActivity) Cb() func(success bool)

type Track

type Track struct {
	// contains filtered or unexported fields
}

func (*Track) Pause

func (t *Track) Pause()

func (*Track) Play

func (t *Track) Play()

func (*Track) SetPan

func (t *Track) SetPan(pan float64)

func (*Track) SetVolume

func (t *Track) SetVolume(volume float64)

type UI

type UI struct {
	// contains filtered or unexported fields
}

func NewUI

func NewUI() *UI

func (*UI) Check

func (ui *UI) Check(mx, my float64, kind UICheckKind) bool

func (*UI) Draw

func (ui *UI) Draw(o *render.Options)

func (*UI) Hide

func (ui *UI) Hide()

func (*UI) Layout

func (ui *UI) Layout(o *UIOptions)

func (*UI) Reveal

func (ui *UI) Reveal()

func (*UI) Update

func (ui *UI) Update(o *UIOptions)

type UIButton

type UIButton struct {
	render.Positionable
	render.Sizeable
	// contains filtered or unexported fields
}

======== BUTTON ========

func NewUIButton

func NewUIButton(name string, tooltip string) *UIButton

func (*UIButton) Check

func (b *UIButton) Check(mx, my float64, kind UICheckKind) bool

func (*UIButton) Draw

func (b *UIButton) Draw(o *render.Options)

func (*UIButton) Height

func (b *UIButton) Height() float64

func (*UIButton) Layout

func (b *UIButton) Layout(parent UIElement, o *UIOptions)

func (*UIButton) SetImage

func (b *UIButton) SetImage(name string)

func (*UIButton) SetPosition

func (b *UIButton) SetPosition(x, y float64)

func (*UIButton) Size

func (b *UIButton) Size() (float64, float64)

func (*UIButton) Update

func (b *UIButton) Update(o *UIOptions)

func (*UIButton) Width

func (b *UIButton) Width() float64

type UICheckKind

type UICheckKind int
const (
	UICheckNone UICheckKind = iota
	UICheckHover
	UICheckClick
)

type UIElement

type UIElement interface {
	Position() (float64, float64)
	SetPosition(float64, float64)
	Size() (float64, float64)
	SetSize(float64, float64)
	X() float64
	Y() float64
	Width() float64
	Height() float64
	Layout(parent UIElement, o *UIOptions)
	Draw(o *render.Options)
	Update(o *UIOptions)
	Check(float64, float64, UICheckKind) bool
}

type UIImage

type UIImage struct {
	render.Positionable
	render.Sizeable
	// contains filtered or unexported fields
}

func NewUIImage

func NewUIImage(img *ebiten.Image) *UIImage

func (*UIImage) Check

func (i *UIImage) Check(mx, my float64, kind UICheckKind) bool

func (*UIImage) Draw

func (i *UIImage) Draw(o *render.Options)

func (*UIImage) Layout

func (i *UIImage) Layout(parent UIElement, o *UIOptions)

func (*UIImage) Update

func (i *UIImage) Update(o *UIOptions)

type UIItemList

type UIItemList struct {
	render.Positionable
	render.Sizeable
	// contains filtered or unexported fields
}

func NewUIItemList

func NewUIItemList(direction int) *UIItemList

func (*UIItemList) AddItem

func (l *UIItemList) AddItem(item UIElement)

func (*UIItemList) Check

func (l *UIItemList) Check(mx, my float64, kind UICheckKind) bool

func (*UIItemList) Clear

func (l *UIItemList) Clear()

func (*UIItemList) Draw

func (l *UIItemList) Draw(o *render.Options)

func (*UIItemList) Layout

func (l *UIItemList) Layout(parent UIElement, o *UIOptions)

func (*UIItemList) RemoveItemByIndex

func (l *UIItemList) RemoveItemByIndex(index int)

func (*UIItemList) Update

func (l *UIItemList) Update(o *UIOptions)

type UIOptions

type UIOptions struct {
	Scale    float64
	Width    int
	Height   int
	Messages []string
}

func (UIOptions) CoordsToScreen

func (o UIOptions) CoordsToScreen(x, y float64) (float64, float64)

func (UIOptions) ScreenToCoords

func (o UIOptions) ScreenToCoords(x, y float64) (float64, float64)

type UIPanel

type UIPanel struct {
	render.Positionable
	render.Sizeable
	// contains filtered or unexported fields
}

======== UIPanel ========

func NewUIPanel

func NewUIPanel(style PanelStyle) *UIPanel

func (*UIPanel) AddChild

func (p *UIPanel) AddChild(child UIElement)

func (*UIPanel) Check

func (p *UIPanel) Check(mx, my float64, kind UICheckKind) bool

func (*UIPanel) Draw

func (p *UIPanel) Draw(o *render.Options)

func (*UIPanel) Layout

func (p *UIPanel) Layout(parent UIElement, o *UIOptions)

func (*UIPanel) RemoveChild

func (p *UIPanel) RemoveChild(child UIElement)

func (*UIPanel) SetStyle

func (p *UIPanel) SetStyle(style PanelStyle)

func (*UIPanel) Update

func (p *UIPanel) Update(o *UIOptions)

type UIText

type UIText struct {
	render.Positionable
	render.Sizeable
	// contains filtered or unexported fields
}

======== UIText ========

func NewUIText

func NewUIText(txt string, font assets.Font, color color.Color) *UIText

func (*UIText) Check

func (t *UIText) Check(mx, my float64, kind UICheckKind) bool

func (*UIText) Draw

func (t *UIText) Draw(o *render.Options)

func (*UIText) Layout

func (t *UIText) Layout(parent UIElement, o *UIOptions)

func (*UIText) SetScale

func (t *UIText) SetScale(scale float64)

func (*UIText) SetSize

func (t *UIText) SetSize(w, h float64)

func (*UIText) SetText

func (t *UIText) SetText(txt string)

func (*UIText) Update

func (t *UIText) Update(o *UIOptions)

Jump to

Keyboard shortcuts

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