/
items.go
108 lines (98 loc) · 2.4 KB
/
items.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
package pokemonbattlelib
// A Party can use Items in a battle for different effects. A Pokemon can hold one Item.
type Item uint16
// Represents data associated with an `Item`.
type ItemData struct {
Name string
Category ItemCategory
FlingPower int
FlingEffect FlingEffect
Flags ItemFlags
}
type ItemCategory uint8
// Fix: remove unnecessary items
const (
ItemCategoryStatBoost ItemCategory = iota + 1
ItemCategoryEffortDrop
ItemCategoryMedicine
ItemCategoryOther
ItemCategoryInAPinch
ItemCategoryPickyHealing
ItemCategoryTypeProtection
ItemCategoryBakingOnly
ItemCategoryCollectibles
ItemCategoryEvolution
ItemCategorySpelunking
ItemCategoryHeldItems
ItemCategoryChoice
ItemCategoryEffortTraining
ItemCategoryBadHeldItems
ItemCategoryTraining
ItemCategoryPlates
ItemCategorySpeciesSpecific
ItemCategoryTypeEnhancement
ItemCategoryEventItems
ItemCategoryGameplay
ItemCategoryPlotAdvancement
ItemCategoryUnused
ItemCategoryLoot
ItemCategoryAllMail
// Medicine
ItemCategoryVitamins
ItemCategoryHealing
ItemCategoryPPRecovery
ItemCategoryRevival
ItemCategoryStatusCures
// Category 31 does not exist
ItemCategoryMulch = iota + 2
ItemCategorySpecialBalls
ItemCategoryStandardBalls
ItemCategoryDexCompletion
ItemCategoryScarves
ItemCategoryAllMachines
ItemCategoryFlutes
ItemCategoryApricornBalls
ItemCategoryApricornBox
ItemCategoryDataCards
ItemCategoryJewels
ItemCategoryMiracleShooter
ItemCategoryMegaStones
ItemCategoryMemories
ItemCategoryZCrystals
)
type FlingEffect uint8
const (
FlingBadlyPoison FlingEffect = iota + 1
FlingBurn
FlingActivateBerry
FlingActivateHerb
FlingParalyze
FlingPoison
FlingFlinch
)
// Properties that an item can have.
type ItemFlags uint8
const (
// The item can be consumed
FlagConsumable ItemFlags = 1 << iota
// The item can be held by a pokemon
FlagHoldable
// The item has passive effects when held.
FlagHoldablePassive
// The item can be used by a pokemon when held.
FlagHoldableActive
// The item can be used in battle
FlagUsableInBattle
)
// Retrieves an Item's data.
// For item effects, see https://github.com/veekun/pokedex/blob/master/pokedex/data/csv/item_prose.csv
func (i Item) Data() *ItemData {
if int(i) >= len(AllItems)-1 {
blog.Panicf("%d is an invalid item", i)
}
if i == ItemNone {
return &ItemData{}
}
return &AllItems[i-1]
}
//go:generate go run ./scripts/getters/gen_getters.go -for Item -data ItemData