battle

package
v0.3.14 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BtnRandomFace = input.NumButtons + 1 + iota
	BtnRandomDirection
	BtnRandomEither
)

Variables

View Source
var Abilities [numAbilities]Ability = [...]Ability{
	AbilityNone: {},
	AbilityBeeBasic: {
		SelfCommand: ActionCommand{
			Type:         CommandRange,
			InitialTimer: 70,
			MinBarPos:    25,
			MaxBarPos:    70,
			BarWidth:     25,
			BarSpeed:     2,
		},
	},
	AbilityBeetleBasic: {
		SelfCommand: ActionCommand{
			Type:         CommandHold,
			InitialTimer: 20,
			NumPips:      4,
			PressKey:     input.BtnDown,
		},
	},
	AbilityMothBasic: {
		SelfCommand: ActionCommand{
			Type:         CommandReveal,
			InitialTimer: 25,
			PressKey:     BtnRandomFace,
			NumPips:      4,
		},
	},
	AbilityTornadoToss: {
		SelfCommand: ActionCommand{
			Type:      CommandMultiRange,
			NumPips:   3,
			MinBarPos: 1.25,
		},
	},
	AbilityHurricaneToss: {
		SelfCommand: ActionCommand{
			Type:         CommandMash,
			InitialTimer: 235,
			PressKey:     input.BtnLeft,
			Alternating:  true,
			BuildRate:    6,
			DecayRate:    0.25,
		},
	},
	AbilitySecretStash:      {},
	AbilityNeedleToss:       {},
	AbilityNeedlePincer:     {},
	AbilityHeavyThrow:       {},
	AbilitySharingStash:     {},
	AbilityTaunt:            {},
	AbilityHeavyStrike:      {},
	AbilityPepTalk:          {},
	AbilityDashThrough:      {},
	AbilityUnderStrike:      {},
	AbilityPebbleToss:       {},
	AbilityBoulderToss:      {},
	AbilityIcefall:          {},
	AbilityFrigidCoffin:     {},
	AbilityBubbleShieldLite: {},
	AbilityBubbleShield:     {},
	AbilityIceRain:          {},
	AbilityChargeUp:         {},
	AbilityChargeUpPlus:     {},
	AbilityEmpower:          {},
	AbilityEmpowerPlus:      {},
	AbilityFortify:          {},
	AbilityFortifyPlus:      {},
	AbilityEnfeeble:         {},
	AbilityEnfeeblePlus:     {},
	AbilityBreak:            {},
	AbilityBreakPlus:        {},
	AbilityCleanse:          {},
	AbilitySturdy:           {},
	AbilityHardCharge:       {},
	AbilityRoyalDecree:      {},
	AbilityFrozenDrill:      {},
	AbilityFlyDrop:          {},
	AbilityFrostRelay:       {},
	AbilityFrostBowling:     {},
	AbilityLongLegs:         {},
	AbilityBite: {
		SelfCommand: ActionCommand{
			Type:         CommandButton,
			InitialTimer: 60,
			PressKey:     BtnRandomFace,
		},
	},
}
View Source
var Characters [numCharacters]CharacterDef = [...]CharacterDef{
	CharacterTanjerin: {
		Name: "Tanjerin",
		Anim: [...]AnimationDef{
			AnimStateIdle:      basicAnimation(sprites.BattleTanjerin1),
			AnimStateBlock:     basicAnimation(sprites.TanjerinBlock1),
			AnimStateAttacking: basicAnimation(sprites.TanjerinAttacking1),
			AnimStateAtkHit:    basicAnimation(sprites.TanjerinAtkHit1),
			AnimStateAtkFail:   basicAnimation(sprites.TanjerinAtkFail1),
		},
		BaseHP: 99,
	},
	CharacterPurple: {
		Name: "Purple",
		Anim: [...]AnimationDef{
			AnimStateIdle:      basicAnimation(sprites.Purple1),
			AnimStateBlock:     basicAnimation(sprites.PurpleBlock1),
			AnimStateAttacking: basicAnimation(sprites.PurpleAttacking1),
			AnimStateAtkHit:    basicAnimation(sprites.PurpleAtkHit1),
			AnimStateAtkFail:   basicAnimation(sprites.PurpleAtkFail1),
		},
		Attack: AbilityBeeBasic,
		BaseHP: 7,
	},
	CharacterCaillou: {
		Name: "Caillou",
		Anim: [...]AnimationDef{
			AnimStateIdle:      basicAnimation(sprites.Caillou1),
			AnimStateBlock:     basicAnimation(sprites.CaillouBlock1),
			AnimStateAttacking: basicAnimation(sprites.CaillouAttacking1),
			AnimStateAtkHit:    basicAnimation(sprites.CaillouAtkHit1),
			AnimStateAtkFail:   basicAnimation(sprites.CaillouAtkFail1),
		},
		Attack: AbilityBeetleBasic,
		BaseHP: 9,
	},
	CharacterEric: {
		Name: "Eric",
		Anim: [...]AnimationDef{
			AnimStateIdle:      basicAnimation(sprites.Eric1),
			AnimStateBlock:     basicAnimation(sprites.EricBlock1),
			AnimStateAttacking: basicAnimation(sprites.EricAttacking1),
			AnimStateAtkHit:    basicAnimation(sprites.EricAtkHit1),
			AnimStateAtkFail:   basicAnimation(sprites.EricAtkFail1),
		},
		Attack: AbilityMothBasic,
		BaseHP: 7,
	},
	CharacterBitey: {
		Name: "Bitey",
		Anim: [...]AnimationDef{
			AnimStateIdle:      basicAnimation(sprites.Bitey1),
			AnimStateBlock:     basicAnimation(sprites.BiteyBlock1),
			AnimStateAttacking: basicAnimation(sprites.BiteyAttacking1),
			AnimStateAtkHit:    basicAnimation(sprites.BiteyAtkHit1),
			AnimStateAtkFail:   basicAnimation(sprites.BiteyAtkFail1),
		},
		Attack: AbilityBite,
		NoHP:   true,
		Last:   true,
	},
}

Functions

This section is empty.

Types

type Ability

type Ability struct {
	SelfCommand     ActionCommand
	OpponentCommand ActionCommand
}

type AbilityType

type AbilityType uint64
const (
	AbilityNone AbilityType = iota
	AbilityBeeBasic
	AbilityBeetleBasic
	AbilityMothBasic
	AbilityTornadoToss
	AbilityHurricaneToss
	AbilitySecretStash
	AbilityNeedleToss
	AbilityNeedlePincer
	AbilityHeavyThrow
	AbilitySharingStash
	AbilityTaunt
	AbilityHeavyStrike
	AbilityPepTalk
	AbilityDashThrough
	AbilityUnderStrike
	AbilityPebbleToss
	AbilityBoulderToss
	AbilityIcefall
	AbilityFrigidCoffin
	AbilityBubbleShieldLite
	AbilityBubbleShield
	AbilityIceRain
	AbilityChargeUp
	AbilityChargeUpPlus
	AbilityEmpower
	AbilityEmpowerPlus
	AbilityFortify
	AbilityFortifyPlus
	AbilityEnfeeble
	AbilityEnfeeblePlus
	AbilityBreak
	AbilityBreakPlus
	AbilityCleanse
	AbilitySturdy
	AbilityHardCharge
	AbilityRoyalDecree
	AbilityFrozenDrill
	AbilityFlyDrop
	AbilityFrostRelay
	AbilityFrostBowling
	AbilityLongLegs
	AbilityBite
)

func (AbilityType) String

func (i AbilityType) String() string

type ActionCommand

type ActionCommand struct {
	Type         ActionCommandType
	InitialTimer int32
	Timer        int32
	NumPips      int32
	Alternating  bool
	Hidden       bool
	PressKey     input.Button
	MinBarPos    float32
	MaxBarPos    float32
	BarPos       float32
	BarWidth     float32
	BarSpeed     float32
	BuildRate    float32
	DecayRate    float32
}

func (*ActionCommand) ModifyForPlayer

func (c *ActionCommand) ModifyForPlayer(p *Player)

type ActionCommandType

type ActionCommandType uint64
const (
	CommandNone ActionCommandType = iota
	CommandButton
	CommandMash
	CommandMultiRange
	CommandRange
	CommandHold
	CommandReveal
	CommandSequence
	CommandSpy
)

func (ActionCommandType) String

func (i ActionCommandType) String() string

type AnimState

type AnimState uint64
const (
	AnimStateIdle AnimState = iota
	AnimStateBlock
	AnimStateAttacking
	AnimStateAtkHit
	AnimStateAtkFail
)

type AnimationDef

type AnimationDef struct {
	ResetFrame uint64
	Frames     []AnimationFrameDef
}

type AnimationFrameDef

type AnimationFrameDef struct {
	Sprite *sprites.Sprite
}

type Character

type Character struct {
	Type  CharacterType
	Anim  AnimState
	Frame uint64
	HP    uint64
	MaxHP uint64
}

func (*Character) CanBlock

func (c *Character) CanBlock() bool

func (*Character) Clone

func (c *Character) Clone() *Character

func (*Character) Render

func (c *Character) Render(batch *sprites.Batch, x, y, z, sx float32, away bool)

func (*Character) Update

func (c *Character) Update()

type CharacterDef

type CharacterDef struct {
	Name   string
	Anim   [numAnimStates]AnimationDef
	BaseHP uint64
	Attack AbilityType
	NoHP   bool
	Last   bool
}

type CharacterType

type CharacterType uint64
const (
	CharacterTanjerin CharacterType = iota
	CharacterPurple
	CharacterCaillou
	CharacterEric
	CharacterBitey
)

func (CharacterType) String

func (i CharacterType) String() string

type Game

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

func New

func New(ctx context.Context) (*Game, error)

func (*Game) Render

func (g *Game) Render(ctx context.Context) error

func (*Game) Resize

func (g *Game) Resize(ctx context.Context) error

func (*Game) Update

func (g *Game) Update(ctx context.Context, frameAdvance bool) error

type Player

type Player struct {
	NoMash bool
	Menu   uint8
}

func (*Player) Clone

func (p *Player) Clone() *Player

type Side

type Side struct {
	TP          uint64
	NoInput     uint8
	Block       uint8
	BtnConsumed [input.NumButtons]uint64
	Characters  [4]*Character
}

func (*Side) CharacterCount

func (s *Side) CharacterCount() int

func (*Side) Clone

func (s *Side) Clone() Side

func (*Side) RenderAway

func (s *Side) RenderAway(batch *sprites.Batch)

func (*Side) RenderHome

func (s *Side) RenderHome(batch *sprites.Batch)

type State

type State struct {
	FrameNum  uint64
	RNG       *rng.RNG
	TurnTimer int64
	Players   [2]*Player
	Sides     [2]Side
}

func (*State) Clone

func (s *State) Clone() rollback.State

func (*State) Frame

func (s *State) Frame() uint64

func (*State) OnFrame

func (s *State) OnFrame()

func (*State) OnRollback

func (s *State) OnRollback()

func (*State) Update

func (s *State) Update(p1, p2 rollback.InputFrame)

Jump to

Keyboard shortcuts

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