models

package
v0.0.0-...-2995887 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MovementPhase               Phase     = "MovementPhase"
	MovementPhase_UnitSelection PhaseStep = "MovementPhase_UnitSelection"
	MovementPhase_Moving        PhaseStep = "MovementPhase_Moving"
)

Variables

This section is empty.

Functions

func InRange

func InRange(id string, playerIndex int, r int, x int, y int) []interfaces.Entity

func InitGameState

func InitGameState()

func New2DArray

func New2DArray[V any](x int, y int) [][]V

func Print2DArray

func Print2DArray(grid [][]int)

Types

type Army

type Army struct {
	ID             string
	Name           string
	Units          []*Unit
	DestroyedUnits []*Unit
}

func (*Army) RemoveDestroyedUnits

func (re *Army) RemoveDestroyedUnits()

type Assets

type Assets struct {
	Units   map[string]Unit
	Weapons map[string]Weapon
}

func NewAssets

func NewAssets() *Assets

type BattleGround

type BattleGround struct {
	Size     Size
	ViewPort ViewPort
	Grid     [][]interfaces.Entity
}

func NewBattleGround

func NewBattleGround(x int, y int) *BattleGround

func (*BattleGround) GetEntityAtLocation

func (re *BattleGround) GetEntityAtLocation(l interfaces.Location) interfaces.Entity

return entity at location if any

func (*BattleGround) IsBattleGroundLocationFree

func (re *BattleGround) IsBattleGroundLocationFree(l interfaces.Location) bool

check if a location is empty

func (*BattleGround) IsBattleGroundLocationRectFree

func (re *BattleGround) IsBattleGroundLocationRectFree(x int, y int, w int, h int) bool

func (*BattleGround) PlaceBattleGroundEntity

func (re *BattleGround) PlaceBattleGroundEntity(entity interfaces.Entity)

put an entity on the battleground thus taking up space

func (*BattleGround) RemoveBattleGroundEntity

func (re *BattleGround) RemoveBattleGroundEntity(entity interfaces.Entity)

put an entity on the battleground thus taking up space

func (*BattleGround) RemoveEntity

func (re *BattleGround) RemoveEntity(l interfaces.Location)

func (*BattleGround) UpdateBattleGroundEntity

func (re *BattleGround) UpdateBattleGroundEntity(entity interfaces.Entity)

put an entity on the battleground thus taking up space

type DraggingGrid

type DraggingGrid struct {
	InDrag       bool
	CursorStartX int
	CursorStartY int
}

type FlashMessage

type FlashMessage struct {
	Msgs []string
	Time int
}

type GameState

type GameState struct {
	Initialized          bool
	CurrentGameState     GameStates
	Round                int
	BattleGround         BattleGround
	PhaseStepper         interfaces.PhaseStepper
	DiceRoller           interfaces.DiceRoller
	Players              [consts.MaxPlayers]Player
	CurrentPlayer        *Player
	CurrentPlayerIndex   int
	OpponetPlayerIndex   int
	StartPlayerIndex     int
	SelectedUnit         *Unit
	DraggingUnit         *Unit
	DraggingUnitLocation interfaces.Location
	SelectedPhaseUnit    *Unit
	SelectedTargetUnit   *Unit
	SelectedModel        *Model
	SelectedWeapon       *ShootingWeapon
	Assets               Assets
	UIState              UIState
	StatusMessage        StatusMessage
	Dice                 []int
	GameStateUpdater     GameStateUpdater
	Drawer               interfaces.Draw
	WeaponAbilityList    interfaces.WeaponAbilityList
	GameOver             bool
	PhaseEventBus        PhaseEventBus
}

func Game

func Game() *GameState

type GameStateUpdater

type GameStateUpdater struct {
}

func (GameStateUpdater) Init

func (re GameStateUpdater) Init()

func (GameStateUpdater) UpdateModel

func (re GameStateUpdater) UpdateModel(player int, model *Model)

func (GameStateUpdater) UpdateUnit

func (re GameStateUpdater) UpdateUnit(player int, unit *Unit)

type GameStates

type GameStates int16
const (
	GameStart GameStates = 0
)

type JsonSerializable

type JsonSerializable interface{}

type Model

type Model struct {
	ID             string
	Name           string
	ShortName      string
	Count          int
	ModelNumber    ModelNumber
	Movement       int
	WeaponSkill    string
	BallisticSkill string
	Strength       int
	Toughness      int
	CurrentWounds  int
	Wounds         int
	Destroyed      bool
	Attacks        int
	Leadership     int
	Save           string
	DefaultWeapons []string
	Weapons        []Weapon
	SelectedWeapon Weapon
	ModelType      ModelType
	PlayerIndex    int
}

func (*Model) ClearFiredWeapon

func (re *Model) ClearFiredWeapon()

func (Model) GetBallisticSkill

func (re Model) GetBallisticSkill() int

func (Model) GetID

func (re Model) GetID() string

func (Model) GetIntSkill

func (re Model) GetIntSkill(value string) int

func (Model) GetUnfiredWeapon

func (re Model) GetUnfiredWeapon() *Weapon

func (*Model) SetFiredWeapon

func (re *Model) SetFiredWeapon(weapon *Weapon)

type ModelNumber

type ModelNumber struct {
	Min int
	Max int
}

type ModelType

type ModelType string
const (
	LeaderModelType ModelType = "Leader"
)

type Phase

type Phase string

type PhaseEventBus

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

func NewPhaseEventBus

func NewPhaseEventBus() *PhaseEventBus

func (PhaseEventBus) Fire

func (re PhaseEventBus) Fire(eventID string)

func (PhaseEventBus) RegisterEventHandler

func (re PhaseEventBus) RegisterEventHandler(eventID string, handler func())

type PhaseStep

type PhaseStep string

type Player

type Player struct {
	AI            bool
	Name          string
	Army          Army
	Gone          bool
	MoraleChecked bool
}

func (*Player) PhaseCleanup

func (re *Player) PhaseCleanup()

func (*Player) RoundCleanup

func (re *Player) RoundCleanup()

type RGBA

type RGBA struct {
	R int
	G int
	B int
	A int
}

type ShootingWeapon

type ShootingWeapon struct {
	Unit        Unit
	Model       Model
	Weapon      Weapon
	Count       int
	Targets     []interfaces.Entity
	TargetRange int
}

type Size

type Size struct {
	Y int
	X int
}

type Stack

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

func (*Stack) Array

func (s *Stack) Array() []interface{}

func (*Stack) Count

func (s *Stack) Count() int

func (*Stack) Peek

func (s *Stack) Peek() (interface{}, bool)

func (*Stack) Pop

func (s *Stack) Pop() (interface{}, bool)

func (*Stack) Push

func (s *Stack) Push(val interface{})

func (*Stack) Randomize

func (s *Stack) Randomize()

func (*Stack) Swap

func (s *Stack) Swap(i int, x int)

type StatusMessage

type StatusMessage struct {
	Phase    string
	Messsage string
	Keys     string
}

func (*StatusMessage) Clear

func (re *StatusMessage) Clear()

type Token

type Token struct {
	RGBA RGBA
	ID   string
	Base int
}

type UIState

type UIState struct {
	ShowGrid     bool
	GridDragging DraggingGrid
}

type Unit

type Unit struct {
	ID                 string
	Name               string
	Army               string
	Models             []*Model
	ModelCount         map[string]int
	DestroyedModels    []*Model
	Power              int
	Location           interfaces.Location
	UnitState          []UnitState
	Destroyed          bool
	OriginalModelCount int
	CurrentMoves       int
	PlayerIndex        int
	Width              int
	Height             int
	Rect               ui.Rect
	Token              Token
	TargetRange        interfaces.Location
}

func (*Unit) AddState

func (re *Unit) AddState(state UnitState)

func (Unit) CanMove

func (re Unit) CanMove() bool

func (Unit) CanShoot

func (re Unit) CanShoot() bool

func (*Unit) Cleanup

func (re *Unit) Cleanup()

func (*Unit) ClearStates

func (re *Unit) ClearStates()

func (Unit) DrawUnitSelected

func (re Unit) DrawUnitSelected(screen *ebiten.Image)

func (*Unit) GetAssetPath

func (re *Unit) GetAssetPath(assetName string, ext string) string

func (*Unit) GetDestroyedModelByID

func (re *Unit) GetDestroyedModelByID(id string) *Model

func (*Unit) GetEntityType

func (re *Unit) GetEntityType() interfaces.EntityType

func (*Unit) GetID

func (re *Unit) GetID() string

func (*Unit) GetLocation

func (re *Unit) GetLocation() interfaces.Location

func (*Unit) GetModelByID

func (re *Unit) GetModelByID(id string) *Model

func (*Unit) GetModelIndexByID

func (re *Unit) GetModelIndexByID(id string) int

func (Unit) GetMoraleCheck

func (re Unit) GetMoraleCheck() int

func (*Unit) GetPlayerIndex

func (re *Unit) GetPlayerIndex() int

func (*Unit) GetTargetRange

func (re *Unit) GetTargetRange() interfaces.Location

func (*Unit) GetToken

func (re *Unit) GetToken() *ebiten.Image

func (*Unit) InflictWounds

func (re *Unit) InflictWounds(targetModel Model, str int) (bool, Model)

func (*Unit) MoraleFailure

func (re *Unit) MoraleFailure()

func (*Unit) Remove

func (re *Unit) Remove()

func (*Unit) SetLocation

func (re *Unit) SetLocation(location interfaces.Location)

func (*Unit) SetTargetRange

func (re *Unit) SetTargetRange(l interfaces.Location)

type UnitState

type UnitState string
const (
	UnitAdvanced UnitState = "UnitAdvanced"
	UnitFellBack UnitState = "UnitFellBack"
	UnitShot     UnitState = "UnitShot"
	UnitMoved    UnitState = "UnitMoved"
)

type ViewPort

type ViewPort struct {
	X      int
	Y      int
	Height int
	Width  int
}

func (ViewPort) GetPixelRectangle

func (re ViewPort) GetPixelRectangle() interfaces.Rectangle

type Weapon

type Weapon struct {
	Name          string
	Range         int
	WeaponType    WeaponType
	Strength      int
	ArmorPiercing int
	Damage        int
	Abilities     []string
	Fired         bool
}

func (Weapon) ApplyBlast

func (re Weapon) ApplyBlast(max int) int

func (*Weapon) GetWeaponAbilities

func (re *Weapon) GetWeaponAbilities() []string

func (*Weapon) SetArmorPiercing

func (re *Weapon) SetArmorPiercing(value int)

type WeaponType

type WeaponType struct {
	Type   string
	Dice   string
	Number int
}

func (WeaponType) GetAttacks

func (re WeaponType) GetAttacks(attacks int, target interfaces.Entity, shootingWeapon ShootingWeapon) int

Jump to

Keyboard shortcuts

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