mechanics

package
v0.0.0-...-13e073c Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoTurn

func DoTurn(mon1 *PokeMon, move1 *PokeMove, mon2 *PokeMon, move2 *PokeMove)

TODO: Make this func flexible to allow moves with special effects such as absorb, super fang and so on. Maybe by using func parameters?

Types

type EggGroup

type EggGroup int

type MovePool

type MovePool map[int][]PokeMove

type PokeAbility

type PokeAbility struct {
	Name                string
	AbilityBattleEffect func(state PokeBattleState) PokeBattleState
}

TODO: Fill this struct with relevant entries for an ability

type PokeBattleState

type PokeBattleState struct {
	Mon1, Mon2 PokeMon
	Turn       int
	Weather    struct {
		Turns int
	}
}

TODO: Fill this struct with relevant information of a state of battle

type PokeHeldItem

type PokeHeldItem struct {
	Name             string
	Condition        PokeBattleState
	ItemBattleEffect func(state PokeBattleState) PokeBattleState
}

type PokeItem

type PokeItem struct {
	Name       string
	ItemEffect func(state PokeBattleState) PokeBattleState
}

TODO: Fill this struct with relevant entries for an item

type PokeMon

type PokeMon struct {
	Base PokeMonBase
	EVS  [6]int
	IVS  [6]int
	//Stat changes in battle
	StatStages [6]int
	Stats      [6]int
	//Effective stats after stages have been applied
	BattleStats   [6]int
	Moves         [4]PokeMove
	Gender, Level int
	VStatus       constants.VStat
	NVStatus      constants.NVStat
	Nature        constants.Nature
	PokeRus       bool
	Nick          string
}

Things that may change for a pokemon over time

func (*PokeMon) CalculateDamageMultiplier

func (mon *PokeMon) CalculateDamageMultiplier(pokeType constants.PokeType) float64

Calculates the effectiveness compared to the RECEIVING pokemon

func (*PokeMon) CalculateHP

func (mon *PokeMon) CalculateHP() int

Same as above, but only for HP, as the formula is a bit different

func (*PokeMon) CalculateStats

func (mon *PokeMon) CalculateStats() [6]int

Calculates a PokeMons stats (including hp) from lvl, iv's ev's and base stats

func (*PokeMon) GainEVs

func (mon *PokeMon) GainEVs(evs [6]int)

Rounds down if the new EV's exceed maximum. 252 for each stat max, 510 for all

func (*PokeMon) SetLevel

func (mon *PokeMon) SetLevel(lvl int)

Sets the pokemon to a given level, and calculates its new stats

func (*PokeMon) SetNick

func (mon *PokeMon) SetNick(nick string)

Gives the pokemon a nickname

type PokeMonBase

type PokeMonBase struct {
	Gendered                  bool
	ID, CatchRate, HatchSteps int
	Types                     [2]*constants.PokeType
	BaseStats                 [6]int
	EVYield                   [6]int
	MovePool                  MovePool
	EggGroup                  EggGroup
	Name                      string
	Evolutions                []PokeMon
	New                       func() *PokeMon
}

Stuff that cannot change throughout the PokeMons lifecycle

type PokeMove

type PokeMove struct {
	Name           string
	Type           constants.PokeType
	Category       constants.MoveCategory
	PP             int
	Power          int
	Accuracy       float64
	FlinchChance   float64
	Priority       int
	Contact        bool
	OwnStatChanges [6]int
	OppStatChanges [6]int
	UseMove        func(state PokeBattleState) PokeBattleState
}

Jump to

Keyboard shortcuts

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