studio

package
v0.0.0-...-da914d2 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExperienceErratic     = "erratic"
	ExperienceFast        = "fast"
	ExperienceMediumFast  = "medium_fast"
	ExperienceMediumSlow  = "medium_slow"
	ExperienceSlow        = "slow"
	ExperienceFluctuating = "fluctuating"
)

ExperienceErratic is the erratic experience type.

View Source
const (
	BreedMonster      = "monster"
	BreedWater1       = "water1"
	BreedBug          = "bug"
	BreedFlying       = "flying"
	BreedField        = "field"
	BreedFairy        = "fairy"
	BreedGrass        = "grass"
	BreedHuman        = "human-like"
	BreedWater3       = "water3"
	BreedMineral      = "mineral"
	BreedAmorphous    = "amorphous"
	BreedWater2       = "water2"
	BreedDitto        = "ditto"
	BreedDragon       = "dragon"
	BreedUndiscovered = "undiscovered"
)

Breed groups constants.

View Source
const (
	StudioFolder   = "Studio"
	LanguageFolder = "Text/Dialogs"

	UndefType = "__undef__"
)

Variables

BreedMap maps breed group descriptors to strings.

ExperienceTypeMap maps experience type descriptors to strings.

Functions

func ComparePokemonId

func ComparePokemonId(p1, p2 *Pokemon) int

ComparePokemonId compares two Pokemon by their ID.

func ImportAbility

func ImportAbility(studioFolder, translationFolder string) (iter.Seq[*AbilityDescriptor], error)

func ImportMoves

func ImportMoves(studioFolder, translationFolder string) (iter.Seq[*MoveDescriptor], error)

ImportMoves import a moves folder to a store studioFolder pokemon studio folder translationFolder the translation folder

func ImportPokemon

func ImportPokemon(studioFolder, translationFolder string) (iter.Seq[*PokemonDescriptor], error)

ImportPokemon import a pokemon folder to a store studioFolder pokemon studio folder translationFolder the translation folder store the store that import is sending data to

func ImportTypes

func ImportTypes(studioFolder, translationFolder string) (iter.Seq[*PokemonTypeDescriptor], error)

ImportTypes import a type folder to a store studioFolder pokemon studio folder translationFolder the translation folder store the store that import is sending data to

func MaxHp

func MaxHp(base int32) int32

MaxHp calculates the maximum possible HP value for a given base HP.

func MaxStat

func MaxStat(base int32) int32

MaxStat calculates the maximum possible stat value for a given base stat.

func MinHp

func MinHp(base int32) int32

MinHp calculates the minimum possible HP value for a given base HP.

func MinStat

func MinStat(base int32) int32

MinStat calculates the minimum possible stat value for a given base stat.

Types

type Ability

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

Ability represents a Pokemon ability.

func (Ability) DbSymbol

func (a Ability) DbSymbol() string

DbSymbol returns the database symbol of the Ability.

func (Ability) Description

func (a Ability) Description(lang string) string

Description returns the localized description of the Ability for the given language.

func (Ability) ID

func (a Ability) ID() int

ID returns the ID of the Ability.

func (Ability) Name

func (a Ability) Name(lang string) string

Name returns the localized name of the Ability for the given language.

func (Ability) TextID

func (a Ability) TextID() int

TextID returns the text ID of the Ability.

type AbilityBuilder

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

AbilityBuilder builds Ability entities.

func NewAbilityBuilder

func NewAbilityBuilder() *AbilityBuilder

NewAbilityBuilder creates a new AbilityBuilder.

func (*AbilityBuilder) Build

func (b *AbilityBuilder) Build() *Ability

Build returns a copy of the built Ability.

func (*AbilityBuilder) DbSymbol

func (b *AbilityBuilder) DbSymbol(dbSymbol string) *AbilityBuilder

DbSymbol sets the database symbol of the Ability.

func (*AbilityBuilder) Description

func (b *AbilityBuilder) Description(desc Translation) *AbilityBuilder

Description sets the description translations of the Ability.

func (*AbilityBuilder) ID

func (b *AbilityBuilder) ID(id int) *AbilityBuilder

ID sets the ID of the Ability.

func (*AbilityBuilder) Name

func (b *AbilityBuilder) Name(name Translation) *AbilityBuilder

Name sets the name translations of the Ability.

func (*AbilityBuilder) TextId

func (b *AbilityBuilder) TextId(textId int) *AbilityBuilder

TextId sets the text ID of the Ability.

type AbilityDescriptor

type AbilityDescriptor struct {
	DbSymbol    string `json:"dbSymbol"`
	Id          int    `json:"id"`
	TextID      int    `json:"textId"`
	Name        Translation
	Description Translation
}

AbilityDescriptor is the JSON descriptor for an Ability.

func UnmarshalAbilityDescriptor

func UnmarshalAbilityDescriptor(abilityContent []byte) (*AbilityDescriptor, error)

UnmarshalAbilityDescriptor unmarshal a json encoded ability to a descriptor abilityContent the encoded ability

type AbilityMapper

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

AbilityMapper maps Ability descriptors to Ability entities.

func NewAbilityMapper

func NewAbilityMapper(store *Store) *AbilityMapper

NewAbilityMapper creates a new AbilityMapper.

func (*AbilityMapper) MapAbilityDescriptorToAbility

func (m *AbilityMapper) MapAbilityDescriptorToAbility(desc AbilityDescriptor) *Ability

MapAbilityDescriptorToAbility maps an AbilityDescriptor to an Ability.

type AimedTarget

type AimedTarget string

AimedTarget represents the target of a move

const (
	AimedTargetAdjacentPokemon    AimedTarget = "adjacent_pokemon"
	AimedTargetAdjacentFoe        AimedTarget = "adjacent_foe"
	AimedTargetAdjacentAllFoe     AimedTarget = "adjacent_all_foe"
	AimedTargetAllFoe             AimedTarget = "all_foe"
	AimedTargetAdjacentAllPokemon AimedTarget = "adjacent_all_pokemon"
	AimedTargetAllPokemon         AimedTarget = "all_pokemon"
	AimedTargetUser               AimedTarget = "user"
	AimedTargetUserOrAdjacentAlly AimedTarget = "user_or_adjacent_ally"
	AimedTargetAdjacentAlly       AimedTarget = "adjacent_ally"
	AimedTargetAllAlly            AimedTarget = "all_ally"
	AimedTargetAllAllyButUser     AimedTarget = "all_ally_but_user"
	AimedTargetAnyOtherPokemon    AimedTarget = "any_other_pokemon"
	AimedTargetRandomFoe          AimedTarget = "random_foe"
)

type BattleStage

type BattleStage string

BattleStage represents a stat stage in battle

const (
	BattleStageATK BattleStage = "ATK_STAGE"
	BattleStageDFE BattleStage = "DFE_STAGE"
	BattleStageATS BattleStage = "ATS_STAGE"
	BattleStageDFS BattleStage = "DFS_STAGE"
	BattleStageSPD BattleStage = "SPD_STAGE"
	BattleStageEVA BattleStage = "EVA_STAGE"
	BattleStageACC BattleStage = "ACC_STAGE"
)

type BattleStageModDescriptor

type BattleStageModDescriptor struct {
	BattleStage string `json:"battleStage"`
	Modificator int    `json:"modificator"`
}

type BreedGroupDescriptor

type BreedGroupDescriptor int32

BreedGroupDescriptor is a numeric descriptor for breed groups.

const (
	BreedMonsterNum      BreedGroupDescriptor = 1
	BreedWater1Num       BreedGroupDescriptor = 2
	BreedBugNum          BreedGroupDescriptor = 3
	BreedFlyingNum       BreedGroupDescriptor = 4
	BreedFieldNum        BreedGroupDescriptor = 5
	BreedFairyNum        BreedGroupDescriptor = 6
	BreedGrassNum        BreedGroupDescriptor = 7
	BreedHumanNum        BreedGroupDescriptor = 8
	BreedWater3Num       BreedGroupDescriptor = 9
	BreedMineralNum      BreedGroupDescriptor = 10
	BreedAmorphousNum    BreedGroupDescriptor = 11
	BreedWater2Num       BreedGroupDescriptor = 12
	BreedDittoNum        BreedGroupDescriptor = 13
	BreedDragonNum       BreedGroupDescriptor = 14
	BreedUndiscoveredNum BreedGroupDescriptor = 15
)

type Condition

type Condition struct {
	Type string
}

Condition represents a condition for evolution.

type ConditionDescriptor

type ConditionDescriptor struct {
	Type string `json:"type"`
}

ConditionDescriptor is the JSON descriptor for an evolution condition.

type ContactType

type ContactType string

ContactType represents how a move makes contact

const (
	ContactTypeDirect  ContactType = "DIRECT"
	ContactTypeDistant ContactType = "DISTANT"
	ContactTypeNone    ContactType = "NONE"
)

type Evolution

type Evolution struct {
	DbSymbol   string
	Form       int32
	Conditions []Condition
}

Evolution represents an evolution from one Pokemon to another.

type EvolutionDescriptor

type EvolutionDescriptor struct {
	DbSymbol   string                `json:"dbSymbol"`
	Form       int32                 `json:"form"`
	Conditions []ConditionDescriptor `json:"conditions"`
}

EvolutionDescriptor is the JSON descriptor for an evolution.

type ExecutionMethod

type ExecutionMethod string

ExecutionMethod represents how a move is executed

const (
	ExecutionMethodBasic      ExecutionMethod = "s_basic"
	ExecutionMethodStat       ExecutionMethod = "s_stat"
	ExecutionMethodStatus     ExecutionMethod = "s_status"
	ExecutionMethodMultiHit   ExecutionMethod = "s_multi_hit"
	ExecutionMethod2Hits      ExecutionMethod = "s_2hits"
	ExecutionMethodOHKO       ExecutionMethod = "s_ohko"
	ExecutionMethod2Turns     ExecutionMethod = "s_2turns"
	ExecutionMethodSelfStat   ExecutionMethod = "s_self_stat"
	ExecutionMethodSelfStatus ExecutionMethod = "s_self_status"
)

type ExperienceType

type ExperienceType string

ExperienceType is a type alias for experience types.

type ExperienceTypeDescriptor

type ExperienceTypeDescriptor int32

ExperienceTypeDescriptor is a numeric descriptor for experience types.

const (
	ExperienceErraticNum     ExperienceTypeDescriptor = 0
	ExperienceFastNum        ExperienceTypeDescriptor = 1
	ExperienceMediumFastNum  ExperienceTypeDescriptor = 2
	ExperienceMediumSlowNum  ExperienceTypeDescriptor = 3
	ExperienceSlowNum        ExperienceTypeDescriptor = 4
	ExperienceFluctuatingNum ExperienceTypeDescriptor = 5
)

type FormDescriptor

type FormDescriptor struct {
	Form           int32                      `json:"form"`
	Height         float32                    `json:"height"`
	Weight         float32                    `json:"weight"`
	Type1          string                     `json:"type1"`
	Type2          *string                    `json:"type2"`
	BaseHp         int32                      `json:"baseHp"`
	BaseAtk        int32                      `json:"baseAtk"`
	BaseDfe        int32                      `json:"baseDfe"`
	BaseSpd        int32                      `json:"baseSpd"`
	BaseAts        int32                      `json:"baseAts"`
	BaseDfs        int32                      `json:"baseDfs"`
	EvHp           int32                      `json:"evHp"`
	EvAtk          int32                      `json:"evAtk"`
	EvDfe          int32                      `json:"evDfe"`
	EvSpd          int32                      `json:"evSpd"`
	EvAts          int32                      `json:"evAts"`
	EvDfs          int32                      `json:"evDfs"`
	Evolutions     []EvolutionDescriptor      `json:"evolutions"`
	ExperienceType ExperienceTypeDescriptor   `json:"experienceType"`
	BaseExperience int32                      `json:"baseExperience"`
	BaseLoyalty    int32                      `json:"baseLoyalty"`
	CatchRate      int32                      `json:"catchRate"`
	FemaleRate     float32                    `json:"femaleRate"`
	BreedGroups    []int32                    `json:"breedGroups"`
	HatchSteps     int32                      `json:"hatchSteps"`
	BabyDbSymbol   *string                    `json:"babyDbSymbol"`
	BabyForm       int32                      `json:"babyForm"`
	ItemHeld       []ItemHeldDescriptor       `json:"itemHeld"`
	Abilities      []string                   `json:"abilities"`
	FrontOffsetY   int32                      `json:"frontOffsetY"`
	FormTextId     FormTextIdDescriptor       `json:"formTextId"`
	Resources      PokemonResourcesDescriptor `json:"resources"`
	Name           Translation
	Description    Translation
}

FormDescriptor is the JSON descriptor for a Pokemon form.

type FormTextIdDescriptor

type FormTextIdDescriptor struct {
	Name        int `json:"name"`
	Description int `json:"description"`
}

FormTextIdDescriptor is the JSON descriptor for form text IDs.

type ItemHeld

type ItemHeld struct {
	DbSymbol string
	Chance   int32
}

ItemHeld represents an item held by a Pokemon.

type ItemHeldDescriptor

type ItemHeldDescriptor struct {
	DbSymbol string `json:"dbSymbol"`
	Chance   int32  `json:"chance"`
}

ItemHeldDescriptor is the JSON descriptor for a held item.

type Move

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

Move represents a Pokemon move.

func (*Move) Accuracy

func (m *Move) Accuracy() int

Accuracy returns the accuracy of the Move.

func (*Move) Category

func (m *Move) Category() MoveCategory

Category returns the category of the Move.

func (*Move) CriticalRate

func (m *Move) CriticalRate() int

CriticalRate returns the critical rate of the Move.

func (*Move) DbSymbol

func (m *Move) DbSymbol() string

DbSymbol returns the database symbol of the Move.

func (*Move) Description

func (m *Move) Description(lang string) string

Description returns the localized description of the Move for the given language.

func (*Move) Execution

func (m *Move) Execution() MoveExecution

Execution returns the execution of the Move.

func (*Move) ID

func (m *Move) ID() int

ID returns the ID of the Move.

func (*Move) Interactions

func (m *Move) Interactions() []MoveInteraction

Interactions returns the interactions of the Move.

func (*Move) MapUse

func (m *Move) MapUse() int

MapUse returns the map use of the Move.

func (*Move) MechanicalTags

func (m *Move) MechanicalTags() []MoveMechanicalTag

MechanicalTags returns the mechanical tags of the Move.

func (*Move) Name

func (m *Move) Name(lang string) string

Name returns the localized name of the Move for the given language.

func (*Move) PP

func (m *Move) PP() int

PP returns the PP of the Move.

func (*Move) Power

func (m *Move) Power() int

Power returns the power of the Move.

func (*Move) Priority

func (m *Move) Priority() int

Priority returns the priority of the Move.

func (*Move) SecondaryEffects

func (m *Move) SecondaryEffects() MoveSecondaryEffects

SecondaryEffects returns the secondary effects of the Move.

func (*Move) Targeting

func (m *Move) Targeting() MoveTargeting

Targeting returns the targeting of the Move.

func (*Move) Type

func (m *Move) Type() PokemonType

Type returns the type of the Move.

type MoveBuilder

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

MoveBuilder builds Move entities.

func NewMoveBuilder

func NewMoveBuilder() *MoveBuilder

NewMoveBuilder creates a new MoveBuilder.

func (*MoveBuilder) Accuracy

func (b *MoveBuilder) Accuracy(acc int) *MoveBuilder

Accuracy sets the accuracy of a Move.

func (*MoveBuilder) Build

func (b *MoveBuilder) Build() *Move

Build returns a copy of the built Move.

func (*MoveBuilder) Category

func (b *MoveBuilder) Category(cat MoveCategory) *MoveBuilder

Category sets the category of a Move.

func (*MoveBuilder) CriticalRate

func (b *MoveBuilder) CriticalRate(rate int) *MoveBuilder

CriticalRate sets the critical rate of a Move.

func (*MoveBuilder) DbSymbol

func (b *MoveBuilder) DbSymbol(dbSymbol string) *MoveBuilder

DbSymbol sets the database symbol of a Move.

func (*MoveBuilder) Description

func (b *MoveBuilder) Description(desc Translation) *MoveBuilder

Description sets the description translations of a Move.

func (*MoveBuilder) Execution

func (b *MoveBuilder) Execution(exec MoveExecution) *MoveBuilder

Execution sets the execution of a Move.

func (*MoveBuilder) ID

func (b *MoveBuilder) ID(id int) *MoveBuilder

ID sets the ID of a Move.

func (*MoveBuilder) Interactions

func (b *MoveBuilder) Interactions(interactions []MoveInteraction) *MoveBuilder

Interactions sets the interactions of a Move.

func (*MoveBuilder) MapUse

func (b *MoveBuilder) MapUse(mapUse int) *MoveBuilder

MapUse sets the map use of a Move.

func (*MoveBuilder) MechanicalTags

func (b *MoveBuilder) MechanicalTags(tags []MoveMechanicalTag) *MoveBuilder

MechanicalTags sets the mechanical tags of a Move.

func (*MoveBuilder) Name

func (b *MoveBuilder) Name(name Translation) *MoveBuilder

Name sets the name translations of a Move.

func (*MoveBuilder) PP

func (b *MoveBuilder) PP(pp int) *MoveBuilder

PP sets the PP of a Move.

func (*MoveBuilder) Power

func (b *MoveBuilder) Power(power int) *MoveBuilder

Power sets the power of a Move.

func (*MoveBuilder) Priority

func (b *MoveBuilder) Priority(priority int) *MoveBuilder

Priority sets the priority of a Move.

func (*MoveBuilder) SecondaryEffects

func (b *MoveBuilder) SecondaryEffects(effects MoveSecondaryEffects) *MoveBuilder

SecondaryEffects sets the secondary effects of a Move.

func (*MoveBuilder) Targeting

func (b *MoveBuilder) Targeting(targeting MoveTargeting) *MoveBuilder

Targeting sets the targeting of a Move.

func (*MoveBuilder) Type

func (b *MoveBuilder) Type(t *PokemonType) *MoveBuilder

Type sets the type of a Move.

type MoveCategory

type MoveCategory string

MoveCategory represents a move category (Physical, Special, Status).

type MoveDescriptor

type MoveDescriptor struct {
	Klass                   string                     `json:"klass"`
	Id                      int                        `json:"id"`
	DbSymbol                string                     `json:"dbSymbol"`
	MapUse                  int                        `json:"mapUse"`
	BattleEngineMethod      string                     `json:"battleEngineMethod"`
	Type                    string                     `json:"type"`
	Power                   int                        `json:"power"`
	Accuracy                int                        `json:"accuracy"`
	PP                      int                        `json:"pp"`
	Category                string                     `json:"category"`
	MoveCriticalRate        int                        `json:"movecriticalRate"`
	Priority                int                        `json:"priority"`
	IsAuthentic             bool                       `json:"isAuthentic"`
	IsBallistics            bool                       `json:"isBallistics"`
	IsBite                  bool                       `json:"isBite"`
	IsBlocable              bool                       `json:"isBlocable"`
	IsCharge                bool                       `json:"isCharge"`
	IsDance                 bool                       `json:"isDance"`
	IsDirect                bool                       `json:"isDirect"`
	IsDistance              bool                       `json:"isDistance"`
	IsEffectChance          bool                       `json:"isEffectChance"`
	IsGravity               bool                       `json:"isGravity"`
	IsHeal                  bool                       `json:"isHeal"`
	IsKingRockUtility       bool                       `json:"isKingRockUtility"`
	IsMagicCoatAffected     bool                       `json:"isMagicCoatAffected"`
	IsMental                bool                       `json:"isMental"`
	IsMirrorMove            bool                       `json:"isMirrorMove"`
	IsNonSkyBattle          bool                       `json:"isNonSkyBattle"`
	IsPowder                bool                       `json:"isPowder"`
	IsPulse                 bool                       `json:"isPulse"`
	IsPunch                 bool                       `json:"isPunch"`
	IsRecharge              bool                       `json:"isRecharge"`
	IsSnatchable            bool                       `json:"isSnatchable"`
	IsSoundAttack           bool                       `json:"isSoundAttack"`
	IsUnfreeze              bool                       `json:"isUnfreeze"`
	BattleEngineAimedTarget string                     `json:"battleEngineAimedTarget"`
	BattleStageMod          []BattleStageModDescriptor `json:"battleStageMod"`
	MoveStatus              []MoveStatusDescriptor     `json:"moveStatus"`
	EffectChance            int                        `json:"effectChance"`
	IsSlicingAttack         bool                       `json:"isSlicingAttack"`
	IsWind                  bool                       `json:"isWind"`
	Name                    Translation
	Description             Translation
}

MoveDescriptor is the JSON descriptor for a Move.

func UnmarshalMoveDescriptor

func UnmarshalMoveDescriptor(moveContent []byte) (*MoveDescriptor, error)

UnmarshalMoveDescriptor unmarshal a json encoded move to a descriptor moveContent the encoded move

type MoveExecution

type MoveExecution struct {
	Method   ExecutionMethod
	Charge   bool
	Recharge bool
}

MoveExecution contains execution information for a move

type MoveInteraction

type MoveInteraction string

MoveInteraction represents an interaction property of a move

const (
	InteractionBlocable          MoveInteraction = "BLOCABLE"
	InteractionMirrorMove        MoveInteraction = "MIRROR_MOVE"
	InteractionSnatchable        MoveInteraction = "SNATCHABLE"
	InteractionMagicCoatAffected MoveInteraction = "MAGIC_COAT_AFFECTED"
	InteractionKingRockUtility   MoveInteraction = "KING_ROCK_UTILITY"
	InteractionAffectedByGravity MoveInteraction = "AFFECTED_BY_GRAVITY"
	InteractionNonSkyBattle      MoveInteraction = "NON_SKY_BATTLE"
)

type MoveMapper

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

MoveMapper handles mapping of Move descriptors using a store

func NewMoveMapper

func NewMoveMapper(store *Store) *MoveMapper

NewMoveMapper creates a new MoveMapper with the given store

func (*MoveMapper) MapMoveDescriptorToMove

func (m *MoveMapper) MapMoveDescriptorToMove(desc MoveDescriptor) *Move

MapMoveDescriptorToMove converts a MoveDescriptor to a Move domain struct

type MoveMechanicalTag

type MoveMechanicalTag string
const (
	MechanicalTagAuthentic MoveMechanicalTag = "AUTHENTIC"
	MechanicalTagBallistic MoveMechanicalTag = "BALLISTIC"
	MechanicalTagBite      MoveMechanicalTag = "BITE"
	MechanicalTagDance     MoveMechanicalTag = "DANCE"
	MechanicalTagPunch     MoveMechanicalTag = "PUNCH"
	MechanicalTagSlice     MoveMechanicalTag = "SLICE"
	MechanicalTagSound     MoveMechanicalTag = "SOUND"
	MechanicalTagWind      MoveMechanicalTag = "WIND"
	MechanicalTagPulse     MoveMechanicalTag = "PULSE"
	MechanicalTagPowder    MoveMechanicalTag = "POWDER"
	MechanicalTagMental    MoveMechanicalTag = "MENTAL"
)

type MoveSecondaryEffects

type MoveSecondaryEffects struct {
	Chance           int
	StatusEffects    []MoveStatusEffect
	StatStageChanges []MoveStatStageChange
}

MoveSecondaryEffects contains secondary effects of a move

type MoveStatStageChange

type MoveStatStageChange struct {
	BattleStage BattleStage
	Modificator int
}

MoveStatStageChange represents a stat stage modification

type MoveStatusDescriptor

type MoveStatusDescriptor struct {
	Status   string `json:"status"`
	LuckRate int    `json:"luckRate"`
}

type MoveStatusEffect

type MoveStatusEffect struct {
	Status   string
	LuckRate int
}

MoveStatusEffect represents a status effect applied by a move

type MoveTargeting

type MoveTargeting struct {
	AimedTarget AimedTarget
	ContactType ContactType
}

MoveTargeting contains targeting information for a move

type Pokemon

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

Pokemon represents a Pokémon species with all its forms.

func (*Pokemon) CustomProperties

func (p *Pokemon) CustomProperties() map[string]any

CustomProperties returns the custom properties of the Pokemon.

func (*Pokemon) DbSymbol

func (p *Pokemon) DbSymbol() string

DbSymbol returns the database symbol of the Pokemon.

func (*Pokemon) Form

func (p *Pokemon) Form(form int32) (PokemonForm, bool)

Form returns a specific form of the Pokemon by its form number.

func (*Pokemon) Forms

func (p *Pokemon) Forms() iter.Seq2[int32, PokemonForm]

Forms returns an iterator over all forms of the Pokemon.

func (*Pokemon) ID

func (p *Pokemon) ID() int32

ID returns the national ID of the Pokemon.

type PokemonBuilder

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

PokemonBuilder builds Pokemon entities.

func NewPokemonBuilder

func NewPokemonBuilder() *PokemonBuilder

NewPokemonBuilder creates a new PokemonBuilder.

func (*PokemonBuilder) Build

func (b *PokemonBuilder) Build() *Pokemon

Build returns a copy of the built Pokemon.

func (*PokemonBuilder) CustomProperties

func (b *PokemonBuilder) CustomProperties(props map[string]any) *PokemonBuilder

CustomProperties sets custom properties for the Pokemon.

func (*PokemonBuilder) DbSymbol

func (b *PokemonBuilder) DbSymbol(dbSymbol string) *PokemonBuilder

DbSymbol sets the database symbol of the Pokemon.

func (*PokemonBuilder) Forms

func (b *PokemonBuilder) Forms(forms map[int32]PokemonForm) *PokemonBuilder

Forms sets the forms of the Pokemon.

func (*PokemonBuilder) ID

func (b *PokemonBuilder) ID(id int32) *PokemonBuilder

ID sets the ID of the Pokemon.

type PokemonDescriptor

type PokemonDescriptor struct {
	ID          int32            `json:"id"`
	DbSymbol    string           `json:"dbSymbol"`
	Forms       []FormDescriptor `json:"forms"`
	Name        Translation
	Description Translation
}

PokemonDescriptor is the JSON descriptor for a Pokemon.

func UnmarshalPokemonDescriptor

func UnmarshalPokemonDescriptor(pokemonContent []byte) (*PokemonDescriptor, error)

UnmarshalPokemonDescriptor unmarshal a json encoded pokemon to a descriptor pokemonContent the encoded pokemon

type PokemonForm

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

PokemonForm represents a specific form of a Pokemon species.

func (*PokemonForm) Abilities

func (f *PokemonForm) Abilities() iter.Seq[Ability]

Abilities returns an iterator over the abilities of the PokemonForm.

func (*PokemonForm) Ability

func (f *PokemonForm) Ability(i int) (Ability, bool)

Ability returns a specific ability by index.

func (*PokemonForm) AbilitySymbol

func (f *PokemonForm) AbilitySymbol(i int) (string, bool)

AbilitySymbol returns a specific ability symbol by index.

func (*PokemonForm) AbilitySymbols

func (f *PokemonForm) AbilitySymbols() iter.Seq[string]

AbilitySymbols returns an iterator over the ability symbols of the PokemonForm.

func (*PokemonForm) BabyDbSymbol

func (f *PokemonForm) BabyDbSymbol() *string

BabyDbSymbol returns the baby Pokemon database symbol of the PokemonForm.

func (*PokemonForm) BabyForm

func (f *PokemonForm) BabyForm() int32

BabyForm returns the baby form number of the PokemonForm.

func (*PokemonForm) BaseAtk

func (f *PokemonForm) BaseAtk() int32

BaseAtk returns the base Attack of the PokemonForm.

func (*PokemonForm) BaseAts

func (f *PokemonForm) BaseAts() int32

BaseAts returns the base Special Attack of the PokemonForm.

func (*PokemonForm) BaseDfe

func (f *PokemonForm) BaseDfe() int32

BaseDfe returns the base Defense of the PokemonForm.

func (*PokemonForm) BaseDfs

func (f *PokemonForm) BaseDfs() int32

BaseDfs returns the base Special Defense of the PokemonForm.

func (*PokemonForm) BaseExperience

func (f *PokemonForm) BaseExperience() int32

BaseExperience returns the base experience of the PokemonForm.

func (*PokemonForm) BaseHp

func (f *PokemonForm) BaseHp() int32

BaseHp returns the base HP of the PokemonForm.

func (*PokemonForm) BaseLoyalty

func (f *PokemonForm) BaseLoyalty() int32

BaseLoyalty returns the base loyalty of the PokemonForm.

func (*PokemonForm) BaseSpd

func (f *PokemonForm) BaseSpd() int32

BaseSpd returns the base Speed of the PokemonForm.

func (*PokemonForm) BreedGroup

func (f *PokemonForm) BreedGroup(i int) (string, bool)

BreedGroup returns a specific breed group by index.

func (*PokemonForm) BreedGroups

func (f *PokemonForm) BreedGroups() iter.Seq[string]

BreedGroups returns an iterator over the breed groups of the PokemonForm.

func (*PokemonForm) CatchRate

func (f *PokemonForm) CatchRate() int32

CatchRate returns the catch rate of the PokemonForm.

func (*PokemonForm) CustomProperties

func (f *PokemonForm) CustomProperties() map[string]any

CustomProperties returns the custom properties of the PokemonForm.

func (*PokemonForm) Description

func (f *PokemonForm) Description(lang string) string

Description returns the description translations of the PokemonForm.

func (*PokemonForm) EvAtk

func (f *PokemonForm) EvAtk() int32

EvAtk returns the EV yield for Attack of the PokemonForm.

func (*PokemonForm) EvAts

func (f *PokemonForm) EvAts() int32

EvAts returns the EV yield for Special Attack of the PokemonForm.

func (*PokemonForm) EvDfe

func (f *PokemonForm) EvDfe() int32

EvDfe returns the EV yield for Defense of the PokemonForm.

func (*PokemonForm) EvDfs

func (f *PokemonForm) EvDfs() int32

EvDfs returns the EV yield for Special Defense of the PokemonForm.

func (*PokemonForm) EvHp

func (f *PokemonForm) EvHp() int32

EvHp returns the EV yield for HP of the PokemonForm.

func (*PokemonForm) EvSpd

func (f *PokemonForm) EvSpd() int32

EvSpd returns the EV yield for Speed of the PokemonForm.

func (*PokemonForm) Evolution

func (f *PokemonForm) Evolution(i int) (Evolution, bool)

Evolution returns a specific evolution by index.

func (*PokemonForm) Evolutions

func (f *PokemonForm) Evolutions() iter.Seq[Evolution]

Evolutions returns an iterator over the evolutions of the PokemonForm.

func (*PokemonForm) ExperienceType

func (f *PokemonForm) ExperienceType() string

ExperienceType returns the experience type of the PokemonForm.

func (*PokemonForm) FemaleRate

func (f *PokemonForm) FemaleRate() float32

FemaleRate returns the female rate of the PokemonForm.

func (*PokemonForm) Form

func (f *PokemonForm) Form() int32

Form returns the form number of the PokemonForm.

func (*PokemonForm) FrontOffsetY

func (f *PokemonForm) FrontOffsetY() int32

FrontOffsetY returns the front offset Y of the PokemonForm.

func (*PokemonForm) HatchSteps

func (f *PokemonForm) HatchSteps() int32

HatchSteps returns the hatch steps of the PokemonForm.

func (*PokemonForm) Height

func (f *PokemonForm) Height() float32

Height returns the height of the PokemonForm in meters.

func (*PokemonForm) Item

func (f *PokemonForm) Item(i int) (*ItemHeld, bool)

Item returns a specific held item by index.

func (*PokemonForm) ItemHeld

func (f *PokemonForm) ItemHeld() iter.Seq[*ItemHeld]

ItemHeld returns an iterator over the items held by the PokemonForm.

func (*PokemonForm) Name

func (f *PokemonForm) Name(lang string) string

Name returns the name translations of the PokemonForm.

func (*PokemonForm) Resources

func (f *PokemonForm) Resources() PokemonResources

Resources returns the resources of the PokemonForm.

func (*PokemonForm) Type1

func (f *PokemonForm) Type1() PokemonType

Type1 returns the primary type of the PokemonForm.

func (*PokemonForm) Type2

func (f *PokemonForm) Type2() (PokemonType, bool)

Type2 returns the secondary type of the PokemonForm.

func (*PokemonForm) Weight

func (f *PokemonForm) Weight() float32

Weight returns the weight of the PokemonForm in hectograms.

type PokemonFormBuilder

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

PokemonFormBuilder builds PokemonForm entities.

func NewPokemonFormBuilder

func NewPokemonFormBuilder() *PokemonFormBuilder

NewPokemonFormBuilder creates a new PokemonFormBuilder.

func (*PokemonFormBuilder) Abilities

func (b *PokemonFormBuilder) Abilities(abilities []*Ability) *PokemonFormBuilder

Abilities sets the abilities of the PokemonForm.

func (*PokemonFormBuilder) AbilitySymbols

func (b *PokemonFormBuilder) AbilitySymbols(symbols []string) *PokemonFormBuilder

AbilitySymbols sets the ability symbols of the PokemonForm.

func (*PokemonFormBuilder) BabyDbSymbol

func (b *PokemonFormBuilder) BabyDbSymbol(symbol *string) *PokemonFormBuilder

BabyDbSymbol sets the baby Pokemon database symbol of the PokemonForm.

func (*PokemonFormBuilder) BabyForm

func (b *PokemonFormBuilder) BabyForm(form int32) *PokemonFormBuilder

BabyForm sets the baby form number of the PokemonForm.

func (*PokemonFormBuilder) BaseAtk

func (b *PokemonFormBuilder) BaseAtk(atk int32) *PokemonFormBuilder

BaseAtk sets the base Attack of the PokemonForm.

func (*PokemonFormBuilder) BaseAts

func (b *PokemonFormBuilder) BaseAts(ats int32) *PokemonFormBuilder

BaseAts sets the base Special Attack of the PokemonForm.

func (*PokemonFormBuilder) BaseDfe

func (b *PokemonFormBuilder) BaseDfe(dfe int32) *PokemonFormBuilder

BaseDfe sets the base Defense of the PokemonForm.

func (*PokemonFormBuilder) BaseDfs

func (b *PokemonFormBuilder) BaseDfs(dfs int32) *PokemonFormBuilder

BaseDfs sets the base Special Defense of the PokemonForm.

func (*PokemonFormBuilder) BaseExperience

func (b *PokemonFormBuilder) BaseExperience(exp int32) *PokemonFormBuilder

BaseExperience sets the base experience of the PokemonForm.

func (*PokemonFormBuilder) BaseHp

BaseHp sets the base HP of the PokemonForm.

func (*PokemonFormBuilder) BaseLoyalty

func (b *PokemonFormBuilder) BaseLoyalty(loyalty int32) *PokemonFormBuilder

BaseLoyalty sets the base loyalty of the PokemonForm.

func (*PokemonFormBuilder) BaseSpd

func (b *PokemonFormBuilder) BaseSpd(spd int32) *PokemonFormBuilder

BaseSpd sets the base Speed of the PokemonForm.

func (*PokemonFormBuilder) BreedGroups

func (b *PokemonFormBuilder) BreedGroups(groups []string) *PokemonFormBuilder

BreedGroups sets the breed groups of the PokemonForm.

func (*PokemonFormBuilder) Build

func (b *PokemonFormBuilder) Build() *PokemonForm

Build returns a copy of the built PokemonForm.

func (*PokemonFormBuilder) CatchRate

func (b *PokemonFormBuilder) CatchRate(rate int32) *PokemonFormBuilder

CatchRate sets the catch rate of the PokemonForm.

func (*PokemonFormBuilder) CustomProperties

func (b *PokemonFormBuilder) CustomProperties(props map[string]any) *PokemonFormBuilder

CustomProperties sets custom properties for the PokemonForm.

func (*PokemonFormBuilder) Description

func (b *PokemonFormBuilder) Description(desc Translation) *PokemonFormBuilder

Description sets the description translations of the PokemonForm.

func (*PokemonFormBuilder) EvAtk

EvAtk sets the EV yield for Attack of the PokemonForm.

func (*PokemonFormBuilder) EvAts

EvAts sets the EV yield for Special Attack of the PokemonForm.

func (*PokemonFormBuilder) EvDfe

EvDfe sets the EV yield for Defense of the PokemonForm.

func (*PokemonFormBuilder) EvDfs

EvDfs sets the EV yield for Special Defense of the PokemonForm.

func (*PokemonFormBuilder) EvHp

EvHp sets the EV yield for HP of the PokemonForm.

func (*PokemonFormBuilder) EvSpd

EvSpd sets the EV yield for Speed of the PokemonForm.

func (*PokemonFormBuilder) Evolutions

func (b *PokemonFormBuilder) Evolutions(evolutions []Evolution) *PokemonFormBuilder

Evolutions sets the evolutions of the PokemonForm.

func (*PokemonFormBuilder) ExperienceType

func (b *PokemonFormBuilder) ExperienceType(expType string) *PokemonFormBuilder

ExperienceType sets the experience type of the PokemonForm.

func (*PokemonFormBuilder) FemaleRate

func (b *PokemonFormBuilder) FemaleRate(rate float32) *PokemonFormBuilder

FemaleRate sets the female rate of the PokemonForm.

func (*PokemonFormBuilder) Form

Form sets the form number of the PokemonForm.

func (*PokemonFormBuilder) FrontOffsetY

func (b *PokemonFormBuilder) FrontOffsetY(y int32) *PokemonFormBuilder

FrontOffsetY sets the front offset Y of the PokemonForm.

func (*PokemonFormBuilder) HatchSteps

func (b *PokemonFormBuilder) HatchSteps(steps int32) *PokemonFormBuilder

HatchSteps sets the hatch steps of the PokemonForm.

func (*PokemonFormBuilder) Height

Height sets the height of the PokemonForm.

func (*PokemonFormBuilder) ItemHeld

func (b *PokemonFormBuilder) ItemHeld(items []*ItemHeld) *PokemonFormBuilder

ItemHeld sets the items held by the PokemonForm.

func (*PokemonFormBuilder) Name

Name sets the name translations of the PokemonForm.

func (*PokemonFormBuilder) Resources

func (b *PokemonFormBuilder) Resources(resources PokemonResources) *PokemonFormBuilder

Resources sets the resources of the PokemonForm.

func (*PokemonFormBuilder) Type1

Type1 sets the primary type of the PokemonForm.

func (*PokemonFormBuilder) Type2

Type2 sets the secondary type of the PokemonForm.

func (*PokemonFormBuilder) Weight

Weight sets the weight of the PokemonForm.

type PokemonMapper

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

PokemonMapper maps Pokemon descriptors to Pokemon entities.

func NewPokemonMapper

func NewPokemonMapper(store *Store) *PokemonMapper

NewPokemonMapper creates a new PokemonMapper.

func (*PokemonMapper) MapBreedGroups

func (m *PokemonMapper) MapBreedGroups(breedGroupInts []int32) []string

MapBreedGroups maps breed group descriptors to breed group strings.

func (*PokemonMapper) MapConditions

func (m *PokemonMapper) MapConditions(conditions []ConditionDescriptor) []Condition

MapConditions maps condition descriptors to conditions.

func (*PokemonMapper) MapEvolutions

func (m *PokemonMapper) MapEvolutions(evolutions []EvolutionDescriptor) []Evolution

MapEvolutions maps evolution descriptors to evolutions.

func (*PokemonMapper) MapFormDescriptorToPokemonForm

func (m *PokemonMapper) MapFormDescriptorToPokemonForm(desc FormDescriptor) *PokemonForm

MapFormDescriptorToPokemonForm maps a FormDescriptor to a PokemonForm.

func (*PokemonMapper) MapItemHelds

func (m *PokemonMapper) MapItemHelds(itemHelds []ItemHeldDescriptor) []*ItemHeld

MapItemHelds maps item held descriptors to item held entities.

func (*PokemonMapper) MapPokemonDescriptorToPokemon

func (m *PokemonMapper) MapPokemonDescriptorToPokemon(desc PokemonDescriptor) *Pokemon

MapPokemonDescriptorToPokemon maps a PokemonDescriptor to a Pokemon.

func (*PokemonMapper) MapPokemonResources

func (m *PokemonMapper) MapPokemonResources(resources PokemonResourcesDescriptor) PokemonResources

MapPokemonResources maps Pokemon resources descriptors to Pokemon resources.

type PokemonResources

type PokemonResources struct {
	Icon            string
	IconF           string
	IconShiny       string
	IconShinyF      string
	Front           string
	FrontF          string
	FrontShiny      string
	FrontShinyF     string
	Back            string
	BackF           string
	BackShiny       string
	BackShinyF      string
	Footprint       string
	Character       string
	CharacterF      string
	CharacterShiny  string
	CharacterShinyF string
	Cry             string
	HasFemale       bool
	Egg             string
	IconEgg         string
}

PokemonResources represents resources for a Pokemon form.

type PokemonResourcesDescriptor

type PokemonResourcesDescriptor struct {
	Icon            string `json:"icon"`
	IconF           string `json:"iconF"`
	IconShiny       string `json:"iconShiny"`
	IconShinyF      string `json:"iconShinyF"`
	Front           string `json:"front"`
	FrontF          string `json:"frontF"`
	FrontShiny      string `json:"frontShiny"`
	FrontShinyF     string `json:"frontShinyF"`
	Back            string `json:"back"`
	BackF           string `json:"backF"`
	BackShiny       string `json:"backShiny"`
	BackShinyF      string `json:"backShinyF"`
	Footprint       string `json:"footprint"`
	Character       string `json:"character"`
	CharacterF      string `json:"characterF"`
	CharacterShiny  string `json:"characterShiny"`
	CharacterShinyF string `json:"characterShinyF"`
	Cry             string `json:"cry"`
	HasFemale       bool   `json:"hasFemale"`
	Egg             string `json:"egg"`
	IconEgg         string `json:"iconEgg"`
}

PokemonResourcesDescriptor is the JSON descriptor for Pokemon resources.

type PokemonType

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

PokemonType represents a Pokemon type (e.g., Fire, Water, Grass).

func (*PokemonType) Color

func (t *PokemonType) Color() string

Color returns the color of the PokemonType.

func (*PokemonType) Damage

func (t *PokemonType) Damage(defType string) (float32, bool)

Damage returns the type damage relation for a defending type.

func (*PokemonType) DamageTo

func (t *PokemonType) DamageTo() iter.Seq2[string, float32]

DamageTo returns an iterator over the type damage relations.

func (*PokemonType) DamageToTypes

func (t *PokemonType) DamageToTypes(type1, type2 string) float32

DamageToTypes calculates the overall damage factor when attacking a Pokemon with the given types.

func (*PokemonType) DbSymbol

func (t *PokemonType) DbSymbol() string

DbSymbol returns the database symbol of the PokemonType.

func (*PokemonType) Name

func (t *PokemonType) Name(lang string) string

Name returns the localized name of the PokemonType for the given language.

func (*PokemonType) TextId

func (t *PokemonType) TextId() int

TextId returns the text ID of the PokemonType.

type PokemonTypeDescriptor

type PokemonTypeDescriptor struct {
	DbSymbol string                 `json:"dbSymbol"`
	Color    string                 `json:"color"`
	TextId   int                    `json:"textId"`
	DamageTo []TypeDamageDescriptor `json:"damageTo"`
	Name     Translation
}

PokemonTypeDescriptor is the JSON descriptor for a Pokemon type.

func UnmarshalTypeDescriptor

func UnmarshalTypeDescriptor(typeContent []byte) (*PokemonTypeDescriptor, error)

UnmarshalTypeDescriptor unmarshal a json encoded type to a descriptor typeContent the encoded type

type Store

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

Store is an in-memory store for a studio project

func Load

func Load(folder string) (*Store, error)

func NewStore

func NewStore() *Store

func (*Store) AddAbility

func (s *Store) AddAbility(ability Ability) *Ability

func (*Store) AddMove

func (s *Store) AddMove(move Move) *Move

func (*Store) AddPokemon

func (s *Store) AddPokemon(pokemon Pokemon) *Pokemon

func (*Store) AddType

func (s *Store) AddType(pokemonType PokemonType) *PokemonType

func (*Store) FindAbilityBySymbol

func (s *Store) FindAbilityBySymbol(symbol string, filters ...iter2.FilterFunc[Ability]) *Ability

func (*Store) FindAllAbilities

func (s *Store) FindAllAbilities(filters ...iter2.FilterFunc[Ability]) iter.Seq[Ability]

func (*Store) FindAllMoves

func (s *Store) FindAllMoves(filters ...iter2.FilterFunc[Move]) iter.Seq[Move]

func (*Store) FindAllPokemon

func (s *Store) FindAllPokemon(filters ...iter2.FilterFunc[Pokemon]) iter.Seq[Pokemon]

func (*Store) FindAllTypes

func (s *Store) FindAllTypes(filters ...iter2.FilterFunc[PokemonType]) iter.Seq[PokemonType]

func (*Store) FindMoveBySymbol

func (s *Store) FindMoveBySymbol(symbol string, filters ...iter2.FilterFunc[Move]) *Move

func (*Store) FindPokemonByName

func (s *Store) FindPokemonByName(name string, filters ...iter2.FilterFunc[Pokemon]) *Pokemon

func (*Store) FindPokemonBySymbol

func (s *Store) FindPokemonBySymbol(symbol string, filters ...iter2.FilterFunc[Pokemon]) *Pokemon

func (*Store) FindTypeBySymbol

func (s *Store) FindTypeBySymbol(symbol string, filters ...iter2.FilterFunc[PokemonType]) *PokemonType

func (*Store) Resistances

func (s *Store) Resistances(type1, type2 string, filters ...iter2.FilterFunc[PokemonType]) iter.Seq2[string, float32]

Resistances calculates the type resistances of the PokemonForm based on its types.

type Translation

type Translation map[string]string

Translation is a map of language codes to translated strings.

func ImportTranslations

func ImportTranslations(path string) ([]Translation, error)

ImportTranslations import translations from file path the path of the file to import

func ImportTranslationsOrEmpty

func ImportTranslationsOrEmpty(path string) []Translation

ImportTranslationsOrEmpty import translations from file, if it fails log the error and return an empty list

func MapTranslation

func MapTranslation(textId int, translations []Translation) Translation

type TypeBuilder

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

TypeBuilder builds PokemonType entities.

func NewTypeBuilder

func NewTypeBuilder() *TypeBuilder

NewTypeBuilder creates a new TypeBuilder.

func (*TypeBuilder) Build

func (b *TypeBuilder) Build() *PokemonType

Build returns a copy of the built PokemonType.

func (*TypeBuilder) Color

func (b *TypeBuilder) Color(color string) *TypeBuilder

Color sets the color of the PokemonType.

func (*TypeBuilder) DamageTo

func (b *TypeBuilder) DamageTo(damageTo map[string]float32) *TypeBuilder

DamageTo sets the damage relations of the PokemonType.

func (*TypeBuilder) DbSymbol

func (b *TypeBuilder) DbSymbol(dbSymbol string) *TypeBuilder

DbSymbol sets the database symbol of the PokemonType.

func (*TypeBuilder) Name

func (b *TypeBuilder) Name(name Translation) *TypeBuilder

Name sets the name translations of the PokemonType.

func (*TypeBuilder) TextId

func (b *TypeBuilder) TextId(id int) *TypeBuilder

TextId sets the text ID of the PokemonType.

type TypeDamageDescriptor

type TypeDamageDescriptor struct {
	DefensiveType string  `json:"defensiveType"`
	Factor        float32 `json:"factor"`
}

TypeDamageDescriptor is the JSON descriptor for a type damage relation.

type TypeMapper

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

TypeMapper maps Type descriptors to PokemonType entities.

func NewTypeMapper

func NewTypeMapper(store *Store) *TypeMapper

NewTypeMapper creates a new TypeMapper.

func (*TypeMapper) MapPokemonTypeDescriptorToPokemonType

func (m *TypeMapper) MapPokemonTypeDescriptorToPokemonType(desc PokemonTypeDescriptor) *PokemonType

MapPokemonTypeDescriptorToPokemonType maps a PokemonTypeDescriptor to a PokemonType.

func (*TypeMapper) MapTypeDamages

func (m *TypeMapper) MapTypeDamages(damages []TypeDamageDescriptor) map[string]float32

MapTypeDamages maps type damage descriptors to type damage entities.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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