game

package
v0.0.0-...-cc63efc Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AbilityNone         AbilityType = ""
	AbilityBlock                    = "BLOCK"
	AbilityPerfectHit               = "PERFECT HIT"
	AbilityPerfectBlock             = "PERFECT BLOCK"
	AbilityHardy                    = "HARDY"
	AbilityCleave                   = "CLEAVE"
	AbilityRandomDamage             = "RANDOM DAMAGE"
)
View Source
const (
	AbilityDescriptionNone         AbilityDescription = ""
	AbilityDescriptionBlock                           = "Block the next 2*Ability damage up to Turns."
	AbilityDescriptionPerfectHit                      = "Deal 2*Ability Tier damage on the next attacks up to Turns."
	AbilityDescriptionPerfectBlock                    = "Block the next 2*Ability Tier attacks up to Turns."
	AbilityDescriptionHardy                           = "Avoid becoming infected up to Turns."
	AbilityDescriptionCleave                          = "Halves enemy INTEGRITY, FIREWALL, or PENETRATION."
	AbilityDescriptionRandomDamage                    = "Deals random bonus damage up to Tier for Turns."
)

Variables

Functions

func GetTileIsoPosition

func GetTileIsoPosition(x, y int) (float64, float64)

func GetTileIsoPositionFromCoordinate

func GetTileIsoPositionFromCoordinate(x, y float64) (int, int)

func GetTilePosition

func GetTilePosition(x, y int) (float64, float64)

func GetTilePositionFromCoordinate

func GetTilePositionFromCoordinate(x, y float64) (int, int)

Types

type Ability

type Ability struct {
	Name     string
	Tier     int
	Turns    int
	Cooldown int
	// contains filtered or unexported fields
}

func (*Ability) Activate

func (b *Ability) Activate()

func (*Ability) IsActive

func (b *Ability) IsActive() bool

func (*Ability) OnCooldown

func (b *Ability) OnCooldown() bool

func (*Ability) ReduceCooldown

func (b *Ability) ReduceCooldown()

func (*Ability) Reset

func (b *Ability) Reset()

func (*Ability) Turn

func (b *Ability) Turn()

type AbilityDescription

type AbilityDescription string

type AbilityType

type AbilityType string

type Actor

type Actor interface {
	Update(r *Room) (cmd commands.Command)
	Ready() bool
	SetReady(bool)
	TakeTurn() (cmd commands.Command)
	Draw(screen *ebiten.Image, r *Room, geom ebiten.GeoM, drawMode DrawMode)
	DrawPost(screen, post *ebiten.Image, r *Room, geom ebiten.GeoM, drawMode DrawMode)
	SetPosition(int, int, int)
	Position() (int, int, int)
	Command(cmd commands.Command)
	Input(in inputs.Input) bool
	Hover(bool)
	Hovered() bool
	SetTag(string)
	Tag() string
	SetName(string)
	Name() string
	SpriteStack() *SpriteStack
	Interact(w *World, r *Room, other Actor) commands.Command
	Blocks() bool
	SetBlocks(bool)
	Ghosting() bool
	SetGhosting(bool)
	Glitch() bool
}

type ActorCommand

type ActorCommand struct {
	Actor Actor
	Cmd   commands.Command
}

type Camera

type Camera struct {
	Rotation float64
	X        float64
	Y        float64
	W        float64
	H        float64
	Zoom     float64
	// contains filtered or unexported fields
}

func NewCamera

func NewCamera() *Camera

func (*Camera) CenterOn

func (c *Camera) CenterOn(x, y float64)

func (*Camera) CenterTo

func (c *Camera) CenterTo(x, y float64)

func (*Camera) MoveTo

func (c *Camera) MoveTo(x, y float64)

func (*Camera) SetPosition

func (c *Camera) SetPosition(x, y float64)

func (*Camera) Update

func (c *Camera) Update() error

type Combat

type Combat struct {
	Attacker CombatActor
	Defender CombatActor

	AutoCapture bool
	// contains filtered or unexported fields
}

func NewCombat

func NewCombat(w, h int, attacker, defender CombatActor) *Combat

func (*Combat) AddReport

func (c *Combat) AddReport(text string, icon *ebiten.Image, color color.NRGBA)

func (*Combat) CaptureChance

func (cmb *Combat) CaptureChance() float64

func (*Combat) Draw

func (c *Combat) Draw(screen *ebiten.Image, geom ebiten.GeoM)

func (*Combat) GenerateEnemyAction

func (c *Combat) GenerateEnemyAction() CombatAction

func (*Combat) Input

func (c *Combat) Input(in inputs.Input)

func (*Combat) Refresh

func (c *Combat) Refresh()

func (*Combat) RefreshAbilities

func (c *Combat) RefreshAbilities()

func (*Combat) RefreshGlitchSwap

func (c *Combat) RefreshGlitchSwap()

func (*Combat) RefreshGlitchUse

func (c *Combat) RefreshGlitchUse()

func (*Combat) SetAction

func (c *Combat) SetAction(action CombatAction)

func (*Combat) SwapMenu

func (c *Combat) SwapMenu(mode CombatMenuMode)

func (*Combat) Update

func (c *Combat) Update(w *World, r *Room) (cmd commands.Command)

type CombatAction

type CombatAction interface {
	Done(c *Combat) (CombatAction, bool)
	Update(c *Combat)
	IsAttacker() bool
}

type CombatActionAbility

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

func (CombatActionAbility) Done

func (c CombatActionAbility) Done(cmb *Combat) (CombatAction, bool)

func (CombatActionAbility) IsAttacker

func (c CombatActionAbility) IsAttacker() bool

func (*CombatActionAbility) Update

func (c *CombatActionAbility) Update(cmb *Combat)

type CombatActionAttack

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

func (CombatActionAttack) Done

func (c CombatActionAttack) Done(cmb *Combat) (CombatAction, bool)

func (CombatActionAttack) IsAttacker

func (c CombatActionAttack) IsAttacker() bool

func (*CombatActionAttack) Update

func (c *CombatActionAttack) Update(cmb *Combat)

type CombatActionBoost

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

func (CombatActionBoost) Done

func (c CombatActionBoost) Done(cmb *Combat) (CombatAction, bool)

func (CombatActionBoost) IsAttacker

func (c CombatActionBoost) IsAttacker() bool

func (*CombatActionBoost) Update

func (c *CombatActionBoost) Update(cmb *Combat)

type CombatActionCapture

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

func (CombatActionCapture) Done

func (c CombatActionCapture) Done(cmb *Combat) (CombatAction, bool)

func (CombatActionCapture) IsAttacker

func (c CombatActionCapture) IsAttacker() bool

func (*CombatActionCapture) Try

func (c *CombatActionCapture) Try(cmb *Combat) bool

func (*CombatActionCapture) Update

func (c *CombatActionCapture) Update(cmb *Combat)

type CombatActionDone

type CombatActionDone struct {
	Result commands.CombatResult
	// contains filtered or unexported fields
}

func (CombatActionDone) Done

func (c CombatActionDone) Done(combat *Combat) (CombatAction, bool)

func (CombatActionDone) IsAttacker

func (c CombatActionDone) IsAttacker() bool

func (*CombatActionDone) Update

func (c *CombatActionDone) Update(combat *Combat)

type CombatActionFlee

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

func (CombatActionFlee) Done

func (c CombatActionFlee) Done(cmb *Combat) (CombatAction, bool)

func (CombatActionFlee) IsAttacker

func (c CombatActionFlee) IsAttacker() bool

func (*CombatActionFlee) Update

func (c *CombatActionFlee) Update(cmb *Combat)

type CombatActionSwapGlitch

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

func (CombatActionSwapGlitch) Done

func (CombatActionSwapGlitch) IsAttacker

func (c CombatActionSwapGlitch) IsAttacker() bool

func (*CombatActionSwapGlitch) Update

func (c *CombatActionSwapGlitch) Update(cmb *Combat)

type CombatActor

type CombatActor interface {
	Name() string
	CurrentStats() (pen int, fire int, inte int)
	MaxStats() (int, int, int)
	RestoreStats()
	ReduceDamage(int, int, int) (int, int, int)
	ApplyDamage(int, int, int) (int, int, int)
	ApplyBoost(int, int, int) (int, int, int)
	Level() int
	SetLevel(int)
	Exp() int
	AddExp(int) int
	ExpValue() int
	RollBoost() (pen, fire, inte int)
	RollAttack() (pen int)
	HasGlitch() bool
	SetGlitch(GlitchActor)
	Glitches() []GlitchActor
	CurrentGlitch() GlitchActor
	AddGlitch(GlitchActor)
	RemoveGlitch(GlitchActor)
	Killed() bool
	Kill()
	Captured() bool
	Capture()
	Penalize(pen, fire, inte int)
	ClearPenalties()
}

type CombatLine

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

type CombatMenu

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

type CombatMenuItem

type CombatMenuItem struct {
	Glitch   GlitchActor
	Icon     *ebiten.Image
	SubIcon  *ebiten.Image
	Text     string
	Bounds   image.Rectangle
	Disabled bool
	Trigger  func()
}

type CombatMenuMode

type CombatMenuMode int
const (
	CombatMenuModeMain CombatMenuMode = iota
	CombatMenuModeAttackStat
	CombatMenuModeBoostStat
	CombatMenuModeUseGlitch
	CombatMenuModeSwapGlitch
)

type CombatMenus

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

type DrawMode

type DrawMode int
const (
	DrawModeFlat DrawMode = iota
	DrawModeIso
	DrawModeIsoToFlat
	DrawModeFlatToIso
)

type GlitchActor

type GlitchActor interface {
	SpriteStack() *SpriteStack
	Name() string
	Level() int
	Exp() int
	ReduceDamage(int, int, int) (int, int, int)
	RollBoost() (pen, fire, inte int)
	RollAttack() (pen int)
	AddExp(int) int
	Ability() *Ability
	SetAbility(*Ability)
}

type Message

type Message struct {
	Text       string
	Duration   time.Duration
	Color      color.NRGBA
	Background color.NRGBA
	X          int
	Y          int
	H          float64
	Font       *res.Font
	// contains filtered or unexported fields
}

type Prompt

type Prompt struct {
	Message string
	Items   []string

	Selected int
	// contains filtered or unexported fields
}

Prompt system. It's kinda jank, but it works well enough for this project.

func NewPrompt

func NewPrompt(w, h int, items []string, msg string, cb func(int, string) bool, showExtra bool) *Prompt

func (*Prompt) Draw

func (p *Prompt) Draw(screen *ebiten.Image, geom ebiten.GeoM)

func (*Prompt) Input

func (p *Prompt) Input(in inputs.Input)

func (*Prompt) Refresh

func (p *Prompt) Refresh()

func (*Prompt) Update

func (p *Prompt) Update()

type Room

type Room struct {
	Tiles           [][]Tile
	Actors          []Actor
	PendingCommands []ActorCommand
	TileMessages    []Message
	Color           color.NRGBA

	Darkness float64

	DrawMode     DrawMode
	OnUpdate     func(*World, *Room)
	OnEnter      func(*World, *Room)
	OnLeave      func(*World, *Room)
	OnTurn       func(*World, *Room)
	RoutineChan  chan func() bool
	RoutineChans []func() bool
	Song         string

	Name        string
	Glitches    int
	MaxGlitches int
	// contains filtered or unexported fields
}

func NewRoom

func NewRoom(w, h int) *Room

func (*Room) Activate

func (r *Room) Activate()

func (*Room) AddActor

func (r *Room) AddActor(a Actor)

func (*Room) Center

func (r *Room) Center() (float64, float64)

func (*Room) CenterIso

func (r *Room) CenterIso() (float64, float64)

func (*Room) Draw

func (r *Room) Draw(screen *ebiten.Image, geom ebiten.GeoM)

func (*Room) DrawPost

func (r *Room) DrawPost(screen, post *ebiten.Image, geom ebiten.GeoM)

func (*Room) DropInR

func (r *Room) DropInR() chan bool

func (*Room) FuncR

func (r *Room) FuncR(fnc func()) chan bool

func (*Room) GetActor

func (r *Room) GetActor(x, y int) Actor

func (*Room) GetActorByTag

func (r *Room) GetActorByTag(tag string) Actor

func (*Room) GetTile

func (r *Room) GetTile(x, y int) *Tile

func (*Room) GetTilePositionFromCoordinate

func (r *Room) GetTilePositionFromCoordinate(x, y float64) (int, int)

func (*Room) GetTilePositionGeoM

func (r *Room) GetTilePositionGeoM(x, y int) (g ebiten.GeoM, ratio float64)

func (*Room) HandlePendingCommands

func (r *Room) HandlePendingCommands(w *World) (results []commands.Command)

func (*Room) Input

func (r *Room) Input(w *World, in inputs.Input) bool

func (*Room) PrependActor

func (r *Room) PrependActor(a Actor)

func (*Room) RemoveActor

func (r *Room) RemoveActor(a Actor)

func (*Room) SetColor

func (r *Room) SetColor(c color.NRGBA)

func (*Room) Size

func (r *Room) Size() (int, int)

func (*Room) TileMessage

func (r *Room) TileMessage(m Message)

func (*Room) TileMessageR

func (r *Room) TileMessageR(m Message) chan bool

func (*Room) ToFlat

func (r *Room) ToFlat()

func (*Room) ToIso

func (r *Room) ToIso()

func (*Room) Update

func (r *Room) Update(w *World) []commands.Command

func (*Room) UpdateGlitchion

func (r *Room) UpdateGlitchion()

type Rooms

type Rooms interface {
	BuildRoom(name string) *Room
}

type SpriteStack

type SpriteStack struct {
	LayerDistance float64
	Alpha         float32
	Rotation      float64
	ExtraRotation float64
	YScale        float64
	Highlight     bool
	Shaded        bool
	SkewX         float64
	SkewY         float64
	// contains filtered or unexported fields
}

func NewSpriteStack

func NewSpriteStack(sprite string) *SpriteStack

func (*SpriteStack) Draw

func (ss *SpriteStack) Draw(screen *ebiten.Image, geom ebiten.GeoM, mode DrawMode, ratio float64)

func (*SpriteStack) DrawFlat

func (ss *SpriteStack) DrawFlat(screen *ebiten.Image, geom ebiten.GeoM)

func (*SpriteStack) DrawIso

func (ss *SpriteStack) DrawIso(screen *ebiten.Image, geom ebiten.GeoM)

func (*SpriteStack) DrawMixed

func (ss *SpriteStack) DrawMixed(screen *ebiten.Image, geom ebiten.GeoM, ratio float64)

func (*SpriteStack) GeoM

func (ss *SpriteStack) GeoM(geom ebiten.GeoM) ebiten.GeoM

func (*SpriteStack) IsoGeoM

func (ss *SpriteStack) IsoGeoM(geom ebiten.GeoM) ebiten.GeoM

func (*SpriteStack) SetSprite

func (ss *SpriteStack) SetSprite(sprite string)

type Tile

type Tile struct {
	Name        string
	SpriteStack *SpriteStack
	BlocksMove  bool
	Ticker      int
	Glitchion   float64
	Rotation    float64
}

func (*Tile) Update

func (t *Tile) Update()

type World

type World struct {
	PlayerActor  Actor
	Rooms        []*Room
	LastRoom     *Room
	Room         *Room
	Camera       *Camera
	RoutineChan  chan func() bool
	RoutineChans []func() bool
	Messages     []Message
	Prompts      []*Prompt
	Combat       *Combat

	Color color.NRGBA

	SkipMessages bool
	// contains filtered or unexported fields
}

func NewWorld

func NewWorld(roomBuilder func(string) *Room) *World

func (*World) AddPrompt

func (w *World) AddPrompt(items []string, msg string, cb func(int, string) bool, showExtra bool)

func (*World) Draw

func (w *World) Draw(screen *ebiten.Image)

Draw the room, combat, overlays, etc. Don't code like this. :)

func (*World) EnterRoom

func (w *World) EnterRoom(room *Room)

func (*World) FuncR

func (w *World) FuncR(fnc func()) chan bool

func (*World) Input

func (w *World) Input(in inputs.Input)

func (*World) MessageR

func (w *World) MessageR(msg Message) chan bool

func (*World) Update

func (w *World) Update()

Jump to

Keyboard shortcuts

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